Improve SPU code and support state of voice
This commit is contained in:
@@ -4,23 +4,6 @@
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace SPU_IO_Values {
|
||||
namespace internal {
|
||||
template<typename T>
|
||||
struct AliasUbus32IOPort : public IOPort<ubus32_t> {
|
||||
T read() const {
|
||||
return T{IOPort<ubus32_t>::read()};
|
||||
}
|
||||
|
||||
void write(T value) {
|
||||
IOPort<ubus32_t>::write(value.raw);
|
||||
}
|
||||
};
|
||||
|
||||
#define alias_ioport_ubus32(type) \
|
||||
template<> \
|
||||
struct IOPort<type> : public SPU_IO_Values::internal::AliasUbus32IOPort<type> {}
|
||||
}
|
||||
|
||||
namespace MemoryMap {
|
||||
static constexpr uintptr_t ADPCM = 0x01000;
|
||||
}
|
||||
@@ -64,7 +47,7 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
__declare_io_value(Echo, ubus32_t) {
|
||||
__declare_io_value(Echo, uint32_t) {
|
||||
static constexpr auto EchoBits = BitRange::from_to(0, 23);
|
||||
|
||||
static constexpr Echo AllOff() {
|
||||
@@ -72,27 +55,27 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
__declare_io_value(KeyOff, ubus32_t) {
|
||||
__declare_io_value(KeyOff, uint32_t) {
|
||||
static constexpr KeyOff for_specific(uint32_t id) {
|
||||
return KeyOff{ubus32_t::from(1 << id)};
|
||||
return KeyOff{1u << id};
|
||||
}
|
||||
|
||||
static constexpr KeyOff all() {
|
||||
return KeyOff{ubus32_t::from(UI32_MAX)};
|
||||
return KeyOff{UI32_MAX};
|
||||
}
|
||||
};
|
||||
|
||||
__declare_io_value(KeyOn, ubus32_t) {
|
||||
__declare_io_value(KeyOn, uint32_t) {
|
||||
static constexpr KeyOn for_specific(uint32_t id) {
|
||||
return KeyOn{ubus32_t::from(1 << id)};
|
||||
return KeyOn{1u << id};
|
||||
}
|
||||
|
||||
static constexpr KeyOn all() {
|
||||
return KeyOn{ubus32_t::from(UI32_MAX)};
|
||||
return KeyOn{UI32_MAX};
|
||||
}
|
||||
};
|
||||
|
||||
__declare_io_value(KeyStatus, ubus32_t) {
|
||||
__declare_io_value(KeyStatus, uint32_t) {
|
||||
};
|
||||
|
||||
__declare_io_value(Noise, uint16_t) {
|
||||
@@ -103,7 +86,7 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
__declare_io_value(PitchModulation, ubus32_t) {
|
||||
__declare_io_value(PitchModulation, uint32_t) {
|
||||
static constexpr auto EnableBits = BitRange::from_to(1, 23);
|
||||
|
||||
static constexpr PitchModulation AllOff() {
|
||||
@@ -228,10 +211,4 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
}
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user