Update SPU
This commit is contained in:
parent
72f947e007
commit
b37582ac5e
|
@ -21,13 +21,11 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
namespace DMA {
|
||||
using words_t = size_t;
|
||||
|
||||
struct WordsReady {
|
||||
uint32_t words_to_use;
|
||||
bool is_last;
|
||||
|
||||
static constexpr WordsReady calculate(const State::Configuration& config, words_t words_left) {
|
||||
static constexpr WordsReady calculate(const State::Configuration& config, size_t words_left) {
|
||||
const auto config_data_words = (config.data_bytes/sizeof(uint32_t));
|
||||
const auto words_to_use = (config_data_words > words_left) ? words_left : config_data_words;
|
||||
|
||||
|
@ -39,7 +37,7 @@ namespace JabyEngine {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
static words_t send_words(words_t words_to_send, bool send_all) {
|
||||
static size_t send_words(size_t words_to_send, bool send_all) {
|
||||
auto blocks_to_send = words_to_send/16;
|
||||
while(blocks_to_send > 0) {
|
||||
const auto block_send = (blocks_to_send > UI16_MAX) ? UI16_MAX : blocks_to_send;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace JabyEngine {
|
|||
namespace SPU_IO_Values {
|
||||
namespace MemoryMap {
|
||||
static constexpr uintptr_t ADPCM = 0x01000;
|
||||
static constexpr uintptr_t End = 0x7FFFF;
|
||||
}
|
||||
|
||||
__declare_io_value(AD, uint16_t) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -77,14 +76,18 @@ namespace JabyEngine {
|
|||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue