Update SPU IO way
This commit is contained in:
@@ -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<size_t>(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()));
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user