Allocate voice
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <PSX/Auxiliary/big_endian.hpp>
|
||||
#include <PSX/File/file_processor_helper.hpp>
|
||||
#include <PSX/SPU/spu.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
||||
#ifdef __SUPPORT_VAG__
|
||||
@@ -28,8 +29,12 @@ namespace JabyEngine {
|
||||
};
|
||||
|
||||
struct VAGState {
|
||||
static constexpr VAGState create() {
|
||||
return VAGState{};
|
||||
uint32_t voice_id;
|
||||
size_t bytes_left;
|
||||
SPU::SRAM_Adr adr;
|
||||
|
||||
static constexpr VAGState create(uint32_t voice_id) {
|
||||
return VAGState{.voice_id = voice_id, .bytes_left = 0, .adr = 0};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,8 +42,10 @@ namespace JabyEngine {
|
||||
if(config.data_bytes >= sizeof(VAGHeader)) {
|
||||
const auto& header = *reinterpret_cast<const VAGHeader*>(config.data_adr);
|
||||
|
||||
//printf("VAG-ID: %s\nName: %s\nSample size: %i\nSample rate: %i\n", header.id, header.name, header.get_sample_size(), header.get_sample_frequency());
|
||||
// TODO: Allocate SPU memory
|
||||
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);
|
||||
|
||||
// TODO: Parse samples
|
||||
return Progress::Error;
|
||||
}
|
||||
|
||||
@@ -46,7 +53,7 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const VAG& file) {
|
||||
return State::from(VAGState::create(), data_adr, parse_header);
|
||||
return State::from(VAGState::create(file.voice_number), data_adr, parse_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user