Audaspace: port CoreAudio closing fix from main.

This commit is contained in:
Jörg Müller
2025-03-04 21:48:53 +01:00
committed by Joerg Mueller
parent 0a16ba9911
commit 41cbebe6d9
2 changed files with 10 additions and 8 deletions

View File

@@ -147,9 +147,13 @@ void CoreAudioDevice::open()
void CoreAudioDevice::close()
{
AudioOutputUnitStop(m_audio_unit);
AudioUnitUninitialize(m_audio_unit);
AudioComponentInstanceDispose(m_audio_unit);
// NOTE: Keep the device open for buggy MacOS versions (see blender issue #121911).
if(__builtin_available(macOS 15.2, *))
{
AudioOutputUnitStop(m_audio_unit);
AudioUnitUninitialize(m_audio_unit);
AudioComponentInstanceDispose(m_audio_unit);
}
}
CoreAudioDevice::CoreAudioDevice(DeviceSpecs specs, int buffersize) :
@@ -165,8 +169,7 @@ m_audio_unit(nullptr)
m_specs = specs;
open();
// NOTE: Keep the device open until #121911 is investigated/resolved from Apple side.
// close();
close();
create();
}

View File

@@ -71,9 +71,8 @@ void OpenCloseDevice::playing(bool playing)
if(m_delayed_close_thread.joinable())
m_delayed_close_thread.join();
// NOTE: Disabled until #121911 is investigated/resolved from Apple side.
// m_delayed_close_running = true;
// m_delayed_close_thread = std::thread(&OpenCloseDevice::closeAfterDelay, this);
m_delayed_close_running = true;
m_delayed_close_thread = std::thread(&OpenCloseDevice::closeAfterDelay, this);
}
}
}