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