/[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 424 by schoenebeck, Fri Mar 4 22:54:11 2005 UTC
# Line 68  namespace LinuxSampler { namespace gig { Line 68  namespace LinuxSampler { namespace gig {
68          Pitch               = 0;          Pitch               = 0;
69          SustainPedal        = false;          SustainPedal        = false;
70          GlobalVolume        = 1.0;          GlobalVolume        = 1.0;
71            GlobalPanLeft       = 1.0f;
72            GlobalPanRight      = 1.0f;
73          CurrentKeyDimension = 0;          CurrentKeyDimension = 0;
74    
75          // set all MIDI controller values to zero          // set all MIDI controller values to zero
76          memset(ControllerTable, 0x00, 128);          memset(ControllerTable, 0x00, 128);
77    
78            // reset voice stealing parameters
79            itLastStolenVoice = RTList<Voice>::Iterator();
80            iuiLastStolenKey  = RTList<uint>::Iterator();
81    
82          // reset key info          // reset key info
83          for (uint i = 0; i < 128; i++) {          for (uint i = 0; i < 128; i++) {
84              if (pMIDIKeyInfo[i].pActiveVoices)              if (pMIDIKeyInfo[i].pActiveVoices)
# Line 98  namespace LinuxSampler { namespace gig { Line 104  namespace LinuxSampler { namespace gig {
104          if (pEngine) pEngine->ResetInternal();          if (pEngine) pEngine->ResetInternal();
105      }      }
106    
     int EngineChannel::RenderAudio(uint Samples) {  
         return (pEngine) ? pEngine->RenderAudio(this, Samples) : 0;  
     }  
   
107      LinuxSampler::Engine* EngineChannel::GetEngine() {      LinuxSampler::Engine* EngineChannel::GetEngine() {
108          return pEngine;          return pEngine;
109      }      }
# Line 214  namespace LinuxSampler { namespace gig { Line 216  namespace LinuxSampler { namespace gig {
216          if (pEngine) pEngine->Enable();          if (pEngine) pEngine->Enable();
217      }      }
218    
219      void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {              void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {
220            if (pEngine && pEngine->pAudioOutputDevice != pAudioOut) {
221                DisconnectAudioOutputDevice();
222            }
223          pEngine = Engine::AcquireEngine(this, pAudioOut);          pEngine = Engine::AcquireEngine(this, pAudioOut);
224          ResetInternal();                  ResetInternal();        
225          for (uint i = 0; i < 128; i++) {          for (uint i = 0; i < 128; i++) {
# Line 231  namespace LinuxSampler { namespace gig { Line 236  namespace LinuxSampler { namespace gig {
236          if (pEngine) { // if clause to prevent disconnect loops          if (pEngine) { // if clause to prevent disconnect loops
237              ResetInternal();              ResetInternal();
238              for (uint i = 0; i < 128; i++) {              for (uint i = 0; i < 128; i++) {
239                  if (pMIDIKeyInfo[i].pActiveVoices) delete pMIDIKeyInfo[i].pActiveVoices;                  if (pMIDIKeyInfo[i].pActiveVoices) {
240                  if (pMIDIKeyInfo[i].pEvents)       delete pMIDIKeyInfo[i].pEvents;                      delete pMIDIKeyInfo[i].pActiveVoices;
241                        pMIDIKeyInfo[i].pActiveVoices = NULL;
242                    }
243                    if (pMIDIKeyInfo[i].pEvents) {
244                        delete pMIDIKeyInfo[i].pEvents;
245                        pMIDIKeyInfo[i].pEvents = NULL;
246                    }
247              }              }
248              Engine* oldEngine = pEngine;              Engine* oldEngine = pEngine;
249              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;
250              pEngine = NULL;              pEngine = NULL;
251              Engine::FreeEngine(this, oldAudioDevice);              Engine::FreeEngine(this, oldAudioDevice);
252              AudioDeviceChannelLeft  = -1;              AudioDeviceChannelLeft  = -1;
253              AudioDeviceChannelRight = -1;              AudioDeviceChannelRight = -1;            
             oldAudioDevice->Disconnect(this);  
254          }          }
255      }      }
256    
# Line 287  namespace LinuxSampler { namespace gig { Line 297  namespace LinuxSampler { namespace gig {
297              event.Type                = Event::type_note_on;              event.Type                = Event::type_note_on;
298              event.Param.Note.Key      = Key;              event.Param.Note.Key      = Key;
299              event.Param.Note.Velocity = Velocity;              event.Param.Note.Velocity = Velocity;
300                event.pEngineChannel      = this;            
301              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
302              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
303          }          }
304      }      }
305    
# Line 305  namespace LinuxSampler { namespace gig { Line 316  namespace LinuxSampler { namespace gig {
316              event.Type                = Event::type_note_off;              event.Type                = Event::type_note_off;
317              event.Param.Note.Key      = Key;              event.Param.Note.Key      = Key;
318              event.Param.Note.Velocity = Velocity;              event.Param.Note.Velocity = Velocity;
319                event.pEngineChannel      = this;
320              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
321              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
322          }          }
323      }      }
324    
# Line 321  namespace LinuxSampler { namespace gig { Line 333  namespace LinuxSampler { namespace gig {
333              Event event             = pEngine->pEventGenerator->CreateEvent();              Event event             = pEngine->pEventGenerator->CreateEvent();
334              event.Type              = Event::type_pitchbend;              event.Type              = Event::type_pitchbend;
335              event.Param.Pitch.Pitch = Pitch;              event.Param.Pitch.Pitch = Pitch;
336                event.pEngineChannel    = this;
337              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
338              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
339          }          }
340      }      }
341    
# Line 339  namespace LinuxSampler { namespace gig { Line 352  namespace LinuxSampler { namespace gig {
352              event.Type                = Event::type_control_change;              event.Type                = Event::type_control_change;
353              event.Param.CC.Controller = Controller;              event.Param.CC.Controller = Controller;
354              event.Param.CC.Value      = Value;              event.Param.CC.Value      = Value;
355                event.pEngineChannel      = this;
356              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);              if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event);
357              else dmsg(1,("Engine: Input event queue full!"));              else dmsg(1,("EngineChannel: Input event queue full!"));
358          }          }
359      }      }
360    

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

  ViewVC Help
Powered by ViewVC