Skip to content

Commit

Permalink
Improve names of GUS reset register action functions
Browse files Browse the repository at this point in the history
1) BeginPlayback is renamed to StartRunning, because the
   documentation discusses 'running' the card when the
   reset bit 0 is set to 1.

2) StopPlayback is renamed to StopAndReset, because the
   documentation discusses 'resetting' the card when the
   reset bit 0 is set to 0 (and it implies stopping).
  • Loading branch information
interloper98 authored and johnnovak committed Jun 11, 2024
1 parent 63ba737 commit 3157a8c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/hardware/gus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ class Gus {

void ActivateVoices(uint8_t requested_voices);
void AudioCallback(uint16_t requested_frames);
void BeginPlayback() noexcept;
void CheckIrq();
void CheckVoiceIrq();
uint32_t GetDmaOffset() noexcept;
Expand All @@ -276,8 +275,10 @@ class Gus {

const std::vector<AudioFrame>& RenderFrames(const int num_requested_frames);

void StartRunning() noexcept;
void StopAndReset() noexcept;

void RenderUpToNow();
void StopPlayback();
void UpdateDmaAddress(uint8_t new_address);
void UpdateWaveMsw(int32_t& addr) const noexcept;
void UpdateWaveLsw(int32_t& addr) const noexcept;
Expand Down Expand Up @@ -1088,7 +1089,7 @@ void Gus::PopulatePanScalars() noexcept
}
}

void Gus::BeginPlayback() noexcept
void Gus::StartRunning() noexcept
{
assert(reset_register.is_running);

Expand Down Expand Up @@ -1322,7 +1323,7 @@ void Gus::RegisterIoHandlers()
write_handlers.at(8).Install(0x20b + port_base, write_to, io_width_t::byte);
}

void Gus::StopPlayback()
void Gus::StopAndReset() noexcept
{
assert(!reset_register.is_running);

Expand Down Expand Up @@ -1566,7 +1567,7 @@ void Gus::WriteToRegister()
return;
case 0x4c: // Reset register
reset_register.data = static_cast<uint8_t>(register_data >> 8);
reset_register.is_running ? BeginPlayback() : StopPlayback();
reset_register.is_running ? StartRunning() : StopAndReset();
return;
default:
break;
Expand Down Expand Up @@ -1650,7 +1651,7 @@ void Gus::WriteToRegister()
Gus::~Gus()
{
LOG_MSG("GUS: Shutting down");
StopPlayback();
StopAndReset();

// Prevent discovery of the GUS via the environment
ClearEnvironment();
Expand Down

0 comments on commit 3157a8c

Please sign in to comment.