2 |
* * |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* * |
* * |
7 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
8 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
59 |
pVoicePool->clear(); |
pVoicePool->clear(); |
60 |
|
|
61 |
pSynthesisParameters[0] = NULL; // we allocate when an audio device is connected |
pSynthesisParameters[0] = NULL; // we allocate when an audio device is connected |
62 |
|
pBasicFilterParameters = NULL; |
63 |
|
pMainFilterParameters = NULL; |
64 |
|
|
65 |
ResetInternal(); |
ResetInternal(); |
66 |
} |
} |
87 |
if (pVoicePool) delete pVoicePool; |
if (pVoicePool) delete pVoicePool; |
88 |
if (pActiveKeys) delete pActiveKeys; |
if (pActiveKeys) delete pActiveKeys; |
89 |
if (pEventGenerator) delete pEventGenerator; |
if (pEventGenerator) delete pEventGenerator; |
90 |
|
if (pMainFilterParameters) delete[] pMainFilterParameters; |
91 |
|
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
92 |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
93 |
} |
} |
94 |
|
|
95 |
void Engine::Enable() { |
void Engine::Enable() { |
96 |
dmsg(3,("gig::Engine: enabling\n")); |
dmsg(3,("gig::Engine: enabling\n")); |
97 |
EngineDisabled.PushAndUnlock(false, 2); // set condition object 'EngineDisabled' to false (wait max. 2s) |
EngineDisabled.PushAndUnlock(false, 2); // set condition object 'EngineDisabled' to false (wait max. 2s) |
98 |
dmsg(1,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe())); |
dmsg(3,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe())); |
99 |
} |
} |
100 |
|
|
101 |
void Engine::Disable() { |
void Engine::Disable() { |
293 |
for (int dst = 1; dst < Event::destination_count; dst++) |
for (int dst = 1; dst < Event::destination_count; dst++) |
294 |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
295 |
|
|
296 |
|
// (re)allocate biquad filter parameter sequence |
297 |
|
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
298 |
|
if (pMainFilterParameters) delete[] pMainFilterParameters; |
299 |
|
pBasicFilterParameters = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()]; |
300 |
|
pMainFilterParameters = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()]; |
301 |
|
|
302 |
dmsg(1,("Starting disk thread...")); |
dmsg(1,("Starting disk thread...")); |
303 |
pDiskThread->StartThread(); |
pDiskThread->StartThread(); |
304 |
dmsg(1,("OK\n")); |
dmsg(1,("OK\n")); |
645 |
*/ |
*/ |
646 |
void Engine::ResetSynthesisParameters(Event::destination_t dst, float val) { |
void Engine::ResetSynthesisParameters(Event::destination_t dst, float val) { |
647 |
int maxsamples = pAudioOutputDevice->MaxSamplesPerCycle(); |
int maxsamples = pAudioOutputDevice->MaxSamplesPerCycle(); |
648 |
for (int i = 0; i < maxsamples; i++) pSynthesisParameters[dst][i] = val; |
float* m = &pSynthesisParameters[dst][0]; |
649 |
|
for (int i = 0; i < maxsamples; i += 4) { |
650 |
|
m[i] = val; |
651 |
|
m[i+1] = val; |
652 |
|
m[i+2] = val; |
653 |
|
m[i+3] = val; |
654 |
|
} |
655 |
} |
} |
656 |
|
|
657 |
float Engine::Volume() { |
float Engine::Volume() { |