diff options
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r-- | apps/pcmbuf.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index c7baad08e4..7201d3981a 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -206,7 +206,7 @@ static void commit_chunk(bool flush_next_time) | |||
206 | { | 206 | { |
207 | if (!pcmbuffer_fillpos) | 207 | if (!pcmbuffer_fillpos) |
208 | return; | 208 | return; |
209 | 209 | ||
210 | /* Never use the last buffer descriptor */ | 210 | /* Never use the last buffer descriptor */ |
211 | while (write_chunk == write_end_chunk) { | 211 | while (write_chunk == write_end_chunk) { |
212 | /* If this happens, something is being stupid */ | 212 | /* If this happens, something is being stupid */ |
@@ -217,9 +217,9 @@ static void commit_chunk(bool flush_next_time) | |||
217 | /* Let approximately one chunk of data playback */ | 217 | /* Let approximately one chunk of data playback */ |
218 | sleep(HZ * PCMBUF_TARGET_CHUNK / BYTERATE); | 218 | sleep(HZ * PCMBUF_TARGET_CHUNK / BYTERATE); |
219 | } | 219 | } |
220 | 220 | ||
221 | /* commit the chunk */ | 221 | /* commit the chunk */ |
222 | 222 | ||
223 | register size_t size = pcmbuffer_fillpos; | 223 | register size_t size = pcmbuffer_fillpos; |
224 | /* Grab the next description to write, and change the write pointer */ | 224 | /* Grab the next description to write, and change the write pointer */ |
225 | register struct chunkdesc *pcmbuf_current = write_chunk; | 225 | register struct chunkdesc *pcmbuf_current = write_chunk; |
@@ -229,7 +229,7 @@ static void commit_chunk(bool flush_next_time) | |||
229 | pcmbuf_current->size = size; | 229 | pcmbuf_current->size = size; |
230 | pcmbuf_current->end_of_track = false; | 230 | pcmbuf_current->end_of_track = false; |
231 | pcmbuf_current->link = NULL; | 231 | pcmbuf_current->link = NULL; |
232 | 232 | ||
233 | if (read_chunk != NULL) | 233 | if (read_chunk != NULL) |
234 | { | 234 | { |
235 | if (flush_pcmbuf) | 235 | if (flush_pcmbuf) |
@@ -263,7 +263,7 @@ static void commit_chunk(bool flush_next_time) | |||
263 | * and the next chunk to be committed will be the next to be played. | 263 | * and the next chunk to be committed will be the next to be played. |
264 | * This is used to empty the PCM buffer for a track change. */ | 264 | * This is used to empty the PCM buffer for a track change. */ |
265 | flush_pcmbuf = flush_next_time; | 265 | flush_pcmbuf = flush_next_time; |
266 | 266 | ||
267 | /* This is now the last buffer to read */ | 267 | /* This is now the last buffer to read */ |
268 | read_end_chunk = pcmbuf_current; | 268 | read_end_chunk = pcmbuf_current; |
269 | 269 | ||
@@ -423,7 +423,7 @@ void pcmbuf_write_complete(int count) | |||
423 | if (crossfade_active) | 423 | if (crossfade_active) |
424 | write_to_crossfade(length); | 424 | write_to_crossfade(length); |
425 | else | 425 | else |
426 | #endif | 426 | #endif |
427 | { | 427 | { |
428 | pcmbuffer_fillpos += length; | 428 | pcmbuffer_fillpos += length; |
429 | COMMIT_IF_NEEDED; | 429 | COMMIT_IF_NEEDED; |
@@ -553,7 +553,7 @@ bool pcmbuf_start_track_change(bool auto_skip) | |||
553 | } | 553 | } |
554 | } | 554 | } |
555 | #endif | 555 | #endif |
556 | 556 | ||
557 | if (!auto_skip || crossfade) | 557 | if (!auto_skip || crossfade) |
558 | /* manual skip or crossfade */ | 558 | /* manual skip or crossfade */ |
559 | { | 559 | { |
@@ -640,7 +640,7 @@ static void pcmbuf_pcm_callback(unsigned char** start, size_t* size) | |||
640 | /* if during a track transition, update the elapsed time in ms */ | 640 | /* if during a track transition, update the elapsed time in ms */ |
641 | if (track_transition) | 641 | if (track_transition) |
642 | audio_pcmbuf_position_callback(last_chunksize * 1000 / BYTERATE); | 642 | audio_pcmbuf_position_callback(last_chunksize * 1000 / BYTERATE); |
643 | 643 | ||
644 | /* if last chunk in the track, stop updates and notify audio thread */ | 644 | /* if last chunk in the track, stop updates and notify audio thread */ |
645 | if (pcmbuf_current->end_of_track) | 645 | if (pcmbuf_current->end_of_track) |
646 | { | 646 | { |
@@ -662,7 +662,7 @@ static void pcmbuf_pcm_callback(unsigned char** start, size_t* size) | |||
662 | crossfade_chunk = read_chunk; | 662 | crossfade_chunk = read_chunk; |
663 | #endif | 663 | #endif |
664 | } | 664 | } |
665 | 665 | ||
666 | { | 666 | { |
667 | /* Commit last samples at end of playlist */ | 667 | /* Commit last samples at end of playlist */ |
668 | if (pcmbuffer_fillpos && !read_chunk) | 668 | if (pcmbuffer_fillpos && !read_chunk) |
@@ -904,7 +904,7 @@ static void crossfade_start(void) | |||
904 | crossfade_mix_fade(factor, block_rem, NULL, | 904 | crossfade_mix_fade(factor, block_rem, NULL, |
905 | &fade_out_sample, &fade_out_chunk); | 905 | &fade_out_sample, &fade_out_chunk); |
906 | } | 906 | } |
907 | 907 | ||
908 | /* zero out the rest of the buffer */ | 908 | /* zero out the rest of the buffer */ |
909 | crossfade_mix_fade(0, crossfade_rem, NULL, | 909 | crossfade_mix_fade(0, crossfade_rem, NULL, |
910 | &fade_out_sample, &fade_out_chunk); | 910 | &fade_out_sample, &fade_out_chunk); |
@@ -997,7 +997,7 @@ static void pcmbuf_finish_crossfade_enable(void) | |||
997 | { | 997 | { |
998 | /* Copy the pending setting over now */ | 998 | /* Copy the pending setting over now */ |
999 | crossfade_enabled = crossfade_enable_request; | 999 | crossfade_enabled = crossfade_enable_request; |
1000 | 1000 | ||
1001 | pcmbuf_watermark = (crossfade_enabled && pcmbuf_size) ? | 1001 | pcmbuf_watermark = (crossfade_enabled && pcmbuf_size) ? |
1002 | /* If crossfading, try to keep the buffer full other than 1 second */ | 1002 | /* If crossfading, try to keep the buffer full other than 1 second */ |
1003 | (pcmbuf_size - BYTERATE) : | 1003 | (pcmbuf_size - BYTERATE) : |
@@ -1021,11 +1021,11 @@ bool pcmbuf_is_same_size(void) | |||
1021 | /* if pcmbuffer is NULL, then not set up yet even once so always */ | 1021 | /* if pcmbuffer is NULL, then not set up yet even once so always */ |
1022 | bool same_size = pcmbuffer ? | 1022 | bool same_size = pcmbuffer ? |
1023 | (get_next_required_pcmbuf_size() == pcmbuf_size) : true; | 1023 | (get_next_required_pcmbuf_size() == pcmbuf_size) : true; |
1024 | 1024 | ||
1025 | /* no buffer change needed, so finish crossfade setup now */ | 1025 | /* no buffer change needed, so finish crossfade setup now */ |
1026 | if (same_size) | 1026 | if (same_size) |
1027 | pcmbuf_finish_crossfade_enable(); | 1027 | pcmbuf_finish_crossfade_enable(); |
1028 | 1028 | ||
1029 | return same_size; | 1029 | return same_size; |
1030 | } | 1030 | } |
1031 | #endif /* HAVE_CROSSFADE */ | 1031 | #endif /* HAVE_CROSSFADE */ |
@@ -1232,7 +1232,7 @@ void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude) | |||
1232 | if (!bufstart || !pcm_is_playing()) | 1232 | if (!bufstart || !pcm_is_playing()) |
1233 | return; | 1233 | return; |
1234 | 1234 | ||
1235 | /* Give 5ms clearance. */ | 1235 | /* Give 5ms clearance. */ |
1236 | bufstart += BYTERATE / 200; | 1236 | bufstart += BYTERATE / 200; |
1237 | 1237 | ||
1238 | #ifdef HAVE_PCM_DMA_ADDRESS | 1238 | #ifdef HAVE_PCM_DMA_ADDRESS |