24 |
#include "EngineChannel.h" |
#include "EngineChannel.h" |
25 |
|
|
26 |
#include "../../common/global_private.h" |
#include "../../common/global_private.h" |
27 |
|
#include "../../Sampler.h" |
28 |
|
|
29 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
30 |
|
|
64 |
|
|
65 |
EngineChannel::~EngineChannel() { |
EngineChannel::~EngineChannel() { |
66 |
DisconnectAudioOutputDevice(); |
DisconnectAudioOutputDevice(); |
67 |
|
|
68 |
|
// In case the channel was removed before the instrument was |
69 |
|
// fully loaded, try to give back instrument again (see bug #113) |
70 |
|
instrument_change_command_t& cmd = ChangeInstrument(NULL); |
71 |
|
if (cmd.pInstrument) { |
72 |
|
Engine::instruments.HandBack(cmd.pInstrument, this); |
73 |
|
} |
74 |
|
/////// |
75 |
|
|
76 |
if (pEventQueue) delete pEventQueue; |
if (pEventQueue) delete pEventQueue; |
77 |
if (pActiveKeys) delete pActiveKeys; |
if (pActiveKeys) delete pActiveKeys; |
78 |
if (pMIDIKeyInfo) delete[] pMIDIKeyInfo; |
if (pMIDIKeyInfo) delete[] pMIDIKeyInfo; |
339 |
// release the currently loaded instrument |
// release the currently loaded instrument |
340 |
Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d); |
Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d); |
341 |
} |
} |
342 |
|
|
343 |
if (d) delete d; |
if (d) delete d; |
344 |
|
|
345 |
// release all active dimension regions to resource |
// release all active dimension regions to resource |
462 |
} |
} |
463 |
fxSends.push_back(pFxSend); |
fxSends.push_back(pFxSend); |
464 |
if (pEngine) pEngine->Enable(); |
if (pEngine) pEngine->Enable(); |
465 |
fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount()); |
fireFxSendCountChanged(GetSamplerChannel()->Index(), GetFxSendCount()); |
466 |
|
|
467 |
return pFxSend; |
return pFxSend; |
468 |
} |
} |
501 |
} |
} |
502 |
} |
} |
503 |
if (pEngine) pEngine->Enable(); |
if (pEngine) pEngine->Enable(); |
504 |
fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount()); |
fireFxSendCountChanged(GetSamplerChannel()->Index(), GetFxSendCount()); |
505 |
} |
} |
506 |
|
|
507 |
/** |
/** |
748 |
MidiVolume = 1.0; |
MidiVolume = 1.0; |
749 |
GlobalPanLeft = 1.0f; |
GlobalPanLeft = 1.0f; |
750 |
GlobalPanRight = 1.0f; |
GlobalPanRight = 1.0f; |
751 |
|
iLastPanRequest = 64; |
752 |
GlobalTranspose = 0; |
GlobalTranspose = 0; |
753 |
// set all MIDI controller values to zero |
// set all MIDI controller values to zero |
754 |
memset(ControllerTable, 0x00, 129); |
memset(ControllerTable, 0x00, 129); |
887 |
bStatusChanged = true; // status of engine channel has changed, so set notify flag |
bStatusChanged = true; // status of engine channel has changed, so set notify flag |
888 |
} |
} |
889 |
|
|
890 |
|
float EngineChannel::Pan() { |
891 |
|
return float(iLastPanRequest - 64) / 64.0f; |
892 |
|
} |
893 |
|
|
894 |
|
void EngineChannel::Pan(float f) { |
895 |
|
int iMidiPan = int(f * 64.0f) + 64; |
896 |
|
if (iMidiPan > 127) iMidiPan = 127; |
897 |
|
else if (iMidiPan < 0) iMidiPan = 0; |
898 |
|
GlobalPanLeft = Engine::PanCurve[128 - iMidiPan]; |
899 |
|
GlobalPanRight = Engine::PanCurve[iMidiPan]; |
900 |
|
iLastPanRequest = iMidiPan; |
901 |
|
} |
902 |
|
|
903 |
uint EngineChannel::Channels() { |
uint EngineChannel::Channels() { |
904 |
return 2; |
return 2; |
905 |
} |
} |