Almost finished setup SPU
This commit is contained in:
parent
cf663aee73
commit
16bf7ac465
|
@ -74,14 +74,14 @@ namespace SPU {
|
|||
};
|
||||
|
||||
struct __no_align Voice {
|
||||
SweepVolume volumeLeft;
|
||||
SweepVolume volumeRight;
|
||||
SampleRate sampleRate;
|
||||
IOPort<uint16_t> adr;
|
||||
IOPort<AD> ad;
|
||||
IOPort<SR> sr;
|
||||
IOPort<SweepVolume> currentVolume; //Not used
|
||||
IOPort<uint16_t> repeatAdr;
|
||||
SweepVolume volumeLeft; //Offset: 0x0
|
||||
SweepVolume volumeRight; //Offset: 0x2
|
||||
SampleRate sampleRate; //Offset: 0x4;
|
||||
IOPort<uint16_t> adr; //Offset: 0x6
|
||||
IOPort<AD> ad; //Offset: 0x8
|
||||
IOPort<SR> sr; //Offset: 0xA
|
||||
IOPort<SweepVolume> currentVolume; //Offset: 0xC
|
||||
IOPort<uint16_t> repeatAdr; //Offset: 0xE
|
||||
};
|
||||
|
||||
struct __no_align ControlRegister : public IOPort<uint16_t> {
|
||||
|
@ -107,6 +107,24 @@ namespace SPU {
|
|||
static constexpr Bit<uint16_t> CDAudioEnable = 0;
|
||||
};
|
||||
|
||||
struct __no_align PitchModFlags : public IOPort<uint16_t> {
|
||||
__io_port_inherit(PitchModFlags);
|
||||
|
||||
static constexpr BitRange<uint16_t> EnableBits = BitRange<uint16_t>::from_to(1, 23);
|
||||
};
|
||||
|
||||
struct __no_align NoiseGenerator : public IOPort<uint16_t> {
|
||||
__io_port_inherit(NoiseGenerator);
|
||||
|
||||
static constexpr BitRange<uint16_t> NoiseBits = BitRange<uint16_t>::from_to(0, 23);
|
||||
};
|
||||
|
||||
struct __no_align EchoOn : public IOPort<uint16_t> {
|
||||
__io_port_inherit(EchoOn);
|
||||
|
||||
static constexpr BitRange<uint16_t> EchoBits = BitRange<uint16_t>::from_to(0, 23);
|
||||
};
|
||||
|
||||
static constexpr size_t VoiceCount = 24;
|
||||
|
||||
namespace Key {
|
||||
|
@ -120,8 +138,31 @@ namespace SPU {
|
|||
__declare_io_port_global(SweepVolume, right, 0x1F801D82);
|
||||
}
|
||||
|
||||
__declare_io_port_global(ControlRegister, Control, 0x1F801DAA);
|
||||
__declare_io_port_global_array(Voice, Voices, 0x1F801C00, VoiceCount);
|
||||
namespace CDVolume {
|
||||
__declare_io_port_global(int16_t, left, 0x1F801DB0);
|
||||
__declare_io_port_global(int16_t, right, 0x1F801DB2);
|
||||
}
|
||||
|
||||
namespace ExternalAudioInputVolume {
|
||||
__declare_io_port_global(int16_t, left, 0x1F801DB4);
|
||||
__declare_io_port_global(int16_t, right, 0x1F801DB6);
|
||||
}
|
||||
|
||||
namespace Reverb {
|
||||
namespace Volume {
|
||||
__declare_io_port_global(int16_t, left, 0x1F801D84);
|
||||
__declare_io_port_global(int16_t, right, 0x1F801D86);
|
||||
}
|
||||
__declare_io_port_global(uint16_t, work_area_adr, 0x1F801DA2);
|
||||
}
|
||||
|
||||
__declare_io_port_global(ControlRegister, Control, 0x1F801DAA);
|
||||
__declare_io_port_global(uint16_t, DataTransferControl, 0x1F801DAC);
|
||||
__declare_io_port_global(PitchModFlags, PMON, 0x1F801D90);
|
||||
__declare_io_port_global(NoiseGenerator, NON, 0x1F801D94);
|
||||
__declare_io_port_global(EchoOn, EON, 0x1F801D98);
|
||||
|
||||
__declare_io_port_global_array(Voice, Voices, 0x1F801C00, VoiceCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,14 @@ namespace SPU {
|
|||
MainVolume::right.write(StartVol);
|
||||
}
|
||||
|
||||
static void clear_cd_and_ext_audio_volume() {
|
||||
CDVolume::left.write(0);
|
||||
CDVolume::right.write(0);
|
||||
|
||||
ExternalAudioInputVolume::left.write(0);
|
||||
ExternalAudioInputVolume::right.write(0);
|
||||
}
|
||||
|
||||
static void clear_control_register() {
|
||||
Control.write(ControlRegister());
|
||||
}
|
||||
|
@ -33,18 +41,44 @@ namespace SPU {
|
|||
}
|
||||
}
|
||||
|
||||
static void clear_pmon() {
|
||||
PMON.write(PitchModFlags());
|
||||
}
|
||||
|
||||
static void clear_noise_and_echo() {
|
||||
NON.write(NoiseGenerator());
|
||||
EON.write(EchoOn());
|
||||
}
|
||||
|
||||
static void clear_reverb() {
|
||||
Reverb::Volume::left.write(0);
|
||||
Reverb::Volume::right.write(0);
|
||||
Reverb::work_area_adr.write(0);
|
||||
}
|
||||
|
||||
static void setup_control_register() {
|
||||
static constexpr auto SetupValue = ControlRegister() | ControlRegister::Enable | ControlRegister::Unmute | ControlRegister::CDAudioEnable;
|
||||
|
||||
Control.write(SetupValue);
|
||||
}
|
||||
|
||||
static void setup_data_transfer_control() {
|
||||
DataTransferControl.write((2 << 1));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
clear_key();
|
||||
clear_main_volume();
|
||||
clear_cd_and_ext_audio_volume();
|
||||
clear_control_register();
|
||||
clear_voice();
|
||||
clear_pmon();
|
||||
clear_noise_and_echo();
|
||||
clear_reverb();
|
||||
|
||||
setup_data_transfer_control();
|
||||
setup_control_register();
|
||||
|
||||
//DPCR missing
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue