diff options
Diffstat (limited to 'firmware/pcm_record.c')
-rw-r--r-- | firmware/pcm_record.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c index 68fc22b937..bce6fb5f25 100644 --- a/firmware/pcm_record.c +++ b/firmware/pcm_record.c | |||
@@ -172,9 +172,9 @@ static void close_wave(void); | |||
172 | /* Creates pcmrec_thread */ | 172 | /* Creates pcmrec_thread */ |
173 | void pcm_rec_init(void) | 173 | void pcm_rec_init(void) |
174 | { | 174 | { |
175 | queue_init(&pcmrec_queue); | 175 | queue_init(&pcmrec_queue, true); |
176 | create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack), | 176 | create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack), |
177 | pcmrec_thread_name); | 177 | pcmrec_thread_name IF_PRIO(, PRIORITY_RECORDING)); |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
@@ -196,8 +196,7 @@ void audio_init_recording(unsigned int buffer_offset) | |||
196 | queue_post(&pcmrec_queue, PCMREC_INIT, 0); | 196 | queue_post(&pcmrec_queue, PCMREC_INIT, 0); |
197 | 197 | ||
198 | while(!init_done) | 198 | while(!init_done) |
199 | sleep_thread(); | 199 | sleep_thread(1); |
200 | wake_up_thread(); | ||
201 | } | 200 | } |
202 | 201 | ||
203 | void audio_close_recording(void) | 202 | void audio_close_recording(void) |
@@ -206,8 +205,7 @@ void audio_close_recording(void) | |||
206 | queue_post(&pcmrec_queue, PCMREC_CLOSE, 0); | 205 | queue_post(&pcmrec_queue, PCMREC_CLOSE, 0); |
207 | 206 | ||
208 | while(!close_done) | 207 | while(!close_done) |
209 | sleep_thread(); | 208 | sleep_thread(1); |
210 | wake_up_thread(); | ||
211 | 209 | ||
212 | audio_remove_encoder(); | 210 | audio_remove_encoder(); |
213 | } | 211 | } |
@@ -421,8 +419,7 @@ void audio_record(const char *filename) | |||
421 | queue_post(&pcmrec_queue, PCMREC_START, 0); | 419 | queue_post(&pcmrec_queue, PCMREC_START, 0); |
422 | 420 | ||
423 | while(!record_done) | 421 | while(!record_done) |
424 | sleep_thread(); | 422 | sleep_thread(1); |
425 | wake_up_thread(); | ||
426 | } | 423 | } |
427 | 424 | ||
428 | 425 | ||
@@ -438,8 +435,7 @@ void audio_new_file(const char *filename) | |||
438 | queue_post(&pcmrec_queue, PCMREC_NEW_FILE, 0); | 435 | queue_post(&pcmrec_queue, PCMREC_NEW_FILE, 0); |
439 | 436 | ||
440 | while(!new_file_done) | 437 | while(!new_file_done) |
441 | sleep_thread(); | 438 | sleep_thread(1); |
442 | wake_up_thread(); | ||
443 | 439 | ||
444 | logf("pcm_new_file done"); | 440 | logf("pcm_new_file done"); |
445 | } | 441 | } |
@@ -459,8 +455,7 @@ void audio_stop_recording(void) | |||
459 | queue_post(&pcmrec_queue, PCMREC_STOP, 0); | 455 | queue_post(&pcmrec_queue, PCMREC_STOP, 0); |
460 | 456 | ||
461 | while(!stop_done) | 457 | while(!stop_done) |
462 | sleep_thread(); | 458 | sleep_thread(1); |
463 | wake_up_thread(); | ||
464 | 459 | ||
465 | logf("pcm_stop done"); | 460 | logf("pcm_stop done"); |
466 | } | 461 | } |
@@ -482,8 +477,7 @@ void audio_pause_recording(void) | |||
482 | queue_post(&pcmrec_queue, PCMREC_PAUSE, 0); | 477 | queue_post(&pcmrec_queue, PCMREC_PAUSE, 0); |
483 | 478 | ||
484 | while(!pause_done) | 479 | while(!pause_done) |
485 | sleep_thread(); | 480 | sleep_thread(1); |
486 | wake_up_thread(); | ||
487 | } | 481 | } |
488 | 482 | ||
489 | void audio_resume_recording(void) | 483 | void audio_resume_recording(void) |
@@ -498,8 +492,7 @@ void audio_resume_recording(void) | |||
498 | queue_post(&pcmrec_queue, PCMREC_RESUME, 0); | 492 | queue_post(&pcmrec_queue, PCMREC_RESUME, 0); |
499 | 493 | ||
500 | while(!resume_done) | 494 | while(!resume_done) |
501 | sleep_thread(); | 495 | sleep_thread(1); |
502 | wake_up_thread(); | ||
503 | } | 496 | } |
504 | 497 | ||
505 | /* return peaks as int, so convert from short first | 498 | /* return peaks as int, so convert from short first |
@@ -817,9 +810,8 @@ static void pcmrec_stop(void) | |||
817 | /* wait for encoding finish */ | 810 | /* wait for encoding finish */ |
818 | is_paused = true; | 811 | is_paused = true; |
819 | while(!wav_queue_empty) | 812 | while(!wav_queue_empty) |
820 | sleep_thread(); | 813 | sleep_thread(1); |
821 | 814 | ||
822 | wake_up_thread(); | ||
823 | is_recording = false; | 815 | is_recording = false; |
824 | 816 | ||
825 | /* Flush buffers to file */ | 817 | /* Flush buffers to file */ |