mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
sound, fix mcd cdda (mono, resampling), type cleanup, remove minimp3
This commit is contained in:
parent
9f1d5acdb4
commit
f7741cac91
14 changed files with 193 additions and 89 deletions
|
@ -24,7 +24,7 @@ static char *mystrip(char *str);
|
|||
|
||||
#include "menu_pico.h"
|
||||
#include "emu.h"
|
||||
#include <pico/pico.h>
|
||||
#include <pico/pico_int.h>
|
||||
|
||||
// always output DOS endlines
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 95864e8e0d3b34402a49ae9af6c66f7e98c13c35
|
|
@ -128,10 +128,10 @@ void mp3_start_play(void *f_, int pos1024)
|
|||
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 */
|
||||
|
@ -139,35 +139,29 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue