diff options
Diffstat (limited to 'apps/plugins')
-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 |
6 files changed, 29 insertions, 8 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index c512a9e02f..00bf9606d4 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -37,6 +37,8 @@ resistor.c | |||
37 | remote_control.c | 37 | remote_control.c |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | test_codec.c | ||
41 | test_sampr.c | ||
40 | 42 | ||
41 | 43 | ||
42 | #ifdef HAVE_BACKLIGHT | 44 | #ifdef HAVE_BACKLIGHT |
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c index 1c167ea2a2..764ad111f2 100644 --- a/apps/plugins/mpegplayer/audio_thread.c +++ b/apps/plugins/mpegplayer/audio_thread.c | |||
@@ -481,6 +481,7 @@ static void audio_thread(void) | |||
481 | init_mad(); | 481 | init_mad(); |
482 | 482 | ||
483 | td.dsp = rb->dsp_get_config(CODEC_IDX_AUDIO); | 483 | td.dsp = rb->dsp_get_config(CODEC_IDX_AUDIO); |
484 | rb->dsp_configure(td.dsp, DSP_SET_OUT_FREQUENCY, CLOCK_RATE); | ||
484 | #ifdef HAVE_PITCHCONTROL | 485 | #ifdef HAVE_PITCHCONTROL |
485 | rb->sound_set_pitch(PITCH_SPEED_100); | 486 | rb->sound_set_pitch(PITCH_SPEED_100); |
486 | rb->dsp_set_timestretch(PITCH_SPEED_100); | 487 | rb->dsp_set_timestretch(PITCH_SPEED_100); |
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h index 32cc7b25be..4ddf0ca7b1 100644 --- a/apps/plugins/mpegplayer/mpegplayer.h +++ b/apps/plugins/mpegplayer/mpegplayer.h | |||
@@ -44,7 +44,7 @@ | |||
44 | #define AUDIOBUF_ALLOC_SIZE (AUDIOBUF_SIZE+AUDIOBUF_GUARD_SIZE) | 44 | #define AUDIOBUF_ALLOC_SIZE (AUDIOBUF_SIZE+AUDIOBUF_GUARD_SIZE) |
45 | 45 | ||
46 | /** PCM buffer **/ | 46 | /** PCM buffer **/ |
47 | #define CLOCK_RATE NATIVE_FREQUENCY /* Our clock rate in ticks/second (samplerate) */ | 47 | #define CLOCK_RATE 44100 /* Our clock rate in ticks/second (samplerate) */ |
48 | 48 | ||
49 | /* Define this as "1" to have a test tone instead of silence clip */ | 49 | /* Define this as "1" to have a test tone instead of silence clip */ |
50 | #define SILENCE_TEST_TONE 0 | 50 | #define SILENCE_TEST_TONE 0 |
diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 3af8e91adc..82e3584277 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 */ | |||
51 | static int pcm_skipped = 0; | 51 | static int pcm_skipped = 0; |
52 | static int pcm_underruns = 0; | 52 | static int pcm_underruns = 0; |
53 | 53 | ||
54 | static unsigned int old_sampr = 0; | ||
55 | |||
54 | /* Small silence clip. ~5.80ms @ 44.1kHz */ | 56 | /* Small silence clip. ~5.80ms @ 44.1kHz */ |
55 | static int16_t silence[256*2] ALIGNED_ATTR(4) = { 0 }; | 57 | static int16_t silence[256*2] ALIGNED_ATTR(4) = { 0 }; |
56 | 58 | ||
@@ -380,9 +382,13 @@ bool pcm_output_init(void) | |||
380 | } | 382 | } |
381 | #endif | 383 | #endif |
382 | 384 | ||
385 | old_sampr = rb->mixer_get_frequency(); | ||
386 | rb->mixer_set_frequency(CLOCK_RATE); | ||
383 | return true; | 387 | return true; |
384 | } | 388 | } |
385 | 389 | ||
386 | void pcm_output_exit(void) | 390 | void pcm_output_exit(void) |
387 | { | 391 | { |
392 | if (old_sampr != 0) | ||
393 | rb->mixer_set_frequency(old_sampr); | ||
388 | } | 394 | } |
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index a4ec6a8789..4d807493d3 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -1200,13 +1200,14 @@ static long anim_peaks_vertical(void) | |||
1200 | /** Waveform View **/ | 1200 | /** Waveform View **/ |
1201 | 1201 | ||
1202 | #ifdef OSCILLOSCOPE_GRAPHMODE | 1202 | #ifdef OSCILLOSCOPE_GRAPHMODE |
1203 | static int16_t waveform_buffer[2*ALIGN_UP(NATIVE_FREQUENCY, 2048)+2*2048] | 1203 | static int16_t waveform_buffer[2*ALIGN_UP(PLAY_SAMPR_MAX, 2048)+2*2048] |
1204 | MEM_ALIGN_ATTR; | 1204 | MEM_ALIGN_ATTR; |
1205 | static size_t waveform_buffer_threshold = 0; | 1205 | static size_t waveform_buffer_threshold = 0; |
1206 | static size_t volatile waveform_buffer_have = 0; | 1206 | static size_t volatile waveform_buffer_have = 0; |
1207 | static size_t waveform_buffer_break = 0; | 1207 | static size_t waveform_buffer_break = 0; |
1208 | static unsigned long mixer_sampr = PLAY_SAMPR_DEFAULT; | ||
1208 | #define PCM_SAMPLESIZE (2*sizeof(int16_t)) | 1209 | #define PCM_SAMPLESIZE (2*sizeof(int16_t)) |
1209 | #define PCM_BYTERATE (NATIVE_FREQUENCY*PCM_SAMPLESIZE) | 1210 | #define PCM_BYTERATE(sampr) ((sampr)*PCM_SAMPLESIZE) |
1210 | 1211 | ||
1211 | #define WAVEFORM_SCALE_PCM(full_scale, sample) \ | 1212 | #define WAVEFORM_SCALE_PCM(full_scale, sample) \ |
1212 | ((((full_scale) * (sample)) + (1 << 14)) >> 15) | 1213 | ((((full_scale) * (sample)) + (1 << 14)) >> 15) |
@@ -1390,7 +1391,7 @@ static long anim_waveform_horizontal(void) | |||
1390 | return cur_tick + HZ/5; | 1391 | return cur_tick + HZ/5; |
1391 | } | 1392 | } |
1392 | 1393 | ||
1393 | int count = (NATIVE_FREQUENCY*osc_delay + 100*HZ - 1) / (100*HZ); | 1394 | int count = (mixer_sampr*osc_delay + 100*HZ - 1) / (100*HZ); |
1394 | 1395 | ||
1395 | waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); | 1396 | waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); |
1396 | 1397 | ||
@@ -1516,7 +1517,8 @@ static long anim_waveform_horizontal(void) | |||
1516 | osd_lcd_update(); | 1517 | osd_lcd_update(); |
1517 | 1518 | ||
1518 | long delay = get_next_delay(); | 1519 | long delay = get_next_delay(); |
1519 | return cur_tick + delay - waveform_buffer_have * HZ / PCM_BYTERATE; | 1520 | return cur_tick + delay - waveform_buffer_have * HZ / |
1521 | PCM_BYTERATE(mixer_sampr); | ||
1520 | } | 1522 | } |
1521 | 1523 | ||
1522 | static void anim_waveform_plot_filled_v(int y, int y_prev, | 1524 | static void anim_waveform_plot_filled_v(int y, int y_prev, |
@@ -1583,7 +1585,7 @@ static long anim_waveform_vertical(void) | |||
1583 | return cur_tick + HZ/5; | 1585 | return cur_tick + HZ/5; |
1584 | } | 1586 | } |
1585 | 1587 | ||
1586 | int count = (NATIVE_FREQUENCY*osc_delay + 100*HZ - 1) / (100*HZ); | 1588 | int count = (mixer_sampr*osc_delay + 100*HZ - 1) / (100*HZ); |
1587 | 1589 | ||
1588 | waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); | 1590 | waveform_buffer_set_threshold(count*PCM_SAMPLESIZE); |
1589 | 1591 | ||
@@ -1709,7 +1711,8 @@ static long anim_waveform_vertical(void) | |||
1709 | osd_lcd_update(); | 1711 | osd_lcd_update(); |
1710 | 1712 | ||
1711 | long delay = get_next_delay(); | 1713 | long delay = get_next_delay(); |
1712 | return cur_tick + delay - waveform_buffer_have * HZ / PCM_BYTERATE; | 1714 | return cur_tick + delay - waveform_buffer_have * HZ |
1715 | / PCM_BYTERATE(mixer_sampr); | ||
1713 | } | 1716 | } |
1714 | 1717 | ||
1715 | static void anim_waveform_exit(void) | 1718 | static void anim_waveform_exit(void) |
@@ -1872,6 +1875,10 @@ static void osc_setup(void) | |||
1872 | osd_lcd_update(); | 1875 | osd_lcd_update(); |
1873 | #endif | 1876 | #endif |
1874 | 1877 | ||
1878 | #ifdef OSCILLOSCOPE_GRAPHMODE | ||
1879 | mixer_sampr = rb->mixer_get_frequency(); | ||
1880 | #endif | ||
1881 | |||
1875 | /* Turn off backlight timeout */ | 1882 | /* Turn off backlight timeout */ |
1876 | backlight_ignore_timeout(); | 1883 | backlight_ignore_timeout(); |
1877 | graphmode_setup(); | 1884 | graphmode_setup(); |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 7523d9e9aa..0b409f8e35 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) | |||
502 | { | 502 | { |
503 | case DSP_SET_FREQUENCY: | 503 | case DSP_SET_FREQUENCY: |
504 | DEBUGF("samplerate=%d\n",(int)value); | 504 | DEBUGF("samplerate=%d\n",(int)value); |
505 | wavinfo.samplerate = use_dsp ? NATIVE_FREQUENCY : (int)value; | 505 | if (use_dsp) { |
506 | wavinfo.samplerate = rb->dsp_configure( | ||
507 | ci.dsp, DSP_GET_OUT_FREQUENCY, 0); | ||
508 | } else { | ||
509 | wavinfo.samplerate = (int)value; | ||
510 | } | ||
506 | break; | 511 | break; |
507 | 512 | ||
508 | case DSP_SET_SAMPLE_DEPTH: | 513 | case DSP_SET_SAMPLE_DEPTH: |