/[svn]/linuxsampler/trunk/src/engines/gig/EngineChannel.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/EngineChannel.cpp

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

revision 411 by schoenebeck, Sat Feb 26 02:01:14 2005 UTC revision 420 by schoenebeck, Thu Mar 3 03:25:17 2005 UTC
# Line 73  namespace LinuxSampler { namespace gig { Line 73  namespace LinuxSampler { namespace gig {
73          // set all MIDI controller values to zero          // set all MIDI controller values to zero
74          memset(ControllerTable, 0x00, 128);          memset(ControllerTable, 0x00, 128);
75    
76            // reset voice stealing parameters
77            itLastStolenVoice = RTList<Voice>::Iterator();
78            iuiLastStolenKey  = RTList<uint>::Iterator();
79    
80          // reset key info          // reset key info
81          for (uint i = 0; i < 128; i++) {          for (uint i = 0; i < 128; i++) {
82              if (pMIDIKeyInfo[i].pActiveVoices)              if (pMIDIKeyInfo[i].pActiveVoices)
# Line 98  namespace LinuxSampler { namespace gig { Line 102  namespace LinuxSampler { namespace gig {
102          if (pEngine) pEngine->ResetInternal();          if (pEngine) pEngine->ResetInternal();
103      }      }
104    
     int EngineChannel::RenderAudio(uint Samples) {  
         return (pEngine) ? pEngine->RenderAudio(this, Samples) : 0;  
     }  
   
105      LinuxSampler::Engine* EngineChannel::GetEngine() {      LinuxSampler::Engine* EngineChannel::GetEngine() {
106          return pEngine;          return pEngine;
107      }      }
# Line 214  namespace LinuxSampler { namespace gig { Line 214  namespace LinuxSampler { namespace gig {
214          if (pEngine) pEngine->Enable();          if (pEngine) pEngine->Enable();
215      }      }
216    
217      void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {              void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {
218            if (pEngine && pEngine->pAudioOutputDevice != pAudioOut) {
219                DisconnectAudioOutputDevice();
220            }
221          pEngine = Engine::AcquireEngine(this, pAudioOut);          pEngine = Engine::AcquireEngine(this, pAudioOut);
222          ResetInternal();                  ResetInternal();        
223          for (uint i = 0; i < 128; i++) {          for (uint i = 0; i < 128; i++) {
# Line 231  namespace LinuxSampler { namespace gig { Line 234  namespace LinuxSampler { namespace gig {
234          if (pEngine) { // if clause to prevent disconnect loops          if (pEngine) { // if clause to prevent disconnect loops
235              ResetInternal();              ResetInternal();
236              for (uint i = 0; i < 128; i++) {              for (uint i = 0; i < 128; i++) {
237                  if (pMIDIKeyInfo[i].pActiveVoices) delete pMIDIKeyInfo[i].pActiveVoices;                  if (pMIDIKeyInfo[i].pActiveVoices) {
238                  if (pMIDIKeyInfo[i].pEvents)       delete pMIDIKeyInfo[i].pEvents;                      delete pMIDIKeyInfo[i].pActiveVoices;
239                        pMIDIKeyInfo[i].pActiveVoices = NULL;
240                    }
241                    if (pMIDIKeyInfo[i].pEvents) {
242                        delete pMIDIKeyInfo[i].pEvents;
243                        pMIDIKeyInfo[i].pEvents = NULL;
244                    }
245              }              }
246              Engine* oldEngine = pEngine;              Engine* oldEngine = pEngine;
247              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;
248              pEngine = NULL;              pEngine = NULL;
249              Engine::FreeEngine(this, oldAudioDevice);              Engine::FreeEngine(this, oldAudioDevice);
250              AudioDeviceChannelLeft  = -1;              AudioDeviceChannelLeft  = -1;
251              AudioDeviceChannelRight = -1;              AudioDeviceChannelRight = -1;            
             oldAudioDevice->Disconnect(this);  
252          }          }
253      }      }
254    
# Line 287  namespace LinuxSampler { namespace gig { Line 295  namespace LinuxSampler { namespace gig {
295              event.Type                = Event::type_note_on;              event.Type                = Event::type_note_on;
296              event.Param.Note.Key      = Key;              event.Param.Note.Key      = Key;
297              event.Param.Note.Velocity = Velocity;              event.Param.Note.Velocity = Velocity;
298                event.pEngineChannel      = this;            
299              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
300              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
301          }          }
302      }      }
303    
# Line 305  namespace LinuxSampler { namespace gig { Line 314  namespace LinuxSampler { namespace gig {
314              event.Type                = Event::type_note_off;              event.Type                = Event::type_note_off;
315              event.Param.Note.Key      = Key;              event.Param.Note.Key      = Key;
316              event.Param.Note.Velocity = Velocity;              event.Param.Note.Velocity = Velocity;
317                event.pEngineChannel      = this;
318              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
319              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
320          }          }
321      }      }
322    
# Line 321  namespace LinuxSampler { namespace gig { Line 331  namespace LinuxSampler { namespace gig {
331              Event event             = pEngine->pEventGenerator->CreateEvent();              Event event             = pEngine->pEventGenerator->CreateEvent();
332              event.Type              = Event::type_pitchbend;              event.Type              = Event::type_pitchbend;
333              event.Param.Pitch.Pitch = Pitch;              event.Param.Pitch.Pitch = Pitch;
334                event.pEngineChannel    = this;
335              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
336              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
337          }          }
338      }      }
339    
# Line 339  namespace LinuxSampler { namespace gig { Line 350  namespace LinuxSampler { namespace gig {
350              event.Type                = Event::type_control_change;              event.Type                = Event::type_control_change;
351              event.Param.CC.Controller = Controller;              event.Param.CC.Controller = Controller;
352              event.Param.CC.Value      = Value;              event.Param.CC.Value      = Value;
353                event.pEngineChannel      = this;
354              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
355              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
356          }          }
357      }      }
358    

Legend:
Removed from v.411  
changed lines
  Added in v.420

  ViewVC Help
Powered by ViewVC