]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia/sndwin.h
Corrections to Forty Thieves; wxMemoryDC problem temporarily sorted
[wxWidgets.git] / utils / wxMMedia / sndwin.h
1 // /////////////////////////////////////////////////////////////////////////////
2 // Name: sndwin.h
3 // Purpose: wxMMedia
4 // Author: Guilhem Lavaux
5 // Created: 1997
6 // Updated: 1998
7 // Copyright: (C) 1997, 1998, Guilhem Lavaux
8 // License: wxWindows license
9 // /////////////////////////////////////////////////////////////////////////////
10 /* Real -*- C++ -*- */
11 #ifndef __SND_win_H__
12 #define __SND_win_H__
13
14 #include "sndsnd.h"
15 #include "sndfrag.h"
16
17 #ifdef WXMMEDIA_INTERNAL
18 #include <wx/msw/private.h>
19 #include <windows.h>
20 #include <mmsystem.h>
21
22 typedef struct wxWinSoundInternal {
23 HWAVEOUT devout_id;
24 HWAVEIN devin_id;
25 HWND sndWin;
26 } wxWinSoundInternal;
27
28 typedef struct wxSndWinInfo {
29 HGLOBAL h_data, h_hdr;
30
31 char *data;
32 WAVEHDR *hdr;
33 } wxSndWinInfo;
34
35 #endif
36
37 /** Sound buffer fragmenter: windows specific implementation
38 * @author Guilhem Lavaux
39 */
40 class wxSndWinFragment : public wxFragmentBuffer {
41 public:
42 wxSndWinFragment(wxSound& io_drv);
43 virtual ~wxSndWinFragment(void);
44
45 virtual void AllocIOBuffer(void);
46 virtual void FreeIOBuffer(void);
47
48 virtual bool OnBufferFilled(wxFragBufPtr *ptr, wxSndMode mode);
49
50 void WaitForAll();
51 };
52
53 ///
54 class wxWinSound : public wxSound {
55 ///
56 DECLARE_DYNAMIC_CLASS(wxWinSound)
57 protected:
58 struct wxWinSoundInternal *internal;
59
60 ///
61 bool wout_opened, win_opened;
62 ///
63 wxUint32 curr_o_srate, curr_i_srate;
64 ///
65 wxUint8 curr_o_bps, curr_i_bps;
66 ///
67 bool curr_o_stereo, curr_i_stereo;
68 ///
69 wxSndMode curr_mode;
70
71 ///
72 wxSndWinFragment fragments;
73
74 #ifdef WXMMEDIA_INTERNAL
75 ///
76 friend LRESULT APIENTRY _EXPORT wxSoundHandlerWndProc(HWND win,
77 UINT message,
78 WPARAM wParam, LPARAM lParam);
79
80 #endif
81
82 public:
83 ///
84 wxWinSound(void);
85 ///
86 virtual ~wxWinSound(void);
87
88 ///
89 void OnNeedBuffer(wxSndMode mode);
90 ///
91 void StopBuffer(wxSndBuffer& buf);
92 protected:
93 ///
94 virtual bool Wakeup(wxSndBuffer& buf);
95
96 ///
97 bool Reopen(wxSndBuffer& buf, bool force);
98
99 ///
100 friend class wxSndWinFragment;
101
102 ///
103 void PrepareHeader(wxFragmentBuffer::wxFragBufPtr& frag, wxSndMode mode);
104 ///
105 void UnprepareHeader(wxFragmentBuffer::wxFragBufPtr& frag, wxSndMode mode);
106 };
107
108 #endif