Update SPU

This commit is contained in:
2024-09-28 13:52:36 +02:00
parent a76784065a
commit 4a46392f24
4 changed files with 10 additions and 9 deletions

View File

@@ -3,7 +3,6 @@
namespace JabyEngine {
namespace SPU_MMU {
// TODO: Make this work with words? Word align?
const uint8_t* allocate(uint8_t voice, size_t size);
void deallocate(uint8_t voice);
}

View File

@@ -12,7 +12,6 @@ namespace JabyEngine {
namespace SPU_MemoryMap = SPU_IO::MemoryMap;
struct SPUMemory {
// TODO: v change to uint16_t??
const uint8_t* adr;
size_t size;
@@ -76,15 +75,19 @@ namespace JabyEngine {
}
};
static VoiceManager voice_mgr;
static VoiceManager voice_mgr;
static const uint8_t* reverb_adr = reinterpret_cast<const uint8_t*>(SPU_MemoryMap::End);
// ^ change this to allocate reverb
using MemoryFoundCallback = const uint8_t* (AllocatedVoice& new_entry, AllocatedVoice* &prev_entry, AllocatedVoice* next_entry);
static const uint8_t* verify_and_add(AllocatedVoice& new_entry, AllocatedVoice* &prev_entry, AllocatedVoice* next_entry) {
// TODO: Verify that we are not crashing into reverb or that we are higher then SPU
if(new_entry.memory.adr >= reverb_adr) {
return nullptr;
}
prev_entry = &new_entry;
new_entry.next_entry = next_entry;
return new_entry.memory.adr;
}