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
This commit is contained in:
parent
cc57381707
commit
826688e699
7 changed files with 42 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -112,6 +112,7 @@ enum audio_buffer_state
|
|||
AUDIOBUF_STATE_VOICED_ONLY = 1, /* voice-only */
|
||||
};
|
||||
int audio_buffer_state(void);
|
||||
void audio_buffer_reset(void);
|
||||
#endif
|
||||
|
||||
/* channel modes */
|
||||
|
|
|
@ -125,6 +125,17 @@ static void usb_slave_mode(bool on)
|
|||
if (rc <= 0) /* no partition */
|
||||
panicf("mount: %d",rc);
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
#if CONFIG_CPU == IMX31L || CONFIG_USBOTG == USBOTG_ISP1583 || \
|
||||
defined(CPU_TCC77X) || defined(CPU_TCC780X)
|
||||
/* These use a static transfer buffer */
|
||||
#elif defined(USB_STORAGE) && !defined (HAVE_HARDWARE_BEEP)
|
||||
/* Storage can use the audio buffer, restore it if it did to get
|
||||
* keyclicks back. */
|
||||
if (audio_buffer_state() == BUFFER_STATE_TRASHED)
|
||||
audio_buffer_reset();
|
||||
#endif /* USB_STORAGE */
|
||||
#endif /* BOOTLOADER */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue