Support new SPU voice approach
This commit is contained in:
@@ -1,7 +1,32 @@
|
||||
#pragma once
|
||||
#include "../jabyengine.hpp"
|
||||
#include "../System/IOPorts/spu_io.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace SPU {
|
||||
using SRAM_Adr = uint16_t;
|
||||
|
||||
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;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
void stop() const {
|
||||
SPU_IO::Key::Off.write(1 << Voice::get_id());
|
||||
}
|
||||
};
|
||||
|
||||
extern const Voice voice[SPU_IO::VoiceCount];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user