39 |
LinuxSampler::EngineChannel* pEngineChannel, |
LinuxSampler::EngineChannel* pEngineChannel, |
40 |
Pool<Event>::Iterator& itControlChangeEvent |
Pool<Event>::Iterator& itControlChangeEvent |
41 |
) { |
) { |
42 |
dmsg(4,("Engine::ContinuousController cc=%d v=%d\n", itControlChangeEvent->Param.CC.Controller, itControlChangeEvent->Param.CC.Value)); |
uint8_t cc = itControlChangeEvent->Param.CC.Controller; |
43 |
|
dmsg(4,("Engine::ContinuousController cc=%d v=%d\n", cc, itControlChangeEvent->Param.CC.Value)); |
44 |
|
|
45 |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
|
// handle the "control triggered" MIDI rule: a control change |
|
|
// event can trigger a new note on or note off event |
|
|
if (pChannel->pInstrument) { |
|
|
|
|
|
// TODO: |
|
|
} |
|
46 |
|
|
47 |
// update controller value in the engine channel's controller table |
// update controller value in the engine channel's controller table |
48 |
pChannel->ControllerTable[itControlChangeEvent->Param.CC.Controller] = itControlChangeEvent->Param.CC.Value; |
pChannel->ControllerTable[cc] = itControlChangeEvent->Param.CC.Value; |
49 |
|
|
50 |
ProcessHardcodedControllers(pEngineChannel, itControlChangeEvent); |
ProcessHardcodedControllers(pEngineChannel, itControlChangeEvent); |
51 |
|
|
52 |
// handle FX send controllers |
// handle FX send controllers |
53 |
ProcessFxSendControllers(pChannel, itControlChangeEvent); |
ProcessFxSendControllers(pChannel, itControlChangeEvent); |
54 |
|
|
55 |
|
// handle control triggered regions: a control change event |
56 |
|
// can trigger a new voice |
57 |
|
if (pChannel->pInstrument && cc < 128) { |
58 |
|
|
59 |
|
::sfz::Query q; |
60 |
|
q.chan = pChannel->MidiChannel(); |
61 |
|
q.key = 60; |
62 |
|
q.vel = 127; |
63 |
|
q.bend = pChannel->Pitch; |
64 |
|
q.bpm = 0; |
65 |
|
q.chanaft = pChannel->ControllerTable[128]; |
66 |
|
q.polyaft = 0; |
67 |
|
q.prog = 0; |
68 |
|
q.rand = Random(); |
69 |
|
q.cc = pChannel->ControllerTable; |
70 |
|
q.timer = 0; |
71 |
|
q.sw = pChannel->PressedKeys; |
72 |
|
q.last_sw_key = pChannel->LastKeySwitch; |
73 |
|
q.prev_sw_key = pChannel->LastKey; |
74 |
|
q.trig = TRIGGER_ATTACK | TRIGGER_FIRST; |
75 |
|
|
76 |
|
q.search(pChannel->pInstrument, cc); |
77 |
|
|
78 |
|
int i = 0; |
79 |
|
while (::sfz::Region* region = q.next()) { |
80 |
|
if (!RegionSuspended(region)) { |
81 |
|
itControlChangeEvent->Param.Note.Key = 60; |
82 |
|
itControlChangeEvent->Param.Note.Velocity = 127; |
83 |
|
itControlChangeEvent->Param.Note.pRegion = region; |
84 |
|
LaunchVoice(pChannel, itControlChangeEvent, i, false, false, true); |
85 |
|
} |
86 |
|
i++; |
87 |
|
} |
88 |
|
} |
89 |
} |
} |
90 |
|
|
91 |
DiskThread* Engine::CreateDiskThread() { |
DiskThread* Engine::CreateDiskThread() { |
183 |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
184 |
int key = itNoteOnEvent->Param.Note.Key; |
int key = itNoteOnEvent->Param.Note.Key; |
185 |
EngineChannel::MidiKey* pKey = &pChannel->pMIDIKeyInfo[key]; |
EngineChannel::MidiKey* pKey = &pChannel->pMIDIKeyInfo[key]; |
186 |
Voice::type_t VoiceType = (ReleaseTriggerVoice) ? Voice::type_release_trigger : (!iLayer) ? Voice::type_release_trigger_required : Voice::type_normal; |
::sfz::Region* pRgn = static_cast< ::sfz::Region*>(itNoteOnEvent->Param.Note.pRegion); |
187 |
|
|
188 |
|
Voice::type_t VoiceType = |
189 |
|
itNoteOnEvent->Type == Event::type_control_change ? Voice::type_controller_triggered : |
190 |
|
ReleaseTriggerVoice ? Voice::type_release_trigger : |
191 |
|
iLayer == 0 ? Voice::type_release_trigger_required : |
192 |
|
Voice::type_normal; |
193 |
|
if (pRgn->loop_mode == ::sfz::ONE_SHOT) VoiceType |= Voice::type_one_shot; |
194 |
|
|
195 |
Pool<Voice>::Iterator itNewVoice; |
Pool<Voice>::Iterator itNewVoice; |
|
::sfz::Region* pRgn = static_cast< ::sfz::Region*>(itNoteOnEvent->Param.Note.pRegion); |
|
196 |
|
|
197 |
// no need to process if sample is silent |
// no need to process if sample is silent |
198 |
if (!pRgn->GetSample() || !pRgn->GetSample()->GetTotalFrameCount()) return Pool<Voice>::Iterator(); |
if (!pRgn->GetSample() || !pRgn->GetSample()->GetTotalFrameCount()) return Pool<Voice>::Iterator(); |
224 |
} |
} |
225 |
|
|
226 |
String Engine::Version() { |
String Engine::Version() { |
227 |
String s = "$Revision: 1.10 $"; |
String s = "$Revision: 1.11 $"; |
228 |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
229 |
} |
} |
230 |
|
|