From 30f9d60eeccc24199485cfd5caefdc9beb21baa9 Mon Sep 17 00:00:00 2001 From: jtbattle Date: Sat, 19 Jan 2019 01:59:47 -0600 Subject: [PATCH] Fix ability to replay wxSound sample on OSX The sound handle was returned to the OS after the first play completed (or the loop first stopped), making it impossible to replay that sound again. Now the handle is returned upon destruction of the wxSound object. Closes https://github.com/wxWidgets/wxWidgets/pull/1149 --- src/osx/core/sound.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/osx/core/sound.cpp b/src/osx/core/sound.cpp index 1c5ec6e2dc..e81a4d7826 100644 --- a/src/osx/core/sound.cpp +++ b/src/osx/core/sound.cpp @@ -58,6 +58,7 @@ wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(SystemSoundID soundID) : wxOSXAudioToolboxSoundData::~wxOSXAudioToolboxSoundData() { DoStop(); + AudioServicesDisposeSystemSoundID (m_soundID); } void @@ -95,8 +96,6 @@ void wxOSXAudioToolboxSoundData::DoStop() { m_playing = false; AudioServicesRemoveSystemSoundCompletion(m_soundID); - AudioServicesDisposeSystemSoundID (m_soundID); - wxSound::SoundStopped(this); } }