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) |
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 |
} |
} |
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++) { |
242 |
pEngine = NULL; |
pEngine = NULL; |
243 |
Engine::FreeEngine(this, oldAudioDevice); |
Engine::FreeEngine(this, oldAudioDevice); |
244 |
AudioDeviceChannelLeft = -1; |
AudioDeviceChannelLeft = -1; |
245 |
AudioDeviceChannelRight = -1; |
AudioDeviceChannelRight = -1; |
|
oldAudioDevice->Disconnect(this); |
|
246 |
} |
} |
247 |
} |
} |
248 |
|
|
289 |
event.Type = Event::type_note_on; |
event.Type = Event::type_note_on; |
290 |
event.Param.Note.Key = Key; |
event.Param.Note.Key = Key; |
291 |
event.Param.Note.Velocity = Velocity; |
event.Param.Note.Velocity = Velocity; |
292 |
|
event.pEngineChannel = this; |
293 |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
294 |
else dmsg(1,("Engine: Input event queue full!")); |
else dmsg(1,("EngineChannel: Input event queue full!")); |
295 |
} |
} |
296 |
} |
} |
297 |
|
|
308 |
event.Type = Event::type_note_off; |
event.Type = Event::type_note_off; |
309 |
event.Param.Note.Key = Key; |
event.Param.Note.Key = Key; |
310 |
event.Param.Note.Velocity = Velocity; |
event.Param.Note.Velocity = Velocity; |
311 |
|
event.pEngineChannel = this; |
312 |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
313 |
else dmsg(1,("Engine: Input event queue full!")); |
else dmsg(1,("EngineChannel: Input event queue full!")); |
314 |
} |
} |
315 |
} |
} |
316 |
|
|
325 |
Event event = pEngine->pEventGenerator->CreateEvent(); |
Event event = pEngine->pEventGenerator->CreateEvent(); |
326 |
event.Type = Event::type_pitchbend; |
event.Type = Event::type_pitchbend; |
327 |
event.Param.Pitch.Pitch = Pitch; |
event.Param.Pitch.Pitch = Pitch; |
328 |
|
event.pEngineChannel = this; |
329 |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
330 |
else dmsg(1,("Engine: Input event queue full!")); |
else dmsg(1,("EngineChannel: Input event queue full!")); |
331 |
} |
} |
332 |
} |
} |
333 |
|
|
344 |
event.Type = Event::type_control_change; |
event.Type = Event::type_control_change; |
345 |
event.Param.CC.Controller = Controller; |
event.Param.CC.Controller = Controller; |
346 |
event.Param.CC.Value = Value; |
event.Param.CC.Value = Value; |
347 |
|
event.pEngineChannel = this; |
348 |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
349 |
else dmsg(1,("Engine: Input event queue full!")); |
else dmsg(1,("EngineChannel: Input event queue full!")); |
350 |
} |
} |
351 |
} |
} |
352 |
|
|