mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-08 21:17:49 +00:00
Better voice id allocation
This commit is contained in:
@@ -15,7 +15,7 @@ Engine::Engine(IBackendVoiceAllocator& backend)
|
||||
|
||||
Voice* Engine::_allocateVoice(int groupId, double sampleRate, bool dynamicPitch, bool emitter)
|
||||
{
|
||||
m_activeVoices.emplace_back(*this, groupId, m_activeVoices.size(), emitter);
|
||||
m_activeVoices.emplace_back(*this, groupId, m_nextVid++, emitter);
|
||||
m_activeVoices.back().m_backendVoice =
|
||||
m_backend.allocateVoice(m_activeVoices.back(), sampleRate, dynamicPitch);
|
||||
return &m_activeVoices.back();
|
||||
@@ -43,6 +43,12 @@ AudioGroup* Engine::_findGroupFromSongId(int songId) const
|
||||
/** Update all active audio entities and fill OS audio buffers as needed */
|
||||
void Engine::pumpEngine()
|
||||
{
|
||||
int maxVid = -1;
|
||||
for (Voice& vox : m_activeVoices)
|
||||
{
|
||||
maxVid = std::max(maxVid, vox.vid());
|
||||
}
|
||||
m_nextVid = maxVid + 1;
|
||||
}
|
||||
|
||||
/** Add audio group data pointers to engine; must remain resident! */
|
||||
|
||||
Reference in New Issue
Block a user