26 |
#include "EGADSR.h" |
#include "EGADSR.h" |
27 |
|
|
28 |
#include "Engine.h" |
#include "Engine.h" |
29 |
|
#include <malloc.h> |
30 |
|
|
31 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
32 |
|
|
77 |
|
|
78 |
Engine::~Engine() { |
Engine::~Engine() { |
79 |
if (pDiskThread) { |
if (pDiskThread) { |
80 |
|
dmsg(1,("Stopping disk thread...")); |
81 |
pDiskThread->StopThread(); |
pDiskThread->StopThread(); |
82 |
delete pDiskThread; |
delete pDiskThread; |
83 |
|
dmsg(1,("OK\n")); |
84 |
} |
} |
85 |
if (pGig) delete pGig; |
if (pGig) delete pGig; |
86 |
if (pRIFF) delete pRIFF; |
if (pRIFF) delete pRIFF; |
91 |
for (uint i = 0; i < Event::destination_count; i++) { |
for (uint i = 0; i < Event::destination_count; i++) { |
92 |
if (pSynthesisEvents[i]) delete pSynthesisEvents[i]; |
if (pSynthesisEvents[i]) delete pSynthesisEvents[i]; |
93 |
} |
} |
|
delete[] pSynthesisEvents; |
|
94 |
if (pEvents) delete pEvents; |
if (pEvents) delete pEvents; |
95 |
if (pCCEvents) delete pCCEvents; |
if (pCCEvents) delete pCCEvents; |
96 |
if (pEventQueue) delete pEventQueue; |
if (pEventQueue) delete pEventQueue; |
97 |
if (pEventPool) delete pEventPool; |
if (pEventPool) delete pEventPool; |
98 |
if (pVoicePool) delete pVoicePool; |
if (pVoicePool) { |
99 |
|
pVoicePool->clear(); |
100 |
|
delete pVoicePool; |
101 |
|
} |
102 |
if (pActiveKeys) delete pActiveKeys; |
if (pActiveKeys) delete pActiveKeys; |
103 |
if (pSysexBuffer) delete pSysexBuffer; |
if (pSysexBuffer) delete pSysexBuffer; |
104 |
if (pEventGenerator) delete pEventGenerator; |
if (pEventGenerator) delete pEventGenerator; |
105 |
if (pMainFilterParameters) delete[] pMainFilterParameters; |
if (pMainFilterParameters) delete[] pMainFilterParameters; |
106 |
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
107 |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
if (pSynthesisParameters[0]) free(pSynthesisParameters[0]); |
108 |
if (pVoiceStealingQueue) delete pVoiceStealingQueue; |
if (pVoiceStealingQueue) delete pVoiceStealingQueue; |
109 |
} |
} |
110 |
|
|
326 |
|
|
327 |
// (re)create disk thread |
// (re)create disk thread |
328 |
if (this->pDiskThread) { |
if (this->pDiskThread) { |
329 |
|
dmsg(1,("Stopping disk thread...")); |
330 |
this->pDiskThread->StopThread(); |
this->pDiskThread->StopThread(); |
331 |
delete this->pDiskThread; |
delete this->pDiskThread; |
332 |
|
dmsg(1,("OK\n")); |
333 |
} |
} |
334 |
this->pDiskThread = new DiskThread(((pAudioOut->MaxSamplesPerCycle() << MAX_PITCH) << 1) + 6); //FIXME: assuming stereo |
this->pDiskThread = new DiskThread(((pAudioOut->MaxSamplesPerCycle() << MAX_PITCH) << 1) + 6); //FIXME: assuming stereo |
335 |
if (!pDiskThread) { |
if (!pDiskThread) { |
348 |
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
349 |
|
|
350 |
// (re)allocate synthesis parameter matrix |
// (re)allocate synthesis parameter matrix |
351 |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
if (pSynthesisParameters[0]) free(pSynthesisParameters[0]); |
352 |
pSynthesisParameters[0] = new float[Event::destination_count * pAudioOut->MaxSamplesPerCycle()]; |
pSynthesisParameters[0] = (float *) memalign(16,(Event::destination_count * sizeof(float) * pAudioOut->MaxSamplesPerCycle())); |
353 |
for (int dst = 1; dst < Event::destination_count; dst++) |
for (int dst = 1; dst < Event::destination_count; dst++) |
354 |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
355 |
|
|
1171 |
} |
} |
1172 |
|
|
1173 |
String Engine::Version() { |
String Engine::Version() { |
1174 |
String s = "$Revision: 1.18 $"; |
String s = "$Revision: 1.20 $"; |
1175 |
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 |
1176 |
} |
} |
1177 |
|
|