forked from len0rd/rockbox
Get warble building again.
Change-Id: Ibdb2d9064d0e948cfb745c10a7b23de1a750d55b
This commit is contained in:
parent
7cc8bbdaaf
commit
d8f3e3d0d1
1 changed files with 34 additions and 14 deletions
|
@ -75,6 +75,13 @@ void debugf(const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int find_first_set_bit(uint32_t value)
|
||||||
|
{
|
||||||
|
if (value == 0)
|
||||||
|
return 32;
|
||||||
|
return __builtin_ctz(value);
|
||||||
|
}
|
||||||
|
|
||||||
/***************** INTERNAL *****************/
|
/***************** INTERNAL *****************/
|
||||||
|
|
||||||
static enum { MODE_PLAY, MODE_WRITE } mode;
|
static enum { MODE_PLAY, MODE_WRITE } mode;
|
||||||
|
@ -391,17 +398,30 @@ static void ci_pcmbuf_insert(const void *ch1, const void *ch2, int count)
|
||||||
num_output_samples += count;
|
num_output_samples += count;
|
||||||
|
|
||||||
if (use_dsp) {
|
if (use_dsp) {
|
||||||
const char *src[2] = {ch1, ch2};
|
struct dsp_buffer src;
|
||||||
while (count > 0) {
|
src.remcount = count;
|
||||||
int out_count = dsp_output_count(ci.dsp, count);
|
src.pin[0] = ch1;
|
||||||
int in_count = MIN(dsp_input_count(ci.dsp, out_count), count);
|
src.pin[1] = ch2;
|
||||||
|
src.proc_mask = 0;
|
||||||
|
while (1) {
|
||||||
|
int out_count = MAX(count, 512);
|
||||||
int16_t buf[2 * out_count];
|
int16_t buf[2 * out_count];
|
||||||
out_count = dsp_process(ci.dsp, (char *)buf, src, in_count);
|
struct dsp_buffer dst;
|
||||||
if (mode == MODE_WRITE)
|
|
||||||
write_pcm(buf, out_count);
|
dst.remcount = 0;
|
||||||
else if (mode == MODE_PLAY)
|
dst.p16out = buf;
|
||||||
playback_pcm(buf, out_count);
|
dst.bufcount = out_count;
|
||||||
count -= in_count;
|
|
||||||
|
dsp_process(ci.dsp, &src, &dst);
|
||||||
|
|
||||||
|
if (dst.remcount > 0) {
|
||||||
|
if (mode == MODE_WRITE)
|
||||||
|
write_pcm(buf, dst.remcount);
|
||||||
|
else if (mode == MODE_PLAY)
|
||||||
|
playback_pcm(buf, dst.remcount);
|
||||||
|
} else if (src.remcount <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Convert to 32-bit interleaved. */
|
/* Convert to 32-bit interleaved. */
|
||||||
|
@ -601,8 +621,9 @@ static struct codec_api ci = {
|
||||||
ci_semaphore_release,
|
ci_semaphore_release,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ci_cpucache_flush,
|
commit_dcache,
|
||||||
ci_cpucache_invalidate,
|
commit_discard_dcache,
|
||||||
|
commit_discard_idcache,
|
||||||
|
|
||||||
/* strings and memory */
|
/* strings and memory */
|
||||||
strcpy,
|
strcpy,
|
||||||
|
@ -685,7 +706,6 @@ static void decode_file(const char *input_fn)
|
||||||
memset(&global_settings, 0, sizeof(global_settings));
|
memset(&global_settings, 0, sizeof(global_settings));
|
||||||
global_settings.timestretch_enabled = true;
|
global_settings.timestretch_enabled = true;
|
||||||
dsp_timestretch_enable(true);
|
dsp_timestretch_enable(true);
|
||||||
tdspeed_init();
|
|
||||||
|
|
||||||
/* Open file */
|
/* Open file */
|
||||||
if (!strcmp(input_fn, "-")) {
|
if (!strcmp(input_fn, "-")) {
|
||||||
|
@ -708,7 +728,7 @@ static void decode_file(const char *input_fn)
|
||||||
ci.filesize = filesize(input_fd);
|
ci.filesize = filesize(input_fd);
|
||||||
ci.id3 = &id3;
|
ci.id3 = &id3;
|
||||||
if (use_dsp) {
|
if (use_dsp) {
|
||||||
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, CODEC_IDX_AUDIO);
|
ci.dsp = dsp_get_config(CODEC_IDX_AUDIO);
|
||||||
dsp_configure(ci.dsp, DSP_RESET, 0);
|
dsp_configure(ci.dsp, DSP_RESET, 0);
|
||||||
dsp_dither_enable(false);
|
dsp_dither_enable(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue