mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-29 14:49:44 +00:00
Better AudioPlay support and CDScan implemented
This commit is contained in:
parent
9a18393fc5
commit
447c7b365d
@ -659,11 +659,10 @@ bool CDPause_bincue(void *fh)
|
|||||||
{
|
{
|
||||||
CueSheet *cs = (CueSheet *) fh;
|
CueSheet *cs = (CueSheet *) fh;
|
||||||
if (cs && cs == player.cs) {
|
if (cs && cs == player.cs) {
|
||||||
if (player.audiostatus == CDROM_AUDIO_PLAY) {
|
// doesn't matter if it was playing, just ensure it's now paused
|
||||||
player.audiostatus = CDROM_AUDIO_PAUSED;
|
player.audiostatus = CDROM_AUDIO_PAUSED;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,11 +685,9 @@ bool CDResume_bincue(void *fh)
|
|||||||
{
|
{
|
||||||
CueSheet *cs = (CueSheet *) fh;
|
CueSheet *cs = (CueSheet *) fh;
|
||||||
if (cs && cs == player.cs) {
|
if (cs && cs == player.cs) {
|
||||||
// if (player.audiostatus == CDROM_AUDIO_PAUSED) {
|
// doesn't matter if it was paused, just ensure it now plays
|
||||||
// don't care if it was paused or not, just ensure it's playing after this call
|
|
||||||
player.audiostatus = CDROM_AUDIO_PLAY;
|
player.audiostatus = CDROM_AUDIO_PLAY;
|
||||||
return true;
|
return true;
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -769,7 +766,22 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
|||||||
bool CDScan_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f, bool reverse) {
|
bool CDScan_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f, bool reverse) {
|
||||||
CueSheet *cs = (CueSheet *)fh;
|
CueSheet *cs = (CueSheet *)fh;
|
||||||
if (cs && cs == player.cs) {
|
if (cs && cs == player.cs) {
|
||||||
// stub
|
uint8 scanrate = 8; // 8x scan default but could use different value or make configurable
|
||||||
|
|
||||||
|
MSF msf;
|
||||||
|
msf.m = start_m; msf.s = start_s; msf.f = start_f;
|
||||||
|
int current_frame = MSFToFrames(msf);
|
||||||
|
|
||||||
|
if (reverse) {
|
||||||
|
msf.s -= scanrate;
|
||||||
|
int goto_frame = MSFToFrames(msf);
|
||||||
|
player.audioposition -= (current_frame - goto_frame) * player.cs->raw_sector_size;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msf.s += scanrate;
|
||||||
|
int goto_frame = MSFToFrames(msf);
|
||||||
|
player.audioposition += (goto_frame - current_frame) * player.cs->raw_sector_size;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -140,6 +140,7 @@ struct cdrom_drive_info {
|
|||||||
uint8 toc[804]; // TOC of currently inserted disk
|
uint8 toc[804]; // TOC of currently inserted disk
|
||||||
uint8 lead_out[3]; // MSF address of lead-out track
|
uint8 lead_out[3]; // MSF address of lead-out track
|
||||||
uint8 stop_at[3]; // MSF address of audio play stopping point
|
uint8 stop_at[3]; // MSF address of audio play stopping point
|
||||||
|
uint8 start_at[3]; // MSF address of position set by track search or audio play
|
||||||
|
|
||||||
uint8 play_mode; // Audio play mode
|
uint8 play_mode; // Audio play mode
|
||||||
uint8 play_order; // Play mode order (normal, shuffle, program)
|
uint8 play_order; // Play mode order (normal, shuffle, program)
|
||||||
@ -785,14 +786,13 @@ int16 CDROMControl(uint32 pb, uint32 dce)
|
|||||||
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
|
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
|
||||||
return offLinErr;
|
return offLinErr;
|
||||||
|
|
||||||
uint8 start_m, start_s, start_f;
|
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
|
||||||
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
|
|
||||||
return paramErr;
|
return paramErr;
|
||||||
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
|
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
|
||||||
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2]))
|
if (!SysCDPlay(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], info->stop_at[0], info->stop_at[1], info->stop_at[2]))
|
||||||
return paramErr;
|
return paramErr;
|
||||||
// if (ReadMacInt16(pb + csParam + 6) == 0) // Hold
|
if (ReadMacInt16(pb + csParam + 6) == 0) // Hold
|
||||||
// SysCDPause(info->fh);
|
SysCDPause(info->fh);
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,13 +808,13 @@ int16 CDROMControl(uint32 pb, uint32 dce)
|
|||||||
return paramErr;
|
return paramErr;
|
||||||
} else {
|
} else {
|
||||||
// Given starting address
|
// Given starting address
|
||||||
uint8 start_m, start_s, start_f;
|
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
|
||||||
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
|
|
||||||
return paramErr;
|
|
||||||
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
|
|
||||||
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2]))
|
|
||||||
return paramErr;
|
return paramErr;
|
||||||
}
|
}
|
||||||
|
// Still need to process the AudioPlay command
|
||||||
|
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
|
||||||
|
if (!SysCDPlay(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], info->stop_at[0], info->stop_at[1], info->stop_at[2]))
|
||||||
|
return paramErr;
|
||||||
return noErr;
|
return noErr;
|
||||||
|
|
||||||
case 105: // AudioPause
|
case 105: // AudioPause
|
||||||
@ -890,11 +890,10 @@ int16 CDROMControl(uint32 pb, uint32 dce)
|
|||||||
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
|
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
|
||||||
return offLinErr;
|
return offLinErr;
|
||||||
|
|
||||||
uint8 start_m, start_s, start_f;
|
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
|
||||||
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
|
|
||||||
return paramErr;
|
return paramErr;
|
||||||
|
|
||||||
if (!SysCDScan(info->fh, start_m, start_s, start_f, ReadMacInt16(pb + csParam + 6) != 0)) {
|
if (!SysCDScan(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], ReadMacInt16(pb + csParam + 6) != 0)) {
|
||||||
return paramErr;
|
return paramErr;
|
||||||
} else {
|
} else {
|
||||||
return noErr;
|
return noErr;
|
||||||
|
Loading…
Reference in New Issue
Block a user