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" |
#include "common/Features.h" |
36 |
|
#include "network/lscpserver.h" |
37 |
|
|
38 |
namespace LinuxSampler { |
namespace LinuxSampler { |
39 |
|
|
550 |
for (; iter != mAudioOutputDevices.end(); iter++) { |
for (; iter != mAudioOutputDevices.end(); iter++) { |
551 |
if (iter->second == pDevice) { |
if (iter->second == pDevice) { |
552 |
// check if there are still sampler engines connected to this device |
// check if there are still sampler engines connected to this device |
553 |
for (uint i = 0; i < SamplerChannels(); i++) |
for (SamplerChannelMap::iterator iterChan = mSamplerChannels.begin(); |
554 |
if (GetSamplerChannel(i)->GetAudioOutputDevice() == pDevice) throw Exception("Sampler channel " + ToString(i) + " is still connected to the audio output device."); |
iterChan != mSamplerChannels.end(); iterChan++) |
555 |
|
if (iterChan->second->GetAudioOutputDevice() == pDevice) throw Exception("Sampler channel " + ToString(iterChan->first) + " is still connected to the audio output device."); |
556 |
|
|
557 |
// disable device |
// disable device |
558 |
pDevice->Stop(); |
pDevice->Stop(); |
574 |
for (; iter != mMidiInputDevices.end(); iter++) { |
for (; iter != mMidiInputDevices.end(); iter++) { |
575 |
if (iter->second == pDevice) { |
if (iter->second == pDevice) { |
576 |
// check if there are still sampler engines connected to this device |
// check if there are still sampler engines connected to this device |
577 |
for (uint i = 0; i < SamplerChannels(); i++) |
for (SamplerChannelMap::iterator iterChan = mSamplerChannels.begin(); |
578 |
if (GetSamplerChannel(i)->GetMidiInputDevice() == pDevice) throw Exception("Sampler channel " + ToString(i) + " is still connected to the midi input device."); |
iterChan != mSamplerChannels.end(); iterChan++) |
579 |
|
if (iterChan->second->GetMidiInputDevice() == pDevice) throw Exception("Sampler channel " + ToString(iterChan->first) + " is still connected to the midi input device."); |
580 |
|
|
581 |
fireMidiDeviceToBeDestroyed(pDevice); |
fireMidiDeviceToBeDestroyed(pDevice); |
582 |
|
|
692 |
return Features::enableDenormalsAreZeroMode(); |
return Features::enableDenormalsAreZeroMode(); |
693 |
} |
} |
694 |
|
|
695 |
|
void Sampler::fireStatistics() { |
696 |
|
static const LSCPEvent::event_t eventsArr[] = { |
697 |
|
LSCPEvent::event_voice_count, LSCPEvent::event_stream_count, |
698 |
|
LSCPEvent::event_buffer_fill, LSCPEvent::event_total_voice_count |
699 |
|
}; |
700 |
|
static const std::list<LSCPEvent::event_t> events(eventsArr, eventsArr + 4); |
701 |
|
|
702 |
|
if (LSCPServer::EventSubscribers(events)) |
703 |
|
{ |
704 |
|
LSCPServer::LockRTNotify(); |
705 |
|
std::map<uint,SamplerChannel*> channels = GetSamplerChannels(); |
706 |
|
std::map<uint,SamplerChannel*>::iterator iter = channels.begin(); |
707 |
|
for (; iter != channels.end(); iter++) { |
708 |
|
SamplerChannel* pSamplerChannel = iter->second; |
709 |
|
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
710 |
|
if (!pEngineChannel) continue; |
711 |
|
Engine* pEngine = pEngineChannel->GetEngine(); |
712 |
|
if (!pEngine) continue; |
713 |
|
fireVoiceCountChanged(iter->first, pEngineChannel->GetVoiceCount()); |
714 |
|
fireStreamCountChanged(iter->first, pEngineChannel->GetDiskStreamCount()); |
715 |
|
fireBufferFillChanged(iter->first, pEngine->DiskStreamBufferFillPercentage()); |
716 |
|
fireTotalStreamCountChanged(GetDiskStreamCount()); |
717 |
|
fireTotalVoiceCountChanged(GetVoiceCount()); |
718 |
|
} |
719 |
|
LSCPServer::UnlockRTNotify(); |
720 |
|
} |
721 |
|
} |
722 |
|
|
723 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |