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 |
|
|
86 |
|
if (pInstrument) Instruments.HandBack(pInstrument, this); |
87 |
|
|
88 |
if (pGig) delete pGig; |
if (pGig) delete pGig; |
89 |
if (pRIFF) delete pRIFF; |
if (pRIFF) delete pRIFF; |
90 |
for (uint i = 0; i < 128; i++) { |
for (uint i = 0; i < 128; i++) { |
94 |
for (uint i = 0; i < Event::destination_count; i++) { |
for (uint i = 0; i < Event::destination_count; i++) { |
95 |
if (pSynthesisEvents[i]) delete pSynthesisEvents[i]; |
if (pSynthesisEvents[i]) delete pSynthesisEvents[i]; |
96 |
} |
} |
|
delete[] pSynthesisEvents; |
|
97 |
if (pEvents) delete pEvents; |
if (pEvents) delete pEvents; |
98 |
if (pCCEvents) delete pCCEvents; |
if (pCCEvents) delete pCCEvents; |
99 |
if (pEventQueue) delete pEventQueue; |
if (pEventQueue) delete pEventQueue; |
100 |
if (pEventPool) delete pEventPool; |
if (pEventPool) delete pEventPool; |
101 |
if (pVoicePool) delete pVoicePool; |
if (pVoicePool) { |
102 |
|
pVoicePool->clear(); |
103 |
|
delete pVoicePool; |
104 |
|
} |
105 |
if (pActiveKeys) delete pActiveKeys; |
if (pActiveKeys) delete pActiveKeys; |
106 |
if (pSysexBuffer) delete pSysexBuffer; |
if (pSysexBuffer) delete pSysexBuffer; |
107 |
if (pEventGenerator) delete pEventGenerator; |
if (pEventGenerator) delete pEventGenerator; |
108 |
if (pMainFilterParameters) delete[] pMainFilterParameters; |
if (pMainFilterParameters) delete[] pMainFilterParameters; |
109 |
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
if (pBasicFilterParameters) delete[] pBasicFilterParameters; |
110 |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
if (pSynthesisParameters[0]) free(pSynthesisParameters[0]); |
111 |
if (pVoiceStealingQueue) delete pVoiceStealingQueue; |
if (pVoiceStealingQueue) delete pVoiceStealingQueue; |
112 |
} |
} |
113 |
|
|
329 |
|
|
330 |
// (re)create disk thread |
// (re)create disk thread |
331 |
if (this->pDiskThread) { |
if (this->pDiskThread) { |
332 |
|
dmsg(1,("Stopping disk thread...")); |
333 |
this->pDiskThread->StopThread(); |
this->pDiskThread->StopThread(); |
334 |
delete this->pDiskThread; |
delete this->pDiskThread; |
335 |
|
dmsg(1,("OK\n")); |
336 |
} |
} |
337 |
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 |
338 |
if (!pDiskThread) { |
if (!pDiskThread) { |
351 |
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
352 |
|
|
353 |
// (re)allocate synthesis parameter matrix |
// (re)allocate synthesis parameter matrix |
354 |
if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; |
if (pSynthesisParameters[0]) free(pSynthesisParameters[0]); |
355 |
pSynthesisParameters[0] = new float[Event::destination_count * pAudioOut->MaxSamplesPerCycle()]; |
pSynthesisParameters[0] = (float *) memalign(16,(Event::destination_count * sizeof(float) * pAudioOut->MaxSamplesPerCycle())); |
356 |
for (int dst = 1; dst < Event::destination_count; dst++) |
for (int dst = 1; dst < Event::destination_count; dst++) |
357 |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); |
358 |
|
|
1174 |
} |
} |
1175 |
|
|
1176 |
String Engine::Version() { |
String Engine::Version() { |
1177 |
String s = "$Revision: 1.18 $"; |
String s = "$Revision: 1.21 $"; |
1178 |
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 |
1179 |
} |
} |
1180 |
|
|