318 |
} |
} |
319 |
} |
} |
320 |
|
|
321 |
|
void Sampler::fireMidiDeviceToBeDestroyed(MidiInputDevice* pDevice) { |
322 |
|
for (int i = 0; i < llMidiDeviceCountListeners.GetListenerCount(); i++) { |
323 |
|
llMidiDeviceCountListeners.GetListener(i)->MidiDeviceToBeDestroyed(pDevice); |
324 |
|
} |
325 |
|
} |
326 |
|
|
327 |
|
void Sampler::fireMidiDeviceCreated(MidiInputDevice* pDevice) { |
328 |
|
for (int i = 0; i < llMidiDeviceCountListeners.GetListenerCount(); i++) { |
329 |
|
llMidiDeviceCountListeners.GetListener(i)->MidiDeviceCreated(pDevice); |
330 |
|
} |
331 |
|
} |
332 |
|
|
333 |
void Sampler::AddVoiceCountListener(VoiceCountListener* l) { |
void Sampler::AddVoiceCountListener(VoiceCountListener* l) { |
334 |
llVoiceCountListeners.AddListener(l); |
llVoiceCountListeners.AddListener(l); |
335 |
} |
} |
571 |
for (uint i = 0; i < SamplerChannels(); i++) |
for (uint i = 0; i < SamplerChannels(); i++) |
572 |
if (GetSamplerChannel(i)->GetMidiInputDevice() == pDevice) throw Exception("Sampler channel " + ToString(i) + " is still connected to the midi input device."); |
if (GetSamplerChannel(i)->GetMidiInputDevice() == pDevice) throw Exception("Sampler channel " + ToString(i) + " is still connected to the midi input device."); |
573 |
|
|
574 |
|
fireMidiDeviceToBeDestroyed(pDevice); |
575 |
|
|
576 |
// disable device |
// disable device |
577 |
pDevice->StopListen(); |
pDevice->StopListen(); |
578 |
|
|
600 |
} |
} |
601 |
} |
} |
602 |
|
|
603 |
|
fireMidiDeviceCreated(pDevice); |
604 |
fireMidiDeviceCountChanged(MidiInputDevices()); |
fireMidiDeviceCountChanged(MidiInputDevices()); |
605 |
return pDevice; |
return pDevice; |
606 |
} |
} |