]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/sound_sdl.cpp
Reflect changes in stc.cpp in stc.cpp.in from which it's generated.
[wxWidgets.git] / src / unix / sound_sdl.cpp
index 972ebd11e4772417828c6e18017fcd3ce3e54ca7..0fc4ebf3ff807c8d9870eddd85ecf4252836eb6e 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Vaclav Slavik
 // Modified by:
 // Created:     2004/01/31
 // Author:      Vaclav Slavik
 // Modified by:
 // Created:     2004/01/31
-// RCS-ID:      $Id$
 // Copyright:   (c) 2004, Open Source Applications Foundation
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) 2004, Open Source Applications Foundation
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -46,19 +45,17 @@ public:
 typedef void (wxEvtHandler::*wxSoundBackendSDLNotificationFunction)
              (wxSoundBackendSDLNotification&);
 
 typedef void (wxEvtHandler::*wxSoundBackendSDLNotificationFunction)
              (wxSoundBackendSDLNotification&);
 
-BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, -1)
-END_DECLARE_EVENT_TYPES()
+wxDECLARE_EVENT(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotification);
 
 #define EVT_SOUND_BACKEND_SDL_NOTIFICATON(func) \
     DECLARE_EVENT_TABLE_ENTRY(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, \
                               -1,                       \
                               -1,                       \
 
 #define EVT_SOUND_BACKEND_SDL_NOTIFICATON(func) \
     DECLARE_EVENT_TABLE_ENTRY(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, \
                               -1,                       \
                               -1,                       \
-                              (wxObjectEventFunction)  wxStaticCastEvent( wxSoundBackendSDLNotificationFunction, & func ), \
-                              (wxObject *) NULL ),
+                              wxEVENT_HANDLER_CAST( wxSoundBackendSDLNotificationFunction, func ), \
+                              NULL ),
 
 IMPLEMENT_DYNAMIC_CLASS(wxSoundBackendSDLNotification, wxEvtHandler)
 
 IMPLEMENT_DYNAMIC_CLASS(wxSoundBackendSDLNotification, wxEvtHandler)
-DEFINE_EVENT_TYPE(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION)
+wxDEFINE_EVENT( wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotification );
 
 wxSoundBackendSDLNotification::wxSoundBackendSDLNotification()
 {
 
 wxSoundBackendSDLNotification::wxSoundBackendSDLNotification()
 {
@@ -75,7 +72,7 @@ public:
           m_data(NULL), m_evtHandler(NULL) {}
     virtual ~wxSoundBackendSDL();
 
           m_data(NULL), m_evtHandler(NULL) {}
     virtual ~wxSoundBackendSDL();
 
-    wxString GetName() const { return _T("Simple DirectMedia Layer"); }
+    wxString GetName() const { return wxT("Simple DirectMedia Layer"); }
     int GetPriority() const { return 9; }
     bool IsAvailable() const;
     bool HasNativeAsyncPlayback() const { return true; }
     int GetPriority() const { return 9; }
     bool IsAvailable() const;
     bool HasNativeAsyncPlayback() const { return true; }
@@ -111,8 +108,8 @@ public:
 private:
     void OnNotify(wxSoundBackendSDLNotification& WXUNUSED(event))
     {
 private:
     void OnNotify(wxSoundBackendSDLNotification& WXUNUSED(event))
     {
-        wxLogTrace(_T("sound"),
-                   _T("received playback status change notification"));
+        wxLogTrace(wxT("sound"),
+                   wxT("received playback status change notification"));
         m_backend->FinishedPlayback();
     }
     wxSoundBackendSDL *m_backend;
         m_backend->FinishedPlayback();
     }
     wxSoundBackendSDL *m_backend;
@@ -141,7 +138,7 @@ bool wxSoundBackendSDL::IsAvailable() const
             return false;
     }
     wxConstCast(this, wxSoundBackendSDL)->m_initialized = true;
             return false;
     }
     wxConstCast(this, wxSoundBackendSDL)->m_initialized = true;
-    wxLogTrace(_T("sound"), _T("initialized SDL audio subsystem"));
+    wxLogTrace(wxT("sound"), wxT("initialized SDL audio subsystem"));
     return true;
 }
 
     return true;
 }
 
@@ -210,13 +207,17 @@ bool wxSoundBackendSDL::OpenAudio()
         m_spec.callback = wx_sdl_audio_callback;
         m_spec.userdata = (void*)this;
 
         m_spec.callback = wx_sdl_audio_callback;
         m_spec.userdata = (void*)this;
 
-        wxLogTrace(_T("sound"), _T("opening SDL audio..."));
+        wxLogTrace(wxT("sound"), wxT("opening SDL audio..."));
         if (SDL_OpenAudio(&m_spec, NULL) >= 0)
         {
 #if wxUSE_LOG_DEBUG
             char driver[256];
         if (SDL_OpenAudio(&m_spec, NULL) >= 0)
         {
 #if wxUSE_LOG_DEBUG
             char driver[256];
+#if SDL_MAJOR_VERSION == 1
             SDL_AudioDriverName(driver, 256);
             SDL_AudioDriverName(driver, 256);
-            wxLogTrace(_T("sound"), _T("opened audio, driver '%s'"),
+#elif SDL_MAJOR_VERSION > 1            
+            strncpy(driver, SDL_GetCurrentAudioDriver(), 256);
+#endif
+            wxLogTrace(wxT("sound"), wxT("opened audio, driver '%s'"),
                        wxString(driver, wxConvLocal).c_str());
 #endif
             m_audioOpen = true;
                        wxString(driver, wxConvLocal).c_str());
 #endif
             m_audioOpen = true;
@@ -237,7 +238,7 @@ void wxSoundBackendSDL::CloseAudio()
     if (m_audioOpen)
     {
         SDL_CloseAudio();
     if (m_audioOpen)
     {
         SDL_CloseAudio();
-        wxLogTrace(_T("sound"), _T("closed audio"));
+        wxLogTrace(wxT("sound"), wxT("closed audio"));
         m_audioOpen = false;
     }
 }
         m_audioOpen = false;
     }
 }
@@ -280,7 +281,7 @@ bool wxSoundBackendSDL::Play(wxSoundData *data, unsigned flags,
     }
 
     SDL_LockAudio();
     }
 
     SDL_LockAudio();
-    wxLogTrace(_T("sound"), _T("playing new sound"));
+    wxLogTrace(wxT("sound"), wxT("playing new sound"));
     m_playing = true;
     m_pos = 0;
     m_loop = (flags & wxSOUND_LOOP);
     m_playing = true;
     m_pos = 0;
     m_loop = (flags & wxSOUND_LOOP);
@@ -293,7 +294,7 @@ bool wxSoundBackendSDL::Play(wxSoundData *data, unsigned flags,
     // wait until playback finishes if called in sync mode:
     if (!(flags & wxSOUND_ASYNC))
     {
     // wait until playback finishes if called in sync mode:
     if (!(flags & wxSOUND_ASYNC))
     {
-        wxLogTrace(_T("sound"), _T("waiting for sample to finish"));
+        wxLogTrace(wxT("sound"), wxT("waiting for sample to finish"));
         while (m_playing && m_data == data)
         {
 #if wxUSE_THREADS
         while (m_playing && m_data == data)
         {
 #if wxUSE_THREADS
@@ -308,7 +309,7 @@ bool wxSoundBackendSDL::Play(wxSoundData *data, unsigned flags,
                 wxMutexGuiEnter();
 #endif
         }
                 wxMutexGuiEnter();
 #endif
         }
-        wxLogTrace(_T("sound"), _T("sample finished"));
+        wxLogTrace(wxT("sound"), wxT("sample finished"));
     }
 
     return true;
     }
 
     return true;