forked from len0rd/rockbox
Enable setting of global output samplerate on certain targets.
Replaces the NATIVE_FREQUENCY constant with a configurable frequency. The user may select 48000Hz if the hardware supports it. The default is still 44100Hz and the minimum is 44100Hz. The setting is located in the playback settings, under "Frequency". "Frequency" was duplicated in english.lang for now to avoid having to fix every .lang file for the moment and throwing everything out of sync because of the new play_frequency feature in features.txt. The next cleanup should combine it with the one included for recording and generalize the ID label. If the hardware doesn't support 48000Hz, no setting will be available. On particular hardware where very high rates are practical and desireable, the upper bound can be extended by patching. The PCM mixer can be configured to play at the full hardware frequency range. The DSP core can configure to the hardware minimum up to the maximum playback setting (some buffers must be reserved according to the maximum rate). If only 44100Hz is supported or possible on a given target for playback, using the DSP and mixer at other samperates is possible if the hardware offers them. Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622 Reviewed-on: http://gerrit.rockbox.org/479 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
This commit is contained in:
parent
00faabef5e
commit
d37bf24d90
44 changed files with 677 additions and 230 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "logf.h"
|
||||
#include "dsp_proc_entry.h"
|
||||
#include "compressor.h"
|
||||
#include "dsp_misc.h"
|
||||
|
||||
static struct compressor_settings curr_set; /* Cached settings */
|
||||
|
||||
|
|
@ -40,7 +41,8 @@ static int32_t release_gain IBSS_ATTR; /* S7.24 format */
|
|||
|
||||
/** COMPRESSOR UPDATE
|
||||
* Called via the menu system to configure the compressor process */
|
||||
static bool compressor_update(const struct compressor_settings *settings)
|
||||
static bool compressor_update(struct dsp_config *dsp,
|
||||
const struct compressor_settings *settings)
|
||||
{
|
||||
/* make settings values useful */
|
||||
int threshold = settings->threshold;
|
||||
|
|
@ -48,9 +50,10 @@ static bool compressor_update(const struct compressor_settings *settings)
|
|||
static const int comp_ratios[] = { 2, 4, 6, 10, 0 };
|
||||
int ratio = comp_ratios[settings->ratio];
|
||||
bool soft_knee = settings->knee == 1;
|
||||
int release = settings->release_time * NATIVE_FREQUENCY / 1000;
|
||||
int release = settings->release_time *
|
||||
dsp_get_output_frequency(dsp) / 1000;
|
||||
|
||||
bool changed = false;
|
||||
bool changed = settings == &curr_set; /* If frequency change */
|
||||
bool active = threshold < 0;
|
||||
|
||||
if (memcmp(settings, &curr_set, sizeof (curr_set)))
|
||||
|
|
@ -300,8 +303,8 @@ static inline int32_t get_compression_gain(struct sample_format *format,
|
|||
void dsp_set_compressor(const struct compressor_settings *settings)
|
||||
{
|
||||
/* enable/disable the compressor depending upon settings */
|
||||
bool enable = compressor_update(settings);
|
||||
struct dsp_config *dsp = dsp_get_config(CODEC_IDX_AUDIO);
|
||||
bool enable = compressor_update(dsp, settings);
|
||||
dsp_proc_enable(dsp, DSP_PROC_COMPRESSOR, enable);
|
||||
dsp_proc_activate(dsp, DSP_PROC_COMPRESSOR, true);
|
||||
}
|
||||
|
|
@ -386,15 +389,20 @@ static intptr_t compressor_configure(struct dsp_proc_entry *this,
|
|||
break; /* Already enabled */
|
||||
|
||||
this->process = compressor_process;
|
||||
/* Won't have been getting frequency updates */
|
||||
compressor_update(dsp, &curr_set);
|
||||
/* Fall-through */
|
||||
case DSP_RESET:
|
||||
case DSP_FLUSH:
|
||||
release_gain = UNITY;
|
||||
break;
|
||||
|
||||
case DSP_SET_OUT_FREQUENCY:
|
||||
compressor_update(dsp, &curr_set);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
(void)dsp;
|
||||
}
|
||||
|
||||
/* Database entry */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue