185 |
if (!mSamplerChannels.size()) { |
if (!mSamplerChannels.size()) { |
186 |
SamplerChannel* pChannel = new SamplerChannel(this); |
SamplerChannel* pChannel = new SamplerChannel(this); |
187 |
mSamplerChannels[0] = pChannel; |
mSamplerChannels[0] = pChannel; |
188 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, 1)); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, 1)); |
189 |
return pChannel; |
return pChannel; |
190 |
} |
} |
191 |
|
|
200 |
// we found an unused index, so insert the new channel there |
// we found an unused index, so insert the new channel there |
201 |
SamplerChannel* pChannel = new SamplerChannel(this); |
SamplerChannel* pChannel = new SamplerChannel(this); |
202 |
mSamplerChannels[i] = pChannel; |
mSamplerChannels[i] = pChannel; |
203 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, i)); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, i)); |
204 |
return pChannel; |
return pChannel; |
205 |
} |
} |
206 |
throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index."); |
throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index."); |
209 |
// we have not reached the index limit so we just add the channel past the highest index |
// we have not reached the index limit so we just add the channel past the highest index |
210 |
SamplerChannel* pChannel = new SamplerChannel(this); |
SamplerChannel* pChannel = new SamplerChannel(this); |
211 |
mSamplerChannels[lastIndex + 1] = pChannel; |
mSamplerChannels[lastIndex + 1] = pChannel; |
212 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, lastIndex + 1)); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, lastIndex + 1)); |
213 |
return pChannel; |
return pChannel; |
214 |
} |
} |
215 |
|
|
227 |
if (iterChan->second == pSamplerChannel) { |
if (iterChan->second == pSamplerChannel) { |
228 |
mSamplerChannels.erase(iterChan); |
mSamplerChannels.erase(iterChan); |
229 |
delete pSamplerChannel; |
delete pSamplerChannel; |
230 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, mSamplerChannels.size())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, mSamplerChannels.size())); |
231 |
return; |
return; |
232 |
} |
} |
233 |
} |
} |