Final clean up of IOPort

This commit is contained in:
Jaby 2022-09-07 19:08:11 +02:00
parent beb3d6cb86
commit 2893acae19
2 changed files with 7 additions and 6 deletions

View File

@ -41,8 +41,9 @@ namespace SPU {
__io_port_inherit_complex_bit_map(SweepVolume);
// For Volume Mode
static constexpr Bit<int16_t> SweepEnable = 15; // 0 Volume Mode; 1 Sweep Mode
static constexpr BitRange<int16_t> Volume = BitRange<int16_t>::from_to(0, 14);
static constexpr Bit<int16_t> SweepEnable = 15; // 0 Volume Mode; 1 Sweep Mode
static constexpr auto VolumeEnable = !SweepEnable;
static constexpr BitRange<int16_t> Volume = BitRange<int16_t>::from_to(0, 14);
// For Sweep Mode
static constexpr Bit<Mode> SweepMode = 14;
@ -74,9 +75,9 @@ namespace SPU {
};
struct __no_align Voice {
IOPort<SweepVolume> volumeLeft; //Offset: 0x0
IOPort<SweepVolume> volumeRight; //Offset: 0x2
IOPort<SampleRate> sampleRate; //Offset: 0x4;
IOPort<SweepVolume> volumeLeft; //Offset: 0x0
IOPort<SweepVolume> volumeRight; //Offset: 0x2
IOPort<SampleRate> sampleRate; //Offset: 0x4;
IOPort<uint16_t> adr; //Offset: 0x6
IOPort<AD> ad; //Offset: 0x8
IOPort<SR> sr; //Offset: 0xA

View File

@ -10,7 +10,7 @@ namespace SPU {
}
static void clear_main_volume() {
static constexpr auto StartVol = SweepVolume::with(!SweepVolume::SweepEnable, SweepVolume::Volume.with(I16_MAX >> 2));
static constexpr auto StartVol = SweepVolume::with(SweepVolume::VolumeEnable, SweepVolume::Volume.with(I16_MAX >> 2));
MainVolume::left.write(StartVol);
MainVolume::right.write(StartVol);