]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/mmedia/sndmsad.h
Compilation fixes
[wxWidgets.git] / contrib / include / wx / mmedia / sndmsad.h
CommitLineData
e8482f24
GL
1// --------------------------------------------------------------------------
2// Name: sndmsad(pcm).h
3// Purpose: MS ADPCM codec
4// Date: 25/02/2000
5// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 2000
6// CVSID: $Id$
7// --------------------------------------------------------------------------
c42b1de6
GL
8#ifndef _WX_SNDMSAD_H
9#define _WX_SNDMSAD_H
e8482f24
GL
10
11#ifdef __GNUG__
12#pragma interface "sndmsad.h"
13#endif
14
15#include "wx/defs.h"
16#include "wx/dynarray.h"
15e8daec 17#include "wx/mmedia/defs.h"
e8482f24
GL
18#include "wx/mmedia/sndcodec.h"
19#include "wx/mmedia/sndbase.h"
20
e53191be 21WX_DEFINE_EXPORTED_ARRAY_INT(wxInt16, wxMSAdpcmCoeffs);
e8482f24
GL
22
23//
24// MSADPCM format
25//
15e8daec 26class WXDLLIMPEXP_MMEDIA wxSoundFormatMSAdpcm: public wxSoundFormatBase {
c42b1de6
GL
27public:
28 wxSoundFormatMSAdpcm();
29 ~wxSoundFormatMSAdpcm();
30
31 void SetSampleRate(wxUint32 srate);
32 wxUint32 GetSampleRate() const;
33
34 void SetCoefs(wxInt16 **coefs, wxUint16 ncoefs, wxUint16 coefs_len);
35 void GetCoefs(wxInt16 **&coefs, wxUint16& ncoefs,
36 wxUint16& coefs_len) const;
e8482f24 37
c42b1de6
GL
38 void SetBlockSize(wxUint16 block_size);
39 wxUint16 GetBlockSize() const;
40
41 void SetChannels(wxUint16 channels);
42 wxUint16 GetChannels() const;
43
44 wxSoundFormatType GetType() const { return wxSOUND_MSADPCM; }
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;
e8482f24 51
c42b1de6
GL
52protected:
53 wxUint32 m_srate, m_nchannels;
54 wxInt16 **m_coefs;
55 wxUint16 m_ncoefs, m_coefs_len;
56 wxUint16 m_block_size;
e8482f24
GL
57};
58
59//
60// MS ADPCM converter class
61//
15e8daec
VS
62class WXDLLIMPEXP_MMEDIA wxSoundRouterStream;
63class WXDLLIMPEXP_MMEDIA wxSoundStreamMSAdpcm: public wxSoundStreamCodec {
e8482f24 64public:
c42b1de6
GL
65 wxSoundStreamMSAdpcm(wxSoundStream& sndio);
66 ~wxSoundStreamMSAdpcm();
e8482f24
GL
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 wxUint32 GetBestSize() const;
74
75protected:
76 wxSoundRouterStream *m_router;
c42b1de6
GL
77
78 typedef struct {
79 wxInt32 predictor;
80 wxInt16 samp1;
81 wxInt16 samp2;
82 wxInt16 coeff[2];
83 wxInt32 iDelta;
84 } AdpcmState;
85
86 AdpcmState m_state[1];
87
88 bool m_got_header;
89 bool m_stereo;
90 wxInt16 **m_coefs;
91 wxUint16 m_block_size;
92 wxUint16 m_ncoefs;
93 wxUint16 m_next_block;
94
95protected:
96 wxUint32 DecodeMonoADPCM(const void *in_buffer, void *out_buffer,
97 wxUint32 in_len);
98 wxUint32 DecodeStereoADPCM(const void *in_buffer, void *out_buffer,
99 wxUint32 in_len);
100 void Nibble(wxInt8 nyb,
101 AdpcmState *state,
102 wxInt16 **out_buffer);
e8482f24
GL
103};
104
105#endif