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
This commit is contained in:
jtbattle
2019-01-19 01:59:47 -06:00
committed by Vadim Zeitlin
parent 557b8526d1
commit 30f9d60eec

View File

@@ -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);
}
}