Improve IOPort code

This commit is contained in:
Jaby
2022-09-05 20:58:33 +02:00
parent acfa8dae92
commit 2ecd72a447
4 changed files with 106 additions and 78 deletions

View File

@@ -10,7 +10,7 @@ namespace SPU {
}
static void clear_main_volume() {
static constexpr auto StartVol = SweepVolume() | !SweepVolume::SweepEnable | (SweepVolume::Volume << static_cast<int16_t>(I16_MAX >> 2));
static constexpr auto StartVol = SweepVolume().set(!SweepVolume::SweepEnable).set(SweepVolume::Volume, I16_MAX >> 2);
MainVolume::left.write(StartVol);
MainVolume::right.write(StartVol);
@@ -58,7 +58,7 @@ namespace SPU {
}
static void setup_control_register() {
static constexpr auto SetupValue = ControlRegister() | ControlRegister::Enable | ControlRegister::Unmute | ControlRegister::CDAudioEnable;
static constexpr auto SetupValue = ControlRegister().set(ControlRegister::Enable).set(ControlRegister::Unmute).set(ControlRegister::CDAudioEnable);
Control.write(SetupValue);
}
@@ -84,5 +84,6 @@ namespace SPU {
// Enable SPU DMA
DPCR.write(DPCR.read() | DMAControlRegister::SPUEnable);
while(!DPCR.read().is_bit_set(DMAControlRegister::SPUEnable));
}
}