Support pushing and poping a playing CDDA track
This commit is contained in:
@@ -6,6 +6,8 @@ namespace JabyEngine {
|
||||
namespace CDDA {
|
||||
namespace CD = JabyEngine::CD::internal;
|
||||
|
||||
static CD::CDTimeStamp last_track;
|
||||
|
||||
TrackList get_tracks() {
|
||||
CD::Command::wait_completed();
|
||||
|
||||
@@ -33,5 +35,27 @@ namespace JabyEngine {
|
||||
CD::Command::wait_completed();
|
||||
CD::Command::send<CD_IO::PortIndex0>(CD_IO::Command::Pause);
|
||||
}
|
||||
|
||||
void push_play() {
|
||||
pause();
|
||||
CD::Command::wait_completed();
|
||||
CD::Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::GetLocP);
|
||||
|
||||
const auto track = CD_IO::PortIndex0::ResponseFifo.read().raw; // track number (AAh=Lead-out area) (FFh=unknown, toc, none?)
|
||||
const auto index = CD_IO::PortIndex0::ResponseFifo.read().raw; // index number (Usually 01h)
|
||||
const auto mm = CD_IO::PortIndex0::ResponseFifo.read().raw; // minute number within track (00h and up)
|
||||
const auto ss = CD_IO::PortIndex0::ResponseFifo.read().raw; // second number within track (00h to 59h)
|
||||
const auto sect = CD_IO::PortIndex0::ResponseFifo.read().raw; // sector number within track (00h to 74h)
|
||||
last_track.min = CD_IO::PortIndex0::ResponseFifo.read().raw; // minute number on entire disk (00h and up)
|
||||
last_track.sec = CD_IO::PortIndex0::ResponseFifo.read().raw; // second number on entire disk (00h to 59h)
|
||||
last_track.sector = CD_IO::PortIndex0::ResponseFifo.read().raw; // sector number on entire disk (00h to 74h)
|
||||
}
|
||||
|
||||
void pop_play() {
|
||||
CD::Command::wait_completed();
|
||||
CD::Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, last_track.min, last_track.sec, last_track.sector);
|
||||
CD::enable_CDDA(); // < Command waits
|
||||
CD::Command::send<CD_IO::PortIndex0>(CD_IO::Command::Play);
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,8 +15,8 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
static void clear_cd_and_ext_audio_volume() {
|
||||
CDVolume::Left.write(0.5_vol);
|
||||
CDVolume::Right.write(0.5_vol);
|
||||
CDVolume::Left.write(0.75_vol);
|
||||
CDVolume::Right.write(0.75_vol);
|
||||
|
||||
ExternalAudioInputVolume::Left.write({0});
|
||||
ExternalAudioInputVolume::Right.write({0});
|
||||
|
Reference in New Issue
Block a user