+void wxSoundBackendSDL::FinishedPlayback()
+{
+ if (!m_playing)
+ Stop();
+}
+
+bool wxSoundBackendSDL::OpenAudio()
+{
+ if (!m_audioOpen)
+ {
+ if (!m_evtHandler)
+ m_evtHandler = new wxSoundBackendSDLEvtHandler(this);
+
+ m_spec.silence = 0;
+ m_spec.samples = 4096;
+ m_spec.size = 0;
+ m_spec.callback = wx_sdl_audio_callback;
+ m_spec.userdata = (void*)this;
+
+ wxLogTrace(_T("sound"), _T("opening SDL audio..."));
+ if (SDL_OpenAudio(&m_spec, NULL) >= 0)
+ {
+#if wxUSE_LOG_DEBUG
+ char driver[256];
+ SDL_AudioDriverName(driver, 256);
+ wxLogTrace(_T("sound"), _T("opened audio, driver '%s'"),
+ wxString(driver, wxConvLocal).c_str());
+#endif
+ m_audioOpen = true;
+ return true;
+ }
+ else
+ {
+ wxString err(SDL_GetError(), wxConvLocal);
+ wxLogError(_("Couldn't open audio: %s"), err.c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+void wxSoundBackendSDL::CloseAudio()
+{
+ if (m_audioOpen)
+ {
+ SDL_CloseAudio();
+ wxLogTrace(_T("sound"), _T("closed audio"));
+ m_audioOpen = false;
+ }
+}
+
+bool wxSoundBackendSDL::Play(wxSoundData *data, unsigned flags,
+ volatile wxSoundPlaybackStatus *WXUNUSED(status))