/[svn]/linuxsampler/trunk/src/drivers/Plugin.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/Plugin.cpp

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

revision 1889 by persson, Sun Apr 26 12:19:00 2009 UTC revision 1895 by persson, Sun May 3 12:15:40 2009 UTC
# Line 84  namespace LinuxSampler { Line 84  namespace LinuxSampler {
84              sleep(1);              sleep(1);
85              pSampler->fireStatistics();              pSampler->fireStatistics();
86          }          }
87            return 0;
88      }      }
89    
90    
# Line 110  namespace LinuxSampler { Line 111  namespace LinuxSampler {
111      }      }
112    
113      void Plugin::Init(int SampleRate, int FragmentSize, int Channels) {      void Plugin::Init(int SampleRate, int FragmentSize, int Channels) {
114            if (pAudioDevice && SampleRate == pAudioDevice->SampleRate() &&
115                FragmentSize == pAudioDevice->MaxSamplesPerCycle()) {
116                return; // nothing has changed
117            }
118    
119            String oldState;
120            if (pAudioDevice) {
121                oldState = GetState();
122                RemoveChannels();
123                global->pSampler->DestroyAudioOutputDevice(pAudioDevice);
124            }
125          std::map<String, String> params;          std::map<String, String> params;
126          params["SAMPLERATE"] = ToString(SampleRate);          params["SAMPLERATE"] = ToString(SampleRate);
127          params["FRAGMENTSIZE"] = ToString(FragmentSize);          params["FRAGMENTSIZE"] = ToString(FragmentSize);
# Line 117  namespace LinuxSampler { Line 129  namespace LinuxSampler {
129          pAudioDevice = dynamic_cast<AudioOutputDevicePlugin*>(          pAudioDevice = dynamic_cast<AudioOutputDevicePlugin*>(
130              global->pSampler->CreateAudioOutputDevice(AudioOutputDevicePlugin::Name(), params));              global->pSampler->CreateAudioOutputDevice(AudioOutputDevicePlugin::Name(), params));
131    
132          pMidiDevice = dynamic_cast<MidiInputDevicePlugin*>(          if (!pMidiDevice) {
133              global->pSampler->CreateMidiInputDevice(MidiInputDevicePlugin::Name(),              pMidiDevice = dynamic_cast<MidiInputDevicePlugin*>(
134                                                      std::map<String,String>()));                  global->pSampler->CreateMidiInputDevice(MidiInputDevicePlugin::Name(),
135                                                            std::map<String,String>()));
136            }
137    
138            if (!oldState.empty()) {
139                SetState(oldState);
140            }
141      }      }
142    
143      Plugin::~Plugin() {      Plugin::~Plugin() {

Legend:
Removed from v.1889  
changed lines
  Added in v.1895

  ViewVC Help
Powered by ViewVC