diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2008-12-13 02:48:36 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2008-12-13 02:48:36 +0000 |
| commit | 826688e69953530d6ccadb77df05395940b8fe30 (patch) | |
| tree | b9d83559f8930b8c4fb6c57466d5328469425051 /apps | |
| parent | cc57381707a2372809ce5398fa49cef64ec138bc (diff) | |
| download | rockbox-826688e69953530d6ccadb77df05395940b8fe30.zip rockbox-826688e69953530d6ccadb77df05395940b8fe30.tar.gz rockbox-826688e69953530d6ccadb77df05395940b8fe30.tar.bz2 rockbox-826688e69953530d6ccadb77df05395940b8fe30.tar.xz | |
PCM buffer beeping needs the audio buffer reset in order to work after operations that trash the buffer or keyclick won't be audible until playback is restarted.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19413 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/filetree.c | 3 | ||||
| -rw-r--r-- | apps/playback.c | 13 | ||||
| -rw-r--r-- | apps/plugin.c | 7 | ||||
| -rw-r--r-- | apps/recorder/pcm_record.c | 4 | ||||
| -rw-r--r-- | apps/settings.c | 3 |
5 files changed, 30 insertions, 0 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index fc5e4d3..03a4d7c 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -509,6 +509,9 @@ int ft_enter(struct tree_context* c) MAX_FILENAME); talk_init(); /* use voice of same language */ splash(HZ, ID2P(LANG_LANGUAGE_LOADED)); +#if CONFIG_CODEC == SWCODEC && !defined(HAVE_HARDWARE_BEEP) + audio_buffer_reset(); +#endif } break; diff --git a/apps/playback.c b/apps/playback.c index d2d9bb6..1a638eb 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -136,6 +136,7 @@ enum { Q_AUDIO_POSTINIT, Q_AUDIO_FILL_BUFFER, Q_AUDIO_FINISH_LOAD, + Q_AUDIO_RESTORE_BUFFER, Q_CODEC_REQUEST_COMPLETE, Q_CODEC_REQUEST_FAILED, @@ -490,6 +491,12 @@ int audio_buffer_state(void) return buffer_state; } +void audio_buffer_reset(void) +{ + LOGFQUEUE("audio_queue >| Q_AUDIO_RESTORE_BUFFER"); + queue_send(&audio_queue, Q_AUDIO_RESTORE_BUFFER, 0); +} + #ifdef HAVE_RECORDING unsigned char *audio_get_recording_buffer(size_t *buffer_size) { @@ -2389,6 +2396,12 @@ static void audio_thread(void) audio_finish_load_track(); break; + case Q_AUDIO_RESTORE_BUFFER: + LOGFQUEUE("audio < Q_AUDIO_RESTORE_BUFFER"); + if (buffer_state != AUDIOBUF_STATE_INITIALIZED) + audio_reset_buffer(); + break; + case Q_AUDIO_PLAY: LOGFQUEUE("audio < Q_AUDIO_PLAY"); if (playing && ev.data <= 0) diff --git a/apps/plugin.c b/apps/plugin.c index e55ecd4..cf015e2 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -784,6 +784,13 @@ int plugin_load(const char* plugin, const void* parameter) splash(HZ*2, str(LANG_PLUGIN_ERROR)); break; } + +#if CONFIG_CODEC == SWCODEC && !defined (HAVE_HARDWARE_BEEP) + /* Did the plugin trash the buffer? Restore it. */ + if (audio_buffer_state() == AUDIOBUF_STATE_TRASHED) + audio_buffer_reset(); +#endif + return PLUGIN_OK; } diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c index 8642150..bc6a532 100644 --- a/apps/recorder/pcm_record.c +++ b/apps/recorder/pcm_record.c @@ -1167,6 +1167,10 @@ static void pcmrec_close(void) pcm_close_recording(); reset_hardware(); audio_remove_encoder(); +#ifndef HAVE_HARDWARE_BEEP + /* Restore keyclicks */ + audio_buffer_reset(); +#endif } /* pcmrec_close */ /* PCMREC_OPTIONS */ diff --git a/apps/settings.c b/apps/settings.c index 4babe33..cc50b93 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -885,6 +885,9 @@ void settings_apply(bool read_disk) global_settings.lang_file); lang_load(buf); talk_init(); /* use voice of same language */ +#if CONFIG_CODEC == SWCODEC && !defined(HAVE_HARDWARE_BEEP) + audio_buffer_reset(); +#endif } /* load the icon set */ icons_init(); |