23 |
|
|
24 |
#include "FxSend.h" |
#include "FxSend.h" |
25 |
|
|
26 |
|
#include "../common/global_private.h" |
27 |
#include "../drivers/audio/AudioOutputDevice.h" |
#include "../drivers/audio/AudioOutputDevice.h" |
28 |
#include "../common/RTMath.h" |
#include "../common/RTMath.h" |
29 |
|
|
30 |
#include <map> |
#include <map> |
31 |
|
|
32 |
|
#define DEFAULT_FX_SEND_LEVEL 0.0f |
33 |
|
|
34 |
namespace LinuxSampler { |
namespace LinuxSampler { |
35 |
|
|
36 |
FxSend::FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name) throw (Exception) { |
FxSend::FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name) throw (Exception) { |
41 |
const int iDestination = iChanOffset + i; |
const int iDestination = iChanOffset + i; |
42 |
Routing.push_back(iDestination); |
Routing.push_back(iDestination); |
43 |
} |
} |
44 |
MidiFxSendController = MidiCtrl; |
SetMidiController(MidiCtrl); |
45 |
sName = Name; |
sName = Name; |
46 |
|
|
47 |
// create an EngineChannel unique ID for this FxSend instance |
// create an EngineChannel unique ID for this FxSend instance |
73 |
} |
} |
74 |
__done: |
__done: |
75 |
|
|
76 |
fLevel = 0.3f; // default FX send level |
fLevel = DEFAULT_FX_SEND_LEVEL; |
77 |
} |
} |
78 |
|
|
79 |
int FxSend::DestinationChannel(int SrcChan) { |
int FxSend::DestinationChannel(int SrcChan) { |
119 |
} |
} |
120 |
|
|
121 |
void FxSend::SetLevel(float f) { |
void FxSend::SetLevel(float f) { |
122 |
|
if(fLevel == f) return; |
123 |
fLevel = f; |
fLevel = f; |
124 |
|
SetInfoChanged(true); |
125 |
} |
} |
126 |
|
|
127 |
void FxSend::SetLevel(uint8_t iMidiValue) { |
void FxSend::SetLevel(uint8_t iMidiValue) { |
128 |
fLevel = float(iMidiValue & 0x7f) / 127.0f; |
fLevel = float(iMidiValue & 0x7f) / 127.0f; |
129 |
|
SetInfoChanged(true); |
130 |
|
} |
131 |
|
|
132 |
|
void FxSend::Reset() { |
133 |
|
SetLevel(DEFAULT_FX_SEND_LEVEL); |
134 |
} |
} |
135 |
|
|
136 |
uint8_t FxSend::MidiController() { |
uint8_t FxSend::MidiController() { |
138 |
} |
} |
139 |
|
|
140 |
void FxSend::SetMidiController(uint8_t MidiCtrl) throw (Exception) { |
void FxSend::SetMidiController(uint8_t MidiCtrl) throw (Exception) { |
141 |
if (MidiCtrl & 0x7f) |
if (MidiCtrl >> 7) |
142 |
throw Exception("Invalid MIDI controller"); |
throw Exception("Invalid MIDI controller " + ToString((int)MidiCtrl)); |
143 |
MidiFxSendController = MidiCtrl; |
MidiFxSendController = MidiCtrl; |
144 |
} |
} |
145 |
|
|
147 |
return sName; |
return sName; |
148 |
} |
} |
149 |
|
|
150 |
|
void FxSend::SetName(String Name) { |
151 |
|
sName = Name; |
152 |
|
} |
153 |
|
|
154 |
uint FxSend::Id() { |
uint FxSend::Id() { |
155 |
return iId; |
return iId; |
156 |
} |
} |
157 |
|
|
158 |
|
void FxSend::SetInfoChanged(bool b) { |
159 |
|
bInfoChanged = b; |
160 |
|
} |
161 |
|
|
162 |
|
bool FxSend::IsInfoChanged() { |
163 |
|
return bInfoChanged; |
164 |
|
} |
165 |
|
|
166 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |