Diffstat (limited to 'core/multimedia/opieplayer/wavplugin/wavplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.cpp | 424 |
1 files changed, 135 insertions, 289 deletions
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp index 0be667f..7ac63c0 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp | |||
@@ -14,12 +14,14 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #include <stdio.h> | 22 | #include <stdio.h> |
21 | #include <stdarg.h> | 23 | #include <stdarg.h> |
22 | #include <stdlib.h> | 24 | #include <stdlib.h> |
23 | #include <errno.h> | 25 | #include <errno.h> |
24 | #include <unistd.h> | 26 | #include <unistd.h> |
25 | #include <qfile.h> | 27 | #include <qfile.h> |
@@ -43,13 +45,13 @@ struct ChunkData { | |||
43 | Q_INT32 avgBytesPerSec; | 45 | Q_INT32 avgBytesPerSec; |
44 | Q_INT16 blockAlign; | 46 | Q_INT16 blockAlign; |
45 | Q_INT16 wBitsPerSample; | 47 | Q_INT16 wBitsPerSample; |
46 | }; | 48 | }; |
47 | 49 | ||
48 | 50 | ||
49 | const int sound_buffer_size = 4096; | 51 | const int sound_buffer_size = 512; // 4096; // you got to be kidding right? |
50 | 52 | ||
51 | 53 | ||
52 | class WavPluginData { | 54 | class WavPluginData { |
53 | public: | 55 | public: |
54 | QFile *input; | 56 | QFile *input; |
55 | 57 | ||
@@ -57,299 +59,140 @@ public: | |||
57 | ChunkData chunkdata; | 59 | ChunkData chunkdata; |
58 | RiffChunk chunk; | 60 | RiffChunk chunk; |
59 | uchar data[sound_buffer_size+32]; // +32 to handle badly aligned input data | 61 | uchar data[sound_buffer_size+32]; // +32 to handle badly aligned input data |
60 | int out,max; | 62 | int out,max; |
61 | int samples_due; | 63 | int samples_due; |
62 | int samples; | 64 | int samples; |
63 | int freq; | 65 | |
64 | int chan; | ||
65 | int sampleRate; | ||
66 | int resolution; | ||
67 | |||
68 | WavPluginData() { | 66 | WavPluginData() { |
69 | max = out = sound_buffer_size; | 67 | max = out = sound_buffer_size; |
70 | wavedata_remaining = 0; | 68 | wavedata_remaining = 0; |
71 | samples_due = 0; | 69 | samples_due = 0; |
72 | samples = -1; | 70 | samples = -1; |
73 | } | 71 | } |
74 | 72 | ||
75 | // expands out samples to the frequency of 44kHz | 73 | // expands out samples to the frequency of 44kHz |
76 | bool add( short *output, long count, long& done, bool stereo ) | 74 | bool add( short *output, long count, long& done, bool stereo ) |
77 | { | 75 | { |
78 | qDebug("add"); | 76 | done = 0; |
79 | done = 0; | 77 | qApp->processEvents(); |
80 | 78 | ||
81 | if ( input == 0 ) { | 79 | if ( input == 0 ) { |
82 | qDebug("no input"); | 80 | qDebug("no input"); |
81 | return FALSE; | ||
82 | } | ||
83 | |||
84 | while ( count ) { | ||
85 | int l,r; | ||
86 | if ( getSample(l, r) == FALSE ) { | ||
87 | qDebug("didn't get sample"); | ||
83 | return FALSE; | 88 | return FALSE; |
84 | } | 89 | } |
85 | 90 | samples_due += chunkdata.samplesPerSec; | |
86 | while ( count ) { | 91 | while ( count && (samples_due > chunkdata.samplesPerSec) ) { |
87 | int l,r; | 92 | *output++ = l; |
88 | if ( getSample(l, r) == FALSE ) { | 93 | if ( stereo ) |
89 | qDebug("didn't get sample"); | 94 | *output++ = r; |
90 | return FALSE; | 95 | samples_due -= chunkdata.samplesPerSec; |
91 | } | 96 | count--; |
92 | samples_due += 44100; | 97 | done++; |
93 | while ( count && (samples_due > chunkdata.samplesPerSec) ) { | ||
94 | *output++ = l; | ||
95 | if ( stereo ) | ||
96 | *output++ = r; | ||
97 | samples_due -= chunkdata.samplesPerSec; | ||
98 | count--; | ||
99 | done++; | ||
100 | } | ||
101 | } | 98 | } |
102 | |||
103 | return TRUE; | ||
104 | } | 99 | } |
100 | return TRUE; | ||
101 | } | ||
105 | 102 | ||
106 | bool initialise() { | 103 | bool initialise() { |
107 | qDebug("initialize"); | 104 | if ( input == 0 ) |
108 | if ( input == 0 ) | 105 | return FALSE; |
109 | return FALSE; | ||
110 | |||
111 | wavedata_remaining = -1; | ||
112 | |||
113 | while ( wavedata_remaining == -1 ) { | ||
114 | // Keep reading chunks... | ||
115 | const int n = sizeof(chunk) - sizeof(chunk.data); | ||
116 | int t = input->readBlock( (char*)&chunk, n ); | ||
117 | if ( t != n ) { | ||
118 | if ( t == -1 ) | ||
119 | return FALSE; | ||
120 | return TRUE; | ||
121 | } | ||
122 | if ( qstrncmp(chunk.id,"data",4) == 0 ) { | ||
123 | samples = wavedata_remaining = chunk.size; | ||
124 | } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { | ||
125 | char d[4]; | ||
126 | if ( input->readBlock(d,4) != 4 ) { | ||
127 | return FALSE; | ||
128 | } | ||
129 | if ( qstrncmp(d,"WAVE",4) != 0 ) { | ||
130 | // skip | ||
131 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size-4) ) { | ||
132 | return FALSE; | ||
133 | } | ||
134 | } | ||
135 | } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { | ||
136 | if ( input->readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) { | ||
137 | return FALSE; | ||
138 | } | ||
139 | #define WAVE_FORMAT_PCM 1 | ||
140 | if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { | ||
141 | qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); | ||
142 | return FALSE; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | 106 | ||
107 | wavedata_remaining = -1; | ||
147 | 108 | ||
148 | 109 | while ( wavedata_remaining == -1 ) { | |
149 | else { | 110 | // Keep reading chunks... |
150 | // ignored chunk | 111 | const int n = sizeof(chunk) - sizeof(chunk.data); |
151 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size) ) { | 112 | int t = input->readBlock( (char*)&chunk, n ); |
152 | return FALSE; | 113 | if ( t != n ) { |
153 | } | 114 | if ( t == -1 ) |
154 | } | 115 | return FALSE; |
155 | } // while | 116 | return TRUE; |
156 | 117 | } | |
157 | return TRUE; | 118 | if ( qstrncmp(chunk.id,"data",4) == 0 ) { |
119 | samples = wavedata_remaining = chunk.size; | ||
120 | } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { | ||
121 | char d[4]; | ||
122 | if ( input->readBlock(d,4) != 4 ) { | ||
123 | return FALSE; | ||
124 | } | ||
125 | if ( qstrncmp(d,"WAVE",4) != 0 ) { | ||
126 | // skip | ||
127 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size-4) ) { | ||
128 | return FALSE; | ||
129 | } | ||
130 | } | ||
131 | } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { | ||
132 | if ( input->readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) { | ||
133 | return FALSE; | ||
134 | } | ||
135 | #define WAVE_FORMAT_PCM 1 | ||
136 | if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { | ||
137 | qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); | ||
138 | return FALSE; | ||
139 | } | ||
140 | } else { | ||
141 | // ignored chunk | ||
142 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size) ) { | ||
143 | return FALSE; | ||
144 | } | ||
145 | } | ||
146 | } // while | ||
147 | qDebug("bits %d", chunkdata.wBitsPerSample); | ||
148 | return TRUE; | ||
158 | } | 149 | } |
159 | 150 | ||
160 | 151 | ||
161 | // gets a sample from the file | 152 | // gets a sample from the file |
162 | bool getSample(int& l, int& r) | 153 | bool getSample(int& l, int& r) |
163 | { | 154 | { |
164 | l = r = 0; | 155 | l = r = 0; |
165 | |||
166 | if ( input == 0 ) | ||
167 | return FALSE; | ||
168 | 156 | ||
169 | if ( (wavedata_remaining < 0) || !max ) | 157 | if ( input == 0 ) |
170 | return FALSE; | 158 | return FALSE; |
171 | |||
172 | if ( out >= max ) { | ||
173 | max = input->readBlock( (char*)data, (uint)QMIN(sound_buffer_size,wavedata_remaining) ); | ||
174 | 159 | ||
175 | wavedata_remaining -= max; | 160 | if ( (wavedata_remaining < 0) || !max ) |
176 | 161 | return FALSE; | |
177 | out = 0; | ||
178 | if ( max <= 0 ) { | ||
179 | max = 0; | ||
180 | return TRUE; | ||
181 | } | ||
182 | } | ||
183 | if ( resolution == 8 ) { | ||
184 | l = (data[out++] - 128) * 128; | ||
185 | } else { | ||
186 | l = ((short*)data)[out/2]; | ||
187 | out += 2; | ||
188 | } | ||
189 | if ( chan == 1 ) { | ||
190 | r = l; | ||
191 | } else { | ||
192 | if ( resolution == 8 ) { | ||
193 | r = (data[out++] - 128) * 128; | ||
194 | } else { | ||
195 | r = ((short*)data)[out/2]; | ||
196 | out += 2; | ||
197 | } | ||
198 | } | ||
199 | return TRUE; | ||
200 | } // getSample | ||
201 | |||
202 | ////////////////////////////////////////////////////// | ||
203 | int getWavSettings(int fd) | ||
204 | { //this came from wmrecord | ||
205 | |||
206 | char t1[4]; | ||
207 | unsigned long l1; | ||
208 | int found; | ||
209 | short fmt; | ||
210 | unsigned short ch, brate; | ||
211 | unsigned long srate; | ||
212 | |||
213 | |||
214 | /* First read in the RIFF identifier. If this is missing then the | ||
215 | * file is not a valid WAVE file. | ||
216 | */ | ||
217 | if (read(fd, t1, 4)<4) { | ||
218 | qDebug(" Could not read from sound file.\n"); | ||
219 | return -1; | ||
220 | } | ||
221 | if (strncmp(t1, "RIFF", 4)) { | ||
222 | qDebug(" not a valid WAV file.\n"); | ||
223 | return -1; | ||
224 | } | ||
225 | /* Advance the file pointer to the next relevant field. */ | ||
226 | lseek(fd, 4, SEEK_CUR); | ||
227 | /* Read in the WAVE identifier. */ | ||
228 | if (read(fd, t1, 4)<4) { | ||
229 | qDebug("Could not read from sound file.\n"); | ||
230 | return -1; | ||
231 | } | ||
232 | if (strncmp(t1, "WAVE", 4)) { | ||
233 | qDebug("not a valid WAV file.\n"); | ||
234 | return -1; | ||
235 | } | ||
236 | 162 | ||
237 | /* Search through the file for the format chunk. If the end of the | 163 | if ( out >= max ) { |
238 | * file is reached without finding the chunk, then the file is not a | 164 | max = input->readBlock( (char*)data, (uint)QMIN(sound_buffer_size,wavedata_remaining) ); |
239 | * valid WAVE file. | ||
240 | */ | ||
241 | found = 0; | ||
242 | while (!found) { | ||
243 | if (read(fd, t1, 4)<4) { | ||
244 | qDebug("Could not read from sound file.\n"); | ||
245 | return -1; | ||
246 | } | ||
247 | if (strncmp(t1, "fmt ", 4)) { | ||
248 | /* Determine the length of the chunk found and skip to the next | ||
249 | * chunk. The chunk length is always stored in the four bytes | ||
250 | * following the chunk id. | ||
251 | */ | ||
252 | if (read(fd, &l1, 4)<4) { | ||
253 | qDebug("Could not read from sound file.\n"); | ||
254 | return -1; | ||
255 | } | ||
256 | lseek(fd, l1, SEEK_CUR); | ||
257 | } | ||
258 | else { | ||
259 | /* This is the format chunk, which stores the playback settings | ||
260 | * for the recording. | ||
261 | */ | ||
262 | /* Skip the length field, since we don't really need it. */ | ||
263 | lseek(fd, 4, SEEK_CUR); | ||
264 | /* Read in the format tag. If it has a value of 1, then there is | ||
265 | * no compression and we can attempt to play the file | ||
266 | * back. Otherwise, return. | ||
267 | */ | ||
268 | if (read(fd, &fmt, 2)<2) { | ||
269 | qDebug("Could not read from format chunk.\n"); | ||
270 | return -1; | ||
271 | } | ||
272 | if (fmt != 1) { | ||
273 | qDebug("Wave file contains compressed data." | ||
274 | " Unable to continue.\n"); | ||
275 | return -1; | ||
276 | } | ||
277 | /* Get the stereo mode. */ | ||
278 | if (read(fd, &ch, 2)<2) { | ||
279 | qDebug("Could not read from format chunk.\n"); | ||
280 | return -1; | ||
281 | } | ||
282 | else { | ||
283 | chan = ch; | ||
284 | qDebug("File has %d channels", chan); | ||
285 | } | ||
286 | /* Get the sample rate. */ | ||
287 | if (read(fd, &srate, 4)<4) { | ||
288 | qDebug("Could not read from format chunk.\n"); | ||
289 | return -1; | ||
290 | } | ||
291 | else { | ||
292 | sampleRate = srate; | ||
293 | qDebug("File has samplerate of %d", sampleRate); | ||
294 | } | ||
295 | /* Get the bit rate. This is at the end of the format chunk. */ | ||
296 | lseek(fd, 6, SEEK_CUR); | ||
297 | if (read(fd, &brate, 2)<2) { | ||
298 | qDebug("Could not read from format chunk.\n"); | ||
299 | return -1; | ||
300 | } | ||
301 | else { | ||
302 | resolution = brate; | ||
303 | qDebug("File has bitrate of %d", resolution); | ||
304 | } | ||
305 | 165 | ||
306 | found++; | 166 | wavedata_remaining -= max; |
307 | } | ||
308 | } | ||
309 | 167 | ||
310 | /* Search through the file for the data chunk. If the end of the | 168 | out = 0; |
311 | * file is reached without finding the chunk, then the file is not a | 169 | if ( max <= 0 ) { |
312 | * valid WAVE file. | 170 | max = 0; |
313 | */ | 171 | return TRUE; |
314 | found = 0; | 172 | } |
315 | while (!found) { | 173 | } |
316 | if (read(fd, t1, 4)<4) { | 174 | if ( chunkdata.wBitsPerSample == 8 ) { |
317 | qDebug("Could not read from sound file.\n"); | 175 | l = (data[out++] - 128) * 128; |
318 | return -1; | 176 | } else { |
319 | } | 177 | l = ((short*)data)[out/2]; |
320 | if (strncmp(t1, "data", 4)) { | 178 | out += 2; |
321 | /* Determine the length of the chunk found and skip to the next | 179 | } |
322 | * chunk. The chunk length is always stored in the four bytes | 180 | if ( chunkdata.channels == 1 ) { |
323 | * following the chunk id. | 181 | r = l; |
324 | */ | 182 | } else { |
325 | if (read(fd, &l1, 4)<4) { | 183 | if ( chunkdata.wBitsPerSample == 8 ) { |
326 | qDebug("Could not read from sound file.\n"); | 184 | r = (data[out++] - 128) * 128; |
327 | return -1; | 185 | } else { |
328 | } | 186 | r = ((short*)data)[out/2]; |
329 | lseek(fd, l1, SEEK_CUR); | 187 | out += 2; |
330 | } | 188 | } |
331 | else { | 189 | } |
332 | /* This is the data chunk, which stores the recording. */ | 190 | return TRUE; |
333 | /* Get the length field. */ | 191 | } // getSample |
334 | if (read(fd, &l1, 4)<4) { | ||
335 | qDebug("Could not read from sound file.\n"); | ||
336 | return -1; | ||
337 | } | ||
338 | else { | ||
339 | samples =l1; | ||
340 | qDebug("file has length of %d\nlasting %d seconds",l1, (( l1 / sampleRate) / chan) / 2 ); // ???? | ||
341 | return l1; | ||
342 | } | ||
343 | } | ||
344 | } | ||
345 | 192 | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | ////////////////////////////////////////////////// | ||
350 | }; | 193 | }; |
351 | 194 | ||
352 | 195 | ||
353 | WavPlugin::WavPlugin() { | 196 | WavPlugin::WavPlugin() { |
354 | d = new WavPluginData; | 197 | d = new WavPluginData; |
355 | d->input = 0; | 198 | d->input = 0; |
@@ -360,13 +203,13 @@ WavPlugin::~WavPlugin() { | |||
360 | close(); | 203 | close(); |
361 | delete d; | 204 | delete d; |
362 | } | 205 | } |
363 | 206 | ||
364 | 207 | ||
365 | bool WavPlugin::isFileSupported( const QString& path ) { | 208 | bool WavPlugin::isFileSupported( const QString& path ) { |
366 | debugMsg( "WavPlugin::isFileSupported" ); | 209 | // qDebug( "WavPlugin::isFileSupported" ); |
367 | 210 | ||
368 | char *ext = strrchr( path.latin1(), '.' ); | 211 | char *ext = strrchr( path.latin1(), '.' ); |
369 | 212 | ||
370 | // Test file extension | 213 | // Test file extension |
371 | if ( ext ) { | 214 | if ( ext ) { |
372 | if ( strncasecmp(ext, ".raw", 4) == 0 ) | 215 | if ( strncasecmp(ext, ".raw", 4) == 0 ) |
@@ -379,83 +222,81 @@ bool WavPlugin::isFileSupported( const QString& path ) { | |||
379 | 222 | ||
380 | return FALSE; | 223 | return FALSE; |
381 | } | 224 | } |
382 | 225 | ||
383 | 226 | ||
384 | bool WavPlugin::open( const QString& path ) { | 227 | bool WavPlugin::open( const QString& path ) { |
385 | qDebug( "WavPlugin::open" ); | 228 | // qDebug( "WavPlugin::open" ); |
386 | 229 | ||
387 | d->max = d->out = sound_buffer_size; | 230 | d->max = d->out = sound_buffer_size; |
388 | d->wavedata_remaining = 0; | 231 | d->wavedata_remaining = 0; |
389 | d->samples_due = 0; | 232 | d->samples_due = 0; |
390 | 233 | ||
391 | d->input = new QFile( path ); | 234 | d->input = new QFile( path ); |
392 | if ( d->input->open(IO_ReadOnly) == FALSE ) { | 235 | if ( d->input->open(IO_ReadOnly) == FALSE ) { |
393 | qDebug("couldn't open file"); | 236 | qDebug("couldn't open file"); |
394 | delete d->input; | 237 | delete d->input; |
395 | d->input = 0; | 238 | d->input = 0; |
396 | return FALSE; | 239 | return FALSE; |
397 | } | 240 | } |
398 | 241 | ||
399 | // d->getWavSettings( d->input.handle()); | ||
400 | d->initialise(); | 242 | d->initialise(); |
401 | 243 | ||
402 | return TRUE; | 244 | return TRUE; |
403 | } | 245 | } |
404 | 246 | ||
405 | 247 | ||
406 | bool WavPlugin::close() { | 248 | bool WavPlugin::close() { |
407 | qDebug( "WavPlugin::close" ); | 249 | // qDebug( "WavPlugin::close" ); |
408 | 250 | ||
409 | d->input->close(); | 251 | d->input->close(); |
410 | delete d->input; | 252 | delete d->input; |
411 | d->input = 0; | 253 | d->input = 0; |
412 | return TRUE; | 254 | return TRUE; |
413 | } | 255 | } |
414 | 256 | ||
415 | 257 | ||
416 | bool WavPlugin::isOpen() { | 258 | bool WavPlugin::isOpen() { |
417 | qDebug( "WavPlugin::isOpen" ); | 259 | // qDebug( "WavPlugin::isOpen" ); |
418 | return ( d->input != 0 ); | 260 | return ( d->input != 0 ); |
419 | } | 261 | } |
420 | 262 | ||
421 | 263 | ||
422 | int WavPlugin::audioStreams() { | 264 | int WavPlugin::audioStreams() { |
423 | qDebug( "WavPlugin::audioStreams" ); | 265 | // qDebug( "WavPlugin::audioStreams" ); |
424 | return 1; | 266 | return 1; |
425 | } | 267 | } |
426 | 268 | ||
427 | 269 | ||
428 | int WavPlugin::audioChannels( int ) { | 270 | int WavPlugin::audioChannels( int ) { |
429 | debugMsg( "WavPlugin::audioChannels" ); | 271 | // qDebug( "WavPlugin::audioChannels" ); |
430 | return d->chan; | 272 | return d->chunkdata.channels;// 2; // ### Always scale audio to stereo samples |
431 | } | 273 | } |
432 | 274 | ||
433 | 275 | ||
434 | int WavPlugin::audioFrequency( int ) { | 276 | int WavPlugin::audioFrequency( int ) { |
435 | qDebug( "WavPlugin::audioFrequency" ); | 277 | // qDebug( "WavPlugin::audioFrequency %d", d->chunkdata.samplesPerSec ); |
436 | return d->freq; | 278 | return d->chunkdata.samplesPerSec; //44100; // ### Always scale to frequency of 44100 |
437 | } | 279 | } |
438 | 280 | ||
439 | 281 | ||
440 | int WavPlugin::audioSamples( int ) { | 282 | int WavPlugin::audioSamples( int ) { |
441 | qDebug( "WavPlugin::audioSamples" ); | 283 | // qDebug( "WavPlugin::audioSamples" ); |
442 | return d->samples; | 284 | return d->samples / d->chunkdata.channels/2; // ### Scaled samples will be made stereo, |
443 | // return d->samples * 2 / d->chunkdata.channels; // ### Scaled samples will be made stereo, | 285 | // Therefore if source is mono we will double the number of samples |
444 | // // Therefore if source is mono we will double the number of samples | ||
445 | } | 286 | } |
446 | 287 | ||
447 | 288 | ||
448 | bool WavPlugin::audioSetSample( long, int ) { | 289 | bool WavPlugin::audioSetSample( long, int ) { |
449 | qDebug( "WavPlugin::audioSetSample" ); | 290 | // qDebug( "WavPlugin::audioSetSample" ); |
450 | return FALSE; | 291 | return FALSE; |
451 | } | 292 | } |
452 | 293 | ||
453 | 294 | ||
454 | long WavPlugin::audioGetSample( int ) { | 295 | long WavPlugin::audioGetSample( int ) { |
455 | qDebug( "WavPlugin::audioGetSample" ); | 296 | // qDebug( "WavPlugin::audioGetSample" ); |
456 | return 0; | 297 | return 0; |
457 | } | 298 | } |
458 | 299 | ||
459 | /* | 300 | /* |
460 | bool WavPlugin::audioReadSamples( short *, int, long, int ) { | 301 | bool WavPlugin::audioReadSamples( short *, int, long, int ) { |
461 | debugMsg( "WavPlugin::audioReadSamples" ); | 302 | debugMsg( "WavPlugin::audioReadSamples" ); |
@@ -479,16 +320,21 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl | |||
479 | debugMsg( "WavPlugin::audioReadStereoSamples" ); | 320 | debugMsg( "WavPlugin::audioReadStereoSamples" ); |
480 | return !d->add( output, samples, samplesMade, TRUE ); | 321 | return !d->add( output, samples, samplesMade, TRUE ); |
481 | } | 322 | } |
482 | */ | 323 | */ |
483 | 324 | ||
484 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { | 325 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { |
485 | qDebug( "WavPlugin::audioReadSamples" ); | 326 | // qDebug( "WavPlugin::audioReadSamples" ); |
486 | return d->add( output, samples, samplesMade, channels != 1 ); | 327 | return d->add( output, samples, samplesMade, channels != 1 ); |
487 | } | 328 | } |
488 | 329 | ||
489 | double WavPlugin::getTime() { | 330 | double WavPlugin::getTime() { |
490 | qDebug( "WavPlugin::getTime" ); | 331 | // qDebug( "WavPlugin::getTime" ); |
491 | return 0.0; | 332 | return 0.0; |
492 | } | 333 | } |
493 | 334 | ||
335 | int WavPlugin::audioBitsPerSample( int ) { | ||
336 | // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); | ||
337 | return d->chunkdata.wBitsPerSample; // | ||
338 | } | ||
339 | |||
494 | 340 | ||