Fix so async wxSound can continue playing after it is destructed,

courtesy of Ryan Norton.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-07-22 04:22:47 +00:00
parent f5b96ee156
commit 9e783cc099

View File

@@ -88,6 +88,14 @@ public:
DisposeMovie(m_movie); DisposeMovie(m_movie);
m_movie = NULL ; m_movie = NULL ;
Stop(); Stop();
//Note that ExitMovies() is not neccessary, but
//the docs are fuzzy on whether or not TerminateQTML is
ExitMovies();
#ifndef __WXMAC__
TerminateQTML();
#endif
} }
void Notify() void Notify()
@@ -173,7 +181,7 @@ Boolean wxIsQuickTime4Installed (void)
long result; long result;
error = Gestalt (gestaltQuickTime, &result); error = Gestalt (gestaltQuickTime, &result);
return (error == noErr) && (result >= 4); //result >= 4 correct? return (error == noErr) && (((result >> 16) & 0xffff) >= 0x0400);
#else #else
return true; return true;
#endif #endif
@@ -219,7 +227,6 @@ wxSound::wxSound(int size, const wxByte* data)
wxSound::~wxSound() wxSound::~wxSound()
{ {
FreeData();
} }
bool wxSound::Create(const wxString& fileName, bool isResource) bool wxSound::Create(const wxString& fileName, bool isResource)
@@ -302,6 +309,8 @@ bool wxSound::DoPlay(unsigned flags) const
SetMovieVolume(movie, kFullVolume); SetMovieVolume(movie, kFullVolume);
GoToBeginningOfMovie(movie); GoToBeginningOfMovie(movie);
DisposeHandle(myHandle);
} }
break; break;
case wxSound_RESOURCE: case wxSound_RESOURCE:
@@ -420,13 +429,9 @@ bool wxSound::FreeData()
m_pTimer = NULL; m_pTimer = NULL;
} }
//Note that ExitMovies() is not neccessary, but
//the docs are fuzzy on whether or not TerminateQTML is
ExitMovies();
#ifndef __WXMAC__
TerminateQTML();
#endif
return true; return true;
} }
#endif //wxUSE_SOUND #endif //wxUSE_SOUND