Finish clean-up

This commit is contained in:
2023-09-22 20:53:26 +02:00
parent 32682aa2f0
commit 09aed0ffc4
11 changed files with 240 additions and 265 deletions

View File

@@ -25,18 +25,18 @@ namespace JabyEngine {
//0..3 = +7, +6, +5, +4 or -6, -7, -6, -5
typedef uint8_t Step;
__new_declare_io_value(DataTransferControl, uint16_t) {
__declare_io_value(DataTransferControl, uint16_t) {
};
__new_declare_io_value(SimpleVolume, int16_t) {
__declare_io_value(SimpleVolume, int16_t) {
constexpr operator int16_t() const {
return this->raw;
}
};
__new_declare_io_value(Adr, uint16_t) {
__declare_io_value(Adr, uint16_t) {
};
__new_declare_io_value(SampleRate, uint16_t) {
__declare_io_value(SampleRate, uint16_t) {
static constexpr SampleRate from_HZ(double freq) {
//4096 == 44100Hz
constexpr double Base = (4096.0 / 44100.0);
@@ -45,7 +45,7 @@ namespace JabyEngine {
}
};
__new_declare_io_value(SweepVolume, int16_t) {
__declare_io_value(SweepVolume, int16_t) {
// For Volume Mode
static constexpr auto SweepEnable = Bit(15);
static constexpr auto VolumeEnable = !SweepEnable;
@@ -59,7 +59,7 @@ namespace JabyEngine {
static constexpr auto SweepStep = BitRange::from_to(0, 1);
};
__new_declare_io_value(SR, uint16_t) {
__declare_io_value(SR, uint16_t) {
static constexpr auto SustainMode = Bit(31 - 16);
static constexpr auto SustainDirection = Bit(30 - 16);
static constexpr auto SustainShift = BitRange::from_to((24 - 16), (28 - 16));
@@ -68,7 +68,7 @@ namespace JabyEngine {
static constexpr auto ReleaseShift = BitRange::from_to((16 - 16), (20 - 16));
};
__new_declare_io_value(AD, uint16_t) {
__declare_io_value(AD, uint16_t) {
static constexpr auto AttackMode = Bit(15);
static constexpr auto AttackShift = BitRange::from_to(10, 14);
static constexpr auto AttackStep = BitRange::from_to(8, 9);
@@ -78,14 +78,14 @@ namespace JabyEngine {
#pragma pack(push, 1)
struct Voice {
New::IOPort<SweepVolume> volumeLeft; //Offset: 0x0
New::IOPort<SweepVolume> volumeRight; //Offset: 0x2
New::IOPort<SampleRate> sampleRate; //Offset: 0x4;
New::IOPort<Adr> adr; //Offset: 0x6
New::IOPort<AD> ad; //Offset: 0x8
New::IOPort<SR> sr; //Offset: 0xA
New::IOPort<SimpleVolume> currentVolume; //Offset: 0xC
New::IOPort<Adr> repeatAdr; //Offset: 0xE
IOPort<SweepVolume> volumeLeft; //Offset: 0x0
IOPort<SweepVolume> volumeRight; //Offset: 0x2
IOPort<SampleRate> sampleRate; //Offset: 0x4;
IOPort<Adr> adr; //Offset: 0x6
IOPort<AD> ad; //Offset: 0x8
IOPort<SR> sr; //Offset: 0xA
IOPort<SimpleVolume> currentVolume; //Offset: 0xC
IOPort<Adr> repeatAdr; //Offset: 0xE
static constexpr Adr start_adr() {
return {0x200};
@@ -93,7 +93,7 @@ namespace JabyEngine {
};
#pragma pack(pop)
__new_declare_io_value(ControlRegister, uint16_t) {
__declare_io_value(ControlRegister, uint16_t) {
enum RAMTransferMode {
Stop = 0,
ManualWrite = 1,
@@ -114,56 +114,56 @@ namespace JabyEngine {
static constexpr auto CDAudioEnable = Bit(0);
};
__new_declare_io_value(PMON, uint16_t) {
__declare_io_value(PMON, uint16_t) {
static constexpr auto EnableBits = BitRange::from_to(1, 23);
};
__new_declare_io_value(NON, uint16_t) {
__declare_io_value(NON, uint16_t) {
static constexpr auto NoiseBits = BitRange::from_to(0, 23);
};
__new_declare_io_value(EON, uint16_t) {
__declare_io_value(EON, uint16_t) {
static constexpr auto EchoBits = BitRange::from_to(0, 23);
};
static constexpr size_t VoiceCount = 24;
struct Key {
__new_declare_io_port_w_type(inline, New::ubus32_t, On, 0x1F801D88);
__new_declare_io_port_w_type(inline, New::ubus32_t, Off, 0x1F801D8C);
__new_declare_io_port_w_type(inline, New::ubus32_t, Status, 0x1F801D9C);
__declare_io_port_w_type(inline, ubus32_t, On, 0x1F801D88);
__declare_io_port_w_type(inline, ubus32_t, Off, 0x1F801D8C);
__declare_io_port_w_type(inline, ubus32_t, Status, 0x1F801D9C);
};
struct MainVolume {
__new_declare_io_port_w_type(inline, SweepVolume, Left, 0x1F801D80);
__new_declare_io_port_w_type(inline, SweepVolume, Right, 0x1F801D82);
__declare_io_port_w_type(inline, SweepVolume, Left, 0x1F801D80);
__declare_io_port_w_type(inline, SweepVolume, Right, 0x1F801D82);
};
struct CDVolume {
__new_declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB0);
__new_declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB2);
__declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB0);
__declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB2);
};
struct ExternalAudioInputVolume {
__new_declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB4);
__new_declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB6);
__declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB4);
__declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB6);
};
struct Reverb {
struct Volume {
__new_declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801D84);
__new_declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801D86);
__declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801D84);
__declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801D86);
};
__new_declare_io_port_w_type(inline, Adr, WorkAreaAdr, 0x1F801DA2);
__declare_io_port_w_type(inline, Adr, WorkAreaAdr, 0x1F801DA2);
};
__new_declare_io_port(, ControlRegister, 0x1F801DAA);
__new_declare_io_port(, DataTransferControl, 0x1F801DAC);
__new_declare_io_port(, PMON, 0x1F801D90);
__new_declare_io_port(, NON, 0x1F801D94);
__new_declare_io_port(, EON, 0x1F801D98);
__declare_io_port(, ControlRegister, 0x1F801DAA);
__declare_io_port(, DataTransferControl, 0x1F801DAC);
__declare_io_port(, PMON, 0x1F801D90);
__declare_io_port(, NON, 0x1F801D94);
__declare_io_port(, EON, 0x1F801D98);
__new_declare_io_port_array(, Voice, VoiceCount, 0x1F801C00);
__declare_io_port_array(, Voice, VoiceCount, 0x1F801C00);
}
}
#endif //!__JABYENGINE_SPU_IO_HPP__