[submodule "pico/cd/libchdr"]
path = pico/cd/libchdr
url = https://github.com/rtissera/libchdr.git
-[submodule "platform/common/minimp3"]
- path = platform/common/minimp3
- url = https://github.com/lieff/minimp3
[submodule "platform/common/dr_libs"]
path = platform/common/dr_libs
url = https://github.com/mackron/dr_libs
}
}
-void p32x_pwm_update(int *buf32, int length, int stereo)
+void p32x_pwm_update(s32 *buf32, int length, int stereo)
{
short *pwmb;
int step;
// external funcs for Sega/Mega CD\r
extern int mp3_get_bitrate(void *f, int size);\r
extern void mp3_start_play(void *f, int pos);\r
-extern void mp3_update(int *buffer, int length, int stereo);\r
+extern void mp3_update(s32 *buffer, int length, int stereo);\r
\r
// this function should write-back d-cache and invalidate i-cache\r
// on a mem region [start_addr, end_addr)\r
#define PICO_SSH2_HZ ((int)(7670442.0 * 2.4))\r
\r
// sound.c\r
-extern void (*PsndMix_32_to_16l)(short *dest, int *src, int count);\r
+extern void (*PsndMix_32_to_16l)(s16 *dest, s32 *src, int count);\r
void PsndRerate(int preserve_state);\r
\r
// media.c\r
int len_e_cnt;\r
unsigned int clkl_mult; // z80 clocks per line in Q20\r
unsigned int smpl_mult; // samples per line in Q16\r
+ unsigned int cdda_mult, cdda_div; // 44.1 KHz resampling factor in Q16\r
short dac_val, dac_val2; // last DAC sample\r
unsigned int dac_pos; // last DAC position in Q20\r
unsigned int fm_pos; // last FM position in Q20\r
// 32x/pwm.c\r
unsigned int p32x_pwm_read16(u32 a, SH2 *sh2, unsigned int m68k_cycles);\r
void p32x_pwm_write16(u32 a, unsigned int d, SH2 *sh2, unsigned int m68k_cycles);\r
-void p32x_pwm_update(int *buf32, int length, int stereo);\r
+void p32x_pwm_update(s32 *buf32, int length, int stereo);\r
void p32x_pwm_ctl_changed(void);\r
void p32x_pwm_schedule(unsigned int m68k_now);\r
void p32x_pwm_schedule_sh2(SH2 *sh2);\r
*/
#include <string.h>
+#include "../pico_int.h"
#define MAXOUT (+32767)
#define MINOUT (-32768)
/* limitter */
#define Limit16(val) \
val -= val >> 3; /* reduce level to avoid clipping */ \
- if ((short)val != val) val = (val < 0 ? MINOUT : MAXOUT)
+ if ((s16)val != val) val = (val < 0 ? MINOUT : MAXOUT)
int mix_32_to_16l_level;
lfi2 = lf, rfi2 = rf; \
}
-void mix_32_to_16l_stereo_lvl(short *dest, int *src, int count)
+void mix_32_to_16l_stereo_lvl(s16 *dest, s32 *src, int count)
{
mix_32_to_16l_stereo_core(dest, src, count, mix_32_to_16l_level, filter);
}
-void mix_32_to_16l_stereo(short *dest, int *src, int count)
+void mix_32_to_16l_stereo(s16 *dest, s32 *src, int count)
{
mix_32_to_16l_stereo_core(dest, src, count, 0, filter);
}
-void mix_32_to_16_mono(short *dest, int *src, int count)
+void mix_32_to_16_mono(s16 *dest, s32 *src, int count)
{
int l;
struct iir lf = lfi2;
}
-void mix_16h_to_32(int *dest_buf, short *mp3_buf, int count)
+void mix_16h_to_32(s32 *dest_buf, s16 *mp3_buf, int count)
{
while (count--)
{
}
}
-void mix_16h_to_32_s1(int *dest_buf, short *mp3_buf, int count)
+void mix_16h_to_32_s1(s32 *dest_buf, s16 *mp3_buf, int count)
{
count >>= 1;
while (count--)
}
}
-void mix_16h_to_32_s2(int *dest_buf, short *mp3_buf, int count)
+void mix_16h_to_32_s2(s32 *dest_buf, s16 *mp3_buf, int count)
{
count >>= 1;
while (count--)
}
}
+// mixes cdda audio @44.1 KHz into dest_buf, resampling with nearest neighbour
+void mix_16h_to_32_resample_stereo(s32 *dest_buf, s16 *cdda_buf, int count, int fac16)
+{
+ int pos16 = 0;
+ while (count--) {
+ int pos = 2 * (pos16>>16);
+ *dest_buf++ += cdda_buf[pos ] >> 1;
+ *dest_buf++ += cdda_buf[pos+1] >> 1;
+ pos16 += fac16;
+ }
+}
+
+// mixes cdda audio @44.1 KHz into dest_buf, resampling with nearest neighbour
+void mix_16h_to_32_resample_mono(s32 *dest_buf, s16 *cdda_buf, int count, int fac16)
+{
+ int pos16 = 0;
+ while (count--) {
+ int pos = 2 * (pos16>>16);
+ *dest_buf += cdda_buf[pos ] >> 2;
+ *dest_buf++ += cdda_buf[pos+1] >> 2;
+ pos16 += fac16;
+ }
+}
+
void mix_reset(int alpha_q16)
{
memset(&lfi2, 0, sizeof(lfi2));
//void mix_32_to_32(int *dest, int *src, int count);
-void mix_16h_to_32(int *dest, short *src, int count);
-void mix_16h_to_32_s1(int *dest, short *src, int count);
-void mix_16h_to_32_s2(int *dest, short *src, int count);
-void mix_32_to_16l_stereo(short *dest, int *src, int count);
-void mix_32_to_16_mono(short *dest, int *src, int count);
+void mix_16h_to_32(s32 *dest, s16 *src, int count);
+void mix_16h_to_32_s1(s32 *dest, s16 *src, int count);
+void mix_16h_to_32_s2(s32 *dest, s16 *src, int count);
+
+void mix_16h_to_32_resample_stereo(s32 *dest, s16 *src, int count, int fac16);
+void mix_16h_to_32_resample_mono(s32 *dest, s16 *src, int count, int fac16);
+void mix_32_to_16l_stereo(s16 *dest, s32 *src, int count);
+void mix_32_to_16_mono(s16 *dest, s32 *src, int count);
extern int mix_32_to_16l_level;
-void mix_32_to_16l_stereo_lvl(short *dest, int *src, int count);
+void mix_32_to_16l_stereo_lvl(s16 *dest, s32 *src, int count);
void mix_reset(int alpha_q16);
+.global mix_16h_to_32_resample_stereo @ int *dest, short *src, int count, int fac16
+
+mix_16h_to_32_resample_stereo:
+ stmfd sp!, {r4-r9,lr}
+
+ subs r2, r2, #2
+ mov r4, #0
+ bmi m16_32_rss_end
+
+m16_32_rss_loop:
+ ldmia r0, {r5-r8}
+ lsr r9, r4, #16
+ ldr r12,[r1, r9, lsl #2]
+ add r4, r4, r3
+ lsr r9, r4, #16
+ ldr lr ,[r1, r9, lsl #2]
+ add r4, r4, r3
+ subs r2, r2, #2
+ add r6, r6, r12,asr #17
+ mov r12,r12,lsl #16
+ add r5, r5, r12,asr #17 @ we use half volume
+ add r8, r8, lr, asr #17
+ mov lr, lr, lsl #16
+ add r7, r7, lr, asr #17
+ stmia r0!,{r5-r8}
+ bpl m16_32_rss_loop
+
+m16_32_rss_end:
+ tst r2, #1
+ ldmeqfd sp!, {r4-r9,pc}
+ lsr r9, r4, #16
+ ldr lr ,[r1, r9, lsl #2]
+ ldmia r0, {r5,r6}
+ mov r12,lr, lsl #16
+ add r5, r5, r12,asr #17
+ add r6, r6, lr, asr #17
+ stmia r0!,{r5,r6}
+
+ ldmfd sp!, {r4-r9,lr}
+ bx lr
+
+
+
+.global mix_16h_to_32_resample_mono @ int *dest, short *src, int count, int fac16
+
+mix_16h_to_32_resample_mono:
+ stmfd sp!, {r4-r6,r9,lr}
+
+ subs r2, r2, #2
+ mov r4, #0
+ bmi m16_32_rsm_end
+
+m16_32_rsm_loop:
+ ldmia r0, {r5-r6}
+ lsr r9, r4, #16
+ ldr r12,[r1, r9, lsl #2]
+ add r4, r4, r3
+ lsr r9, r4, #16
+ ldr lr ,[r1, r9, lsl #2]
+ add r4, r4, r3
+ subs r2, r2, #2
+ add r5, r5, r12,asr #18
+ mov r12,r12,lsl #16
+ add r5, r5, r12,asr #18 @ we use half volume (= quarter vol per channel)
+ add r6, r6, lr, asr #18
+ mov lr, lr, lsl #16
+ add r6, r6, lr, asr #18
+ stmia r0!,{r5-r6}
+ bpl m16_32_rsm_loop
+
+m16_32_rsm_end:
+ tst r2, #1
+ ldmeqfd sp!, {r4-r6,r9,pc}
+ lsr r9, r4, #16
+ ldr lr ,[r1, r9, lsl #2]
+ ldr r5, [r0]
+ mov r12,lr, lsl #16
+ add r5, r5, r12,asr #18
+ add r5, r5, lr, asr #18
+ str r5, [r0]
+
+ ldmfd sp!, {r4-r6,r9,lr}
+ bx lr
+
+
+
@ limit
@ reg=int_sample, r12=1, r8=tmp, kills flags
.macro Limit reg
#include "mix.h"\r
#include "emu2413/emu2413.h"\r
\r
-void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo;\r
+void (*PsndMix_32_to_16l)(s16 *dest, s32 *src, int count) = mix_32_to_16l_stereo;\r
\r
// master int buffer to mix to\r
// +1 for a fill triggered by an instruction overhanging into the next scanline\r
Pico.snd.smpl_mult = 65536LL * PicoIn.sndRate / (target_fps*target_lines);\r
// samples per z80 clock (Q20)\r
Pico.snd.clkl_mult = 16 * Pico.snd.smpl_mult * 15/7 / 488;\r
+ // samples per 44.1 KHz sample\r
+ Pico.snd.cdda_mult = 65536LL * 44100 / PicoIn.sndRate;\r
+ Pico.snd.cdda_div = 65536LL * PicoIn.sndRate / 44100;\r
\r
// clear all buffers\r
memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4);\r
// y[n] = (x[n] + x[n-1])*(1/2) (3dB cutoff at 11025 Hz, no gain)\r
// 1 sample delay for correct IIR filtering over audio frame boundaries\r
if (PicoIn.opt & POPT_EN_STEREO) {\r
- short *d = PicoIn.sndOut + pos*2;\r
+ s16 *d = PicoIn.sndOut + pos*2;\r
// left channel only, mixed ro right channel in mixing phase\r
*d++ += Pico.snd.dac_val2; d++;\r
while (--len) *d++ += Pico.snd.dac_val, d++;\r
} else {\r
- short *d = PicoIn.sndOut + pos;\r
+ s16 *d = PicoIn.sndOut + pos;\r
*d++ += Pico.snd.dac_val2;\r
while (--len) *d++ += Pico.snd.dac_val;\r
}\r
{\r
int pos, len;\r
int stereo = 0;\r
- short *buf;\r
+ s16 *buf;\r
\r
// nothing to do if sound is off\r
if (!PicoIn.sndOut) return;\r
}\r
\r
// cdda\r
-static void cdda_raw_update(int *buffer, int length)\r
+static void cdda_raw_update(s32 *buffer, int length, int stereo)\r
{\r
- int ret, cdda_bytes, mult = 1;\r
+ int ret, cdda_bytes;\r
\r
- cdda_bytes = length*4;\r
- if (PicoIn.sndRate <= 22050 + 100) mult = 2;\r
- if (PicoIn.sndRate < 22050 - 100) mult = 4;\r
- cdda_bytes *= mult;\r
+ cdda_bytes = (length * Pico.snd.cdda_mult >> 16) * 4;\r
\r
ret = pm_read_audio(cdda_out_buffer, cdda_bytes, Pico_mcd->cdda_stream);\r
if (ret < cdda_bytes) {\r
}\r
\r
// now mix\r
- switch (mult) {\r
- case 1: mix_16h_to_32(buffer, cdda_out_buffer, length*2); break;\r
- case 2: mix_16h_to_32_s1(buffer, cdda_out_buffer, length*2); break;\r
- case 4: mix_16h_to_32_s2(buffer, cdda_out_buffer, length*2); break;\r
- }\r
+ if (stereo) switch (Pico.snd.cdda_mult) {\r
+ case 0x10000: mix_16h_to_32(buffer, cdda_out_buffer, length*2); break;\r
+ case 0x20000: mix_16h_to_32_s1(buffer, cdda_out_buffer, length*2); break;\r
+ case 0x40000: mix_16h_to_32_s2(buffer, cdda_out_buffer, length*2); break;\r
+ default: mix_16h_to_32_resample_stereo(buffer, cdda_out_buffer, length, Pico.snd.cdda_mult);\r
+ } else\r
+ mix_16h_to_32_resample_mono(buffer, cdda_out_buffer, length, Pico.snd.cdda_mult);\r
}\r
\r
void cdda_start_play(int lba_base, int lba_offset, int lb_len)\r
if (PicoIn.opt & POPT_EN_STEREO)\r
memset32((int *) PicoIn.sndOut, 0, len); // assume PicoIn.sndOut to be aligned\r
else {\r
- short *out = PicoIn.sndOut;\r
+ s16 *out = PicoIn.sndOut;\r
if ((uintptr_t)out & 2) { *out++ = 0; len--; }\r
memset32((int *) out, 0, len/2);\r
if (len & 1) out[len-1] = 0;\r
\r
if (PicoIn.AHW & PAHW_PICO) {\r
// XXX ugly hack, need to render sound for interrupts\r
- s16 *buf16 = PicoIn.sndOut ? PicoIn.sndOut : (short *)PsndBuffer;\r
+ s16 *buf16 = PicoIn.sndOut ? PicoIn.sndOut : (s16 *)PsndBuffer;\r
PicoPicoPCMUpdate(buf16+(offset<<stereo), length-offset, stereo);\r
return length;\r
}\r
\r
// Fill up DAC output in case of missing samples (Q rounding errors)\r
if (length-daclen > 0 && PicoIn.sndOut) {\r
- short *dacbuf = PicoIn.sndOut + (daclen << stereo);\r
+ s16 *dacbuf = PicoIn.sndOut + (daclen << stereo);\r
Pico.snd.dac_pos += (length-daclen) << 20;\r
*dacbuf++ += Pico.snd.dac_val2;\r
if (stereo) dacbuf++;\r
\r
// Add in parts of the PSG output not yet done\r
if (length-psglen > 0 && PicoIn.sndOut) {\r
- short *psgbuf = PicoIn.sndOut + (psglen << stereo);\r
+ s16 *psgbuf = PicoIn.sndOut + (psglen << stereo);\r
Pico.snd.psg_pos += (length-psglen) << 20;\r
if (PicoIn.opt & POPT_EN_PSG)\r
SN76496Update(psgbuf, length-psglen, stereo);\r
\r
// Add in parts of the FM buffer not yet done\r
if (length-fmlen > 0 && PicoIn.sndOut) {\r
- int *fmbuf = buf32 + ((fmlen-offset) << stereo);\r
+ s32 *fmbuf = buf32 + ((fmlen-offset) << stereo);\r
Pico.snd.fm_pos += (length-fmlen) << 20;\r
if (PicoIn.opt & POPT_EN_FM)\r
YM2612UpdateOne(fmbuf, length-fmlen, stereo, 1);\r
&& Pico_mcd->cdda_stream != NULL\r
&& !(Pico_mcd->s68k_regs[0x36] & 1))\r
{\r
- // note: only 44, 22 and 11 kHz supported, with forced stereo\r
if (Pico_mcd->cdda_type == CT_MP3)\r
mp3_update(buf32, length-offset, stereo);\r
else\r
- cdda_raw_update(buf32, length-offset);\r
+ cdda_raw_update(buf32, length-offset, stereo);\r
}\r
\r
if ((PicoIn.AHW & PAHW_32X) && (PicoIn.opt & POPT_EN_PWM))\r
\r
// Add in parts of the PSG output not yet done\r
if (length-psglen > 0) {\r
- short *psgbuf = PicoIn.sndOut + (psglen << stereo);\r
+ s16 *psgbuf = PicoIn.sndOut + (psglen << stereo);\r
Pico.snd.psg_pos += (length-psglen) << 20;\r
if (PicoIn.opt & POPT_EN_PSG)\r
SN76496Update(psgbuf, length-psglen, stereo);\r
}\r
\r
if (length-ym2413len > 0) {\r
- short *ym2413buf = PicoIn.sndOut + (ym2413len << stereo);\r
+ s16 *ym2413buf = PicoIn.sndOut + (ym2413len << stereo);\r
Pico.snd.ym2413_pos += (length-ym2413len) << 20;\r
int len = (length-ym2413len);\r
if (PicoIn.opt & POPT_EN_YM2413){\r
// upmix to "stereo" if needed\r
if (PicoIn.opt & POPT_EN_STEREO) {\r
int i;\r
- short *p;\r
- for (i = length, p = (short *)PicoIn.sndOut; i > 0; i--, p+=2)\r
+ s16 *p;\r
+ for (i = length, p = (s16 *)PicoIn.sndOut; i > 0; i--, p+=2)\r
*(p + 1) = *p;\r
}\r
\r
return smp;\r
}\r
\r
-static void chan_render_loop(chan_rend_context *ct, int *buffer, int length)\r
+static void chan_render_loop(chan_rend_context *ct, s32 *buffer, int length)\r
{\r
int scounter; /* sample counter */\r
\r
}\r
}\r
#else\r
-void chan_render_loop(chan_rend_context *ct, int *buffer, unsigned short length);\r
+void chan_render_loop(chan_rend_context *ct, s32 *buffer, unsigned short length);\r
#endif\r
\r
static chan_rend_context crct;\r
crct.lfo_inc = ym2612.OPN.lfo_inc;\r
}\r
\r
-static void chan_render_finish(int *buffer, unsigned short length, int active_chans)\r
+static void chan_render_finish(s32 *buffer, unsigned short length, int active_chans)\r
{\r
ym2612.OPN.eg_cnt = crct.eg_cnt;\r
ym2612.OPN.eg_timer = crct.eg_timer;\r
return SLOT->Incr;\r
}\r
\r
-static int chan_render(int *buffer, int length, int c, UINT32 flags) // flags: stereo, ?, disabled, ?, pan_r, pan_l\r
+static int chan_render(s32 *buffer, int length, int c, UINT32 flags) // flags: stereo, ?, disabled, ?, pan_r, pan_l\r
{\r
crct.CH = &ym2612.CH[c];\r
crct.mem = crct.CH->mem_value; /* one sample delay memory */\r
/*******************************************************************************/\r
\r
/* Generate samples for YM2612 */\r
-int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty)\r
+int YM2612UpdateOne_(s32 *buffer, int length, int stereo, int is_buf_empty)\r
{\r
int pan;\r
int active_chs = 0;\r
\r
void YM2612Init_(int baseclock, int rate, int flags);\r
void YM2612ResetChip_(void);\r
-int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty);\r
+int YM2612UpdateOne_(s32 *buffer, int length, int stereo, int is_buf_empty);\r
\r
int YM2612Write_(unsigned int a, unsigned int v);\r
//unsigned char YM2612Read_(void);\r
#include "menu_pico.h"
#include "emu.h"
-#include <pico/pico.h>
+#include <pico/pico_int.h>
// always output DOS endlines
#ifdef _WIN32
+++ /dev/null
-Subproject commit 95864e8e0d3b34402a49ae9af6c66f7e98c13c35
mp3dec_decode(mp3_current_file, &mp3_file_pos, mp3_file_len);
}
-void mp3_update(int *buffer, int length, int stereo)
+void mp3_update(s32 *buffer, int length, int stereo)
{
- int length_mp3, shr = 0;
- void (*mix_samples)(int *dest_buf, short *mp3_buf, int count) = mix_16h_to_32;
+ int length_mp3;
+ void (*mix_samples)(int *dest_buf, short *mp3_buf, int count, int fac16) = mix_16h_to_32_resample_stereo;
if (mp3_current_file == NULL || mp3_file_pos >= mp3_file_len)
return; /* no file / EOF */
if (!decoder_active)
return;
- length_mp3 = length;
- if (PicoIn.sndRate <= 11025 + 100) {
- mix_samples = mix_16h_to_32_s2;
- length_mp3 <<= 2; shr = 2;
- }
- else if (PicoIn.sndRate <= 22050 + 100) {
- mix_samples = mix_16h_to_32_s1;
- length_mp3 <<= 1; shr = 1;
- }
+ length_mp3 = length * Pico.snd.cdda_mult >> 16;
+ if (!stereo)
+ mix_samples = mix_16h_to_32_resample_mono;
if (1152 - cdda_out_pos >= length_mp3) {
mix_samples(buffer, cdda_out_buffer + cdda_out_pos * 2,
- length * 2);
+ length, Pico.snd.cdda_mult);
cdda_out_pos += length_mp3;
} else {
- int ret, left = 1152 - cdda_out_pos;
+ int left = (1152 - cdda_out_pos) * Pico.snd.cdda_div >> 16;
+ int ret, sm = stereo ? 2 : 1;
if (left > 0)
mix_samples(buffer, cdda_out_buffer + cdda_out_pos * 2,
- (left >> shr) * 2);
+ left, Pico.snd.cdda_mult);
ret = mp3dec_decode(mp3_current_file, &mp3_file_pos,
mp3_file_len);
if (ret == 0) {
- cdda_out_pos = length_mp3 - left;
- mix_samples(buffer + (left >> shr) * 2,
- cdda_out_buffer,
- (cdda_out_pos >> shr) * 2);
+ mix_samples(buffer + left * sm, cdda_out_buffer,
+ length-left, Pico.snd.cdda_mult);
+ cdda_out_pos = (length-left) * Pico.snd.cdda_mult >> 16;
} else
cdda_out_pos = 0;
}
}
-void mp3_update(int *buffer, int length, int stereo)
+void mp3_update(s32 *buffer, int length, int stereo)
{
int length_mp3;
// playback was started, track not ended
if (mp3_handle < 0 || mp3_src_pos >= mp3_src_size) return;
- length_mp3 = length;
- if (PicoIn.sndRate == 22050) length_mp3 <<= 1; // mp3s are locked to 44100Hz stereo
- else if (PicoIn.sndRate == 11025) length_mp3 <<= 2; // so make length 44100ish
+ length_mp3 = length * Pico.snd.cdda_mult >> 16;
/* do we have to wait? */
if (mp3_job_started && mp3_samples_ready < length_mp3)
/* mix mp3 data, only stereo */
if (mp3_samples_ready >= length_mp3)
{
- int shr = 0;
- void (*mix_samples)(int *dest_buf, short *mp3_buf, int count) = mix_16h_to_32;
- if (PicoIn.sndRate == 22050) { mix_samples = mix_16h_to_32_s1; shr = 1; }
- else if (PicoIn.sndRate == 11025) { mix_samples = mix_16h_to_32_s2; shr = 2; }
+ void (*mix_samples)(s32 *dest_buf, s16 *mp3_buf, int count, int fac16) = mix_16h_to_32_resample_stereo;
+ if (!stereo)
+ mix_samples = mix_16h_to_32_resample_mono;
if (1152 - mp3_buffer_offs >= length_mp3) {
- mix_samples(buffer, mp3_mix_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, length<<1);
+ mix_samples(buffer, mp3_mix_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, length, Pico.snd.cdda_mult);
mp3_buffer_offs += length_mp3;
} else {
// collect samples from both buffers..
- int left = 1152 - mp3_buffer_offs;
+ int left = (1152 - mp3_buffer_offs) * Pico.snd.cdda_div >> 16;
+ int sm = stereo ? 2 : 1;
+
if (mp3_play_bufsel == 0)
{
- mix_samples(buffer, mp3_mix_buffer[0] + mp3_buffer_offs*2, length<<1);
- mp3_buffer_offs = length_mp3 - left;
+ mix_samples(buffer, mp3_mix_buffer[0] + mp3_buffer_offs*2, length, Pico.snd.cdda_mult);
mp3_play_bufsel = 1;
} else {
- mix_samples(buffer, mp3_mix_buffer[1] + mp3_buffer_offs*2, (left>>shr)<<1);
- mp3_buffer_offs = length_mp3 - left;
- mix_samples(buffer + ((left>>shr)<<1),
- mp3_mix_buffer[0], (mp3_buffer_offs>>shr)<<1);
+ mix_samples(buffer, mp3_mix_buffer[1] + mp3_buffer_offs*2, left, Pico.snd.cdda_mult);
+ mix_samples(buffer + left * sm,
+ mp3_mix_buffer[0], (length-left), Pico.snd.cdda_mult);
mp3_play_bufsel = 0;
}
+ mp3_buffer_offs = (length-left) * Pico.snd.cdda_mult >> 16;
}
mp3_samples_ready -= length_mp3;
}