mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
wav support, better mp3 length handling using .cue
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@436 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
c0fcf293c1
commit
0bccafebb6
5 changed files with 55 additions and 16 deletions
|
@ -105,7 +105,7 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
Tracks[0].MSF.S = 2; // seconds
|
||||
Tracks[0].MSF.F = 0; // frames
|
||||
|
||||
elprintf(EL_STATUS, "Track 0: %02d:%02d:%02d %9i DATA",
|
||||
elprintf(EL_STATUS, "Track 1: %02d:%02d:%02d %9i DATA",
|
||||
Tracks[0].MSF.M, Tracks[0].MSF.S, Tracks[0].MSF.F, Tracks[0].Length);
|
||||
|
||||
Cur_LBA = Tracks[0].Length = cd_img_sectors;
|
||||
|
@ -130,12 +130,24 @@ 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 = 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;
|
||||
Tracks[index].Offset = 0;
|
||||
} else {
|
||||
pm_file *pmfn = pm_open(cue_data->tracks[num_track].fname);
|
||||
if (pmfn != NULL)
|
||||
{
|
||||
// addume raw, ignore header for wav..
|
||||
Tracks[index].F = pmfn;
|
||||
Tracks[index].Length = pmfn->size / 2352;
|
||||
Tracks[index].Offset = cue_data->tracks[num_track].sector_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
elprintf(EL_STATUS, "track %2i (%s): can't determine length",
|
||||
num_track, cue_data->tracks[num_track].fname);
|
||||
Tracks[index].Length = 2*75;
|
||||
Tracks[index].Offset = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_track < cue_data->track_count)
|
||||
Tracks[index].Length = cue_data->tracks[num_track+1].sector_offset -
|
||||
cue_data->tracks[num_track].sector_offset;
|
||||
|
@ -145,10 +157,14 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
}
|
||||
}
|
||||
|
||||
if (cue_data->tracks[num_track].sector_xlength != 0)
|
||||
// overriden by custom cue command
|
||||
Tracks[index].Length = cue_data->tracks[num_track].sector_xlength;
|
||||
|
||||
LBA_to_MSF(Cur_LBA, &Tracks[index].MSF);
|
||||
Cur_LBA += Tracks[index].Length;
|
||||
|
||||
elprintf(EL_STATUS, "Track %2i: %02d:%02d:%02d %9i AUDIO - %s", index, Tracks[index].MSF.M,
|
||||
elprintf(EL_STATUS, "Track %2i: %02d:%02d:%02d %9i AUDIO - %s", num_track, Tracks[index].MSF.M,
|
||||
Tracks[index].MSF.S, Tracks[index].MSF.F, Tracks[index].Length,
|
||||
cue_data->tracks[num_track].fname);
|
||||
}
|
||||
|
@ -188,7 +204,7 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type)
|
|||
LBA_to_MSF(Cur_LBA, &Tracks[index].MSF);
|
||||
Cur_LBA += Tracks[index].Length;
|
||||
|
||||
elprintf(EL_STATUS, "Track %2i: %02d:%02d:%02d %9i AUDIO - %s", index, Tracks[index].MSF.M,
|
||||
elprintf(EL_STATUS, "Track %2i: %02d:%02d:%02d %9i AUDIO - %s", num_track, Tracks[index].MSF.M,
|
||||
Tracks[index].MSF.S, Tracks[index].MSF.F, Tracks[index].Length, tmp_name);
|
||||
|
||||
num_track++;
|
||||
|
|
|
@ -86,9 +86,7 @@ cue_data_t *cue_parse(const char *fname)
|
|||
|
||||
mystrip(buff);
|
||||
if (buff[0] == 0) continue;
|
||||
if (BEGINS(buff, "REM"))
|
||||
continue;
|
||||
else if (BEGINS(buff, "TITLE ") || BEGINS(buff, "PERFORMER ") || BEGINS(buff, "SONGWRITER "))
|
||||
if (BEGINS(buff, "TITLE ") || BEGINS(buff, "PERFORMER ") || BEGINS(buff, "SONGWRITER "))
|
||||
continue; /* who would put those here? Ignore! */
|
||||
else if (BEGINS(buff, "FILE "))
|
||||
{
|
||||
|
@ -199,6 +197,16 @@ cue_data_t *cue_parse(const char *fname)
|
|||
else
|
||||
pending_pregap = m*60*75 + s*75 + f;
|
||||
}
|
||||
else if (BEGINS(buff, "REM LENGTH ")) // custom "extension"
|
||||
{
|
||||
int m, s, f;
|
||||
get_token(buff+11, buff2, sizeof(buff2));
|
||||
ret = sscanf(buff2, "%d:%d:%d", &m, &s, &f);
|
||||
if (ret != 3) continue;
|
||||
data->tracks[count].sector_xlength = m*60*75 + s*75 + f;
|
||||
}
|
||||
else if (BEGINS(buff, "REM"))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
elprintf(EL_STATUS, "cue: unhandled line: \"%s\"", buff);
|
||||
|
|
|
@ -13,6 +13,7 @@ typedef struct
|
|||
char *fname;
|
||||
int pregap; /* pregap for current track */
|
||||
int sector_offset; /* in current file */
|
||||
int sector_xlength;
|
||||
cue_track_type type;
|
||||
} cue_track;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue