31 |
pInstrument = NULL; |
pInstrument = NULL; |
32 |
pEvents = NULL; // we allocate when we retrieve the right Engine object |
pEvents = NULL; // we allocate when we retrieve the right Engine object |
33 |
pCCEvents = NULL; // we allocate when we retrieve the right Engine object |
pCCEvents = NULL; // we allocate when we retrieve the right Engine object |
34 |
pEventQueue = new RingBuffer<Event>(MAX_EVENTS_PER_FRAGMENT, 0); |
pEventQueue = new RingBuffer<Event>(CONFIG_MAX_EVENTS_PER_FRAGMENT, 0); |
35 |
pActiveKeys = new Pool<uint>(128); |
pActiveKeys = new Pool<uint>(128); |
36 |
for (uint i = 0; i < 128; i++) { |
for (uint i = 0; i < 128; i++) { |
37 |
pMIDIKeyInfo[i].pActiveVoices = NULL; // we allocate when we retrieve the right Engine object |
pMIDIKeyInfo[i].pActiveVoices = NULL; // we allocate when we retrieve the right Engine object |
39 |
pMIDIKeyInfo[i].Active = false; |
pMIDIKeyInfo[i].Active = false; |
40 |
pMIDIKeyInfo[i].ReleaseTrigger = false; |
pMIDIKeyInfo[i].ReleaseTrigger = false; |
41 |
pMIDIKeyInfo[i].pEvents = NULL; // we allocate when we retrieve the right Engine object |
pMIDIKeyInfo[i].pEvents = NULL; // we allocate when we retrieve the right Engine object |
42 |
|
pMIDIKeyInfo[i].VoiceTheftsQueued = 0; |
43 |
pMIDIKeyInfo[i].RoundRobinIndex = 0; |
pMIDIKeyInfo[i].RoundRobinIndex = 0; |
44 |
} |
} |
45 |
for (uint i = 0; i < Event::destination_count; i++) { |
for (uint i = 0; i < Event::destination_count; i++) { |
70 |
GlobalPanRight = 1.0f; |
GlobalPanRight = 1.0f; |
71 |
CurrentKeyDimension = 0; |
CurrentKeyDimension = 0; |
72 |
|
|
73 |
// set all MIDI controller values to zero |
ResetControllers(); |
|
memset(ControllerTable, 0x00, 128); |
|
74 |
|
|
75 |
// reset key info |
// reset key info |
76 |
for (uint i = 0; i < 128; i++) { |
for (uint i = 0; i < 128; i++) { |
82 |
pMIDIKeyInfo[i].Active = false; |
pMIDIKeyInfo[i].Active = false; |
83 |
pMIDIKeyInfo[i].ReleaseTrigger = false; |
pMIDIKeyInfo[i].ReleaseTrigger = false; |
84 |
pMIDIKeyInfo[i].itSelf = Pool<uint>::Iterator(); |
pMIDIKeyInfo[i].itSelf = Pool<uint>::Iterator(); |
85 |
|
pMIDIKeyInfo[i].VoiceTheftsQueued = 0; |
86 |
} |
} |
87 |
|
|
88 |
// reset all key groups |
// reset all key groups |
191 |
|
|
192 |
/** |
/** |
193 |
* Will be called by the InstrumentResourceManager when the instrument |
* Will be called by the InstrumentResourceManager when the instrument |
194 |
* we are currently using in this engine is going to be updated, so we |
* we are currently using on this EngineChannel is going to be updated, |
195 |
* can stop playback before that happens. |
* so we can stop playback before that happens. |
196 |
*/ |
*/ |
197 |
void EngineChannel::ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg) { |
void EngineChannel::ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg) { |
198 |
dmsg(3,("gig::Engine: Received instrument update message.\n")); |
dmsg(3,("gig::Engine: Received instrument update message.\n")); |
210 |
if (pEngine) pEngine->Enable(); |
if (pEngine) pEngine->Enable(); |
211 |
} |
} |
212 |
|
|
213 |
|
/** |
214 |
|
* Will be called by the InstrumentResourceManager on progress changes |
215 |
|
* while loading or realoading an instrument for this EngineChannel. |
216 |
|
* |
217 |
|
* @param fProgress - current progress as value between 0.0 and 1.0 |
218 |
|
*/ |
219 |
|
void EngineChannel::OnResourceProgress(float fProgress) { |
220 |
|
this->InstrumentStat = int(fProgress * 100.0f); |
221 |
|
dmsg(7,("gig::EngineChannel: progress %d%", InstrumentStat)); |
222 |
|
} |
223 |
|
|
224 |
void EngineChannel::Connect(AudioOutputDevice* pAudioOut) { |
void EngineChannel::Connect(AudioOutputDevice* pAudioOut) { |
225 |
if (pEngine) { |
if (pEngine) { |
226 |
if (pEngine->pAudioOutputDevice == pAudioOut) return; |
if (pEngine->pAudioOutputDevice == pAudioOut) return; |
399 |
} |
} |
400 |
} |
} |
401 |
|
|
402 |
|
void EngineChannel::ResetControllers() { |
403 |
|
// set all MIDI controller values to zero |
404 |
|
memset(ControllerTable, 0x00, 128); |
405 |
|
} |
406 |
|
|
407 |
/** |
/** |
408 |
* Copy all events from the engine channel's input event queue buffer to |
* Copy all events from the engine channel's input event queue buffer to |
409 |
* the internal event list. This will be done at the beginning of each |
* the internal event list. This will be done at the beginning of each |
468 |
return InstrumentStat; |
return InstrumentStat; |
469 |
} |
} |
470 |
|
|
471 |
|
String EngineChannel::EngineName() { |
472 |
|
return LS_GIG_ENGINE_NAME; |
473 |
|
} |
474 |
|
|
475 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |