Support new SPU voice approach
This commit is contained in:
@@ -4,7 +4,28 @@
|
||||
#include <PSX/SPU/spu.hpp>
|
||||
#include <stddef.hpp>
|
||||
|
||||
#include <stdio.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace SPU {
|
||||
SRAM_Adr Voice :: allocate(size_t size) const {
|
||||
Voice::stop();
|
||||
const auto voice_id = Voice::get_id();
|
||||
const auto adr = static_cast<SRAM_Adr>(reinterpret_cast<uintptr_t>(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 {
|
||||
const auto result = Voice::allocate(size);
|
||||
Voice::set_sample_rate(frequency);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Voice :: deallocate() const {
|
||||
Voice::stop();
|
||||
SPU_MMU::deallocate(Voice::get_id());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user