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