]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/mmedia/sndg72x.h
generate makefile.unx files using bakefile
[wxWidgets.git] / contrib / include / wx / mmedia / sndg72x.h
1 // --------------------------------------------------------------------------
2 // Name: sndg72x.h
3 // Purpose:
4 // Date: 08/26/1999
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6 // CVSID: $Id$
7 // License: wxWindows license
8 // --------------------------------------------------------------------------
9 #ifndef _WX_SNDG72X_H
10 #define _WX_SNDG72X_H
11
12 #include "wx/defs.h"
13 #include "wx/mmedia/defs.h"
14 #include "wx/mmedia/sndbase.h"
15 #include "wx/mmedia/sndcodec.h"
16 #include "wx/mmedia/sndbase.h"
17
18 typedef enum {
19 wxSOUND_G721,
20 wxSOUND_G723_24,
21 wxSOUND_G723_40
22 } wxSoundG72XType;
23
24 // This fixes a bug in Mingw95
25 typedef struct g72x_state g72state;
26
27 //
28 // G72X format
29 //
30 class WXDLLIMPEXP_MMEDIA wxSoundFormatG72X: public wxSoundFormatBase {
31 public:
32 wxSoundFormatG72X();
33 ~wxSoundFormatG72X();
34
35 void SetG72XType(wxSoundG72XType type);
36 wxSoundG72XType GetG72XType() const { return m_g72x_type; }
37
38 void SetSampleRate(wxUint32 srate);
39 wxUint32 GetSampleRate() const;
40
41 wxSoundFormatType GetType() const { return wxSOUND_G72X; }
42 wxSoundFormatBase *Clone() const;
43
44 wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
45 wxUint32 GetBytesFromTime(wxUint32 time) const;
46
47 bool operator !=(const wxSoundFormatBase& frmt2) const;
48
49 protected:
50 wxUint32 m_srate;
51 wxSoundG72XType m_g72x_type;
52 };
53
54 //
55 // ULAW converter class
56 //
57
58 class WXDLLIMPEXP_MMEDIA wxSoundRouterStream;
59 class WXDLLIMPEXP_MMEDIA wxSoundStreamG72X: public wxSoundStreamCodec {
60 public:
61 wxSoundStreamG72X(wxSoundStream& sndio);
62 ~wxSoundStreamG72X();
63
64 wxSoundStream& Read(void *buffer, wxUint32 len);
65 wxSoundStream& Write(const void *buffer, wxUint32 len);
66
67 bool SetSoundFormat(const wxSoundFormatBase& format);
68
69 protected:
70 wxSoundRouterStream *m_router;
71 wxUint8 m_n_bits, m_current_mask, m_current_b_pos, m_current_byte;
72 wxUint8 *m_io_buffer;
73 g72state *m_state;
74
75 int (*m_coder)(int code, int in_code, struct g72x_state *state);
76 int (*m_decoder)(int code, int out_code, struct g72x_state *state);
77
78 protected:
79 void PutBits(wxUint8 bits);
80 wxUint8 GetBits();
81 };
82
83 #endif