Improve SPU code and support state of voice
This commit is contained in:
@@ -52,11 +52,14 @@ namespace JabyEngine {
|
||||
static Progress parse_header(State::Configuration& config, VAGState& state) {
|
||||
if(config.data_bytes >= sizeof(VAGHeader)) {
|
||||
const auto& header = *reinterpret_cast<const VAGHeader*>(config.data_adr);
|
||||
const auto bytes = header.get_sample_size();
|
||||
const auto words = bytes_to_words(header.get_sample_size());
|
||||
const auto bytes = words_to_bytes(words);
|
||||
|
||||
state.words_left = bytes_to_words(bytes);
|
||||
state.words_left = words;
|
||||
|
||||
auto sram_adr = SPU::voice[state.voice_id].allocate(SPU_IO::SampleRate::from_HZ(header.get_sample_frequency()), words_to_bytes(state.words_left));
|
||||
auto sram_adr = SPU::voice[state.voice_id].allocate(SPU_IO::SampleRate::from_HZ(header.get_sample_frequency()), bytes);
|
||||
// TODO: Keep this as optional?
|
||||
printf("SPU: Allocated %i @0x%p to 0x%p (%i bytes)\n", state.voice_id, sram_adr.raw, (sram_adr.raw + bytes), bytes);
|
||||
SPU::voice[state.voice_id].set_volume(state.inital_vol, state.inital_vol);
|
||||
|
||||
config.processed(sizeof(VAGHeader));
|
||||
|
||||
Reference in New Issue
Block a user