mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
cue/bin finally implemented
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@434 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
9037e45d9f
commit
c9e1affca5
13 changed files with 147 additions and 94 deletions
|
@ -24,7 +24,6 @@ extern "C" {
|
|||
// external funcs for Sega/Mega CD
|
||||
int mp3_get_bitrate(FILE *f, int size);
|
||||
void mp3_start_play(FILE *f, int pos);
|
||||
int mp3_get_offset(void); // 0-1023
|
||||
void mp3_update(int *buffer, int length, int stereo);
|
||||
|
||||
|
||||
|
@ -91,6 +90,7 @@ int PicoCdLoadStateGfx(void *file);
|
|||
// cd/buffering.c
|
||||
void PicoCDBufferInit(void);
|
||||
void PicoCDBufferFree(void);
|
||||
void PicoCDBufferFlush(void);
|
||||
|
||||
// cd/cd_sys.c
|
||||
int Insert_CD(char *iso_name, int is_bin);
|
||||
|
|
|
@ -322,9 +322,7 @@ struct mcd_misc
|
|||
unsigned char s68k_pend_ints;
|
||||
unsigned int state_flags; // 04: emu state: reset_pending, dmna_pending
|
||||
unsigned int counter75hz;
|
||||
unsigned short audio_offset; // 0c: for savestates: play pointer offset (0-1023)
|
||||
unsigned char audio_track; // playing audio track # (zero based)
|
||||
char pad1;
|
||||
unsigned int pad0;
|
||||
int timer_int3; // 10
|
||||
unsigned int timer_stopwatch;
|
||||
unsigned char bcram_reg; // 18: battery-backed RAM cart register
|
||||
|
@ -455,6 +453,8 @@ PICO_INTERNAL int SekResetS68k(void);
|
|||
PICO_INTERNAL int SekInterruptS68k(int irq);
|
||||
|
||||
// sound/sound.c
|
||||
PICO_INTERNAL void cdda_start_play();
|
||||
extern short cdda_out_buffer[2*1152];
|
||||
extern int PsndLen_exc_cnt;
|
||||
extern int PsndLen_exc_add;
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ PICO_INTERNAL int PicoCdSaveState(void *file)
|
|||
|
||||
if (PicoAHW & PAHW_MCD)
|
||||
{
|
||||
Pico_mcd->m.audio_offset = mp3_get_offset();
|
||||
memset(buff, 0, sizeof(buff));
|
||||
PicoAreaPackCpu(buff, 1);
|
||||
if (Pico_mcd->s68k_regs[3]&4) // 1M mode?
|
||||
|
@ -280,8 +279,8 @@ PICO_INTERNAL int PicoCdLoadState(void *file)
|
|||
if (Pico_mcd->s68k_regs[3]&4)
|
||||
PicoMemResetCDdecode(Pico_mcd->s68k_regs[3]);
|
||||
#endif
|
||||
if (Pico_mcd->m.audio_track > 0 && Pico_mcd->m.audio_track < Pico_mcd->TOC.Last_Track)
|
||||
mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset);
|
||||
if (!(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1))
|
||||
cdda_start_play();
|
||||
// restore hint vector
|
||||
*(unsigned short *)(Pico_mcd->bios + 0x72) = Pico_mcd->m.hint_vector;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,13 @@ void PicoCDBufferFree(void)
|
|||
}
|
||||
|
||||
|
||||
/* this is a try to fight slow SD access of GP2X */
|
||||
void PicoCDBufferFlush(void)
|
||||
{
|
||||
prev_lba = 0x80000000;
|
||||
}
|
||||
|
||||
|
||||
/* this is was a try to fight slow SD access of GP2X */
|
||||
PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba)
|
||||
{
|
||||
int is_bin, offs, read_len, moved = 0;
|
||||
|
|
|
@ -115,8 +115,10 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
if (cue_data->tracks[2].fname == NULL) { // NULL means track2 is in same file as track1
|
||||
Cur_LBA = Tracks[0].Length = cue_data->tracks[2].sector_offset;
|
||||
}
|
||||
i = 100 / cue_data->track_count+1;
|
||||
for (num_track = 2; num_track <= cue_data->track_count; num_track++)
|
||||
{
|
||||
if (PicoCDLoadProgressCB != NULL) PicoCDLoadProgressCB(i * num_track);
|
||||
index = num_track - 1;
|
||||
Cur_LBA += cue_data->tracks[num_track].pregap;
|
||||
if (cue_data->tracks[num_track].type == CT_MP3) {
|
||||
|
@ -128,7 +130,7 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
Tracks[index].ftype = cue_data->tracks[num_track].type;
|
||||
if (cue_data->tracks[num_track].fname != NULL)
|
||||
{
|
||||
Tracks[index].F = fopen(cue_data->tracks[num_track].fname, "rb");
|
||||
Tracks[index].F = pm_open(cue_data->tracks[num_track].fname);
|
||||
elprintf(EL_STATUS, "track %2i (%s): can't determine length",
|
||||
cue_data->tracks[num_track].fname);
|
||||
Tracks[index].Length = 2*75;
|
||||
|
@ -154,7 +156,7 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
goto finish;
|
||||
}
|
||||
|
||||
/* track autosearch, Gens-like */
|
||||
/* mp3 track autosearch, Gens-like */
|
||||
iso_name_len = strlen(cd_img_name);
|
||||
if (iso_name_len >= sizeof(tmp_name))
|
||||
iso_name_len = sizeof(tmp_name) - 1;
|
||||
|
@ -194,7 +196,7 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (ret != 0) missed++;
|
||||
if (ret != 0 && i > 1) missed++;
|
||||
}
|
||||
|
||||
finish:
|
||||
|
@ -225,12 +227,14 @@ PICO_INTERNAL void Unload_ISO(void)
|
|||
{
|
||||
if (Pico_mcd->TOC.Tracks[i].F != NULL)
|
||||
{
|
||||
if (Pico_mcd->TOC.Tracks[i].ftype == TYPE_MP3)
|
||||
#if DONT_OPEN_MANY_FILES
|
||||
if (Pico_mcd->TOC.Tracks[i].type == TYPE_MP3)
|
||||
free(Pico_mcd->TOC.Tracks[i].F);
|
||||
else
|
||||
#endif
|
||||
#else
|
||||
fclose(Pico_mcd->TOC.Tracks[i].F);
|
||||
#endif
|
||||
else
|
||||
pm_close(Pico_mcd->TOC.Tracks[i].F);
|
||||
}
|
||||
}
|
||||
memset(Pico_mcd->TOC.Tracks, 0, sizeof(Pico_mcd->TOC.Tracks));
|
||||
|
@ -239,8 +243,6 @@ PICO_INTERNAL void Unload_ISO(void)
|
|||
|
||||
PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
|
||||
{
|
||||
// static char cp_buf[2560];
|
||||
|
||||
if (Pico_mcd->s68k_regs[0x36] & 1) // DATA
|
||||
{
|
||||
if (Pico_mcd->TOC.Tracks[0].F == NULL) return -1;
|
||||
|
@ -253,15 +255,6 @@ PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
|
|||
}
|
||||
else // AUDIO
|
||||
{
|
||||
// int rate, channel;
|
||||
|
||||
// if (Pico_mcd->TOC.Tracks[Pico_mcd->scd.Cur_Track - 1].ftype == TYPE_MP3)
|
||||
{
|
||||
// TODO
|
||||
// MP3_Update(cp_buf, &rate, &channel, 0);
|
||||
// Write_CD_Audio((short *) cp_buf, rate, channel, 588);
|
||||
}
|
||||
|
||||
cdprintf("Read file CDC 1 audio sector :\n");
|
||||
}
|
||||
|
||||
|
@ -324,7 +317,8 @@ PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
|
|||
{
|
||||
// CAUTION : lookahead bit not implemented
|
||||
|
||||
//memcpy(&Pico_mcd->cdc.Buffer[Pico_mcd->cdc.PT.N], cp_buf, 2352);
|
||||
// this is pretty rough, but oh well - not much depends on this anyway
|
||||
memcpy(&Pico_mcd->cdc.Buffer[Pico_mcd->cdc.PT.N], cdda_out_buffer, 2352);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -362,34 +356,3 @@ PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PICO_INTERNAL int FILE_Play_CD_LBA(void)
|
||||
{
|
||||
int index = Pico_mcd->scd.Cur_Track - 1;
|
||||
Pico_mcd->m.audio_track = index;
|
||||
|
||||
cdprintf("Play track #%i", Pico_mcd->scd.Cur_Track);
|
||||
|
||||
if (Pico_mcd->TOC.Tracks[index].F == NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Pico_mcd->TOC.Tracks[index].ftype == TYPE_MP3)
|
||||
{
|
||||
int pos1024 = 0;
|
||||
int Track_LBA_Pos = Pico_mcd->scd.Cur_LBA - Track_to_LBA(Pico_mcd->scd.Cur_Track);
|
||||
if (Track_LBA_Pos < 0) Track_LBA_Pos = 0;
|
||||
if (Track_LBA_Pos)
|
||||
pos1024 = Track_LBA_Pos * 1024 / Pico_mcd->TOC.Tracks[index].Length;
|
||||
|
||||
mp3_start_play(Pico_mcd->TOC.Tracks[index].F, pos1024);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ extern "C" {
|
|||
#define TYPE_ISO 1
|
||||
#define TYPE_BIN 2
|
||||
#define TYPE_MP3 3
|
||||
//#define TYPE_WAV 4
|
||||
#define TYPE_WAV 4
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -23,7 +23,6 @@ cd_img_type;
|
|||
PICO_INTERNAL int Load_CD_Image(const char *iso_name, cd_img_type type);
|
||||
PICO_INTERNAL void Unload_ISO(void);
|
||||
PICO_INTERNAL int FILE_Read_One_LBA_CDC(void);
|
||||
PICO_INTERNAL int FILE_Play_CD_LBA(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -489,8 +489,7 @@ PICO_INTERNAL int Play_CDD_c3(void)
|
|||
else
|
||||
{
|
||||
Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
|
||||
//CD_Audio_Starting = 1;
|
||||
FILE_Play_CD_LBA();
|
||||
cdda_start_play();
|
||||
}
|
||||
|
||||
if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;
|
||||
|
@ -592,8 +591,7 @@ PICO_INTERNAL int Resume_CDD_c7(void)
|
|||
else
|
||||
{
|
||||
Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
|
||||
//CD_Audio_Starting = 1;
|
||||
FILE_Play_CD_LBA();
|
||||
cdda_start_play();
|
||||
}
|
||||
|
||||
if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;
|
||||
|
|
|
@ -60,17 +60,24 @@ static char *get_ext(char *fname)
|
|||
/* note: tracks[0] is not used */
|
||||
cue_data_t *cue_parse(const char *fname)
|
||||
{
|
||||
char buff[256], current_file[256], buff2[32];
|
||||
char buff[256], current_file[256], buff2[32], *current_filep;
|
||||
FILE *f, *tmpf;
|
||||
int ret, count = 0, count_alloc = 2;
|
||||
int ret, count = 0, count_alloc = 2, pending_pregap = 0;
|
||||
cue_data_t *data;
|
||||
void *tmp;
|
||||
|
||||
f = fopen(fname, "r");
|
||||
if (f == NULL) return NULL;
|
||||
|
||||
current_file[0] = 0;
|
||||
snprintf(current_file, sizeof(current_file), "%s", fname);
|
||||
for (current_filep = current_file + strlen(current_file); current_filep > current_file; current_filep--)
|
||||
if (current_filep[-1] == '/' || current_filep[-1] == '\\') break;
|
||||
|
||||
data = calloc(1, sizeof(*data) + count_alloc * sizeof(cue_track));
|
||||
if (data == NULL) {
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (!feof(f))
|
||||
{
|
||||
|
@ -79,11 +86,13 @@ cue_data_t *cue_parse(const char *fname)
|
|||
|
||||
mystrip(buff);
|
||||
if (buff[0] == 0) continue;
|
||||
if (BEGINS(buff, "TITLE ") || BEGINS(buff, "PERFORMER "))
|
||||
if (BEGINS(buff, "REM"))
|
||||
continue;
|
||||
else if (BEGINS(buff, "TITLE ") || BEGINS(buff, "PERFORMER ") || BEGINS(buff, "SONGWRITER "))
|
||||
continue; /* who would put those here? Ignore! */
|
||||
else if (BEGINS(buff, "FILE "))
|
||||
{
|
||||
get_token(buff+5, current_file, sizeof(current_file));
|
||||
get_token(buff+5, current_filep, sizeof(current_file) - (current_filep - current_file));
|
||||
}
|
||||
else if (BEGINS(buff, "TRACK "))
|
||||
{
|
||||
|
@ -107,6 +116,8 @@ cue_data_t *cue_parse(const char *fname)
|
|||
}
|
||||
fclose(tmpf);
|
||||
}
|
||||
data->tracks[count].pregap = pending_pregap;
|
||||
pending_pregap = 0;
|
||||
// track number
|
||||
ret = get_token(buff+6, buff2, sizeof(buff2));
|
||||
if (count != atoi(buff2))
|
||||
|
@ -172,7 +183,7 @@ cue_data_t *cue_parse(const char *fname)
|
|||
data->tracks[count].fname = strdup(current_file);
|
||||
}
|
||||
}
|
||||
else if (BEGINS(buff, "PREGAP "))
|
||||
else if (BEGINS(buff, "PREGAP ") || BEGINS(buff, "POSTGAP "))
|
||||
{
|
||||
int m, s, f;
|
||||
get_token(buff+7, buff2, sizeof(buff2));
|
||||
|
@ -181,7 +192,12 @@ cue_data_t *cue_parse(const char *fname)
|
|||
elprintf(EL_STATUS, "cue: failed to parse: \"%s\"", buff);
|
||||
continue;
|
||||
}
|
||||
data->tracks[count].pregap = m*60*75 + s*75 + f;
|
||||
// pregap overrides previous postgap?
|
||||
// by looking at some .cues produced by some programs I've decided that..
|
||||
if (BEGINS(buff, "PREGAP "))
|
||||
data->tracks[count].pregap = m*60*75 + s*75 + f;
|
||||
else
|
||||
pending_pregap = m*60*75 + s*75 + f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -23,6 +23,9 @@ static int PsndBuffer[2*44100/50];
|
|||
// dac
|
||||
static unsigned short dac_info[312]; // pppppppp ppppllll, p - pos in buff, l - length to write for this sample
|
||||
|
||||
// cdda output buffer
|
||||
short cdda_out_buffer[2*1152];
|
||||
|
||||
// for Pico
|
||||
int PsndRate=0;
|
||||
int PsndLen=0; // number of mono samples, multiply by 2 for stereo
|
||||
|
@ -119,16 +122,14 @@ void PsndRerate(int preserve_state)
|
|||
state = malloc(0x200);
|
||||
if (state == NULL) return;
|
||||
memcpy(state, YM2612GetRegs(), 0x200);
|
||||
if ((PicoAHW & PAHW_MCD) && Pico_mcd->m.audio_track)
|
||||
Pico_mcd->m.audio_offset = mp3_get_offset();
|
||||
}
|
||||
YM2612Init(Pico.m.pal ? OSC_PAL/7 : OSC_NTSC/7, PsndRate);
|
||||
if (preserve_state) {
|
||||
// feed it back it's own registers, just like after loading state
|
||||
memcpy(YM2612GetRegs(), state, 0x200);
|
||||
YM2612PicoStateLoad();
|
||||
if ((PicoAHW & PAHW_MCD) && Pico_mcd->m.audio_track)
|
||||
mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset);
|
||||
if ((PicoAHW & PAHW_MCD) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1))
|
||||
cdda_start_play();
|
||||
}
|
||||
|
||||
if (preserve_state) memcpy(state, sn76496_regs, 28*4); // remember old state
|
||||
|
@ -151,6 +152,7 @@ void PsndRerate(int preserve_state)
|
|||
|
||||
// clear all buffers
|
||||
memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4);
|
||||
memset(cdda_out_buffer, 0, sizeof(cdda_out_buffer));
|
||||
if (PsndOut)
|
||||
PsndClear();
|
||||
|
||||
|
@ -208,6 +210,76 @@ PICO_INTERNAL void Psnd_timers_and_dac(int raster)
|
|||
#endif
|
||||
}
|
||||
|
||||
// cdda
|
||||
static pm_file *cdda_stream = NULL;
|
||||
|
||||
static void cdda_raw_update(int *buffer, int length)
|
||||
{
|
||||
int ret, cdda_bytes;
|
||||
if (cdda_stream == NULL) return;
|
||||
|
||||
cdda_bytes = length*4;
|
||||
if (PsndRate <= 22050) cdda_bytes *= 2;
|
||||
if (PsndRate < 22050) cdda_bytes *= 2;
|
||||
|
||||
ret = pm_read(cdda_out_buffer, cdda_bytes, cdda_stream);
|
||||
if (ret < cdda_bytes) {
|
||||
memset((char *)cdda_out_buffer + ret, 0, cdda_bytes - ret);
|
||||
cdda_stream = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// now mix
|
||||
switch (PsndRate) {
|
||||
case 44100: mix_16h_to_32(buffer, cdda_out_buffer, length*2); break;
|
||||
case 22050: mix_16h_to_32_s1(buffer, cdda_out_buffer, length*2); break;
|
||||
case 11025: mix_16h_to_32_s2(buffer, cdda_out_buffer, length*2); break;
|
||||
}
|
||||
}
|
||||
|
||||
PICO_INTERNAL void cdda_start_play(void)
|
||||
{
|
||||
int lba_offset, index, lba_length, i;
|
||||
|
||||
elprintf(EL_STATUS, "cdda play track #%i", Pico_mcd->scd.Cur_Track);
|
||||
|
||||
index = Pico_mcd->scd.Cur_Track - 1;
|
||||
|
||||
lba_offset = Pico_mcd->scd.Cur_LBA - Track_to_LBA(index + 1);
|
||||
if (lba_offset < 0) lba_offset = 0;
|
||||
lba_offset += Pico_mcd->TOC.Tracks[index].Offset;
|
||||
|
||||
// find the actual file for this track
|
||||
for (i = index; i >= 0; i--)
|
||||
if (Pico_mcd->TOC.Tracks[i].F != NULL) break;
|
||||
|
||||
if (Pico_mcd->TOC.Tracks[i].F == NULL) {
|
||||
elprintf(EL_STATUS|EL_ANOMALY, "no track?!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pico_mcd->TOC.Tracks[i].ftype == TYPE_MP3)
|
||||
{
|
||||
int pos1024 = 0;
|
||||
|
||||
lba_length = Pico_mcd->TOC.Tracks[i].Length;
|
||||
for (i++; i < Pico_mcd->TOC.Last_Track; i++) {
|
||||
if (Pico_mcd->TOC.Tracks[i].F != NULL) break;
|
||||
lba_length += Pico_mcd->TOC.Tracks[i].Length;
|
||||
}
|
||||
|
||||
if (lba_offset)
|
||||
pos1024 = lba_offset * 1024 / lba_length;
|
||||
|
||||
mp3_start_play(Pico_mcd->TOC.Tracks[index].F, pos1024);
|
||||
return;
|
||||
}
|
||||
|
||||
cdda_stream = Pico_mcd->TOC.Tracks[i].F;
|
||||
PicoCDBufferFlush(); // buffering relies on fp not being touched
|
||||
pm_seek(cdda_stream, lba_offset * 2352, SEEK_SET);
|
||||
}
|
||||
|
||||
|
||||
PICO_INTERNAL void PsndClear(void)
|
||||
{
|
||||
|
@ -267,7 +339,15 @@ PICO_INTERNAL int PsndRender(int offset, int length)
|
|||
// CD mode, cdda enabled, not data track, CDC is reading
|
||||
if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_CDDA) &&
|
||||
!(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1))
|
||||
mp3_update(buf32, length, stereo);
|
||||
{
|
||||
// note: only 44, 22 and 11 kHz supported, with forced stereo
|
||||
int index = Pico_mcd->scd.Cur_Track - 1;
|
||||
|
||||
if (Pico_mcd->TOC.Tracks[index].ftype == TYPE_MP3)
|
||||
mp3_update(buf32, length, stereo);
|
||||
else
|
||||
cdda_raw_update(buf32, length);
|
||||
}
|
||||
|
||||
// convert + limit to normal 16bit output
|
||||
PsndMix_32_to_16l(PsndOut+offset, buf32, length);
|
||||
|
@ -276,6 +356,9 @@ PICO_INTERNAL int PsndRender(int offset, int length)
|
|||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// z80 stuff
|
||||
|
||||
|
||||
#if defined(_USE_MZ80)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "helix/pub/mp3dec.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
static short mp3_out_buffer[2*1152];
|
||||
static HMP3Decoder mp3dec = 0;
|
||||
static int mp3_buffer_offs = 0;
|
||||
|
||||
|
@ -94,7 +93,7 @@ static int mp3_decode(void)
|
|||
readPtr += offset;
|
||||
bytesLeft -= offset;
|
||||
|
||||
err = MP3Decode(mp3dec, &readPtr, &bytesLeft, mp3_out_buffer, 0);
|
||||
err = MP3Decode(mp3dec, &readPtr, &bytesLeft, cdda_out_buffer, 0);
|
||||
if (err) {
|
||||
if (err == ERR_MP3_INDATA_UNDERFLOW) {
|
||||
shared_ctl->mp3_offs = shared_ctl->mp3_len; // EOF
|
||||
|
@ -119,7 +118,7 @@ void mp3_start_local(void)
|
|||
|
||||
#define mp3_update mp3_update_local
|
||||
|
||||
#else
|
||||
#else // !__GP2X__
|
||||
|
||||
static FILE *mp3_current_file = NULL;
|
||||
static int mp3_file_len = 0, mp3_file_pos = 0;
|
||||
|
@ -148,7 +147,7 @@ static int mp3_decode(void)
|
|||
readPtr = mp3_input_buffer + offset;
|
||||
bytesLeft -= offset;
|
||||
|
||||
err = MP3Decode(mp3dec, &readPtr, &bytesLeft, mp3_out_buffer, 0);
|
||||
err = MP3Decode(mp3dec, &readPtr, &bytesLeft, cdda_out_buffer, 0);
|
||||
if (err) {
|
||||
//lprintf("MP3Decode err (%i/%i) %i\n", mp3_file_pos, mp3_file_len, err);
|
||||
if (err == ERR_MP3_INDATA_UNDERFLOW) {
|
||||
|
@ -232,17 +231,17 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
else if (PsndRate == 11025) { mix_samples = mix_16h_to_32_s2; length_mp3 <<= 2; shr = 2; }
|
||||
|
||||
if (1152 - mp3_buffer_offs >= length_mp3) {
|
||||
mix_samples(buffer, mp3_out_buffer + mp3_buffer_offs*2, length<<1);
|
||||
mix_samples(buffer, cdda_out_buffer + mp3_buffer_offs*2, length<<1);
|
||||
|
||||
mp3_buffer_offs += length_mp3;
|
||||
} else {
|
||||
int ret, left = 1152 - mp3_buffer_offs;
|
||||
|
||||
mix_samples(buffer, mp3_out_buffer + mp3_buffer_offs*2, (left>>shr)<<1);
|
||||
mix_samples(buffer, cdda_out_buffer + mp3_buffer_offs*2, (left>>shr)<<1);
|
||||
ret = mp3_decode();
|
||||
if (ret == 0) {
|
||||
mp3_buffer_offs = length_mp3 - left;
|
||||
mix_samples(buffer + ((left>>shr)<<1), mp3_out_buffer, (mp3_buffer_offs>>shr)<<1);
|
||||
mix_samples(buffer + ((left>>shr)<<1), cdda_out_buffer, (mp3_buffer_offs>>shr)<<1);
|
||||
} else
|
||||
mp3_buffer_offs = 0;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pi
|
|||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/cue.o ../../Pico/cd/gfx_cd.o \
|
||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||
endif
|
||||
# Pico - Pico
|
||||
OBJS += ../../Pico/Pico/Pico.o ../../Pico/Pico/Memory.o
|
||||
# Pico - carthw
|
||||
OBJS += ../../Pico/carthw/carthw.o ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o \
|
||||
../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/compiler.o ../../Pico/carthw/svp/stub_arm.o
|
||||
|
|
|
@ -205,9 +205,3 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
|
|||
}
|
||||
|
||||
|
||||
int mp3_get_offset(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,12 +76,6 @@ int EmuFrame()
|
|||
}
|
||||
|
||||
|
||||
|
||||
int mp3_get_offset(void) // 0-1023
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mp3_update(int *buffer, int length, int stereo)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue