Make SPU wait for boot up sound to finish
This commit is contained in:
@@ -6,6 +6,7 @@ namespace GPU {
|
||||
}
|
||||
|
||||
namespace SPU {
|
||||
void stop_voices();
|
||||
void setup();
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,12 @@
|
||||
#include <PSX/System/IOPorts/SPU_IO.hpp>
|
||||
#include <PSX/System/IOPorts/DMA_IO.hpp>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace SPU {
|
||||
using namespace Port;
|
||||
using namespace DMA::Port;
|
||||
|
||||
static void clear_key() {
|
||||
Key::off.write(UI32_MAX);
|
||||
}
|
||||
|
||||
static void clear_main_volume() {
|
||||
static constexpr auto StartVol = SweepVolume::with(SweepVolume::VolumeEnable, SweepVolume::Volume.with(I16_MAX >> 2));
|
||||
|
||||
@@ -70,8 +67,24 @@ namespace SPU {
|
||||
DataTransferControl.write(RequiredValue);
|
||||
}
|
||||
|
||||
static void wait_voices() {
|
||||
static constexpr int16_t Treshhold = (I16_MAX*0.03);
|
||||
|
||||
try_again:
|
||||
for(const auto& voice : Voices) {
|
||||
if(voice.currentVolume.read() > Treshhold) {
|
||||
goto try_again;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void stop_voices() {
|
||||
Key::off.write(UI32_MAX);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
clear_key();
|
||||
wait_voices();
|
||||
|
||||
clear_main_volume();
|
||||
clear_cd_and_ext_audio_volume();
|
||||
clear_control_register();
|
||||
|
@@ -4,7 +4,13 @@
|
||||
namespace JabyEngine {
|
||||
void start() {
|
||||
printf("Hello Planschbecken\n");
|
||||
//We key off the voices
|
||||
SPU::stop_voices();
|
||||
|
||||
//Load picture here
|
||||
//Pause??
|
||||
|
||||
//Do the real setup
|
||||
GPU::setup();
|
||||
SPU::setup();
|
||||
printf("Setup done!\n");
|
||||
|
Reference in New Issue
Block a user