Clear Voice Keys
This commit is contained in:
@@ -2,47 +2,11 @@
|
||||
#include <PSX/System/IOPorts/IOPort.hpp>
|
||||
|
||||
namespace SPU {
|
||||
static void clear_main_volume() {
|
||||
static constexpr auto StartVol = SweepVolume().set_volume_mode().set_volume_percent(50.0);
|
||||
|
||||
io_class__update_with(MainVolume::Left, StartVol);
|
||||
io_class__update_with(MainVolume::Right, StartVol);
|
||||
}
|
||||
|
||||
static void clear_keys() {
|
||||
io_class__update_with(Key::off, KeyW::All1());
|
||||
}
|
||||
|
||||
static void clear_voice(Voice& voice) {
|
||||
io_class__update_with(voice.volumeLeft, SweepVolume());
|
||||
io_class__update_with(voice.volumeRight, SweepVolume());
|
||||
|
||||
io_class__update_with(voice.sampleRate, SampleRate::from_HZ(0.0));
|
||||
io_class__update_with(voice.adsr, ADSR());
|
||||
io_class__update_with(voice.currentVolume, SweepVolume());
|
||||
|
||||
voice.adr = 0x200;
|
||||
voice.repeatAdr = 0x200;
|
||||
}
|
||||
|
||||
static void enable_control() {
|
||||
io_class__update_with(Control::Register, Control().set_on().set_unmute().set_cd_audio_enable());
|
||||
}
|
||||
|
||||
static void disable_control() {
|
||||
io_class__update_with(Control::Register, Control());
|
||||
static void clear_key() {
|
||||
Key::off.write(UI32_MAX);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
clear_main_volume();
|
||||
clear_keys();
|
||||
disable_control();
|
||||
|
||||
for(auto& voice : Voice::Channel) {
|
||||
clear_voice(voice);
|
||||
}
|
||||
|
||||
DataTransferControl::Register = (2 << 1);
|
||||
enable_control();
|
||||
clear_key();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user