mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-14 07:32:35 -05:00
rbcodec refactoring: dsp_set_eq_coefs
dsp_set_eq_coefs now has parameters for the band settings, so it doesn't need to access global_settings. Change-Id: I29ac19fc353b15a79cb25f0e45132aef0881e4c9 Reviewed-on: http://gerrit.rockbox.org/138 Reviewed-by: Nils Wallménius <nils@rockbox.org>
This commit is contained in:
parent
79a667d3e2
commit
a6dea9e13d
4 changed files with 15 additions and 13 deletions
|
|
@ -70,12 +70,13 @@ const char* eq_precut_format(char* buffer, size_t buffer_size, int value, const
|
|||
*/
|
||||
static void eq_apply(void)
|
||||
{
|
||||
int i;
|
||||
dsp_set_eq(global_settings.eq_enabled);
|
||||
dsp_set_eq_precut(global_settings.eq_precut);
|
||||
/* Update all bands */
|
||||
for(i = 0; i < 5; i++) {
|
||||
dsp_set_eq_coefs(i);
|
||||
for(int i = 0; i < 5; i++) {
|
||||
dsp_set_eq_coefs(i, global_settings.eq_band_settings[i].cutoff,
|
||||
global_settings.eq_band_settings[i].q,
|
||||
global_settings.eq_band_settings[i].gain);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +579,10 @@ bool eq_menu_graphical(void)
|
|||
|
||||
/* Update the filter if the user changed something */
|
||||
if (has_changed) {
|
||||
dsp_set_eq_coefs(current_band);
|
||||
dsp_set_eq_coefs(current_band,
|
||||
global_settings.eq_band_settings[current_band].cutoff,
|
||||
global_settings.eq_band_settings[current_band].q,
|
||||
global_settings.eq_band_settings[current_band].gain);
|
||||
has_changed = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -988,8 +988,11 @@ void settings_apply(bool read_disk)
|
|||
/* Configure software equalizer, hardware eq is handled in audio_init() */
|
||||
dsp_set_eq(global_settings.eq_enabled);
|
||||
dsp_set_eq_precut(global_settings.eq_precut);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
dsp_set_eq_coefs(i);
|
||||
dsp_set_eq_coefs(i, global_settings.eq_band_settings[i].cutoff,
|
||||
global_settings.eq_band_settings[i].q,
|
||||
global_settings.eq_band_settings[i].gain);
|
||||
}
|
||||
|
||||
dsp_dither_enable(global_settings.dithering_enabled);
|
||||
|
|
|
|||
|
|
@ -951,15 +951,10 @@ void dsp_set_eq_precut(int precut)
|
|||
*
|
||||
* @param band the equalizer band to synchronize
|
||||
*/
|
||||
void dsp_set_eq_coefs(int band)
|
||||
void dsp_set_eq_coefs(int band, int cutoff, int q, int gain)
|
||||
{
|
||||
/* Adjust setting pointer to the band we actually want to change */
|
||||
struct eq_band_setting *setting = &global_settings.eq_band_settings[band];
|
||||
|
||||
/* Convert user settings to format required by coef generator functions */
|
||||
unsigned long cutoff = 0xffffffff / NATIVE_FREQUENCY * setting->cutoff;
|
||||
unsigned long q = setting->q;
|
||||
int gain = setting->gain;
|
||||
cutoff = 0xffffffff / NATIVE_FREQUENCY * cutoff;
|
||||
|
||||
if (q == 0)
|
||||
q = 1;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain,
|
|||
long cutoff);
|
||||
void dsp_set_eq(bool enable);
|
||||
void dsp_set_eq_precut(int precut);
|
||||
void dsp_set_eq_coefs(int band);
|
||||
void dsp_set_eq_coefs(int band, int cutoff, int q, int gain);
|
||||
void dsp_dither_enable(bool enable);
|
||||
void dsp_timestretch_enable(bool enable);
|
||||
bool dsp_timestretch_available(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue