From 8b6921cba5a0ee44c883a95ba141f9fa9dd4345c Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 22 Sep 2024 16:10:18 +0200 Subject: [PATCH] Update SPU IO way --- include/PSX/SPU/spu.hpp | 13 +- .../System/IOPorts/IOValues/spu_io_values.hpp | 167 ++++++++++++- include/PSX/System/IOPorts/ioport.hpp | 5 +- include/PSX/System/IOPorts/spu_io.hpp | 219 +++++------------- .../internal-include/SPU/spu_internal.hpp | 2 +- src/Library/src/BootLoader/spu_boot.cpp | 41 ++-- .../src/File/Processor/vag_processor.cpp | 6 +- src/Library/src/SPU/spu.cpp | 6 +- 8 files changed, 258 insertions(+), 201 deletions(-) diff --git a/include/PSX/SPU/spu.hpp b/include/PSX/SPU/spu.hpp index ab92464e..84937d52 100644 --- a/include/PSX/SPU/spu.hpp +++ b/include/PSX/SPU/spu.hpp @@ -3,27 +3,28 @@ namespace JabyEngine { namespace SPU { - using SRAM_Adr = SPU_IO::SRAM_Adr; + using SRAMAdr = SPU_IO::SRAMAdr; + // TODO: Rename to sample...? struct Voice { size_t get_id() const { return reinterpret_cast(this); } - SRAM_Adr allocate(size_t size) const; - SRAM_Adr allocate(SPU_IO::SampleRate frequency, size_t size) const; - void deallocate() const; + SRAMAdr allocate(size_t size) const; + SRAMAdr allocate(SPU_IO::SampleRate frequency, size_t size) const; + void deallocate() const; void set_sample_rate(SPU_IO::SampleRate frequency) const { SPU_IO::Voice[Voice::get_id()].sampleRate.write(frequency); } void play() const { - SPU_IO::Key::On.write(1 << Voice::get_id()); + SPU_IO::Key::On.write(SPU_IO::KeyOn::for_specific(Voice::get_id())); } void stop() const { - SPU_IO::Key::Off.write(1 << Voice::get_id()); + SPU_IO::Key::Off.write(SPU_IO::KeyOff::for_specific(Voice::get_id())); } }; diff --git a/include/PSX/System/IOPorts/IOValues/spu_io_values.hpp b/include/PSX/System/IOPorts/IOValues/spu_io_values.hpp index 29abad4e..8a5ae53c 100644 --- a/include/PSX/System/IOPorts/IOValues/spu_io_values.hpp +++ b/include/PSX/System/IOPorts/IOValues/spu_io_values.hpp @@ -1,5 +1,6 @@ #pragma once #include "../ioport.hpp" +#include namespace JabyEngine { namespace SPU_IO_Values { @@ -20,6 +21,22 @@ namespace JabyEngine { struct IOPort : public SPU_IO_Values::internal::AliasUbus32IOPort {} } + namespace MemoryMap { + static constexpr uintptr_t ADPCM = 0x01000; + } + + __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); + static constexpr auto DecayShift = BitRange::from_to(4, 7); + static constexpr auto SustainLevel = BitRange::from_to(0, 3); + + static constexpr AD none() { + return AD{0}; + } + }; + __declare_io_value(ControlRegister, uint16_t) { enum RAMTransferMode { Stop = 0, @@ -41,6 +58,12 @@ namespace JabyEngine { static constexpr auto CDAudioEnable = Bit(0); }; + __declare_io_value(DataTransferControl, uint16_t) { + static constexpr DataTransferControl NormalTransferMode() { + return DataTransferControl{0x0004}; + } + }; + __declare_io_value(Echo, ubus32_t) { static constexpr auto EchoBits = BitRange::from_to(0, 23); @@ -49,12 +72,109 @@ namespace JabyEngine { } }; - __declare_io_value(SRAM_Adr, uint16_t) { + __declare_io_value(KeyOff, ubus32_t) { + static constexpr KeyOff for_specific(uint32_t id) { + return KeyOff{ubus32_t::from(1 << id)}; + } + + static constexpr KeyOff all() { + return KeyOff{ubus32_t::from(UI32_MAX)}; + } + }; + + __declare_io_value(KeyOn, ubus32_t) { + static constexpr KeyOn for_specific(uint32_t id) { + return KeyOn{ubus32_t::from(1 << id)}; + } + + static constexpr KeyOn all() { + return KeyOn{ubus32_t::from(UI32_MAX)}; + } + }; + + __declare_io_value(KeyStatus, ubus32_t) { + }; + + __declare_io_value(Noise, uint16_t) { + static constexpr auto NoiseBits = BitRange::from_to(0, 23); + + static constexpr Noise AllOff() { + return Noise{0}; + } + }; + + __declare_io_value(PitchModulation, ubus32_t) { + static constexpr auto EnableBits = BitRange::from_to(1, 23); + + static constexpr PitchModulation AllOff() { + return PitchModulation{0}; + } + }; + + __declare_io_value(SampleRate, uint16_t) { + static constexpr SampleRate stop() { + return SampleRate{0}; + } + + static constexpr SampleRate from_HZ(uint32_t freq) { + constexpr uint32_t Base1024Hz = static_cast((4096.0/44100.0)*1024.0); + return SampleRate{static_cast((freq >> 10)*Base1024Hz)}; + } + + static constexpr SampleRate from_HZ(double freq) { + //4096 == 44100Hz + constexpr double Base = (4096.0 / 44100.0); + return SampleRate{static_cast((freq*Base))}; + } + }; + + __declare_io_value(SimpleVolume, int16_t) { + static constexpr auto MaxVolume = I16_MAX; + + static constexpr SimpleVolume mute() { + return SimpleVolume{0}; + } + + constexpr operator int16_t() const { + return this->raw; + } + }; + + static constexpr SimpleVolume operator""_vol(long double fraction) { + return {static_cast(static_cast(SimpleVolume::MaxVolume)*fraction)}; + } + + __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)); + static constexpr auto SustainStep = BitRange::from_to((22 - 16), (23 - 16)); + static constexpr auto ReleaseMode = Bit(21 - 16); + static constexpr auto ReleaseShift = BitRange::from_to((16 - 16), (20 - 16)); + + static constexpr SR none() { + return SR{0}; + } + }; + + __declare_io_value(SRAMAdr, uint16_t) { + static constexpr SRAMAdr null() { + return SRAMAdr{0x0}; + } + + static constexpr SRAMAdr adpcm_start() { + return SRAMAdr{MemoryMap::ADPCM}; + } }; __declare_io_value(StatusRegister, uint16_t) { + enum CapureBufferHalf { + First = 0, + Second = 1 + }; + static constexpr auto Unused = BitRange::from_to(12, 15); - static constexpr auto CaputreBufferHalf = Bit(11); // TODO: Turn into enum?; Writing to First/Second half of Capture Buffers (0=First, 1=Second) + static constexpr auto CaputreBufferHalf = Bit(11); static constexpr auto TransferBusy = Bit(10); static constexpr auto IsDMARead = Bit(9); static constexpr auto isDMAWrite = Bit(8); @@ -66,7 +186,48 @@ namespace JabyEngine { static constexpr auto CDAudioReverb = Bit(2); static constexpr auto ExternalAudioEnable = Bit(1); static constexpr auto CDAudioEnable = Bit(0); - }; + }; + + __declare_io_value(SweepVolume, int16_t) { + struct VolumeMode { + static constexpr auto MaxVolume = (I16_MAX >> 1); + static constexpr auto EnableSweep = Bit(15); + static constexpr auto Enable = !EnableSweep; + static constexpr auto Volume = BitRange::from_to(0, 14); + }; + + struct SweepMode { + enum Mode { + Linear = 0, + Exponential = 1, + }; + + enum Direction { + Increase = 0, + Decrease = 1, + }; + + enum Phase { + Posititve = 0, + Negative = 1, + }; + + static constexpr auto Mode = Bit(14); + static constexpr auto Direction = Bit(13); + static constexpr auto Phase = Bit(12); + static constexpr auto Shift = BitRange::from_to(2, 6); + static constexpr auto Step = BitRange::from_to(0, 1); + }; + + static constexpr SweepVolume mute() { + return SweepVolume{0}; + } + }; } alias_ioport_ubus32(SPU_IO_Values::Echo); + alias_ioport_ubus32(SPU_IO_Values::Noise); + alias_ioport_ubus32(SPU_IO_Values::KeyOff); + alias_ioport_ubus32(SPU_IO_Values::KeyOn); + alias_ioport_ubus32(SPU_IO_Values::KeyStatus); + alias_ioport_ubus32(SPU_IO_Values::PitchModulation); } \ No newline at end of file diff --git a/include/PSX/System/IOPorts/ioport.hpp b/include/PSX/System/IOPorts/ioport.hpp index 63c72ce0..d3033589 100644 --- a/include/PSX/System/IOPorts/ioport.hpp +++ b/include/PSX/System/IOPorts/ioport.hpp @@ -69,7 +69,7 @@ namespace JabyEngine { uint16_t low; uint16_t high; - static ubus32_t from(uint32_t value) { + static constexpr ubus32_t from(uint32_t value) { return {.low = static_cast(value & 0xFFFF), .high = static_cast(value >> 16)}; } }; @@ -117,4 +117,7 @@ namespace JabyEngine { #define __declare_io_port_w_type(cv, type, name, adr) __declare_value_at(cv, ::JabyEngine::IOPort, name, adr) #define __declare_io_port(cv, name, adr) __declare_io_port_w_type(cv, struct name, name, adr) #define __declare_io_port_array(cv, name, size, adr) __declare_array_at(cv, struct name, name, size, adr) + + #define __new_declare_io_port(type, adr) *reinterpret_cast(adr) + #define __new_declare_io_port_array(type, size, adr) reinterpret_cast(*reinterpret_cast(adr)) } \ No newline at end of file diff --git a/include/PSX/System/IOPorts/spu_io.hpp b/include/PSX/System/IOPorts/spu_io.hpp index 3c08c64e..ebf834fd 100644 --- a/include/PSX/System/IOPorts/spu_io.hpp +++ b/include/PSX/System/IOPorts/spu_io.hpp @@ -6,151 +6,9 @@ namespace JabyEngine { namespace SPU_IO { using namespace SPU_IO_Values; - namespace MemoryMap { - static constexpr uintptr_t ADPCM = 0x01000; - } - - enum struct Mode { - Linear = 0, - Exponential = 1, - }; - - enum struct Direction { - Increase = 0, - Decrease = 1, - }; - - enum struct Phase { - Posititve = 0, - Negative = 1, - }; - - //0..0x1F = Fast..Slow - typedef uint8_t Shift; - - //0..3 = +7, +6, +5, +4 or -6, -7, -6, -5 - typedef uint8_t Step; - - __declare_io_value(DataTransferControl, uint16_t) { - static constexpr DataTransferControl NormalTransferMode() { - return DataTransferControl{0x0004}; - } - }; - - __declare_io_value(SimpleVolume, int16_t) { - constexpr operator int16_t() const { - return this->raw; - } - }; - - __declare_io_value(SampleRate, uint16_t) { - static constexpr SampleRate from_HZ(uint32_t freq) { - constexpr uint32_t Base1024Hz = static_cast((4096.0/44100.0)*1024.0); - return {static_cast((freq >> 10)*Base1024Hz)}; - } - - static constexpr SampleRate from_HZ(double freq) { - //4096 == 44100Hz - constexpr double Base = (4096.0 / 44100.0); - return {static_cast((freq*Base))}; - } - }; - - __declare_io_value(SweepVolume, int16_t) { - // For Volume Mode - static constexpr auto SweepEnable = Bit(15); - static constexpr auto VolumeEnable = !SweepEnable; - static constexpr auto Volume = BitRange::from_to(0, 14); - - // For Sweep Mode - static constexpr auto SweepMode = Bit(14); - static constexpr auto SweepDirection = Bit(13); - static constexpr auto SweepPhase = Bit(12); - static constexpr auto SweepShift = BitRange::from_to(2, 6); - static constexpr auto SweepStep = BitRange::from_to(0, 1); - }; - - __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)); - static constexpr auto SustainStep = BitRange::from_to((22 - 16), (23 - 16)); - static constexpr auto ReleaseMode = Bit(21 - 16); - static constexpr auto ReleaseShift = BitRange::from_to((16 - 16), (20 - 16)); - }; - - __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); - static constexpr auto DecayShift = BitRange::from_to(4, 7); - static constexpr auto SustainLevel = BitRange::from_to(0, 3); - }; - - #pragma pack(push, 1) - struct Voice { - IOPort volumeLeft; //Offset: 0x0 - IOPort volumeRight; //Offset: 0x2 - IOPort sampleRate; //Offset: 0x4; - IOPort adr; //Offset: 0x6 - IOPort ad; //Offset: 0x8 - IOPort sr; //Offset: 0xA - IOPort currentVolume; //Offset: 0xC - IOPort repeatAdr; //Offset: 0xE - - static constexpr SRAM_Adr start_adr() { - return {0x200}; - } - }; - #pragma pack(pop) - - // TODO: This is ubus32_t - __declare_io_value(PMON, uint16_t) { - static constexpr auto EnableBits = BitRange::from_to(1, 23); - }; - - // TODO: This is ubus32_t - __declare_io_value(NON, uint16_t) { - static constexpr auto NoiseBits = BitRange::from_to(0, 23); - }; - static constexpr size_t VoiceCount = 24; static constexpr size_t ReverbCount = 1; - struct Key { - __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 { - __declare_io_port_w_type(inline, SweepVolume, Left, 0x1F801D80); - __declare_io_port_w_type(inline, SweepVolume, Right, 0x1F801D82); - }; - - struct CDVolume { - __declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB0); - __declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB2); - }; - - struct ExternalAudioInputVolume { - __declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801DB4); - __declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801DB6); - }; - - struct Reverb { - struct Volume { - __declare_io_port_w_type(inline, SimpleVolume, Left, 0x1F801D84); - __declare_io_port_w_type(inline, SimpleVolume, Right, 0x1F801D86); - }; - __declare_io_port_w_type(inline, SRAM_Adr, WorkAreaAdr, 0x1F801DA2); - }; - - static constexpr SimpleVolume operator""_vol(long double fraction) { - return {static_cast(static_cast(I16_MAX)*fraction)}; - } - -//--------------------------------------------------------------------------------------------------- struct ControlRegisterIO : public IOPort { using TransferMode = Value::RAMTransferMode; @@ -160,30 +18,71 @@ namespace JabyEngine { } }; - struct EchoIO : public IOPort { + using ADIO = IOPort; + using DataTransferControlIO = IOPort; + using EchoIO = IOPort; + using KeyOffIO = IOPort; + using KeyOnIO = IOPort; + using KeyStatusIO = IOPort; + using NoiseIO = IOPort; + using PitchModulationIO = IOPort; + using SampleRateIO = IOPort; + using SimpleVolumeIO = IOPort; + using StatusRegisterIO = IOPort; + using SRIO = IOPort; + using SRAMAdrIO = IOPort; + using SweepVolumeIO = IOPort; + + #pragma pack(push, 1) + struct Voice { + SweepVolumeIO volumeLeft; //Offset: 0x0 + SweepVolumeIO volumeRight; //Offset: 0x2 + SampleRateIO sampleRate; //Offset: 0x4; + SRAMAdrIO adr; //Offset: 0x6 + ADIO ad; //Offset: 0x8 + SRIO sr; //Offset: 0xA + SimpleVolumeIO currentVolume; //Offset: 0xC + SRAMAdrIO repeatAdr; //Offset: 0xE + }; + #pragma pack(pop) + + static auto& Voice = __new_declare_io_port_array(struct Voice, VoiceCount, 0x1F801C00); + static auto& PMON = __new_declare_io_port(PitchModulationIO, 0x1F801D90); + static auto& NON = __new_declare_io_port(NoiseIO, 0x1F801D94); + static auto& EON = __new_declare_io_port(EchoIO, 0x1F801D98); + static auto& SRAMTransferAdr = __new_declare_io_port(SRAMAdrIO, 0x1F801DA6); + static auto& ControlRegister = __new_declare_io_port(ControlRegisterIO, 0x1F801DAA); + static auto& DataTransferControl = __new_declare_io_port(DataTransferControlIO, 0x1F801DAC); + static auto& StatusRegister = __new_declare_io_port(StatusRegisterIO, 0x1F801DAE); + + struct CDVolume { + static inline auto& Left = __new_declare_io_port(SimpleVolumeIO, 0x1F801DB0); + static inline auto& Right = __new_declare_io_port(SimpleVolumeIO, 0x1F801DB2); }; - struct StatusRegisterIO : public IOPort { + struct ExternalAudioInputVolume { + static inline auto& Left = __new_declare_io_port(SimpleVolumeIO, 0x1F801DB4); + static inline auto& Right = __new_declare_io_port(SimpleVolumeIO, 0x1F801DB6); }; - struct SRAMTransferAddressIO : public IOPort { + struct Key { + static inline auto& On = __new_declare_io_port(KeyOnIO, 0x1F801D88); + static inline auto& Off = __new_declare_io_port(KeyOffIO, 0x1F801D8C); + static inline auto& Status = __new_declare_io_port(KeyStatusIO, 0x1F801D9C); }; - - // TODO: The new way? v Parse with a Macro? - static auto& EON = *reinterpret_cast(0x1F801D98); - static auto& SRAMTransferAdr = *reinterpret_cast(0x1F801DA6); - static auto& ControlRegister = *reinterpret_cast(0x1F801DAA); - static auto& StatusRegister = *reinterpret_cast(0x1F801DAE); - -//--------------------------------------------------------------------------------------------------- + struct MainVolume { + static inline auto& Left = __new_declare_io_port(SweepVolumeIO, 0x1F801D80); + static inline auto& Right = __new_declare_io_port(SweepVolumeIO, 0x1F801D82); + }; - //__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); - - __declare_io_port_array(, Voice, VoiceCount, 0x1F801C00); + struct Reverb { + struct Volume { + static inline auto& Left = __new_declare_io_port(SimpleVolumeIO, 0x1F801D84); + static inline auto& Right = __new_declare_io_port(SimpleVolumeIO, 0x1F801D86); + }; + static inline auto& On = EON; + static inline auto& WorkAreaAdr = __new_declare_io_port(SRAMAdrIO, 0x1F801DA2); + }; } } \ No newline at end of file diff --git a/src/Library/internal-include/SPU/spu_internal.hpp b/src/Library/internal-include/SPU/spu_internal.hpp index 9cdf0805..cb5e7776 100644 --- a/src/Library/internal-include/SPU/spu_internal.hpp +++ b/src/Library/internal-include/SPU/spu_internal.hpp @@ -26,7 +26,7 @@ namespace JabyEngine { DMA_IO::SPU.set_adr(adr); } - static void set_dst(SPU::SRAM_Adr adr) { + static void set_dst(SPU::SRAMAdr adr) { SPU_IO::SRAMTransferAdr.write(adr); SPU_IO::ControlRegister.set_transfer_mode(SPU_IO::ControlRegister::DMAWrite); } diff --git a/src/Library/src/BootLoader/spu_boot.cpp b/src/Library/src/BootLoader/spu_boot.cpp index 32d73491..d92d4534 100644 --- a/src/Library/src/BootLoader/spu_boot.cpp +++ b/src/Library/src/BootLoader/spu_boot.cpp @@ -8,7 +8,7 @@ namespace JabyEngine { using namespace SPU_IO; static void clear_main_volume() { - static constexpr auto StartVol = SweepVolume::from(SweepVolume::VolumeEnable, SweepVolume::Volume.with(static_cast(I16_MAX >> 2))); + static constexpr auto StartVol = SweepVolume::from(SweepVolume::VolumeMode::Enable, SweepVolume::VolumeMode::Volume.with(SweepVolume::VolumeMode::MaxVolume >> 1)); MainVolume::Left.write(StartVol); MainVolume::Right.write(StartVol); @@ -18,37 +18,37 @@ namespace JabyEngine { CDVolume::Left.write(0.75_vol); CDVolume::Right.write(0.75_vol); - ExternalAudioInputVolume::Left.write({0}); - ExternalAudioInputVolume::Right.write({0}); + ExternalAudioInputVolume::Left.write(SimpleVolume::mute()); + ExternalAudioInputVolume::Right.write(SimpleVolume::mute()); } static void clear_voice() { for(auto& voice : SPU_IO::Voice) { - voice.volumeLeft.write({0}); - voice.volumeRight.write({0}); - voice.sampleRate.write({0}); - voice.ad.write({0}); - voice.sr.write({0}); - voice.currentVolume.write({0}); + voice.volumeLeft.write(SweepVolume::mute()); + voice.volumeRight.write(SweepVolume::mute()); + voice.sampleRate.write(SampleRate::stop()); + voice.ad.write(AD::none()); + voice.sr.write(SR::none()); + voice.currentVolume.write(SimpleVolume::mute()); - voice.adr.write(Voice::start_adr()); - voice.repeatAdr.write(Voice::start_adr()); + voice.adr.write(SRAMAdr::adpcm_start()); + voice.repeatAdr.write(SRAMAdr::adpcm_start()); } } static void clear_pmon() { - SPU_IO::PMON.write({0}); + SPU_IO::PMON.write(PitchModulation::AllOff()); } static void clear_noise_and_echo() { - SPU_IO::NON.write({0}); + SPU_IO::NON.write(Noise::AllOff()); SPU_IO::EON.write(Echo::AllOff()); } static void clear_reverb() { - Reverb::Volume::Left.write({0}); - Reverb::Volume::Right.write({0}); - Reverb::WorkAreaAdr.write({0}); + Reverb::Volume::Left.write(SimpleVolume::mute()); + Reverb::Volume::Right.write(SimpleVolume::mute()); + Reverb::WorkAreaAdr.write(SRAMAdr::null()); } static void setup_control_register() { @@ -57,12 +57,6 @@ namespace JabyEngine { SPU_IO::ControlRegister.write(SetupValue); } - static void setup_data_transfer_control() { - static constexpr struct DataTransferControl RequiredValue{(2 << 1)}; - - DataTransferControl.write(RequiredValue); - } - static void wait_voices() { static constexpr SimpleVolume Treshhold{static_cast(I16_MAX*0.03)}; @@ -75,7 +69,7 @@ namespace JabyEngine { } void stop_voices() { - SPU_IO::Key::Off.write({UI32_MAX}); + SPU_IO::Key::Off.write(KeyOff::all()); } void setup() { @@ -88,7 +82,6 @@ namespace JabyEngine { clear_noise_and_echo(); clear_reverb(); - setup_data_transfer_control(); setup_control_register(); } } diff --git a/src/Library/src/File/Processor/vag_processor.cpp b/src/Library/src/File/Processor/vag_processor.cpp index 4468aca1..dec432df 100644 --- a/src/Library/src/File/Processor/vag_processor.cpp +++ b/src/Library/src/File/Processor/vag_processor.cpp @@ -31,9 +31,9 @@ namespace JabyEngine { }; struct VAGState { - uint32_t voice_id; - size_t words_left; - SPU::SRAM_Adr adr; + uint32_t voice_id; + size_t words_left; + SPU::SRAMAdr adr; static constexpr VAGState create(uint32_t voice_id) { return VAGState{.voice_id = voice_id, .words_left = 0, .adr = 0}; diff --git a/src/Library/src/SPU/spu.cpp b/src/Library/src/SPU/spu.cpp index 3b7a8c9b..f541152f 100644 --- a/src/Library/src/SPU/spu.cpp +++ b/src/Library/src/SPU/spu.cpp @@ -8,16 +8,16 @@ namespace JabyEngine { namespace SPU { - SRAM_Adr Voice :: allocate(size_t size) const { + SRAMAdr Voice :: allocate(size_t size) const { Voice::stop(); const auto voice_id = Voice::get_id(); - const auto adr = SRAM_Adr{static_cast(reinterpret_cast(SPU_MMU::allocate(voice_id, size)))}; + const auto adr = SRAMAdr{static_cast(reinterpret_cast(SPU_MMU::allocate(voice_id, size)))}; SPU_IO::Voice[voice_id].adr.write(adr); return adr; } - SRAM_Adr Voice :: allocate(SPU_IO::SampleRate frequency, size_t size) const { + SRAMAdr Voice :: allocate(SPU_IO::SampleRate frequency, size_t size) const { const auto result = Voice::allocate(size); Voice::set_sample_rate(frequency); return result;