--- linuxsampler/trunk/src/engines/EngineChannel.cpp 2007/08/16 15:55:21 1297 +++ linuxsampler/trunk/src/engines/EngineChannel.cpp 2008/11/01 19:01:27 1789 @@ -25,6 +25,8 @@ #include +#include "../Sampler.h" +#include "../common/global_private.h" #include "../drivers/midi/MidiInstrumentMapper.h" #define NO_MIDI_INSTRUMENT_MAP -1 @@ -40,8 +42,9 @@ uiMidiProgram = 0; bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false; iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; - uiVoiceCount = 0; - uiDiskStreamCount = 0; + SetVoiceCount(0); + SetDiskStreamCount(0); + pSamplerChannel = NULL; ResetMidiRpnController(); } @@ -188,19 +191,35 @@ } uint EngineChannel::GetVoiceCount() { - return uiVoiceCount; + return atomic_read(&voiceCount); } void EngineChannel::SetVoiceCount(uint Voices) { - uiVoiceCount = Voices; + atomic_set(&voiceCount, Voices); } uint EngineChannel::GetDiskStreamCount() { - return uiDiskStreamCount; + return atomic_read(&diskStreamCount); } void EngineChannel::SetDiskStreamCount(uint Streams) { - uiDiskStreamCount = Streams; + atomic_set(&diskStreamCount, Streams); + } + + SamplerChannel* EngineChannel::GetSamplerChannel() { + if(pSamplerChannel == NULL) { + std::cerr << "EngineChannel::GetSamplerChannel(): pSamplerChannel is NULL, this is a bug!\n" << std::flush; + } + return pSamplerChannel; + } + + void EngineChannel::SetSamplerChannel(SamplerChannel* pChannel) { + pSamplerChannel = pChannel; + } + + Sampler* EngineChannel::GetSampler() { + if (GetSamplerChannel() == NULL) return NULL; + return GetSamplerChannel()->GetSampler(); } void EngineChannel::AddFxSendCountListener(FxSendCountListener* l) {