forked from len0rd/rockbox
SWCODEC: Annoying neatness update. Use intptr_t for codec_configure_callback and dsp_configure and stop all the silly type casting of intergral types to pointers to set dsp configuration and watermarks. Shouldn't have any effect on already compiled codecs at all. Will fix any important patches in the tracker so they compile.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12259 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ce3b774b21
commit
97f369a587
19 changed files with 100 additions and 100 deletions
|
|
@ -164,7 +164,7 @@ struct codec_api {
|
||||||
|
|
||||||
void (*set_offset)(size_t value);
|
void (*set_offset)(size_t value);
|
||||||
/* Configure different codec buffer parameters. */
|
/* Configure different codec buffer parameters. */
|
||||||
void (*configure)(int setting, void *value);
|
void (*configure)(int setting, intptr_t value);
|
||||||
|
|
||||||
void (*splash)(int ticks, bool center, const unsigned char *fmt, ...);
|
void (*splash)(int ticks, bool center, const unsigned char *fmt, ...);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,9 @@ enum codec_status codec_main(void)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*128));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
if (codec_init()) {
|
if (codec_init()) {
|
||||||
|
|
@ -135,7 +135,7 @@ next_track:
|
||||||
while (!ci->taginfo_ready)
|
while (!ci->taginfo_ready)
|
||||||
ci->yield();
|
ci->yield();
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
|
|
||||||
/* Intialise the A52 decoder and check for success */
|
/* Intialise the A52 decoder and check for success */
|
||||||
state = a52_init(0);
|
state = a52_init(0);
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,11 @@ enum codec_status codec_main(void)
|
||||||
unsigned char c = 0;
|
unsigned char c = 0;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
|
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(29));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 29);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
err = CODEC_OK;
|
err = CODEC_OK;
|
||||||
|
|
@ -71,7 +71,7 @@ next_track:
|
||||||
|
|
||||||
sound_samples_done = ci->id3->offset;
|
sound_samples_done = ci->id3->offset;
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
stream_create(&input_stream,ci);
|
stream_create(&input_stream,ci);
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ enum codec_status codec_main(void)
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
/* we only render 16 bits */
|
/* we only render 16 bits */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)16);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
|
||||||
/*ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));*/
|
/*ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);*/
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
DEBUGF("ADX: next_track\n");
|
DEBUGF("ADX: next_track\n");
|
||||||
|
|
@ -73,7 +73,7 @@ next_track:
|
||||||
|
|
||||||
/* Read the entire file (or as much as possible) */
|
/* Read the entire file (or as much as possible) */
|
||||||
DEBUGF("ADX: request initial buffer\n");
|
DEBUGF("ADX: request initial buffer\n");
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(ci->filesize));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, ci->filesize);
|
||||||
ci->seek_buffer(0);
|
ci->seek_buffer(0);
|
||||||
buf = ci->request_buffer(&n, ci->filesize);
|
buf = ci->request_buffer(&n, ci->filesize);
|
||||||
if (!buf || n < 0x38) {
|
if (!buf || n < 0x38) {
|
||||||
|
|
@ -155,11 +155,11 @@ next_track:
|
||||||
bufoff = chanstart;
|
bufoff = chanstart;
|
||||||
|
|
||||||
/* setup pcm buffer format */
|
/* setup pcm buffer format */
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
if (channels == 2) {
|
if (channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
||||||
} else if (channels == 1) {
|
} else if (channels == 1) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF("ADX CODEC_ERROR: more than 2 channels\n");
|
DEBUGF("ADX CODEC_ERROR: more than 2 channels\n");
|
||||||
return CODEC_ERROR;
|
return CODEC_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,9 @@ enum codec_status codec_main(void)
|
||||||
off_t firstblockposn; /* position of the first block in file */
|
off_t firstblockposn; /* position of the first block in file */
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
if (codec_init()) {
|
if (codec_init()) {
|
||||||
|
|
@ -165,12 +165,12 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
|
|
||||||
if (num_channels == 2) {
|
if (num_channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
||||||
} else if (num_channels == 1) {
|
} else if (num_channels == 1) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF("CODEC_ERROR: more than 2 channels unsupported\n");
|
DEBUGF("CODEC_ERROR: more than 2 channels unsupported\n");
|
||||||
i = CODEC_ERROR;
|
i = CODEC_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ enum codec_status codec_main(void)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||||
|
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(ALAC_OUTPUT_DEPTH-1));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, ALAC_OUTPUT_DEPTH-1);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ enum codec_status codec_main(void)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
ci->sleep(1);
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
stream_create(&input_stream,ci);
|
stream_create(&input_stream,ci);
|
||||||
|
|
|
||||||
|
|
@ -425,10 +425,10 @@ enum codec_status codec_main(void)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||||
|
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(FLAC_OUTPUT_DEPTH-1));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, FLAC_OUTPUT_DEPTH-1);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
|
|
||||||
|
|
@ -450,9 +450,9 @@ enum codec_status codec_main(void)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
ci->sleep(1);
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (int *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
ci->configure(DSP_SET_STEREO_MODE, fc.channels == 1 ?
|
ci->configure(DSP_SET_STEREO_MODE, fc.channels == 1 ?
|
||||||
(int *)STEREO_MONO : (int *)STEREO_NONINTERLEAVED);
|
STEREO_MONO : STEREO_NONINTERLEAVED);
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
if (samplesdone) {
|
if (samplesdone) {
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ enum codec_status codec_main(void)
|
||||||
|
|
||||||
/* Create a decoder instance */
|
/* Create a decoder instance */
|
||||||
|
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(MAD_F_FRACBITS));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, MAD_F_FRACBITS);
|
||||||
ci->configure(DSP_SET_CLIP_MIN, (int *)-MAD_F_ONE);
|
ci->configure(DSP_SET_CLIP_MIN, -MAD_F_ONE);
|
||||||
ci->configure(DSP_SET_CLIP_MAX, (int *)(MAD_F_ONE - 1));
|
ci->configure(DSP_SET_CLIP_MAX, MAD_F_ONE - 1);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
status = CODEC_OK;
|
status = CODEC_OK;
|
||||||
|
|
@ -93,7 +93,7 @@ next_track:
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
ci->sleep(1);
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (int *)ci->id3->frequency);
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
current_frequency = ci->id3->frequency;
|
current_frequency = ci->id3->frequency;
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
|
|
@ -212,16 +212,16 @@ next_track:
|
||||||
/* Check if sample rate and stereo settings changed in this frame. */
|
/* Check if sample rate and stereo settings changed in this frame. */
|
||||||
if (frame.header.samplerate != current_frequency) {
|
if (frame.header.samplerate != current_frequency) {
|
||||||
current_frequency = frame.header.samplerate;
|
current_frequency = frame.header.samplerate;
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (int *)current_frequency);
|
ci->configure(DSP_SWITCH_FREQUENCY, current_frequency);
|
||||||
}
|
}
|
||||||
if (MAD_NCHANNELS(&frame.header) == 2) {
|
if (MAD_NCHANNELS(&frame.header) == 2) {
|
||||||
if (current_stereo_mode != STEREO_NONINTERLEAVED) {
|
if (current_stereo_mode != STEREO_NONINTERLEAVED) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
current_stereo_mode = STEREO_NONINTERLEAVED;
|
current_stereo_mode = STEREO_NONINTERLEAVED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (current_stereo_mode != STEREO_MONO) {
|
if (current_stereo_mode != STEREO_MONO) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
current_stereo_mode = STEREO_MONO;
|
current_stereo_mode = STEREO_MONO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,9 @@ enum codec_status codec_main(void)
|
||||||
mpc_streaminfo info;
|
mpc_streaminfo info;
|
||||||
int retval = CODEC_OK;
|
int retval = CODEC_OK;
|
||||||
|
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)(28));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*16));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||||
ci->configure(CODEC_SET_FILEBUF_PRESEEK, (long *)(0));
|
ci->configure(CODEC_SET_FILEBUF_PRESEEK, 0);
|
||||||
|
|
||||||
/* Create a decoder instance */
|
/* Create a decoder instance */
|
||||||
reader.read = read_impl;
|
reader.read = read_impl;
|
||||||
|
|
@ -107,15 +107,15 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
frequency = info.sample_freq / 1000;
|
frequency = info.sample_freq / 1000;
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)info.sample_freq);
|
ci->configure(DSP_SWITCH_FREQUENCY, info.sample_freq);
|
||||||
|
|
||||||
/* set playback engine up for correct number of channels */
|
/* set playback engine up for correct number of channels */
|
||||||
/* NOTE: current musepack format only allows for stereo files
|
/* NOTE: current musepack format only allows for stereo files
|
||||||
but code is here to handle other configurations anyway */
|
but code is here to handle other configurations anyway */
|
||||||
if (info.channels == 2)
|
if (info.channels == 2)
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
else if (info.channels == 1)
|
else if (info.channels == 1)
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
else {
|
else {
|
||||||
retval = CODEC_ERROR;
|
retval = CODEC_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -136,7 +136,7 @@ next_track:
|
||||||
/* Complete seek handler. */
|
/* Complete seek handler. */
|
||||||
if (ci->seek_time) {
|
if (ci->seek_time) {
|
||||||
/* hack to improve seek time if filebuf goes empty */
|
/* hack to improve seek time if filebuf goes empty */
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*512);
|
||||||
mpc_int64_t new_offset = (ci->seek_time - 1)*frequency;
|
mpc_int64_t new_offset = (ci->seek_time - 1)*frequency;
|
||||||
if (mpc_decoder_seek_sample(&decoder, new_offset)) {
|
if (mpc_decoder_seek_sample(&decoder, new_offset)) {
|
||||||
samplesdone = new_offset;
|
samplesdone = new_offset;
|
||||||
|
|
@ -144,7 +144,7 @@ next_track:
|
||||||
}
|
}
|
||||||
ci->seek_complete();
|
ci->seek_complete();
|
||||||
/* reset chunksize */
|
/* reset chunksize */
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*16));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -4321,10 +4321,10 @@ enum codec_status codec_main(void)
|
||||||
int usingplaylist;
|
int usingplaylist;
|
||||||
|
|
||||||
/* we only render 16 bits */
|
/* we only render 16 bits */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)16);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
|
||||||
|
|
||||||
ci->configure(DSP_SET_FREQUENCY, (long*)44100);
|
ci->configure(DSP_SET_FREQUENCY, 44100);
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
|
|
||||||
RebuildOutputTables();
|
RebuildOutputTables();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,11 @@ enum codec_status codec_main(void)
|
||||||
size_t bytesleft;
|
size_t bytesleft;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||||
|
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(SHN_OUTPUT_DEPTH-1));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, SHN_OUTPUT_DEPTH-1);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
/* Codec initialization */
|
/* Codec initialization */
|
||||||
|
|
@ -79,7 +79,7 @@ next_track:
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->id3->frequency = sc.sample_rate;
|
ci->id3->frequency = sc.sample_rate;
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)(sc.sample_rate));
|
ci->configure(DSP_SWITCH_FREQUENCY, sc.sample_rate);
|
||||||
|
|
||||||
if (sc.sample_rate) {
|
if (sc.sample_rate) {
|
||||||
ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000;
|
ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000;
|
||||||
|
|
|
||||||
|
|
@ -1216,8 +1216,8 @@ enum codec_status codec_main(void)
|
||||||
int nSamplesToRender = 0;
|
int nSamplesToRender = 0;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
if (codec_init()) {
|
if (codec_init()) {
|
||||||
|
|
@ -1246,11 +1246,11 @@ next_track:
|
||||||
|
|
||||||
|
|
||||||
/* Make use of 44.1khz */
|
/* Make use of 44.1khz */
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)44100);
|
ci->configure(DSP_SWITCH_FREQUENCY, 44100);
|
||||||
/* Sample depth is 28 bit host endian */
|
/* Sample depth is 28 bit host endian */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
/* Mono output */
|
/* Mono output */
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
|
|
||||||
|
|
||||||
/* Set the elapsed time to the current subsong (in seconds) */
|
/* Set the elapsed time to the current subsong (in seconds) */
|
||||||
|
|
|
||||||
|
|
@ -369,9 +369,9 @@ static void *process_header(spx_ogg_packet *op,
|
||||||
*nframes = header->frames_per_packet;
|
*nframes = header->frames_per_packet;
|
||||||
|
|
||||||
if (*channels == 2) {
|
if (*channels == 2) {
|
||||||
rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
|
rb->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
||||||
} else if (*channels == 1) {
|
} else if (*channels == 1) {
|
||||||
rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
rb->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
}
|
}
|
||||||
|
|
||||||
*extra_headers = header->extra_headers;
|
*extra_headers = header->extra_headers;
|
||||||
|
|
@ -409,9 +409,9 @@ enum codec_status codec_main(void)
|
||||||
int j;
|
int j;
|
||||||
rb = ci;
|
rb = ci;
|
||||||
|
|
||||||
//rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(CHUNKSIZE*128));
|
//rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, CHUNKSIZE*128);
|
||||||
//rb->configure(DSP_DITHER, (bool *)false);
|
//rb->configure(DSP_DITHER, false);
|
||||||
rb->configure(DSP_SET_SAMPLE_DEPTH, (long *)16);
|
rb->configure(DSP_SET_SAMPLE_DEPTH, 16);
|
||||||
|
|
||||||
/* We need to flush reserver memory every track load. */
|
/* We need to flush reserver memory every track load. */
|
||||||
next_track:
|
next_track:
|
||||||
|
|
@ -501,7 +501,7 @@ next_page:
|
||||||
|
|
||||||
rb->id3->vbr = true;
|
rb->id3->vbr = true;
|
||||||
rb->id3->frequency = samplerate;
|
rb->id3->frequency = samplerate;
|
||||||
rb->configure(DSP_SET_FREQUENCY, (int *)(rb->id3->frequency));
|
rb->configure(DSP_SET_FREQUENCY, rb->id3->frequency);
|
||||||
|
|
||||||
/* Speex header in its own page, add the whole page
|
/* Speex header in its own page, add the whole page
|
||||||
headersize */
|
headersize */
|
||||||
|
|
|
||||||
|
|
@ -83,13 +83,13 @@ bool vorbis_set_codec_parameters(OggVorbis_File *vf)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (int *)ci->id3->frequency);
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
if (vi->channels == 2) {
|
if (vi->channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||||
} else if (vi->channels == 1) {
|
} else if (vi->channels == 1) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -112,9 +112,9 @@ enum codec_status codec_main(void)
|
||||||
ogg_uint32_t vf_serialnos;
|
ogg_uint32_t vf_serialnos;
|
||||||
ogg_int64_t vf_pcmlengths[2];
|
ogg_int64_t vf_pcmlengths[2];
|
||||||
|
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)24);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 24);
|
||||||
ci->configure(DSP_SET_CLIP_MAX, (long *)((1 << 24) - 1));
|
ci->configure(DSP_SET_CLIP_MAX, (1 << 24) - 1);
|
||||||
ci->configure(DSP_SET_CLIP_MIN, (long *)-((1 << 24) - 1));
|
ci->configure(DSP_SET_CLIP_MIN, -((1 << 24) - 1));
|
||||||
/* Note: These are sane defaults for these values. Perhaps
|
/* Note: These are sane defaults for these values. Perhaps
|
||||||
* they should be set differently based on quality setting
|
* they should be set differently based on quality setting
|
||||||
*/
|
*/
|
||||||
|
|
@ -122,7 +122,7 @@ enum codec_status codec_main(void)
|
||||||
/* The chunk size below is magic. If set any lower, resume
|
/* The chunk size below is magic. If set any lower, resume
|
||||||
* doesn't work properly (ov_raw_seek() does the wrong thing).
|
* doesn't work properly (ov_raw_seek() does the wrong thing).
|
||||||
*/
|
*/
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*256));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||||
|
|
||||||
/* We need to flush reserver memory every track load. */
|
/* We need to flush reserver memory every track load. */
|
||||||
next_track:
|
next_track:
|
||||||
|
|
|
||||||
|
|
@ -225,9 +225,9 @@ enum codec_status codec_main(void)
|
||||||
|
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
if (codec_init()) {
|
if (codec_init()) {
|
||||||
|
|
@ -379,11 +379,11 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
if (channels == 2) {
|
if (channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
||||||
} else if (channels == 1) {
|
} else if (channels == 1) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF("CODEC_ERROR: more than 2 channels\n");
|
DEBUGF("CODEC_ERROR: more than 2 channels\n");
|
||||||
i = CODEC_ERROR;
|
i = CODEC_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ enum codec_status codec_main(void)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* Generic codec initialisation */
|
/* Generic codec initialisation */
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||||
|
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(28));
|
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||||
|
|
||||||
next_track:
|
next_track:
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ enum codec_status codec_main(void)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
ci->sleep(1);
|
||||||
|
|
||||||
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
/* Create a decoder instance */
|
/* Create a decoder instance */
|
||||||
|
|
@ -70,7 +70,7 @@ enum codec_status codec_main(void)
|
||||||
|
|
||||||
bps = WavpackGetBytesPerSample (wpc);
|
bps = WavpackGetBytesPerSample (wpc);
|
||||||
nchans = WavpackGetReducedChannels (wpc);
|
nchans = WavpackGetReducedChannels (wpc);
|
||||||
ci->configure(DSP_SET_STEREO_MODE, nchans == 2 ? (int *)STEREO_INTERLEAVED : (int *)STEREO_MONO);
|
ci->configure(DSP_SET_STEREO_MODE, nchans == 2 ? STEREO_INTERLEAVED : STEREO_MONO);
|
||||||
sr_100 = ci->id3->frequency / 100;
|
sr_100 = ci->id3->frequency / 100;
|
||||||
|
|
||||||
ci->set_elapsed (0);
|
ci->set_elapsed (0);
|
||||||
|
|
|
||||||
18
apps/dsp.c
18
apps/dsp.c
|
|
@ -128,7 +128,7 @@ void sound_set_pitch(int permille)
|
||||||
{
|
{
|
||||||
pitch_ratio = permille;
|
pitch_ratio = permille;
|
||||||
|
|
||||||
dsp_configure(DSP_SWITCH_FREQUENCY, (int *)dsp->codec_frequency);
|
dsp_configure(DSP_SWITCH_FREQUENCY, dsp->codec_frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert at most count samples to the internal format, if needed. Returns
|
/* Convert at most count samples to the internal format, if needed. Returns
|
||||||
|
|
@ -844,7 +844,7 @@ int dsp_stereo_mode(void)
|
||||||
return dsp->stereo_mode;
|
return dsp->stereo_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dsp_configure(int setting, void *value)
|
bool dsp_configure(int setting, intptr_t value)
|
||||||
{
|
{
|
||||||
dsp = &dsp_conf[current_codec];
|
dsp = &dsp_conf[current_codec];
|
||||||
|
|
||||||
|
|
@ -855,7 +855,7 @@ bool dsp_configure(int setting, void *value)
|
||||||
sizeof(struct resample_data));
|
sizeof(struct resample_data));
|
||||||
/* Fall through!!! */
|
/* Fall through!!! */
|
||||||
case DSP_SWITCH_FREQUENCY:
|
case DSP_SWITCH_FREQUENCY:
|
||||||
dsp->codec_frequency = ((long) value == 0) ? NATIVE_FREQUENCY : (long) value;
|
dsp->codec_frequency = (value == 0) ? NATIVE_FREQUENCY : value;
|
||||||
/* Account for playback speed adjustment when setting dsp->frequency
|
/* Account for playback speed adjustment when setting dsp->frequency
|
||||||
if we're called from the main audio thread. Voice UI thread should
|
if we're called from the main audio thread. Voice UI thread should
|
||||||
not need this feature.
|
not need this feature.
|
||||||
|
|
@ -868,15 +868,15 @@ bool dsp_configure(int setting, void *value)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DSP_SET_CLIP_MIN:
|
case DSP_SET_CLIP_MIN:
|
||||||
dsp->clip_min = (long) value;
|
dsp->clip_min = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DSP_SET_CLIP_MAX:
|
case DSP_SET_CLIP_MAX:
|
||||||
dsp->clip_max = (long) value;
|
dsp->clip_max = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DSP_SET_SAMPLE_DEPTH:
|
case DSP_SET_SAMPLE_DEPTH:
|
||||||
dsp->sample_depth = (long) value;
|
dsp->sample_depth = value;
|
||||||
|
|
||||||
if (dsp->sample_depth <= NATIVE_DEPTH)
|
if (dsp->sample_depth <= NATIVE_DEPTH)
|
||||||
{
|
{
|
||||||
|
|
@ -887,10 +887,10 @@ bool dsp_configure(int setting, void *value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsp->frac_bits = (long) value;
|
dsp->frac_bits = value;
|
||||||
dsp->sample_bytes = 4; /* samples are 32 bits */
|
dsp->sample_bytes = 4; /* samples are 32 bits */
|
||||||
dsp->clip_max = (1 << (long)value) - 1;
|
dsp->clip_max = (1 << value) - 1;
|
||||||
dsp->clip_min = -(1 << (long)value);
|
dsp->clip_min = -(1 << value);
|
||||||
}
|
}
|
||||||
|
|
||||||
dither_init();
|
dither_init();
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ int dsp_process(char *dest, const char *src[], int count);
|
||||||
int dsp_input_count(int count);
|
int dsp_input_count(int count);
|
||||||
int dsp_output_count(int count);
|
int dsp_output_count(int count);
|
||||||
int dsp_stereo_mode(void);
|
int dsp_stereo_mode(void);
|
||||||
bool dsp_configure(int setting, void *value);
|
bool dsp_configure(int setting, intptr_t value);
|
||||||
void dsp_set_replaygain(bool always);
|
void dsp_set_replaygain(bool always);
|
||||||
void dsp_set_crossfeed(bool enable);
|
void dsp_set_crossfeed(bool enable);
|
||||||
void dsp_set_crossfeed_direct_gain(int gain);
|
void dsp_set_crossfeed_direct_gain(int gain);
|
||||||
|
|
|
||||||
|
|
@ -1663,7 +1663,7 @@ static void codec_seek_complete_callback(void)
|
||||||
{
|
{
|
||||||
/* If this is not a seamless seek, clear the buffer */
|
/* If this is not a seamless seek, clear the buffer */
|
||||||
pcmbuf_play_stop();
|
pcmbuf_play_stop();
|
||||||
dsp_configure(DSP_FLUSH, NULL);
|
dsp_configure(DSP_FLUSH, 0);
|
||||||
|
|
||||||
/* If playback was not 'deliberately' paused, unpause now */
|
/* If playback was not 'deliberately' paused, unpause now */
|
||||||
if (!paused)
|
if (!paused)
|
||||||
|
|
@ -1729,20 +1729,20 @@ static bool codec_seek_buffer_callback(size_t newpos)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void codec_configure_callback(int setting, void *value)
|
static void codec_configure_callback(int setting, intptr_t value)
|
||||||
{
|
{
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case CODEC_SET_FILEBUF_WATERMARK:
|
case CODEC_SET_FILEBUF_WATERMARK:
|
||||||
conf_watermark = (unsigned long)value;
|
conf_watermark = value;
|
||||||
set_filebuf_watermark(buffer_margin);
|
set_filebuf_watermark(buffer_margin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODEC_SET_FILEBUF_CHUNKSIZE:
|
case CODEC_SET_FILEBUF_CHUNKSIZE:
|
||||||
conf_filechunk = (unsigned long)value;
|
conf_filechunk = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODEC_SET_FILEBUF_PRESEEK:
|
case CODEC_SET_FILEBUF_PRESEEK:
|
||||||
conf_preseek = (unsigned long)value;
|
conf_preseek = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue