Fix XEBA and Voice::is_end code

This commit is contained in:
Jaby 2024-09-26 21:40:15 +02:00
parent 018058d79b
commit 01b2ec4083
3 changed files with 12 additions and 13 deletions

View File

@ -44,8 +44,7 @@ namespace JabyEngine {
}
bool is_end() const {
// TODO: Make work in XEBRA
return SPU_IO::Key::Status.read().is_set(Voice::get_id());
return SPU_IO::Voice[Voice::get_id()].adsr_volume.read() == SimpleVolume::mute();
}
};

View File

@ -35,14 +35,14 @@ namespace JabyEngine {
#pragma pack(push, 1)
struct Voice {
SweepVolumeIO volumeLeft; //Offset: 0x0
SweepVolumeIO volumeRight; //Offset: 0x2
SampleRateIO sampleRate; //Offset: 0x4;
SRAMAdrIO adr; //Offset: 0x6
ADIO ad; //Offset: 0x8
SRIO sr; //Offset: 0xA
SimpleVolumeIO currentVolume; //Offset: 0xC
SRAMAdrIO repeatAdr; //Offset: 0xE
SweepVolumeIO volumeLeft; //Offset: 0x0
SweepVolumeIO volumeRight; //Offset: 0x2
SampleRateIO sampleRate; //Offset: 0x4;
SRAMAdrIO adr; //Offset: 0x6
ADIO ad; //Offset: 0x8
SRIO sr; //Offset: 0xA
SimpleVolumeIO adsr_volume; //Offset: 0xC
SRAMAdrIO repeatAdr; //Offset: 0xE
};
#pragma pack(pop)

View File

@ -29,7 +29,7 @@ namespace JabyEngine {
voice.sampleRate.write(SampleRate::stop());
voice.ad.write(AD::none());
voice.sr.write(SR::none());
voice.currentVolume.write(SimpleVolume::mute());
voice.adsr_volume.write(SimpleVolume::mute());
voice.adr.write(SRAMAdr::adpcm_start());
voice.repeatAdr.write(SRAMAdr::adpcm_start());
@ -58,11 +58,11 @@ namespace JabyEngine {
}
static void wait_voices() {
static constexpr SimpleVolume Treshhold{static_cast<int16_t>(I16_MAX*0.03)};
static constexpr auto Treshhold = SimpleVolume::mute();
try_again:
for(const auto& voice : SPU_IO::Voice) {
if(voice.currentVolume.read() > Treshhold) {
if(voice.adsr_volume.read() > Treshhold) {
goto try_again;
}
}