/[svn]/linuxsampler/trunk/src/Sampler.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/Sampler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1686 by schoenebeck, Thu Feb 14 14:58:50 2008 UTC revision 1761 by iliev, Fri Aug 29 15:42:06 2008 UTC
# Line 32  Line 32 
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    
# Line 82  namespace LinuxSampler { Line 83  namespace LinuxSampler {
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());
# Line 215  namespace LinuxSampler { Line 215  namespace LinuxSampler {
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      }      }
# Line 318  namespace LinuxSampler { Line 322  namespace LinuxSampler {
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      }      }
# Line 559  namespace LinuxSampler { Line 575  namespace LinuxSampler {
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    
# Line 586  namespace LinuxSampler { Line 604  namespace LinuxSampler {
604                  }                  }
605          }          }
606    
607            fireMidiDeviceCreated(pDevice);
608          fireMidiDeviceCountChanged(MidiInputDevices());          fireMidiDeviceCountChanged(MidiInputDevices());
609          return pDevice;          return pDevice;
610      }      }
# Line 665  namespace LinuxSampler { Line 684  namespace LinuxSampler {
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

Legend:
Removed from v.1686  
changed lines
  Added in v.1761

  ViewVC Help
Powered by ViewVC