35 |
DisconnectAudioOutputDevice(); |
DisconnectAudioOutputDevice(); |
36 |
// In case the channel was removed before the instrument was |
// In case the channel was removed before the instrument was |
37 |
// fully loaded, try to give back instrument again (see bug #113) |
// fully loaded, try to give back instrument again (see bug #113) |
38 |
InstrumentChangeCmd< ::sf2::Region, ::sf2::InstrumentBase>& cmd = ChangeInstrument(NULL); |
InstrumentChangeCmd< ::sf2::Region, ::sf2::Preset>& cmd = ChangeInstrument(NULL); |
39 |
if (cmd.pInstrument) { |
if (cmd.pInstrument) { |
40 |
InstrumentResourceManager* instrs = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager()); |
InstrumentResourceManager* instrs = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager()); |
41 |
instrs->HandBack(cmd.pInstrument, this); |
instrs->HandBack(cmd.pInstrument, this); |
48 |
/** This method is not thread safe! */ |
/** This method is not thread safe! */ |
49 |
void EngineChannel::ResetInternal() { |
void EngineChannel::ResetInternal() { |
50 |
CurrentKeyDimension = 0; |
CurrentKeyDimension = 0; |
51 |
EngineChannelBase<Voice, ::sf2::Region, ::sf2::InstrumentBase>::ResetInternal(); |
EngineChannelBase<Voice, ::sf2::Region, ::sf2::Preset>::ResetInternal(); |
52 |
for(int i = 0; i < 128; i++) PressedKeys[i] = false; |
for(int i = 0; i < 128; i++) PressedKeys[i] = false; |
53 |
} |
} |
54 |
|
|
84 |
|
|
85 |
// make sure we don't trigger any new notes with an old |
// make sure we don't trigger any new notes with an old |
86 |
// instrument |
// instrument |
87 |
InstrumentChangeCmd< ::sf2::Region, ::sf2::InstrumentBase>& cmd = ChangeInstrument(0); |
InstrumentChangeCmd< ::sf2::Region, ::sf2::Preset>& cmd = ChangeInstrument(0); |
88 |
if (cmd.pInstrument) { |
if (cmd.pInstrument) { |
89 |
// give old instrument back to instrument manager, but |
// give old instrument back to instrument manager, but |
90 |
// keep the dimension regions and samples that are in use |
// keep the dimension regions and samples that are in use |
96 |
ActiveKeyGroups.clear(); |
ActiveKeyGroups.clear(); |
97 |
|
|
98 |
// request sf2 instrument from instrument manager |
// request sf2 instrument from instrument manager |
99 |
::sf2::InstrumentBase* newInstrument; |
::sf2::Preset* newInstrument; |
100 |
try { |
try { |
101 |
InstrumentManager::instrument_id_t instrid; |
InstrumentManager::instrument_id_t instrid; |
102 |
instrid.FileName = InstrumentFile; |
instrid.FileName = InstrumentFile; |