Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: pcm_set_frequency is ignored

Re: pcm_set_frequency is ignored

From: Christian Gmeiner <christian.gmeiner_at_gmail.com>
Date: Sun, 31 Aug 2008 15:56:40 +0000

2008/8/31 Joseph Garvin <k04jg02_at_gmail.com>:
> On Sun, Aug 31, 2008 at 3:05 AM, Magnus Holmgren <lear_at_algonet.se> wrote:
>>
>> Joseph Garvin wrote:
>>
>>> To shrink my plugin size I'm trying to convert my sound samples to be
>>> 22050hz instead of 44100. But when I do this the sound always plays too fast
>>> like a chipmunk. I'm calling pcm_set_frequency(22050) but no matter what
>>> number I give it (I tested crazy values like 100) I get the same result. It
>>> always tries to play at 44100hz. I'm trying on the Sansa e200 simulator. Is
>>> this a limitation of the simulator or maybe of the e200? If so it'd be nice
>>> to get some sort of console warning.
>>
>> pcm_set_frequency sets the frequency of the hardware, but it is usually
>> quite limited in what frequencies it supports. Try dsp_configure, using
>> DSP_SWITCH_FREQUENCY, to set the frequency. See the mpegplayer audio thread
>> for an example.
>
> I tried:
>
> struct dsp_config* dsp = (struct dsp_config *)rb->dsp_configure(NULL,
> DSP_MYDSP,
>
> CODEC_IDX_AUDIO);
> rb->dsp_configure(dsp, DSP_SWITCH_FREQUENCY, 22050);
> rb->pcm_set_frequency(22050);
> rb->pcm_apply_settings();
>
> But this still had no effect, at least in the simulator. Do I need to use
> dsp_process somehow? It's unclear to me how it works. I'm still playing the
> sound with pcm_play_data.
>

The uisimulator is not using rockboxs dsp yet, I have here some basic
code to use the dsp for bass, treble settings. The
frequency stuff is on todo for the audioapi. Maybe I will find some
time to commit some stuff during the coming week.

-- 
BSc, Christian Gmeiner
Received on 2008-08-31

Page was last modified "Jan 10 2012" The Rockbox Crew
aaa