1 // /////////////////////////////////////////////////////////////////////////////
4 // Author: Guilhem Lavaux
7 // Copyright: (C) 1997, 1998, Guilhem Lavaux
8 // License: wxWindows license
9 // /////////////////////////////////////////////////////////////////////////////
10 /* Real -*- C++ -*- */
11 #ifndef __SND_file_H__
12 #define __SND_file_H__
22 class wxSndFileCodec
: public wxMMediaFile
, public wxSndBuffer
{
24 DECLARE_ABSTRACT_CLASS(wxSndFileCodec
)
31 wxSFILE_PREPARED_TO_PLAY
,
32 wxSFILE_PREPARED_TO_RECORD
,
36 wxUint32 m_fsize
, m_fpos
, m_fdone
;
44 wxSndFileCodec(wxInputStream
& s
, bool preload
, bool seekable
);
46 wxSndFileCodec(wxOutputStream
& s
, bool seekable
);
48 wxSndFileCodec(const wxString
& fname
);
50 virtual ~wxSndFileCodec();
53 void Play(wxSound
& snd
);
55 void Stop(wxSound
& snd
);
57 void Record(wxSound
& snd
,
58 const wxSoundDataFormat
& format
, wxUint32 seconds
);
61 void OnNeedOutputData(char *data
, wxUint32
& size
);
63 void OnBufferInFinished(char *iobuf
, wxUint32
& size
);
66 virtual bool OnNeedData(char *buf
, wxUint32 size
) = 0;
68 virtual bool OnWriteData(char *buf
, wxUint32 size
) = 0;
70 virtual wxUint32
PrepareToPlay() = 0;
72 virtual bool PrepareToRecord(wxUint32 file_size
) = 0;
74 virtual bool TranslateBuffer(wxSndBuffer
& buf
);
76 virtual bool RestartBuffer(wxSndMode mode
);
78 virtual wxUint32
GetSize() const;
80 virtual wxUint32
Available() const;
82 virtual wxMMtime
GetLength();
85 wxMMtime
GetPosition();
88 virtual bool StartPlay();
90 virtual void StopPlay();