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