]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia/sndfile.h
Added test for sprintf and vsnprintf to fix string.cpp for non-GNU systems.
[wxWidgets.git] / utils / wxMMedia / sndfile.h
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,
30 wxSFILE_RECORDING
31 } FileState;
32
33 protected:
34 wxUint32 m_fsize, m_fpos, m_fdone;
35 FileState m_fstate;
36 wxMMtime m_sndtime;
37 public:
38
39 ///
40 wxSndFileCodec();
41 ///
42 wxSndFileCodec(wxInputStream& s, bool preload, bool seekable);
43 ///
44 wxSndFileCodec(wxOutputStream& s, bool seekable);
45 ///
46 wxSndFileCodec(const wxString& fname);
47 ///
48 virtual ~wxSndFileCodec();
49
50 ///
51 void Play(wxSound& snd);
52 ///
53 void Stop(wxSound& snd);
54 ///
55 void Record(wxSound& snd,
56 const wxSoundDataFormat& format, wxUint32 seconds);
57
58 ///
59 void OnNeedOutputData(char *data, wxUint32& size);
60 ///
61 void OnBufferInFinished(char *iobuf, wxUint32& size);
62
63 ///
64 virtual bool OnNeedData(char *buf, wxUint32 size) = 0;
65 ///
66 virtual bool OnWriteData(char *buf, wxUint32 size) = 0;
67 ///
68 virtual wxUint32 PrepareToPlay() = 0;
69 ///
70 virtual bool PrepareToRecord(wxUint32 file_size) = 0;
71 ///
72 virtual bool TranslateBuffer(wxSndBuffer& buf);
73 ///
74 virtual bool RestartBuffer(wxSndMode mode);
75 ///
76 virtual wxUint32 GetSize() const;
77 ///
78 virtual wxUint32 Available() const;
79 ///
80 virtual wxMMtime GetLength();
81
82 ///
83 wxMMtime GetPosition();
84
85 ///
86 virtual bool StartPlay();
87 ///
88 virtual void StopPlay();
89 };
90
91 #endif