]>
Commit | Line | Data |
---|---|---|
4d6306eb GL |
1 | // ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sndfile.h | |
3 | // Purpose: wxMMedia | |
4 | // Author: Guilhem Lavaux | |
5 | // Created: 1997 | |
6 | // Updated: 1998 | |
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__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "mmfile.h" | |
19 | #include "sndsnd.h" | |
20 | ||
21 | /// | |
22 | class wxSndFileCodec : public wxMMediaFile, public wxSndBuffer { | |
23 | /// | |
24 | DECLARE_ABSTRACT_CLASS(wxSndFileCodec) | |
25 | public: | |
26 | ||
27 | typedef enum { | |
28 | wxSFILE_STOPPED, | |
29 | wxSFILE_PLAYING, | |
8a7c9dcc GL |
30 | wxSFILE_RECORDING, |
31 | wxSFILE_PREPARED_TO_PLAY, | |
32 | wxSFILE_PREPARED_TO_RECORD, | |
4d6306eb GL |
33 | } FileState; |
34 | ||
35 | protected: | |
36 | wxUint32 m_fsize, m_fpos, m_fdone; | |
37 | FileState m_fstate; | |
38 | wxMMtime m_sndtime; | |
39 | public: | |
40 | ||
41 | /// | |
42 | wxSndFileCodec(); | |
43 | /// | |
44 | wxSndFileCodec(wxInputStream& s, bool preload, bool seekable); | |
45 | /// | |
46 | wxSndFileCodec(wxOutputStream& s, bool seekable); | |
47 | /// | |
48 | wxSndFileCodec(const wxString& fname); | |
49 | /// | |
50 | virtual ~wxSndFileCodec(); | |
51 | ||
52 | /// | |
53 | void Play(wxSound& snd); | |
54 | /// | |
55 | void Stop(wxSound& snd); | |
56 | /// | |
57 | void Record(wxSound& snd, | |
58 | const wxSoundDataFormat& format, wxUint32 seconds); | |
59 | ||
60 | /// | |
61 | void OnNeedOutputData(char *data, wxUint32& size); | |
62 | /// | |
63 | void OnBufferInFinished(char *iobuf, wxUint32& size); | |
64 | ||
65 | /// | |
66 | virtual bool OnNeedData(char *buf, wxUint32 size) = 0; | |
67 | /// | |
68 | virtual bool OnWriteData(char *buf, wxUint32 size) = 0; | |
69 | /// | |
70 | virtual wxUint32 PrepareToPlay() = 0; | |
71 | /// | |
72 | virtual bool PrepareToRecord(wxUint32 file_size) = 0; | |
73 | /// | |
74 | virtual bool TranslateBuffer(wxSndBuffer& buf); | |
75 | /// | |
76 | virtual bool RestartBuffer(wxSndMode mode); | |
77 | /// | |
78 | virtual wxUint32 GetSize() const; | |
79 | /// | |
80 | virtual wxUint32 Available() const; | |
81 | /// | |
82 | virtual wxMMtime GetLength(); | |
83 | ||
84 | /// | |
85 | wxMMtime GetPosition(); | |
86 | ||
87 | /// | |
88 | virtual bool StartPlay(); | |
89 | /// | |
90 | virtual void StopPlay(); | |
91 | }; | |
92 | ||
93 | #endif |