291 |
// make sure that the engine does not get any sysex messages |
// make sure that the engine does not get any sysex messages |
292 |
// while it's reseting |
// while it's reseting |
293 |
bool sysexDisabled = MidiInputPort::RemoveSysexListener(this); |
bool sysexDisabled = MidiInputPort::RemoveSysexListener(this); |
294 |
ActiveVoiceCount = 0; |
SetVoiceCount(0); |
295 |
ActiveVoiceCountMax = 0; |
ActiveVoiceCountMax = 0; |
296 |
|
|
297 |
// reset voice stealing parameters |
// reset voice stealing parameters |
686 |
pVoiceStealingQueue->clear(); |
pVoiceStealingQueue->clear(); |
687 |
|
|
688 |
// just some statistics about this engine instance |
// just some statistics about this engine instance |
689 |
ActiveVoiceCount = ActiveVoiceCountTemp; |
SetVoiceCount(ActiveVoiceCountTemp); |
690 |
if (ActiveVoiceCount > ActiveVoiceCountMax) ActiveVoiceCountMax = ActiveVoiceCount; |
if (VoiceCount() > ActiveVoiceCountMax) ActiveVoiceCountMax = VoiceCount(); |
691 |
|
|
692 |
// in case regions were previously suspended and we killed voices |
// in case regions were previously suspended and we killed voices |
693 |
// with disk streams due to that, check if those streams have finally |
// with disk streams due to that, check if those streams have finally |
786 |
voiceCount++; |
voiceCount++; |
787 |
|
|
788 |
if (itVoice->PlaybackState == Voice::playback_state_disk) { |
if (itVoice->PlaybackState == Voice::playback_state_disk) { |
789 |
if ((itVoice->DiskStreamRef).State == Stream::state_active) streamCount++; |
if ((itVoice->DiskStreamRef).State != Stream::state_unused) streamCount++; |
790 |
} |
} |
791 |
} else { // voice reached end, is now inactive |
} else { // voice reached end, is now inactive |
792 |
FreeVoice(pEngineChannel, itVoice); // remove voice from the list of active voices |
FreeVoice(pEngineChannel, itVoice); // remove voice from the list of active voices |
827 |
pEngineChannel->SetVoiceCount(pEngineChannel->GetVoiceCount() + 1); |
pEngineChannel->SetVoiceCount(pEngineChannel->GetVoiceCount() + 1); |
828 |
|
|
829 |
if (itNewVoice->PlaybackState == Voice::playback_state_disk) { |
if (itNewVoice->PlaybackState == Voice::playback_state_disk) { |
830 |
if (itNewVoice->DiskStreamRef.State == Stream::state_active) { |
if (itNewVoice->DiskStreamRef.State != Stream::state_unused) { |
831 |
pEngineChannel->SetDiskStreamCount(pEngineChannel->GetDiskStreamCount() + 1); |
pEngineChannel->SetDiskStreamCount(pEngineChannel->GetDiskStreamCount() + 1); |
832 |
} |
} |
833 |
} |
} |
2100 |
} |
} |
2101 |
|
|
2102 |
uint Engine::VoiceCount() { |
uint Engine::VoiceCount() { |
2103 |
return ActiveVoiceCount; |
return atomic_read(&ActiveVoiceCount); |
2104 |
|
} |
2105 |
|
|
2106 |
|
void Engine::SetVoiceCount(uint Count) { |
2107 |
|
atomic_set(&ActiveVoiceCount, Count); |
2108 |
} |
} |
2109 |
|
|
2110 |
uint Engine::VoiceCountMax() { |
uint Engine::VoiceCountMax() { |
2116 |
} |
} |
2117 |
|
|
2118 |
uint Engine::DiskStreamCount() { |
uint Engine::DiskStreamCount() { |
2119 |
return (pDiskThread) ? pDiskThread->ActiveStreamCount : 0; |
return (pDiskThread) ? pDiskThread->GetActiveStreamCount() : 0; |
2120 |
} |
} |
2121 |
|
|
2122 |
uint Engine::DiskStreamCountMax() { |
uint Engine::DiskStreamCountMax() { |
2140 |
} |
} |
2141 |
|
|
2142 |
String Engine::Version() { |
String Engine::Version() { |
2143 |
String s = "$Revision: 1.97 $"; |
String s = "$Revision: 1.98 $"; |
2144 |
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 |
2145 |
} |
} |
2146 |
|
|