/[svn]/linuxsampler/trunk/src/drivers/audio/AudioChannel.cpp
ViewVC logotype

Annotation of /linuxsampler/trunk/src/drivers/audio/AudioChannel.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 226 - (hide annotations) (download)
Wed Aug 25 22:00:33 2004 UTC (19 years, 8 months ago) by schoenebeck
File size: 4377 byte(s)
* ALSA MIDI driver: create one MIDI port by default, implemented parameter
  info for parameter 'ALSA_SEQ_BINDINGS'
* ALSA audio driver: implemented parameter info for driver parameters
  'FRAGMENTS' and 'FRAGMENTSIZE'
* JACK audio driver: fixed creation of channels on device creation, channel
  parameter 'NAME' now actually updates the respective JACK port name,
  implemented channel parameter 'JACK_BINDINGS' (as well as its parameter
  info)
* src/network/lscpserver.cpp: fixed commands
  "GET MIDI_INPUT_DRIVER_PARAMETER INFO" and
  "GET AUDIO_OUTPUT_DRIVER_PARAMETER  INFO", fixed backward compatibility
  for "SET AUDIO_OUTPUT_TYPE" and "SET MIDI_INPUT_TYPE" commands
* src/networ/lscp.y: added comma character (',') to symbol 'char'
* src/drivers/DeviceParameter.cpp: fixed methods RangeMin(), RangeMax() in
  class DeviceCreationParameterInt which returned wrong values

1 schoenebeck 200 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * *
7     * This program is free software; you can redistribute it and/or modify *
8     * it under the terms of the GNU General Public License as published by *
9     * the Free Software Foundation; either version 2 of the License, or *
10     * (at your option) any later version. *
11     * *
12     * This program is distributed in the hope that it will be useful, *
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15     * GNU General Public License for more details. *
16     * *
17     * You should have received a copy of the GNU General Public License *
18     * along with this program; if not, write to the Free Software *
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20     * MA 02111-1307 USA *
21     ***************************************************************************/
22    
23     #include "AudioChannel.h"
24    
25     namespace LinuxSampler {
26    
27     /**
28     * Create real channel.
29     *
30 schoenebeck 226 * @param ChannelNr - channel number of this new channel
31 schoenebeck 200 * @param BufferSize - desired audio data buffer size
32     */
33 schoenebeck 226 AudioChannel::AudioChannel(uint ChannelNr, uint BufferSize) {
34     this->ChannelNr = ChannelNr;
35 schoenebeck 200 this->pBuffer = new float[BufferSize];
36     this->uiBufferSize = BufferSize;
37     this->pMixChannel = NULL;
38     this->UsesExternalBuffer = false;
39    
40 schoenebeck 226 Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr));
41     Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false);
42 schoenebeck 200
43     Clear();
44     }
45    
46     /**
47     * Create channel with external (already existing) audio buffer.
48     *
49 schoenebeck 226 * @param ChannelNr - channel number of this new channel
50 schoenebeck 200 * @param pBuffer - external audio buffer
51     * @param BufferSIze - size of the external buffer
52     */
53 schoenebeck 226 AudioChannel::AudioChannel(uint ChannelNr, float* pBuffer, uint BufferSize) {
54     this->ChannelNr = ChannelNr;
55 schoenebeck 200 this->pBuffer = pBuffer;
56     this->uiBufferSize = BufferSize;
57     this->pMixChannel = NULL;
58     this->UsesExternalBuffer = true;
59    
60 schoenebeck 226 Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr));
61     Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false);
62 schoenebeck 200
63     Clear();
64     }
65    
66     /**
67     * Create mix channel.
68     *
69 schoenebeck 226 * @param ChannelNr - channel number of this new channel
70     * @param pMixChannelDestination - a real audio channel this new mix
71     * channel refers to
72 schoenebeck 200 */
73 schoenebeck 226 AudioChannel::AudioChannel(uint ChannelNr, AudioChannel* pMixChannelDestination) {
74     this->ChannelNr = ChannelNr;
75 schoenebeck 200 this->pBuffer = pMixChannel->Buffer();
76     this->uiBufferSize = pMixChannel->uiBufferSize;
77     this->pMixChannel = pMixChannel;
78     this->UsesExternalBuffer = true;
79    
80 schoenebeck 226 Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr));
81     Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(true);
82     //TODO: Parameters["MIX_CHANNEL_DESTINATION"] = new ParameterMixChannelDestination(dest_chan);
83 schoenebeck 200
84     Clear();
85     }
86    
87     /**
88     * Destructor
89     */
90     AudioChannel::~AudioChannel() {
91 schoenebeck 226 std::map<String,DeviceRuntimeParameter*>::iterator iter = Parameters.begin();
92     while (iter != Parameters.end()) { delete iter->second; iter++; }
93     if (!UsesExternalBuffer) delete[] pBuffer;
94 schoenebeck 200 }
95    
96     std::map<String,DeviceRuntimeParameter*> AudioChannel::ChannelParameters() {
97 schoenebeck 226 return Parameters;
98 schoenebeck 200 }
99     }

  ViewVC Help
Powered by ViewVC