~ubuntu-dev/wxwidgets2.6/upstream-debian

« back to all changes in this revision

Viewing changes to contrib/include/wx/mmedia/sndg72x.h

  • Committer: Daniel T Chen
  • Date: 2006-06-26 10:15:11 UTC
  • Revision ID: crimsun@ubuntu.com-20060626101511-a4436cec4c6d9b35
ImportĀ DebianĀ 2.6.3.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// --------------------------------------------------------------------------
 
2
// Name: sndg72x.h
 
3
// Purpose:
 
4
// Date: 08/26/1999
 
5
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
 
6
// CVSID: $Id: sndg72x.h,v 1.3 2004/11/22 20:05:25 JS Exp $
 
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