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