Added wxSound for Windows support (successful WAV playback on VC++ 5)
[wxWidgets.git] / utils / wxMMedia2 / lib / sndwin.h
1 // --------------------------------------------------------------------------
2 // Name: sndwin.h
3 // Purpose:
4 // Date: 08/11/1999
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6 // CVSID: $Id$
7 // --------------------------------------------------------------------------
8 #ifndef _WX_SNDWIN_H
9 #define _WX_SNDWIN_H
10
11 #include <wx/wxprec.h>
12 #include "sndbase.h"
13
14 typedef struct _wxSoundInternal wxSoundInternal;
15 typedef struct _wxSoundInfoHeader wxSoundInfoHeader;
16
17 class WXDLLEXPORT wxSoundStreamWin : public wxSoundStream {
18 public:
19 wxSoundStreamWin();
20 ~wxSoundStreamWin();
21
22 wxSoundStream& Write(const void *buffer, size_t len);
23 wxSoundStream& Read(void *buffer, size_t len);
24
25 bool SetSoundFormat(wxSoundFormatBase& base);
26 void SetDuplexMode(bool on) {}
27
28 bool StartProduction(int evt);
29 bool StopProduction();
30
31 bool QueueFilled() const;
32
33 // Internal but defined as public
34 void NotifyDoneBuffer(wxUint32 dev_handle);
35
36 protected:
37 wxSoundInternal *m_internal;
38 wxUint32 m_current_frag_in, m_current_frag_out;
39 wxUint32 m_input_frag_in, m_output_frag_out;
40 wxSoundInfoHeader **m_headers_play, **m_headers_rec;
41
42 bool m_production_started, m_queue_filled;
43
44 protected:
45 void CreateSndWindow();
46 void DestroySndWindow();
47 bool OpenDevice(int mode);
48 void CloseDevice();
49
50 wxSoundInfoHeader *AllocHeader(int mode);
51 void FreeHeader(wxSoundInfoHeader *header, int mode);
52 bool AllocHeaders(int mode);
53 void FreeHeaders(int mode);
54
55 void WaitFor(wxSoundInfoHeader *info);
56 bool AddToQueue(wxSoundInfoHeader *info);
57 void ClearHeader(wxSoundInfoHeader *info);
58
59 wxSoundInfoHeader *NextFragmentOutput();
60 wxSoundInfoHeader *NextFragmentInput();
61 };
62
63 #endif