27 |
/** |
/** |
28 |
* Create real channel. |
* Create real channel. |
29 |
* |
* |
30 |
|
* @param ChannelNr - channel number of this new channel |
31 |
* @param BufferSize - desired audio data buffer size |
* @param BufferSize - desired audio data buffer size |
|
* @param Name - arbitrary name for this channel (optional) |
|
32 |
*/ |
*/ |
33 |
AudioChannel::AudioChannel(uint BufferSize, String Name, std::map<String,DeviceRuntimeParameter*> ChannelParameters) { |
AudioChannel::AudioChannel(uint ChannelNr, uint BufferSize) { |
34 |
|
this->ChannelNr = ChannelNr; |
35 |
this->pBuffer = new float[BufferSize]; |
this->pBuffer = new float[BufferSize]; |
36 |
this->uiBufferSize = BufferSize; |
this->uiBufferSize = BufferSize; |
37 |
this->pMixChannel = NULL; |
this->pMixChannel = NULL; |
38 |
this->UsesExternalBuffer = false; |
this->UsesExternalBuffer = false; |
39 |
|
|
40 |
if (!ChannelParameters["NAME"]) ChannelParameters["NAME"] = new ParameterName(Name); |
Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr)); |
41 |
if (!ChannelParameters["IS_MIX_CHANNEL"]) ChannelParameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false); |
Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false); |
|
this->mParameters = ChannelParameters; |
|
42 |
|
|
43 |
Clear(); |
Clear(); |
44 |
} |
} |
46 |
/** |
/** |
47 |
* Create channel with external (already existing) audio buffer. |
* Create channel with external (already existing) audio buffer. |
48 |
* |
* |
49 |
|
* @param ChannelNr - channel number of this new channel |
50 |
* @param pBuffer - external audio buffer |
* @param pBuffer - external audio buffer |
51 |
* @param BufferSIze - size of the external buffer |
* @param BufferSIze - size of the external buffer |
|
* @param Name - arbitrary name for this channel (optional) |
|
52 |
*/ |
*/ |
53 |
AudioChannel::AudioChannel(float* pBuffer, uint BufferSize, String Name, std::map<String,DeviceRuntimeParameter*> ChannelParameters) { |
AudioChannel::AudioChannel(uint ChannelNr, float* pBuffer, uint BufferSize) { |
54 |
|
this->ChannelNr = ChannelNr; |
55 |
this->pBuffer = pBuffer; |
this->pBuffer = pBuffer; |
56 |
this->uiBufferSize = BufferSize; |
this->uiBufferSize = BufferSize; |
57 |
this->pMixChannel = NULL; |
this->pMixChannel = NULL; |
58 |
this->UsesExternalBuffer = true; |
this->UsesExternalBuffer = true; |
59 |
|
|
60 |
if (!ChannelParameters["NAME"]) ChannelParameters["NAME"] = new ParameterName(Name); |
Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr)); |
61 |
if (!ChannelParameters["IS_MIX_CHANNEL"]) ChannelParameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false); |
Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(false); |
62 |
|
|
63 |
Clear(); |
Clear(); |
64 |
} |
} |
66 |
/** |
/** |
67 |
* Create mix channel. |
* Create mix channel. |
68 |
* |
* |
69 |
* @param pMixChannel - the real channel this new mix channel refers to |
* @param ChannelNr - channel number of this new channel |
70 |
* @param Name - arbitrary name for this channel (optional) |
* @param pMixChannelDestination - a real audio channel this new mix |
71 |
|
* channel refers to |
72 |
*/ |
*/ |
73 |
AudioChannel::AudioChannel(AudioChannel* pMixChannel, String Name, std::map<String,DeviceRuntimeParameter*> ChannelParameters) { |
AudioChannel::AudioChannel(uint ChannelNr, AudioChannel* pMixChannelDestination) { |
74 |
|
this->ChannelNr = ChannelNr; |
75 |
this->pBuffer = pMixChannel->Buffer(); |
this->pBuffer = pMixChannel->Buffer(); |
76 |
this->uiBufferSize = pMixChannel->uiBufferSize; |
this->uiBufferSize = pMixChannel->uiBufferSize; |
77 |
this->pMixChannel = pMixChannel; |
this->pMixChannel = pMixChannel; |
78 |
this->UsesExternalBuffer = true; |
this->UsesExternalBuffer = true; |
79 |
|
|
80 |
if (!ChannelParameters["NAME"]) ChannelParameters["NAME"] = new ParameterName(Name); |
Parameters["NAME"] = new ParameterName("Channel " + ToString(ChannelNr)); |
81 |
if (!ChannelParameters["IS_MIX_CHANNEL"]) ChannelParameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(true); |
Parameters["IS_MIX_CHANNEL"] = new ParameterIsMixChannel(true); |
82 |
//TODO: if (!ChannelParameters["MIX_CHANNEL_DESTINATION"]) ChannelParameters["MIX_CHANNEL_DESTINATION"] = new ParameterMixChannelDestination(dest_chan); |
//TODO: Parameters["MIX_CHANNEL_DESTINATION"] = new ParameterMixChannelDestination(dest_chan); |
83 |
|
|
84 |
Clear(); |
Clear(); |
85 |
} |
} |
88 |
* Destructor |
* Destructor |
89 |
*/ |
*/ |
90 |
AudioChannel::~AudioChannel() { |
AudioChannel::~AudioChannel() { |
91 |
std::map<String,DeviceRuntimeParameter*>::iterator iter = mParameters.begin(); |
std::map<String,DeviceRuntimeParameter*>::iterator iter = Parameters.begin(); |
92 |
while (iter != mParameters.end()) { delete iter->second; iter++; } |
while (iter != Parameters.end()) { delete iter->second; iter++; } |
93 |
if (!UsesExternalBuffer) delete[] pBuffer; |
if (!UsesExternalBuffer) delete[] pBuffer; |
94 |
} |
} |
95 |
|
|
96 |
std::map<String,DeviceRuntimeParameter*> AudioChannel::ChannelParameters() { |
std::map<String,DeviceRuntimeParameter*> AudioChannel::ChannelParameters() { |
97 |
return mParameters; |
return Parameters; |
98 |
} |
} |
99 |
} |
} |