X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e8482f24cfc00645607f8526fde38d39e0dcaa63..a333f34d91ae845d39ca8a833290e9a1c3d04749:/contrib/src/mmedia/sndwin.cpp diff --git a/contrib/src/mmedia/sndwin.cpp b/contrib/src/mmedia/sndwin.cpp index c2776d9438..ea2cbe2b69 100644 --- a/contrib/src/mmedia/sndwin.cpp +++ b/contrib/src/mmedia/sndwin.cpp @@ -16,11 +16,12 @@ #ifndef WX_PRECOMP #include "wx/defs.h" #include "wx/app.h" - #include "wx/module.h" - #include "wx/msw/private.h" #include "wx/string.h" #endif +#include "wx/module.h" +#include "wx/msw/private.h" + // ------------------------------------------------------------------------- // MMedia headers // ------------------------------------------------------------------------- @@ -52,7 +53,7 @@ static inline wxSoundStreamWin *wxFindSoundFromHandle(WXHWND hWnd) wxNode *node = wxSoundHandleList->Find((long)hWnd); if (!node) return NULL; - return (wxSoundStreamWin *)node->Data(); + return (wxSoundStreamWin *)node->GetData(); } struct _wxSoundInternal { @@ -97,8 +98,11 @@ wxSoundStreamWin::wxSoundStreamWin() m_waiting_for = FALSE; - if (!OpenDevice(wxSOUND_OUTPUT)) - return; + if (!OpenDevice(wxSOUND_OUTPUT)) { + m_snderror = wxSOUND_NOERROR; //next call to OpenDevice won't do this + if (!OpenDevice(wxSOUND_INPUT)) + return; + } CloseDevice(); } @@ -117,8 +121,10 @@ wxSoundStreamWin::~wxSoundStreamWin() // ----------------------------------------------------------------------- // _wxSoundHandlerWndProc: Window callback to handle buffer completion // ----------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT _wxSoundHandlerWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam) +LRESULT APIENTRY _EXPORT + + _wxSoundHandlerWndProc(HWND hWnd, UINT message, + WPARAM wParam, LPARAM WXUNUSED(lParam)) { wxSoundStreamWin *sndwin; @@ -148,13 +154,13 @@ void wxSoundStreamWin::CreateSndWindow() { FARPROC proc = MakeProcInstance((FARPROC)_wxSoundHandlerWndProc, wxGetInstance()); - int error; - - m_internal->m_sndWin = ::CreateWindow(wxCanvasClassName, NULL, 0, + // NB: class name must be kept in sync with wxCanvasClassName in + // src/msw/app.cpp! + m_internal->m_sndWin = ::CreateWindow(wxT("wxWindowClass"), NULL, 0, 0, 0, 0, 0, NULL, (HMENU) NULL, wxGetInstance(), NULL); - error = GetLastError(); + GetLastError(); ::SetWindowLong(m_internal->m_sndWin, GWL_WNDPROC, (LONG)proc); @@ -307,7 +313,7 @@ wxSoundInfoHeader *wxSoundStreamWin::AllocHeader(int mode) info->m_h_header = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(WAVEHDR)); if (!info->m_h_data || !info->m_h_header) { delete info; - m_snderror = wxSOUND_MEMERR; + m_snderror = wxSOUND_MEMERROR; return NULL; } @@ -653,7 +659,7 @@ wxSoundStream& wxSoundStreamWin::Read(void *buffer, wxUint32 len) // fragment finished. It reinitializes the parameters of the fragment and // sends an event to the clients. // ------------------------------------------------------------------------- -void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 dev_handle, int flag) +void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 WXUNUSED(dev_handle), int flag) { wxSoundInfoHeader *info; @@ -687,7 +693,7 @@ void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 dev_handle, int flag) // ------------------------------------------------------------------------- // SetSoundFormat() // ------------------------------------------------------------------------- -bool wxSoundStreamWin::SetSoundFormat(wxSoundFormatBase& base) +bool wxSoundStreamWin::SetSoundFormat(const wxSoundFormatBase& base) { // TODO: detect best format return wxSoundStream::SetSoundFormat(base); @@ -754,7 +760,7 @@ bool wxSoundStreamWin::QueueFilled() const // wxSoundWinModule // -------------------------------------------------------------------------- -class WXDLLEXPORT wxSoundWinModule : public wxModule { +class wxSoundWinModule : public wxModule { DECLARE_DYNAMIC_CLASS(wxSoundWinModule) public: bool OnInit();