3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
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-2009 Christian Schoenebeck * |
* Copyright (C) 2005-2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 Grigor Iliev * |
* Copyright (C) 2009-2011 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 * |
68 |
virtual void ClearRegionsInUse() { |
virtual void ClearRegionsInUse() { |
69 |
{ |
{ |
70 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
71 |
if(cmd.pRegionsInUse != NULL) cmd.pRegionsInUse->clear(); |
if (cmd.pRegionsInUse) cmd.pRegionsInUse->clear(); |
72 |
|
cmd.bChangeInstrument = false; |
73 |
} |
} |
74 |
{ |
{ |
75 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
76 |
if(cmd.pRegionsInUse != NULL) cmd.pRegionsInUse->clear(); |
if (cmd.pRegionsInUse) cmd.pRegionsInUse->clear(); |
77 |
|
cmd.bChangeInstrument = false; |
78 |
} |
} |
79 |
} |
} |
80 |
|
|
86 |
virtual void DeleteRegionsInUse() { |
virtual void DeleteRegionsInUse() { |
87 |
{ |
{ |
88 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
89 |
if(cmd.pRegionsInUse != NULL) { |
if (cmd.pRegionsInUse) { |
90 |
delete cmd.pRegionsInUse; |
delete cmd.pRegionsInUse; |
91 |
cmd.pRegionsInUse = NULL; |
cmd.pRegionsInUse = NULL; |
92 |
} |
} |
93 |
|
cmd.bChangeInstrument = false; |
94 |
} |
} |
95 |
{ |
{ |
96 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
97 |
if(cmd.pRegionsInUse != NULL) { |
if (cmd.pRegionsInUse) { |
98 |
delete cmd.pRegionsInUse; |
delete cmd.pRegionsInUse; |
99 |
cmd.pRegionsInUse = NULL; |
cmd.pRegionsInUse = NULL; |
100 |
} |
} |
101 |
|
cmd.bChangeInstrument = false; |
102 |
} |
} |
103 |
} |
} |
104 |
|
|
106 |
{ |
{ |
107 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate(); |
108 |
cmd.pRegionsInUse = new RTList<R*>(pRegionPool[0]); |
cmd.pRegionsInUse = new RTList<R*>(pRegionPool[0]); |
109 |
|
cmd.bChangeInstrument = false; |
110 |
} |
} |
111 |
{ |
{ |
112 |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig(); |
113 |
cmd.pRegionsInUse = new RTList<R*>(pRegionPool[1]); |
cmd.pRegionsInUse = new RTList<R*>(pRegionPool[1]); |
114 |
|
cmd.bChangeInstrument = false; |
115 |
} |
} |
116 |
} |
} |
117 |
|
|
189 |
|
|
190 |
MidiKeyboardManager<V>::DeleteActiveVoices(); |
MidiKeyboardManager<V>::DeleteActiveVoices(); |
191 |
MidiKeyboardManager<V>::DeleteEvents(); |
MidiKeyboardManager<V>::DeleteEvents(); |
192 |
|
DeleteGroupEventLists(); |
193 |
|
|
194 |
AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice; |
AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice; |
195 |
pEngine = NULL; |
pEngine = NULL; |
215 |
// empty MIDI key specific event lists |
// empty MIDI key specific event lists |
216 |
ClearEventListsHandler handler; |
ClearEventListsHandler handler; |
217 |
ProcessActiveVoices(&handler); |
ProcessActiveVoices(&handler); |
218 |
|
|
219 |
|
// empty exclusive group specific event lists |
220 |
|
ClearGroupEventLists(); |
221 |
} |
} |
222 |
|
|
223 |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
316 |
if ((itVoice->DiskStreamRef).State != Stream::state_unused) StreamCount++; |
if ((itVoice->DiskStreamRef).State != Stream::state_unused) StreamCount++; |
317 |
} |
} |
318 |
} else { // voice reached end, is now inactive |
} else { // voice reached end, is now inactive |
319 |
|
itVoice->VoiceFreed(); |
320 |
pChannel->FreeVoice(itVoice); // remove voice from the list of active voices |
pChannel->FreeVoice(itVoice); // remove voice from the list of active voices |
321 |
} |
} |
322 |
} |
} |