]>
Commit | Line | Data |
---|---|---|
30726107 GL |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: sndfile.tex | |
3 | %% Purpose: wxMMedia docs | |
4 | %% Author: Guilhem Lavaux <lavaux@easynet.fr> | |
5 | %% Modified by: | |
6 | %% Created: 2000 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWindows team | |
9 | %% Licence: wxWindows licence | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
272c4453 GL |
11 | \section{\class{wxSoundFileStream}}\label{wxsoundfilestream} |
12 | ||
30726107 GL |
13 | Base class for file coders/decoders. This class is not constructor (it is an abstract |
14 | class). | |
272c4453 GL |
15 | |
16 | \wxheading{Derived from} | |
17 | ||
18 | \helpref{wxSoundStream}{wxsoundstream} | |
19 | ||
30726107 GL |
20 | \wxheading{Include file} |
21 | ||
22 | wx/sndfile.h | |
23 | ||
272c4453 GL |
24 | \wxheading{Data structures} |
25 | ||
26 | \latexignore{\rtfignore{\wxheading{Members}}} | |
27 | ||
272c4453 GL |
28 | \membersection{wxSoundFileStream::wxSoundFileStream}\label{wxsoundfilestreamwxsoundfilestream} |
29 | ||
30 | \func{}{wxSoundFileStream}{\param{wxInputStream\& }{stream}, \param{wxSoundStream\& }{io\_sound}} | |
31 | ||
30726107 GL |
32 | It constructs a new file decoder object which will send |
33 | audio data to the specified sound stream. | |
34 | The {\it stream} is the input stream to be decoded. The | |
35 | {\it io_sound} is the destination sound stream. | |
36 | Once it has been constructed, you cannot change any of | |
37 | the specified streams nor the direction of the stream. | |
38 | ||
39 | You will have access to the playback functions. | |
40 | ||
272c4453 GL |
41 | \func{}{wxSoundFileStream}{\param{wxOutputStream\& }{stream}, \param{wxSoundStream\& }{io\_sound}} |
42 | ||
30726107 GL |
43 | It constructs a new file coder object which will get |
44 | data to be recorded from the specified sound stream. | |
45 | The {\it stream} is the output wxStream. The {\it io_sound} | |
46 | is the source sound stream of the audio data. Once | |
47 | it has been constructed, you cannot change any of | |
48 | the specified streams nor the direction of the stream. | |
272c4453 | 49 | |
30726107 | 50 | \membersection{wxSoundFileStream::\destruct{wxSoundFileStream}}\label{wxsoundfilestreamdtor} |
272c4453 GL |
51 | \func{}{\destruct{wxSoundFileStream}}{\void} |
52 | ||
30726107 | 53 | It destroys the current sound file codec. |
272c4453 GL |
54 | |
55 | \membersection{wxSoundFileStream::Play}\label{wxsoundfilestreamplay} | |
272c4453 GL |
56 | \func{bool}{Play}{\void} |
57 | ||
30726107 GL |
58 | It starts playing the file. The playing begins, in background |
59 | in nearly all cases, after the return of the function. The | |
60 | codec returns to a {\bf stopped} state when it reaches the | |
61 | end of the file. | |
62 | On success, it returns TRUE. | |
272c4453 GL |
63 | |
64 | \membersection{wxSoundFileStream::Record}\label{wxsoundfilestreamrecord} | |
272c4453 GL |
65 | \func{bool}{Record}{\param{wxUint32 }{time}} |
66 | ||
30726107 GL |
67 | It starts recording data from the sound stream and writing them |
68 | to the output stream. You have to precise the recording length in | |
69 | parameter. This length is expressed in seconds. If you want to | |
70 | control the record length (using \helpref{Stop}{wxsoundfilestreamstop}), | |
71 | you can set it to wxSOUND_INFINITE_TIME. | |
272c4453 | 72 | |
30726107 | 73 | On success, it returns TRUE. |
272c4453 | 74 | |
30726107 | 75 | \membersection{wxSoundFileStream::Stop}\label{wxsoundfilestreamstop} |
272c4453 GL |
76 | \func{bool}{Stop}{\void} |
77 | ||
30726107 GL |
78 | It stops either recording or playing. Whatever happens (even unexpected |
79 | errors), the stream is stopped when the function returns. When you are | |
80 | in recording mode, the file headers are updated and flushed if possible | |
81 | (ie: if the output stream is seekable). | |
272c4453 | 82 | |
30726107 | 83 | On success, it returns TRUE. |
272c4453 | 84 | |
30726107 | 85 | \membersection{wxSoundFileStream::Pause}\label{wxsoundfilestreampause} |
272c4453 GL |
86 | \func{bool}{Pause}{\void} |
87 | ||
30726107 GL |
88 | The file codec tries to pause the stream: it means that it stops audio |
89 | production but keep the file pointer at the place. | |
272c4453 | 90 | |
30726107 | 91 | If the file codec is already paused, it returns FALSE. |
272c4453 | 92 | |
30726107 GL |
93 | On success, it returns TREE. |
94 | ||
95 | \membersection{wxSoundFileStream::Resume}\label{wxsoundfilestreamresume} | |
272c4453 GL |
96 | \func{bool}{Resume}{\void} |
97 | ||
30726107 GL |
98 | When the file codec has been paused using |
99 | \helpref{Pause}{wxsoundfilestreampause}, you could be interrested in | |
100 | resuming it. This is the goal of this function. | |
272c4453 GL |
101 | |
102 | \membersection{wxSoundFileStream::IsStopped}\label{wxsoundfilestreamisstopped} | |
272c4453 GL |
103 | \constfunc{bool}{IsStopped}{\void} |
104 | ||
272c4453 | 105 | \membersection{wxSoundFileStream::IsPaused}\label{wxsoundfilestreamispaused} |
272c4453 GL |
106 | \constfunc{bool}{IsPaused}{\void} |
107 | ||
272c4453 | 108 | \membersection{wxSoundFileStream::StartProduction}\label{wxsoundfilestreamstartproduction} |
272c4453 GL |
109 | \func{bool}{StartProduction}{\param{int }{evt}} |
110 | ||
111 | A user should not call these two functions. | |
112 | Several things must be done before calling them. | |
113 | Users should use Play(), ... | |
114 | ||
115 | ||
116 | \membersection{wxSoundFileStream::StopProduction}\label{wxsoundfilestreamstopproduction} | |
117 | ||
118 | \func{bool}{StopProduction}{\void} | |
119 | ||
120 | ||
121 | \membersection{wxSoundFileStream::GetLength}\label{wxsoundfilestreamgetlength} | |
122 | ||
123 | \func{wxUint32}{GetLength}{\void} | |
124 | ||
125 | These three functions deals with the length, the position in the sound file. | |
126 | All the values are expressed in bytes. If you need the values expressed | |
127 | in terms of time, you have to use GetSoundFormat().GetTimeFromBytes(...) | |
128 | ||
272c4453 GL |
129 | \membersection{wxSoundFileStream::GetPosition}\label{wxsoundfilestreamgetposition} |
130 | ||
131 | \func{wxUint32}{GetPosition}{\void} | |
132 | ||
133 | ||
134 | \membersection{wxSoundFileStream::SetPosition}\label{wxsoundfilestreamsetposition} | |
135 | ||
136 | \func{wxUint32}{SetPosition}{\param{wxUint32 }{new\_position}} | |
137 | ||
138 | ||
139 | \membersection{wxSoundFileStream::Read}\label{wxsoundfilestreamread} | |
140 | ||
141 | \func{wxSoundStream\&}{Read}{\param{void* }{buffer}, \param{wxUint32 }{len}} | |
142 | ||
143 | These two functions use the sound format specified by GetSoundFormat(). | |
144 | All samples must be encoded in that format. | |
145 | ||
146 | ||
147 | \membersection{wxSoundFileStream::Write}\label{wxsoundfilestreamwrite} | |
148 | ||
149 | \func{wxSoundStream\&}{Write}{\param{const void* }{buffer}, \param{wxUint32 }{len}} | |
150 | ||
151 | ||
152 | \membersection{wxSoundFileStream::SetSoundFormat}\label{wxsoundfilestreamsetsoundformat} | |
153 | ||
154 | \func{bool}{SetSoundFormat}{\param{const wxSoundFormatBase\& }{format}} | |
155 | ||
156 | This function set the sound format of the file. !! It must be used only | |
157 | when you are in output mode (concerning the file) !! If you are in | |
158 | input mode (concerning the file) you can't use this function to modify | |
159 | the format of the samples returned by Read() ! | |
160 | For this action, you must use wxSoundRouterStream applied to wxSoundFileStream. | |
161 | ||
162 | ||
163 | \membersection{wxSoundFileStream::GetCodecName}\label{wxsoundfilestreamgetcodecname} | |
164 | ||
165 | \constfunc{wxString}{GetCodecName}{\void} | |
166 | ||
167 | This function returns the Codec name. This is useful for those who want to build | |
168 | a player (But also in some other case). | |
169 | ||
170 | ||
171 | \membersection{wxSoundFileStream::CanRead}\label{wxsoundfilestreamcanread} | |
172 | ||
173 | \func{bool}{CanRead}{\void} | |
174 | ||
175 | You should use this function to test whether this file codec can read | |
176 | the stream you passed to it. | |
177 | ||
178 | ||
179 | \membersection{wxSoundFileStream::PrepareToPlay}\label{wxsoundfilestreampreparetoplay} | |
180 | ||
181 | \func{bool}{PrepareToPlay}{\void} | |
182 | ||
183 | ||
184 | \membersection{wxSoundFileStream::PrepareToRecord}\label{wxsoundfilestreampreparetorecord} | |
185 | ||
186 | \func{bool}{PrepareToRecord}{\param{wxUint32 }{time}} | |
187 | ||
188 | ||
189 | \membersection{wxSoundFileStream::FinishRecording}\label{wxsoundfilestreamfinishrecording} | |
190 | ||
191 | \func{bool}{FinishRecording}{\void} | |
192 | ||
193 | ||
194 | \membersection{wxSoundFileStream::RepositionStream}\label{wxsoundfilestreamrepositionstream} | |
195 | ||
196 | \func{bool}{RepositionStream}{\param{wxUint32 }{position}} | |
197 | ||
198 | ||
199 | \membersection{wxSoundFileStream::FinishPreparation}\label{wxsoundfilestreamfinishpreparation} | |
200 | ||
201 | \func{void}{FinishPreparation}{\param{wxUint32 }{len}} | |
202 | ||
203 | ||
204 | \membersection{wxSoundFileStream::GetData}\label{wxsoundfilestreamgetdata} | |
205 | ||
206 | \func{wxUint32}{GetData}{\param{void* }{buffer}, \param{wxUint32 }{len}} | |
207 | ||
208 | ||
209 | \membersection{wxSoundFileStream::PutData}\label{wxsoundfilestreamputdata} | |
210 | ||
211 | \func{wxUint32}{PutData}{\param{const void* }{buffer}, \param{wxUint32 }{len}} | |
212 | ||
213 | ||
214 | \membersection{wxSoundFileStream::OnSoundEvent}\label{wxsoundfilestreamonsoundevent} | |
215 | ||
216 | \func{void}{OnSoundEvent}{\param{int }{evt}} | |
217 |