]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/mmedia/sndmsad.h
mark slider as being transparent, otherwise it has ugly solid grey background when...
[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$
05aa8cf3 7// License: wxWindows license
e8482f24 8// --------------------------------------------------------------------------
c42b1de6
GL
9#ifndef _WX_SNDMSAD_H
10#define _WX_SNDMSAD_H
e8482f24
GL
11
12#ifdef __GNUG__
13#pragma interface "sndmsad.h"
14#endif
15
16#include "wx/defs.h"
17#include "wx/dynarray.h"
15e8daec 18#include "wx/mmedia/defs.h"
e8482f24
GL
19#include "wx/mmedia/sndcodec.h"
20#include "wx/mmedia/sndbase.h"
21
e53191be 22WX_DEFINE_EXPORTED_ARRAY_INT(wxInt16, wxMSAdpcmCoeffs);
e8482f24
GL
23
24//
25// MSADPCM format
26//
15e8daec 27class WXDLLIMPEXP_MMEDIA wxSoundFormatMSAdpcm: public wxSoundFormatBase {
c42b1de6
GL
28public:
29 wxSoundFormatMSAdpcm();
30 ~wxSoundFormatMSAdpcm();
31
32 void SetSampleRate(wxUint32 srate);
33 wxUint32 GetSampleRate() const;
34
35 void SetCoefs(wxInt16 **coefs, wxUint16 ncoefs, wxUint16 coefs_len);
36 void GetCoefs(wxInt16 **&coefs, wxUint16& ncoefs,
37 wxUint16& coefs_len) const;
e8482f24 38
c42b1de6
GL
39 void SetBlockSize(wxUint16 block_size);
40 wxUint16 GetBlockSize() const;
41
42 void SetChannels(wxUint16 channels);
43 wxUint16 GetChannels() const;
44
45 wxSoundFormatType GetType() const { return wxSOUND_MSADPCM; }
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;
e8482f24 52
c42b1de6
GL
53protected:
54 wxUint32 m_srate, m_nchannels;
55 wxInt16 **m_coefs;
56 wxUint16 m_ncoefs, m_coefs_len;
57 wxUint16 m_block_size;
e8482f24
GL
58};
59
60//
61// MS ADPCM converter class
62//
15e8daec
VS
63class WXDLLIMPEXP_MMEDIA wxSoundRouterStream;
64class WXDLLIMPEXP_MMEDIA wxSoundStreamMSAdpcm: public wxSoundStreamCodec {
e8482f24 65public:
c42b1de6
GL
66 wxSoundStreamMSAdpcm(wxSoundStream& sndio);
67 ~wxSoundStreamMSAdpcm();
e8482f24
GL
68
69 wxSoundStream& Read(void *buffer, wxUint32 len);
70 wxSoundStream& Write(const void *buffer, wxUint32 len);
71
72 bool SetSoundFormat(const wxSoundFormatBase& format);
73
74 wxUint32 GetBestSize() const;
75
76protected:
77 wxSoundRouterStream *m_router;
c42b1de6
GL
78
79 typedef struct {
80 wxInt32 predictor;
81 wxInt16 samp1;
82 wxInt16 samp2;
83 wxInt16 coeff[2];
84 wxInt32 iDelta;
85 } AdpcmState;
86
87 AdpcmState m_state[1];
88
89 bool m_got_header;
90 bool m_stereo;
91 wxInt16 **m_coefs;
92 wxUint16 m_block_size;
93 wxUint16 m_ncoefs;
94 wxUint16 m_next_block;
95
96protected:
97 wxUint32 DecodeMonoADPCM(const void *in_buffer, void *out_buffer,
98 wxUint32 in_len);
99 wxUint32 DecodeStereoADPCM(const void *in_buffer, void *out_buffer,
100 wxUint32 in_len);
101 void Nibble(wxInt8 nyb,
102 AdpcmState *state,
103 wxInt16 **out_buffer);
e8482f24
GL
104};
105
106#endif