forked from len0rd/rockbox
rbcodec dsp: Replace enum dsp_ids arguments with unsigned int
Because casting to and from "enum dsp_id" just adds noise, change everything to unsigned int. Change-Id: I52a7ae55f406e673d5b811b29657fcdc4b62ab10
This commit is contained in:
parent
b96b7640de
commit
34a092a997
9 changed files with 19 additions and 27 deletions
|
@ -714,7 +714,7 @@ struct plugin_api {
|
|||
#endif
|
||||
intptr_t (*dsp_configure)(struct dsp_config *dsp,
|
||||
unsigned int setting, intptr_t value);
|
||||
struct dsp_config * (*dsp_get_config)(enum dsp_ids id);
|
||||
struct dsp_config * (*dsp_get_config)(unsigned int dsp_id);
|
||||
void (*dsp_process)(struct dsp_config *dsp, struct dsp_buffer *src,
|
||||
struct dsp_buffer *dst);
|
||||
|
||||
|
|
|
@ -483,24 +483,19 @@ intptr_t dsp_configure(struct dsp_config *dsp, unsigned int setting,
|
|||
return proc_broadcast(dsp, setting, value);
|
||||
}
|
||||
|
||||
struct dsp_config * dsp_get_config(enum dsp_ids id)
|
||||
struct dsp_config *dsp_get_config(unsigned int dsp_id)
|
||||
{
|
||||
if (id >= DSP_COUNT)
|
||||
if (dsp_id >= DSP_COUNT)
|
||||
return NULL;
|
||||
|
||||
return &dsp_conf[id];
|
||||
return &dsp_conf[dsp_id];
|
||||
}
|
||||
|
||||
/* Return the id given a dsp pointer (or even via something within
|
||||
the struct itself) */
|
||||
enum dsp_ids dsp_get_id(const struct dsp_config *dsp)
|
||||
unsigned int dsp_get_id(const struct dsp_config *dsp)
|
||||
{
|
||||
ptrdiff_t id = dsp - dsp_conf;
|
||||
|
||||
if (id < 0 || id >= DSP_COUNT)
|
||||
return DSP_COUNT; /* obviously invalid */
|
||||
|
||||
return (enum dsp_ids)id;
|
||||
return dsp - dsp_conf;
|
||||
}
|
||||
|
||||
/* Do what needs initializing before enable/disable calls can be made.
|
||||
|
|
|
@ -128,10 +128,10 @@ static inline void dsp_advance_buffer32(struct dsp_buffer *buf,
|
|||
}
|
||||
|
||||
/* Get DSP pointer */
|
||||
struct dsp_config * dsp_get_config(enum dsp_ids id);
|
||||
struct dsp_config *dsp_get_config(unsigned int dsp_id);
|
||||
|
||||
/* Get DSP id */
|
||||
enum dsp_ids dsp_get_id(const struct dsp_config *dsp);
|
||||
unsigned int dsp_get_id(const struct dsp_config *dsp);
|
||||
|
||||
/** General DSP processing **/
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ unsigned int dsp_get_output_frequency(struct dsp_config *dsp)
|
|||
return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0);
|
||||
}
|
||||
|
||||
static void misc_dsp_init(struct dsp_config *dsp, enum dsp_ids dsp_id)
|
||||
static void misc_dsp_init(struct dsp_config *dsp, unsigned int dsp_id)
|
||||
{
|
||||
/* Enable us for the audio DSP at startup */
|
||||
if (dsp_id == CODEC_IDX_AUDIO)
|
||||
|
@ -168,7 +168,7 @@ static intptr_t misc_handler_configure(struct dsp_proc_entry *this,
|
|||
switch (setting)
|
||||
{
|
||||
case DSP_INIT:
|
||||
misc_dsp_init(dsp, (enum dsp_ids)value);
|
||||
misc_dsp_init(dsp, value);
|
||||
break;
|
||||
|
||||
case DSP_PROC_CLOSE:
|
||||
|
|
|
@ -242,8 +242,7 @@ void dsp_sample_input_flush(struct sample_io_data *this)
|
|||
this->sample_buf.remcount = 0;
|
||||
}
|
||||
|
||||
void dsp_sample_input_init(struct sample_io_data *this,
|
||||
enum dsp_ids dsp_id)
|
||||
void dsp_sample_input_init(struct sample_io_data *this, unsigned int dsp_id)
|
||||
{
|
||||
int32_t *lbuf, *rbuf;
|
||||
|
||||
|
@ -260,7 +259,7 @@ void dsp_sample_input_init(struct sample_io_data *this,
|
|||
|
||||
default:
|
||||
/* orly */
|
||||
DEBUGF("DSP Input- unknown dsp %d\n", (int)dsp_id);
|
||||
DEBUGF("DSP Input- unknown dsp %u\n", dsp_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ bool dsp_sample_io_configure(struct sample_io_data *this,
|
|||
{
|
||||
case DSP_INIT:
|
||||
this->output_sampr = DSP_OUT_DEFAULT_HZ;
|
||||
dsp_sample_input_init(this, (enum dsp_ids)value);
|
||||
dsp_sample_input_init(this, value);
|
||||
dsp_sample_output_init(this);
|
||||
break;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ struct sample_io_data
|
|||
uint8_t output_version; /* Format version of src buffer at output */
|
||||
};
|
||||
|
||||
void dsp_sample_input_init(struct sample_io_data *this, enum dsp_ids dsp_id);
|
||||
void dsp_sample_input_init(struct sample_io_data *this, unsigned int dsp_id);
|
||||
void dsp_sample_input_flush(struct sample_io_data *this);
|
||||
void dsp_sample_input_format_change(struct sample_io_data *this,
|
||||
struct sample_format *format);
|
||||
|
|
|
@ -262,8 +262,7 @@ static intptr_t resample_new_format(struct dsp_proc_entry *this,
|
|||
return PROC_NEW_FORMAT_DEACTIVATED;
|
||||
}
|
||||
|
||||
static void resample_dsp_init(struct dsp_config *dsp,
|
||||
enum dsp_ids dsp_id)
|
||||
static void resample_dsp_init(struct dsp_config *dsp, unsigned int dsp_id)
|
||||
{
|
||||
int32_t *lbuf, *rbuf;
|
||||
|
||||
|
@ -280,7 +279,7 @@ static void resample_dsp_init(struct dsp_config *dsp,
|
|||
|
||||
default:
|
||||
/* huh? */
|
||||
DEBUGF("DSP_PROC_RESAMPLE- unknown DSP %d\n", (int)dsp_id);
|
||||
DEBUGF("DSP_PROC_RESAMPLE- unknown DSP %u\n", dsp_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -312,7 +311,7 @@ static intptr_t resample_configure(struct dsp_proc_entry *this,
|
|||
switch (setting)
|
||||
{
|
||||
case DSP_INIT:
|
||||
resample_dsp_init(dsp, (enum dsp_ids)value);
|
||||
resample_dsp_init(dsp, value);
|
||||
break;
|
||||
|
||||
case DSP_FLUSH:
|
||||
|
|
|
@ -521,8 +521,7 @@ static intptr_t tdspeed_new_format(struct dsp_proc_entry *this,
|
|||
(void)this;
|
||||
}
|
||||
|
||||
static void tdspeed_dsp_init(struct tdspeed_state_s *st,
|
||||
enum dsp_ids dsp_id)
|
||||
static void tdspeed_dsp_init(struct tdspeed_state_s *st, unsigned int dsp_id)
|
||||
{
|
||||
/* everything is at 100% until dsp_set_timestretch is called with
|
||||
some other value and timestretch is enabled at the time */
|
||||
|
@ -543,7 +542,7 @@ static intptr_t tdspeed_configure(struct dsp_proc_entry *this,
|
|||
switch (setting)
|
||||
{
|
||||
case DSP_INIT:
|
||||
tdspeed_dsp_init(st, (enum dsp_ids)value);
|
||||
tdspeed_dsp_init(st, value);
|
||||
break;
|
||||
|
||||
case DSP_FLUSH:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue