diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/beep.c | 13 | ||||
| -rw-r--r-- | apps/codec_thread.c | 1 | ||||
| -rw-r--r-- | apps/features.txt | 4 | ||||
| -rw-r--r-- | apps/lang/english.lang | 17 | ||||
| -rw-r--r-- | apps/menus/playback_menu.c | 27 | ||||
| -rw-r--r-- | apps/pcmbuf.c | 21 | ||||
| -rw-r--r-- | apps/pcmbuf.h | 2 | ||||
| -rw-r--r-- | apps/playback.c | 11 | ||||
| -rw-r--r-- | apps/plugin.c | 2 | ||||
| -rw-r--r-- | apps/plugin.h | 4 | ||||
| -rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
| -rw-r--r-- | apps/plugins/mpegplayer/audio_thread.c | 1 | ||||
| -rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.h | 2 | ||||
| -rw-r--r-- | apps/plugins/mpegplayer/pcm_output.c | 6 | ||||
| -rw-r--r-- | apps/plugins/oscilloscope.c | 19 | ||||
| -rw-r--r-- | apps/plugins/test_codec.c | 7 | ||||
| -rw-r--r-- | apps/rbcodecconfig.h | 4 | ||||
| -rw-r--r-- | apps/settings.c | 38 | ||||
| -rw-r--r-- | apps/settings.h | 7 | ||||
| -rw-r--r-- | apps/settings_list.c | 5 | ||||
| -rw-r--r-- | apps/voice_thread.c | 11 |
21 files changed, 176 insertions, 28 deletions
diff --git a/apps/beep.c b/apps/beep.c index 8ac7ccf..25b5e0e 100644 --- a/apps/beep.c +++ b/apps/beep.c @@ -21,10 +21,10 @@ #include "config.h" #include "system.h" #include "settings.h" -#include "dsp_core.h" /* for NATIVE_FREQUENCY */ #include "pcm.h" #include "pcm_mixer.h" #include "misc.h" +#include "fixedpoint.h" /** Beep generation, CPU optimized **/ #include "asm/beep.c" @@ -39,8 +39,10 @@ static uint32_t beep_amplitude; /* Amplitude of square wave generator */ #endif static int beep_count; /* Number of samples remaining to generate */ -/* Reserve enough static space for keyclick to fit */ -#define BEEP_BUF_COUNT (NATIVE_FREQUENCY / 1000 * KEYCLICK_DURATION) +#define BEEP_COUNT(fs, duration) ((fs) / 1000 * (duration)) + +/* Reserve enough static space for keyclick to fit in worst case */ +#define BEEP_BUF_COUNT BEEP_COUNT(PLAY_SAMPR_MAX, KEYCLICK_DURATION) static int16_t beep_buf[BEEP_BUF_COUNT*2] IBSS_ATTR __attribute__((aligned(4))); /* Callback to generate the beep frames - also don't want inlining of @@ -75,9 +77,10 @@ void beep_play(unsigned int frequency, unsigned int duration, amplitude = INT16_MAX; /* Setup the parameters for the square wave generator */ + uint32_t fout = mixer_get_frequency(); beep_phase = 0; - beep_step = 0xffffffffu / NATIVE_FREQUENCY * frequency; - beep_count = NATIVE_FREQUENCY / 1000 * duration; + beep_step = fp_div(frequency, fout, 32); + beep_count = BEEP_COUNT(fout, duration); #ifdef BEEP_GENERIC beep_amplitude = amplitude; diff --git a/apps/codec_thread.c b/apps/codec_thread.c index d4b1c64..8f9f5a3 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c @@ -507,6 +507,7 @@ static void run_codec(void) codec_queue_ack(Q_CODEC_RUN); trigger_cpu_boost(); + dsp_configure(ci.dsp, DSP_SET_OUT_FREQUENCY, pcmbuf_get_frequency()); if (!encoder) { diff --git a/apps/features.txt b/apps/features.txt index a65744f..897657f 100644 --- a/apps/features.txt +++ b/apps/features.txt @@ -274,3 +274,7 @@ lowmem #if defined(HAVE_HARDWARE_CLICK) hardware_click #endif + +#if defined(HAVE_PLAY_FREQ) +play_frequency +#endif diff --git a/apps/lang/english.lang b/apps/lang/english.lang index dbd0baa..0dd3b43 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13156,3 +13156,20 @@ *: "Slow" </voice> </phrase> +<phrase> + id: LANG_PLAYBACK_FREQUENCY + desc: in playback settings (merge with LANG_RECORDING_FREQUENCY if cleaning) + user: core + <source> + *: none + play_frequency: "Frequency" + </source> + <dest> + *: none + play_frequency: "Frequency" + </dest> + <voice> + *: none + play_frequency: "Frequency" + </voice> +</phrase> diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 6beda93..89472d4 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -37,6 +37,10 @@ #include "misc.h" #if CONFIG_CODEC == SWCODEC #include "playback.h" +#include "pcm_sampr.h" +#ifdef HAVE_PLAY_FREQ +#include "talk.h" +#endif #endif @@ -192,6 +196,10 @@ MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL); MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL); #endif MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL); +#ifdef HAVE_PLAY_FREQ +MENUITEM_SETTING(play_frequency, &global_settings.play_frequency, + playback_callback); +#endif MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, Icon_Playback_menu, @@ -217,12 +225,15 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, #ifdef HAVE_HEADPHONE_DETECTION ,&unplug_menu #endif - ,&skip_length, &prevent_skip, + ,&skip_length, &prevent_skip #if CONFIG_CODEC == SWCODEC - &resume_rewind, + ,&resume_rewind +#endif + ,&pause_rewind +#ifdef HAVE_PLAY_FREQ + ,&play_frequency #endif - &pause_rewind, ); static int playback_callback(int action,const struct menu_item_ex *this_item) @@ -243,9 +254,19 @@ static int playback_callback(int action,const struct menu_item_ex *this_item) break; case ACTION_EXIT_MENUITEM: /* on exit */ + /* Playing or not */ +#ifdef HAVE_PLAY_FREQ + if (this_item == &play_frequency) + { + settings_apply_play_freq(global_settings.play_frequency, false); + break; + } +#endif /* HAVE_PLAY_FREQ */ + if (!(audio_status() & AUDIO_STATUS_PLAY)) break; + /* Playing only */ if (this_item == &shuffle_item) { if (old_shuffle == global_settings.playlist_shuffle) diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index cc454a4..ff9b3e1 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -40,7 +40,6 @@ #include "settings.h" #include "audio.h" #include "voice_thread.h" -#include "dsp_core.h" /* This is the target fill size of chunks on the pcm buffer Can be any number of samples but power of two sizes make for faster and @@ -66,11 +65,11 @@ chunks */ /* Return data level in 1/4-second increments */ -#define DATA_LEVEL(quarter_secs) (NATIVE_FREQUENCY * (quarter_secs)) +#define DATA_LEVEL(quarter_secs) (pcmbuf_sampr * (quarter_secs)) /* Number of bytes played per second: (sample rate * 2 channels * 2 bytes/sample) */ -#define BYTERATE (NATIVE_FREQUENCY * 4) +#define BYTERATE (pcmbuf_sampr * 2 * 2) #if MEMORYSIZE > 2 /* Keep watermark high for large memory target - at least (2s) */ @@ -104,6 +103,7 @@ static size_t pcmbuf_size; static struct chunkdesc *pcmbuf_descriptors; static unsigned int pcmbuf_desc_count; static unsigned int position_key = 1; +static unsigned int pcmbuf_sampr = 0; static size_t chunk_ridx; static size_t chunk_widx; @@ -111,8 +111,7 @@ static size_t chunk_widx; static size_t pcmbuf_bytes_waiting; static struct chunkdesc *current_desc; -/* Only written if HAVE_CROSSFADE */ -static size_t pcmbuf_watermark = PCMBUF_WATERMARK; +static size_t pcmbuf_watermark = 0; static bool low_latency_mode = false; @@ -545,6 +544,8 @@ size_t pcmbuf_init(void *bufend) } pcmbuf_finish_crossfade_enable(); +#else + pcmbuf_watermark = PCMBUF_WATERMARK; #endif /* HAVE_CROSSFADE */ init_buffer_state(); @@ -1331,3 +1332,13 @@ void pcmbuf_set_low_latency(bool state) { low_latency_mode = state; } + +void pcmbuf_update_frequency(void) +{ + pcmbuf_sampr = mixer_get_frequency(); +} + +unsigned int pcmbuf_get_frequency(void) +{ + return pcmbuf_sampr; +} diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h index 7fa3563..008872b 100644 --- a/apps/pcmbuf.h +++ b/apps/pcmbuf.h @@ -81,5 +81,7 @@ void pcmbuf_sync_position_update(void); /* Misc */ bool pcmbuf_is_lowdata(void); void pcmbuf_set_low_latency(bool state); +void pcmbuf_update_frequency(void); +unsigned int pcmbuf_get_frequency(void); #endif /* PCMBUF_H */ diff --git a/apps/playback.c b/apps/playback.c index 24c268f..8b498f2 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -2028,8 +2028,11 @@ static int audio_fill_file_buffer(void) /* Must reset the buffer before use if trashed or voice only - voice file size shouldn't have changed so we can go straight from AUDIOBUF_STATE_VOICED_ONLY to AUDIOBUF_STATE_INITIALIZED */ - if (buffer_state != AUDIOBUF_STATE_INITIALIZED) + if (buffer_state != AUDIOBUF_STATE_INITIALIZED || + !pcmbuf_is_same_size()) + { audio_reset_buffer(AUDIOBUF_STATE_INITIALIZED); + } logf("Starting buffer fill"); @@ -2510,6 +2513,11 @@ static void audio_start_playback(size_t offset, unsigned int flags) #ifndef PLATFORM_HAS_VOLUME_CHANGE sound_set_volume(global_settings.volume); #endif +#ifdef HAVE_PLAY_FREQ + settings_apply_play_freq(global_settings.play_frequency, true); +#endif + pcmbuf_update_frequency(); + /* Be sure channel is audible */ pcmbuf_fade(false, true); @@ -3755,6 +3763,7 @@ void INIT_ATTR playback_init(void) mutex_init(&id3_mutex); track_list_init(); buffering_init(); + pcmbuf_update_frequency(); add_event(PLAYBACK_EVENT_VOICE_PLAYING, false, playback_voice_event); #ifdef HAVE_CROSSFADE /* Set crossfade setting for next buffer init which should be about... */ diff --git a/apps/plugin.c b/apps/plugin.c index 24443b5..a5cdfc3 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -798,6 +798,8 @@ static const struct plugin_api rockbox_api = { /* new stuff at the end, sort into place next time the API gets incompatible */ + mixer_set_frequency, + mixer_get_frequency, }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 936f977..f926b34 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -155,7 +155,7 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 223 +#define PLUGIN_API_VERSION 224 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -970,6 +970,8 @@ struct plugin_api { /* new stuff at the end, sort into place next time the API gets incompatible */ + void (*mixer_set_frequency)(unsigned int samplerate); + unsigned int (*mixer_get_frequency)(void); }; /* plugin header */ diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index c512a9e..00bf960 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -37,6 +37,8 @@ resistor.c remote_control.c #endif +test_codec.c +test_sampr.c #ifdef HAVE_BACKLIGHT diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c index 1c167ea..764ad11 100644 --- a/apps/plugins/mpegplayer/audio_thread.c +++ b/apps/plugins/mpegplayer/audio_thread.c @@ -481,6 +481,7 @@ static void audio_thread(void) init_mad(); td.dsp = rb->dsp_get_config(CODEC_IDX_AUDIO); + rb->dsp_configure(td.dsp, DSP_SET_OUT_FREQUENCY, CLOCK_RATE); #ifdef HAVE_PITCHCONTROL rb->sound_set_pitch(PITCH_SPEED_100); rb->dsp_set_timestretch(PITCH_SPEED_100); diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h index 32cc7b2..4ddf0ca 100644 --- a/apps/plugins/mpegplayer/mpegplayer.h +++ b/apps/plugins/mpegplayer/mpegplayer.h @@ -44,7 +44,7 @@ #define AUDIOBUF_ALLOC_SIZE (AUDIOBUF_SIZE+AUDIOBUF_GUARD_SIZE) /** PCM buffer **/ -#define CLOCK_RATE NATIVE_FREQUENCY /* Our clock rate in ticks/second (samplerate) */ +#define CLOCK_RATE 44100 /* Our clock rate in ticks/second (samplerate) */ /* Define this as "1" to have a test tone instead of silence clip */ #define SILENCE_TEST_TONE 0 diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 3af8e91..82e3584 100644 --- a/apps/plugins/mpegplayer/pcm_output.c +++ b/apps/plugins/mpegplayer/pcm_output.c @@ -51,6 +51,8 @@ static uint32_t volatile clock_time IBSS_ATTR; /* Timestamp adjusted */ static int pcm_skipped = 0; static int pcm_underruns = 0; +static unsigned int old_sampr = 0; + /* Small silence clip. ~5.80ms @ 44.1kHz */ static int16_t silence[256*2] ALIGNED_ATTR(4) = { 0 }; @@ -380,9 +382,13 @@ bool pcm_output_init(void) } #endif + old_sampr = rb->mixer_get_frequency(); + rb->mixer_set_frequency(CLOCK_RATE); return true; } void pcm_output_exit(void) { + if (old_sampr != 0) + rb->mixer_set_frequency(old_sampr); } diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index a4ec6a8..4d80749 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c @@ -1200,13 +1200,14 @@ static long anim_peaks_vertical(void) /** Waveform View **/ #ifdef OSCILLOSCOPE_GRAPHMODE -static int16_t waveform_buffer[2*ALIGN_UP(NATIVE_FREQUENCY, 2048)+2*2048] +static int16_t waveform_buffer[2*ALIGN_UP(PLAY_SAMPR_MAX, 2048)+2*2048] MEM_ALIGN_ATTR; static size_t waveform_buffer_threshold = 0; static size_t volatile waveform_buffer_have = 0; static size_t waveform_buffer_break = 0; +static unsigned long mixer_sampr = PLAY_SAMPR_DEFAULT; #define PCM_SAMPLESIZE (2*sizeof(int16_t)) -#define PCM_BYTERATE (NATIVE_FREQUENCY*PCM_SAMPLESIZE) +#define PCM_BYTERATE(sampr) ((sampr)*PCM_SAMPLESIZE) #define WAVEFORM_SCALE_PCM(full_scale, sample) \ ((((full_scale) * (sample)) + (1 << 14)) >> 15) @@ -1390,7 +1391,7 @@ static long anim_waveform_horizontal(void) return cur_tick + HZ/5; } - int count = (NATIVE_FREQUENCY*osc_delay + 100*HZ - 1) / (100*HZ); + int count = (mixer_sampr*osc_delay + 100*HZ - 1) / (100*HZ); waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); @@ -1516,7 +1517,8 @@ static long anim_waveform_horizontal(void) osd_lcd_update(); long delay = get_next_delay(); - return cur_tick + delay - waveform_buffer_have * HZ / PCM_BYTERATE; + return cur_tick + delay - waveform_buffer_have * HZ / + PCM_BYTERATE(mixer_sampr); } static void anim_waveform_plot_filled_v(int y, int y_prev, @@ -1583,7 +1585,7 @@ static long anim_waveform_vertical(void) return cur_tick + HZ/5; } - int count = (NATIVE_FREQUENCY*osc_delay + 100*HZ - 1) / (100*HZ); + int count = (mixer_sampr*osc_delay + 100*HZ - 1) / (100*HZ); waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); @@ -1709,7 +1711,8 @@ static long anim_waveform_vertical(void) osd_lcd_update(); long delay = get_next_delay(); - return cur_tick + delay - waveform_buffer_have * HZ / PCM_BYTERATE; + return cur_tick + delay - waveform_buffer_have * HZ + / PCM_BYTERATE(mixer_sampr); } static void anim_waveform_exit(void) @@ -1872,6 +1875,10 @@ static void osc_setup(void) osd_lcd_update(); #endif +#ifdef OSCILLOSCOPE_GRAPHMODE + mixer_sampr = rb->mixer_get_frequency(); +#endif + /* Turn off backlight timeout */ backlight_ignore_timeout(); graphmode_setup(); diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 7523d9e..0b409f8 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -502,7 +502,12 @@ static void configure(int setting, intptr_t value) { case DSP_SET_FREQUENCY: DEBUGF("samplerate=%d\n",(int)value); - wavinfo.samplerate = use_dsp ? NATIVE_FREQUENCY : (int)value; + if (use_dsp) { + wavinfo.samplerate = rb->dsp_configure( + ci.dsp, DSP_GET_OUT_FREQUENCY, 0); + } else { + wavinfo.samplerate = (int)value; + } break; case DSP_SET_SAMPLE_DEPTH: diff --git a/apps/rbcodecconfig.h b/apps/rbcodecconfig.h index ff9fc41..cc51595 100644 --- a/apps/rbcodecconfig.h +++ b/apps/rbcodecconfig.h @@ -71,4 +71,8 @@ static inline void dsp_process_end(struct dsp_loop_context *ctx) #endif +#define DSP_OUT_MIN_HZ PLAY_SAMPR_HW_MIN +#define DSP_OUT_MAX_HZ PLAY_SAMPR_MAX +#define DSP_OUT_DEFAULT_HZ PLAY_SAMPR_DEFAULT + #endif diff --git a/apps/settings.c b/apps/settings.c index adc53cd..cf51b07 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -85,6 +85,11 @@ struct system_status global_status; #ifdef HAVE_RECORDING #include "enc_config.h" #endif +#include "pcm_sampr.h" +#ifdef HAVE_PLAY_FREQ +#include "pcm_mixer.h" +#include "dsp_core.h" +#endif #endif /* CONFIG_CODEC == SWCODEC */ #define NVRAM_BLOCK_SIZE 44 @@ -720,6 +725,36 @@ void settings_apply_pm_range(void) } #endif /* HAVE_LCD_BITMAP */ +#ifdef HAVE_PLAY_FREQ +void settings_apply_play_freq(int value, bool playback) +{ + static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 }; + static int prev_setting = 0; + + if ((unsigned)value >= ARRAYLEN(play_sampr)) + value = 0; + + bool changed = value != prev_setting; + prev_setting = value; + + long offset = 0; + bool playing = changed && !playback && + audio_status() == AUDIO_STATUS_PLAY; + + if (playing) + offset = audio_current_track()->offset; + + if (changed && !playback) + audio_hard_stop(); + + /* Other sub-areas of playback pick it up from the mixer */ + mixer_set_frequency(play_sampr[value]); + + if (playing) + audio_play(offset); +} +#endif /* HAVE_PLAY_FREQ */ + void sound_settings_apply(void) { #ifdef AUDIOHW_HAVE_BASS @@ -976,6 +1011,9 @@ void settings_apply(bool read_disk) set_codepage(global_settings.default_codepage); CHART("<set_codepage"); +#ifdef HAVE_PLAY_FREQ + settings_apply_play_freq(global_settings.play_frequency, false); +#endif #if CONFIG_CODEC == SWCODEC #ifdef HAVE_CROSSFADE audio_set_crossfade(global_settings.crossfade); diff --git a/apps/settings.h b/apps/settings.h index 1aec931..087ff0c 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -223,6 +223,9 @@ void settings_apply_skins(void); void settings_apply(bool read_disk); void settings_apply_pm_range(void); +#ifdef HAVE_PLAY_FREQ +void settings_apply_play_freq(int value, bool playback); +#endif void settings_display(void); enum optiontype { INT, BOOL }; @@ -821,6 +824,10 @@ struct user_settings #ifdef HAVE_QUICKSCREEN bool shortcuts_replaces_qs; #endif + +#ifdef HAVE_PLAY_FREQ + int play_frequency; /* core audio output frequency selection */ +#endif }; /** global variables **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index c1b40a6..980c74f 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -807,6 +807,11 @@ const struct settings_list settings[] = { ,ID2P(LANG_REPEAT_AB) #endif ), /* CHOICE_SETTING( repeat_mode ) */ +#ifdef HAVE_PLAY_FREQ + STRINGCHOICE_SETTING(0, play_frequency, LANG_PLAYBACK_FREQUENCY, 0, + "playback frequency", "44.1 kHz,48 kHz", NULL, 2, + TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ)), +#endif /* HAVE_PLAY_FREQ */ /* LCD */ #ifdef HAVE_LCD_CONTRAST /* its easier to leave this one un-macro()ed for the time being */ diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 46471c0..7788f65 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c @@ -18,7 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ -#include <sys/types.h> +#include "config.h" #include "system.h" #include "core_alloc.h" #include "thread.h" @@ -30,8 +30,7 @@ #include "pcm_mixer.h" #include "codecs/libspeex/speex/speex.h" -/* Default number of native-frequency PCM frames to queue - adjust as - necessary per-target */ +/* Default number of PCM frames to queue - adjust as necessary per-target */ #define VOICE_FRAMES 4 /* Define any of these as "1" and uncomment the LOGF_ENABLE line to log @@ -84,8 +83,8 @@ static struct queue_sender_list voice_queue_sender_list SHAREDBSS_ATTR; static int quiet_counter SHAREDDATA_ATTR = 0; static bool voice_playing = false; -#define VOICE_PCM_FRAME_COUNT ((NATIVE_FREQUENCY*VOICE_FRAME_COUNT + \ - VOICE_SAMPLE_RATE) / VOICE_SAMPLE_RATE) +#define VOICE_PCM_FRAME_COUNT ((PLAY_SAMPR_MAX*VOICE_FRAME_COUNT + \ + VOICE_SAMPLE_RATE) / VOICE_SAMPLE_RATE) #define VOICE_PCM_FRAME_SIZE (VOICE_PCM_FRAME_COUNT*2*sizeof (int16_t)) /* Voice processing states */ @@ -356,11 +355,13 @@ static enum voice_state voice_message(struct voice_thread_data *td) { /* Stop any clip still playing */ voice_stop_playback(); + dsp_configure(td->dsp, DSP_FLUSH, 0); } if (quiet_counter <= 0) { voice_playing = true; + dsp_configure(td->dsp, DSP_SET_OUT_FREQUENCY, mixer_get_frequency()); send_event(PLAYBACK_EVENT_VOICE_PLAYING, &voice_playing); } |