32 |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
33 |
#include "drivers/midi/MidiInputDeviceFactory.h" |
#include "drivers/midi/MidiInputDeviceFactory.h" |
34 |
#include "drivers/midi/MidiInstrumentMapper.h" |
#include "drivers/midi/MidiInstrumentMapper.h" |
35 |
|
#include "common/Features.h" |
36 |
|
|
37 |
namespace LinuxSampler { |
namespace LinuxSampler { |
38 |
|
|
83 |
EngineChannel* pNewEngineChannel = EngineChannelFactory::Create(EngineType); |
EngineChannel* pNewEngineChannel = EngineChannelFactory::Create(EngineType); |
84 |
if (!pNewEngineChannel) throw Exception("Unknown engine type"); |
if (!pNewEngineChannel) throw Exception("Unknown engine type"); |
85 |
|
|
86 |
//FIXME: hack to allow fast retrieval of engine channel's sampler channel index |
pNewEngineChannel->SetSamplerChannel(this); |
|
pNewEngineChannel->iSamplerChannelIndex = Index(); |
|
87 |
|
|
88 |
// dereference midi input port. |
// dereference midi input port. |
89 |
MidiInputPort* pMidiInputPort = __GetMidiInputDevicePort(GetMidiInputPort()); |
MidiInputPort* pMidiInputPort = __GetMidiInputDevicePort(GetMidiInputPort()); |
215 |
throw Exception("Internal error: SamplerChannel index not found"); |
throw Exception("Internal error: SamplerChannel index not found"); |
216 |
} |
} |
217 |
|
|
218 |
|
Sampler* SamplerChannel::GetSampler() { |
219 |
|
return pSampler; |
220 |
|
} |
221 |
|
|
222 |
void SamplerChannel::AddEngineChangeListener(EngineChangeListener* l) { |
void SamplerChannel::AddEngineChangeListener(EngineChangeListener* l) { |
223 |
llEngineChangeListeners.AddListener(l); |
llEngineChangeListeners.AddListener(l); |
224 |
} |
} |
322 |
} |
} |
323 |
} |
} |
324 |
|
|
325 |
|
void Sampler::fireMidiDeviceToBeDestroyed(MidiInputDevice* pDevice) { |
326 |
|
for (int i = 0; i < llMidiDeviceCountListeners.GetListenerCount(); i++) { |
327 |
|
llMidiDeviceCountListeners.GetListener(i)->MidiDeviceToBeDestroyed(pDevice); |
328 |
|
} |
329 |
|
} |
330 |
|
|
331 |
|
void Sampler::fireMidiDeviceCreated(MidiInputDevice* pDevice) { |
332 |
|
for (int i = 0; i < llMidiDeviceCountListeners.GetListenerCount(); i++) { |
333 |
|
llMidiDeviceCountListeners.GetListener(i)->MidiDeviceCreated(pDevice); |
334 |
|
} |
335 |
|
} |
336 |
|
|
337 |
void Sampler::AddVoiceCountListener(VoiceCountListener* l) { |
void Sampler::AddVoiceCountListener(VoiceCountListener* l) { |
338 |
llVoiceCountListeners.AddListener(l); |
llVoiceCountListeners.AddListener(l); |
339 |
} |
} |
575 |
for (uint i = 0; i < SamplerChannels(); i++) |
for (uint i = 0; i < SamplerChannels(); i++) |
576 |
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."); |
577 |
|
|
578 |
|
fireMidiDeviceToBeDestroyed(pDevice); |
579 |
|
|
580 |
// disable device |
// disable device |
581 |
pDevice->StopListen(); |
pDevice->StopListen(); |
582 |
|
|
604 |
} |
} |
605 |
} |
} |
606 |
|
|
607 |
|
fireMidiDeviceCreated(pDevice); |
608 |
fireMidiDeviceCountChanged(MidiInputDevices()); |
fireMidiDeviceCountChanged(MidiInputDevices()); |
609 |
return pDevice; |
return pDevice; |
610 |
} |
} |
684 |
InstrumentEditorFactory::ClosePlugins(); |
InstrumentEditorFactory::ClosePlugins(); |
685 |
} |
} |
686 |
|
|
687 |
|
bool Sampler::EnableDenormalsAreZeroMode() { |
688 |
|
Features::detect(); |
689 |
|
return Features::enableDenormalsAreZeroMode(); |
690 |
|
} |
691 |
|
|
692 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |