Save state

This commit is contained in:
Jaby
2024-09-06 18:32:09 +01:00
committed by Jaby
parent 1a5404322b
commit afbefcce45
8 changed files with 143 additions and 32 deletions

View File

@@ -1,3 +1,4 @@
#include "../../../internal-include/SPU/spu_internal.hpp"
#include <PSX/Auxiliary/big_endian.hpp>
#include <PSX/File/file_processor_helper.hpp>
#include <PSX/SPU/spu.hpp>
@@ -38,15 +39,23 @@ namespace JabyEngine {
}
};
static Progress parse_sample(State::Configuration& config, VAGState& state) {
// Load balancer?
}
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);
state.bytes_left = header.get_sample_size();
state.adr = SPU::voice[state.voice_id].allocate(SPU_IO::SampleRate::from_HZ(header.get_sample_frequency()), state.bytes_left);
state.adr = SPU::voice[state.voice_id].allocate(SPU_IO::SampleRate::from_HZ(header.get_sample_frequency()), state.bytes_left);
SPU::internal::DMA::Receive::prepare();
SPU::internal::DMA::Receive::set_dst(state.adr);
// TODO: Parse samples
return Progress::Error;
config.processed(sizeof(VAGHeader));
return Helper::exchange_and_execute_process_function(parse_sample, config, state);
}
return Progress::InProgress;