25 |
|
|
26 |
#include "Sampler.h" |
#include "Sampler.h" |
27 |
|
|
28 |
|
#include "engines/EngineFactory.h" |
29 |
#include "engines/EngineChannelFactory.h" |
#include "engines/EngineChannelFactory.h" |
30 |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
31 |
#include "drivers/midi/MidiInputDeviceFactory.h" |
#include "drivers/midi/MidiInputDeviceFactory.h" |
88 |
this->pMidiInputDevice = NULL; |
this->pMidiInputDevice = NULL; |
89 |
this->iMidiPort = 0; |
this->iMidiPort = 0; |
90 |
|
|
91 |
|
pEngineChannel->StatusChanged(true); |
92 |
|
|
93 |
dmsg(2,("OK\n")); |
dmsg(2,("OK\n")); |
94 |
} |
} |
95 |
|
|
307 |
// disable device |
// disable device |
308 |
pDevice->Stop(); |
pDevice->Stop(); |
309 |
|
|
|
// remove device from the device list |
|
|
mAudioOutputDevices.erase(iter); |
|
|
|
|
310 |
// destroy and free device from memory |
// destroy and free device from memory |
311 |
delete pDevice; |
delete pDevice; |
312 |
} |
} |
313 |
} |
} |
314 |
|
// remove devices from the device list |
315 |
|
mAudioOutputDevices.clear(); |
316 |
} |
} |
317 |
|
|
318 |
void Sampler::DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (LinuxSamplerException) { |
void Sampler::DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (LinuxSamplerException) { |
326 |
// disable device |
// disable device |
327 |
pDevice->StopListen(); |
pDevice->StopListen(); |
328 |
|
|
|
// remove device from the device list |
|
|
mMidiInputDevices.erase(iter); |
|
|
|
|
329 |
// destroy and free device from memory |
// destroy and free device from memory |
330 |
delete pDevice; |
delete pDevice; |
331 |
} |
} |
332 |
} |
} |
333 |
|
// remove devices from the device list |
334 |
|
mMidiInputDevices.clear(); |
335 |
} |
} |
336 |
|
|
337 |
MidiInputDevice* Sampler::CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (LinuxSamplerException) { |
MidiInputDevice* Sampler::CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (LinuxSamplerException) { |
349 |
return pDevice; |
return pDevice; |
350 |
} |
} |
351 |
|
|
352 |
|
int Sampler::GetVoiceCount() { |
353 |
|
int count = 0; |
354 |
|
std::set<Engine*>::iterator it = EngineFactory::EngineInstances().begin(); |
355 |
|
|
356 |
|
for(; it != EngineFactory::EngineInstances().end(); it++) { |
357 |
|
count += (*it)->VoiceCount(); |
358 |
|
} |
359 |
|
|
360 |
|
return count; |
361 |
|
} |
362 |
|
|
363 |
void Sampler::Reset() { |
void Sampler::Reset() { |
364 |
// delete sampler channels |
// delete sampler channels |
365 |
try { |
try { |