Mercurial > audlegacy-plugins
comparison src/sndfile/plugin.c @ 2554:8d09a4d017ea
Using a static buffer, eh? Don't. Just don't.
| author | Matti Hamalainen <ccr@tnsp.org> |
|---|---|
| date | Thu, 08 May 2008 22:07:03 +0300 |
| parents | b119d6f2e6c8 |
| children | 04b1b020be88 |
comparison
equal
deleted
inserted
replaced
| 2553:b119d6f2e6c8 | 2554:8d09a4d017ea |
|---|---|
| 364 } | 364 } |
| 365 | 365 |
| 366 static gpointer | 366 static gpointer |
| 367 play_loop (gpointer arg) | 367 play_loop (gpointer arg) |
| 368 { | 368 { |
| 369 static gshort buffer[BUFFER_SIZE]; | 369 gshort buffer[BUFFER_SIZE]; |
| 370 gint samples; | 370 gint samples; |
| 371 InputPlayback *playback = arg; | 371 InputPlayback *playback = arg; |
| 372 | 372 |
| 373 for (;;) | 373 for (;;) |
| 374 { | 374 { |
| 389 if (playback->playing == FALSE) | 389 if (playback->playing == FALSE) |
| 390 break; | 390 break; |
| 391 } | 391 } |
| 392 | 392 |
| 393 playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels, | 393 playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels, |
| 394 samples * sizeof (short), buffer, &playback->playing); | 394 samples * sizeof(buffer[0]), buffer, &playback->playing); |
| 395 } | 395 } |
| 396 else { | 396 else { |
| 397 while(playback->output->buffer_playing()) { | 397 while(playback->output->buffer_playing()) { |
| 398 g_get_current_time(&sleeptime); | 398 g_get_current_time(&sleeptime); |
| 399 g_time_val_add(&sleeptime, 500000); | 399 g_time_val_add(&sleeptime, 500000); |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 bit_rate = sfinfo.samplerate * pcmbitwidth; | 454 bit_rate = sfinfo.samplerate * pcmbitwidth; |
| 455 | 455 |
| 456 if (sfinfo.samplerate > 0) | 456 if (sfinfo.samplerate > 0) |
| 457 song_length = (int) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate); | 457 song_length = (gint) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate); |
| 458 else | 458 else |
| 459 song_length = 0; | 459 song_length = 0; |
| 460 | 460 |
| 461 if (! playback->output->open_audio (FMT_S16_NE, sfinfo.samplerate, sfinfo.channels)) | 461 if (! playback->output->open_audio (FMT_S16_NE, sfinfo.samplerate, sfinfo.channels)) |
| 462 { | 462 { |
