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, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* 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 * |
23 |
|
|
24 |
#include "EngineChannel.h" |
#include "EngineChannel.h" |
25 |
|
|
26 |
|
#include "../../common/global_private.h" |
27 |
|
|
28 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
29 |
|
|
30 |
EngineChannel::EngineChannel() { |
EngineChannel::EngineChannel() { |
161 |
* This method will then actually start to load the instrument and block |
* This method will then actually start to load the instrument and block |
162 |
* the calling thread until loading was completed. |
* the calling thread until loading was completed. |
163 |
* |
* |
|
* @returns detailed description of the method call result |
|
164 |
* @see PrepareLoadInstrument() |
* @see PrepareLoadInstrument() |
165 |
*/ |
*/ |
166 |
void EngineChannel::LoadInstrument() { |
void EngineChannel::LoadInstrument() { |
193 |
instrid.Index = InstrumentIdx; |
instrid.Index = InstrumentIdx; |
194 |
newInstrument = Engine::instruments.Borrow(instrid, this); |
newInstrument = Engine::instruments.Borrow(instrid, this); |
195 |
if (!newInstrument) { |
if (!newInstrument) { |
196 |
InstrumentStat = -1; |
throw InstrumentManagerException("resource was not created"); |
|
dmsg(1,("no instrument loaded!!!\n")); |
|
|
exit(EXIT_FAILURE); |
|
197 |
} |
} |
198 |
} |
} |
199 |
catch (RIFF::Exception e) { |
catch (RIFF::Exception e) { |
200 |
InstrumentStat = -2; |
InstrumentStat = -2; |
201 |
|
StatusChanged(true); |
202 |
String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message; |
String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message; |
203 |
throw Exception(msg); |
throw Exception(msg); |
204 |
} |
} |
205 |
catch (InstrumentResourceManagerException e) { |
catch (InstrumentManagerException e) { |
206 |
InstrumentStat = -3; |
InstrumentStat = -3; |
207 |
|
StatusChanged(true); |
208 |
String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message(); |
String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message(); |
209 |
throw Exception(msg); |
throw Exception(msg); |
210 |
} |
} |
211 |
catch (...) { |
catch (...) { |
212 |
InstrumentStat = -4; |
InstrumentStat = -4; |
213 |
|
StatusChanged(true); |
214 |
throw Exception("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file."); |
throw Exception("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file."); |
215 |
} |
} |
216 |
|
|
223 |
|
|
224 |
if (pEngine) pEngine->ChangeInstrument(this, newInstrument); |
if (pEngine) pEngine->ChangeInstrument(this, newInstrument); |
225 |
else pInstrument = newInstrument; |
else pInstrument = newInstrument; |
226 |
|
|
227 |
|
StatusChanged(true); |
228 |
} |
} |
229 |
|
|
230 |
/** |
/** |
342 |
default: |
default: |
343 |
throw AudioOutputException("Invalid engine audio channel " + ToString(EngineAudioChannel)); |
throw AudioOutputException("Invalid engine audio channel " + ToString(EngineAudioChannel)); |
344 |
} |
} |
345 |
|
|
346 |
|
bStatusChanged = true; |
347 |
} |
} |
348 |
|
|
349 |
int EngineChannel::OutputChannel(uint EngineAudioChannel) { |
int EngineChannel::OutputChannel(uint EngineAudioChannel) { |
396 |
} |
} |
397 |
fxSends.push_back(pFxSend); |
fxSends.push_back(pFxSend); |
398 |
if (pEngine) pEngine->Enable(); |
if (pEngine) pEngine->Enable(); |
399 |
|
fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount()); |
400 |
|
|
401 |
return pFxSend; |
return pFxSend; |
402 |
} |
} |
403 |
|
|
435 |
} |
} |
436 |
} |
} |
437 |
if (pEngine) pEngine->Enable(); |
if (pEngine) pEngine->Enable(); |
438 |
|
fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount()); |
439 |
} |
} |
440 |
|
|
441 |
/** |
/** |
642 |
MidiVolume = 1.0; |
MidiVolume = 1.0; |
643 |
GlobalPanLeft = 1.0f; |
GlobalPanLeft = 1.0f; |
644 |
GlobalPanRight = 1.0f; |
GlobalPanRight = 1.0f; |
645 |
|
GlobalTranspose = 0; |
646 |
// set all MIDI controller values to zero |
// set all MIDI controller values to zero |
647 |
memset(ControllerTable, 0x00, 129); |
memset(ControllerTable, 0x00, 129); |
648 |
|
// reset all FX Send levels |
649 |
|
for ( |
650 |
|
std::vector<FxSend*>::iterator iter = fxSends.begin(); |
651 |
|
iter != fxSends.end(); iter++ |
652 |
|
) { |
653 |
|
(*iter)->Reset(); |
654 |
|
} |
655 |
} |
} |
656 |
|
|
657 |
/** |
/** |