4 |
* * |
* * |
5 |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005-2008 Christian Schoenebeck * |
* Copyright (C) 2005-2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009-2011 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009-2013 Christian Schoenebeck and Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
10 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
120 |
if (pEngine->pAudioOutputDevice == pAudioOut) return; |
if (pEngine->pAudioOutputDevice == pAudioOut) return; |
121 |
DisconnectAudioOutputDevice(); |
DisconnectAudioOutputDevice(); |
122 |
} |
} |
123 |
pEngine = AbstractEngine::AcquireEngine(this, pAudioOut); |
AbstractEngine* newEngine = AbstractEngine::AcquireEngine(this, pAudioOut); |
124 |
|
{ |
125 |
|
LockGuard lock(EngineMutex); |
126 |
|
pEngine = newEngine; |
127 |
|
} |
128 |
ResetInternal(); |
ResetInternal(); |
129 |
pEvents = new RTList<Event>(pEngine->pEventPool); |
pEvents = new RTList<Event>(pEngine->pEventPool); |
130 |
|
|
196 |
DeleteGroupEventLists(); |
DeleteGroupEventLists(); |
197 |
|
|
198 |
AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice; |
AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice; |
199 |
pEngine = NULL; |
{ |
200 |
|
LockGuard lock(EngineMutex); |
201 |
|
pEngine = NULL; |
202 |
|
} |
203 |
AbstractEngine::FreeEngine(this, oldAudioDevice); |
AbstractEngine::FreeEngine(this, oldAudioDevice); |
204 |
AudioDeviceChannelLeft = -1; |
AudioDeviceChannelLeft = -1; |
205 |
AudioDeviceChannelRight = -1; |
AudioDeviceChannelRight = -1; |
221 |
pEvents->clear(); |
pEvents->clear(); |
222 |
// empty MIDI key specific event lists |
// empty MIDI key specific event lists |
223 |
ClearEventListsHandler handler; |
ClearEventListsHandler handler; |
224 |
ProcessActiveVoices(&handler); |
this->ProcessActiveVoices(&handler); |
225 |
|
|
226 |
// empty exclusive group specific event lists |
// empty exclusive group specific event lists |
227 |
ClearGroupEventLists(); |
// (pInstrument == 0 could mean that LoadInstrument is |
228 |
|
// building new group event lists, so we must check |
229 |
|
// for that) |
230 |
|
if (pInstrument) ClearGroupEventLists(); |
231 |
} |
} |
232 |
|
|
233 |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
268 |
|
|
269 |
void RenderActiveVoices(uint Samples) { |
void RenderActiveVoices(uint Samples) { |
270 |
RenderVoicesHandler handler(this, Samples); |
RenderVoicesHandler handler(this, Samples); |
271 |
ProcessActiveVoices(&handler); |
this->ProcessActiveVoices(&handler); |
272 |
|
|
273 |
SetVoiceCount(handler.VoiceCount); |
SetVoiceCount(handler.VoiceCount); |
274 |
SetDiskStreamCount(handler.StreamCount); |
SetDiskStreamCount(handler.StreamCount); |