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