Fix XEBA and Voice::is_end code
This commit is contained in:
parent
018058d79b
commit
01b2ec4083
|
@ -44,8 +44,7 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_end() const {
|
bool is_end() const {
|
||||||
// TODO: Make work in XEBRA
|
return SPU_IO::Voice[Voice::get_id()].adsr_volume.read() == SimpleVolume::mute();
|
||||||
return SPU_IO::Key::Status.read().is_set(Voice::get_id());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ namespace JabyEngine {
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct Voice {
|
struct Voice {
|
||||||
SweepVolumeIO volumeLeft; //Offset: 0x0
|
SweepVolumeIO volumeLeft; //Offset: 0x0
|
||||||
SweepVolumeIO volumeRight; //Offset: 0x2
|
SweepVolumeIO volumeRight; //Offset: 0x2
|
||||||
SampleRateIO sampleRate; //Offset: 0x4;
|
SampleRateIO sampleRate; //Offset: 0x4;
|
||||||
SRAMAdrIO adr; //Offset: 0x6
|
SRAMAdrIO adr; //Offset: 0x6
|
||||||
ADIO ad; //Offset: 0x8
|
ADIO ad; //Offset: 0x8
|
||||||
SRIO sr; //Offset: 0xA
|
SRIO sr; //Offset: 0xA
|
||||||
SimpleVolumeIO currentVolume; //Offset: 0xC
|
SimpleVolumeIO adsr_volume; //Offset: 0xC
|
||||||
SRAMAdrIO repeatAdr; //Offset: 0xE
|
SRAMAdrIO repeatAdr; //Offset: 0xE
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace JabyEngine {
|
||||||
voice.sampleRate.write(SampleRate::stop());
|
voice.sampleRate.write(SampleRate::stop());
|
||||||
voice.ad.write(AD::none());
|
voice.ad.write(AD::none());
|
||||||
voice.sr.write(SR::none());
|
voice.sr.write(SR::none());
|
||||||
voice.currentVolume.write(SimpleVolume::mute());
|
voice.adsr_volume.write(SimpleVolume::mute());
|
||||||
|
|
||||||
voice.adr.write(SRAMAdr::adpcm_start());
|
voice.adr.write(SRAMAdr::adpcm_start());
|
||||||
voice.repeatAdr.write(SRAMAdr::adpcm_start());
|
voice.repeatAdr.write(SRAMAdr::adpcm_start());
|
||||||
|
@ -58,11 +58,11 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_voices() {
|
static void wait_voices() {
|
||||||
static constexpr SimpleVolume Treshhold{static_cast<int16_t>(I16_MAX*0.03)};
|
static constexpr auto Treshhold = SimpleVolume::mute();
|
||||||
|
|
||||||
try_again:
|
try_again:
|
||||||
for(const auto& voice : SPU_IO::Voice) {
|
for(const auto& voice : SPU_IO::Voice) {
|
||||||
if(voice.currentVolume.read() > Treshhold) {
|
if(voice.adsr_volume.read() > Treshhold) {
|
||||||
goto try_again;
|
goto try_again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue