This commit is contained in:
wheremyfoodat 2024-04-27 00:37:45 +03:00
parent 26c07717aa
commit e9e041813f
2 changed files with 19 additions and 18 deletions

View file

@ -99,6 +99,7 @@ namespace Audio {
using Source = Audio::DSPSource; using Source = Audio::DSPSource;
using SampleBuffer = Source::SampleBuffer; using SampleBuffer = Source::SampleBuffer;
private: private:
enum class DSPState : u32 { enum class DSPState : u32 {
Off, Off,

View file

@ -145,10 +145,7 @@ namespace Audio {
dspService.triggerPipeEvent(DSPPipeType::Audio); dspService.triggerPipeEvent(DSPPipeType::Audio);
break; break;
case StateChange::Shutdown: case StateChange::Shutdown: dspState = DSPState::Off; break;
dspState = DSPState::Off;
break;
default: Helpers::panic("Unimplemented DSP audio pipe state change %d", state); default: Helpers::panic("Unimplemented DSP audio pipe state change %d", state);
} }
} }
@ -216,6 +213,7 @@ namespace Audio {
// Generate audio // Generate audio
if (source.enabled && !source.buffers.empty()) { if (source.enabled && !source.buffers.empty()) {
static int aaaa = 0;
const auto& buffer = source.buffers.top(); const auto& buffer = source.buffers.top();
const u8* data = getPointerPhys<u8>(buffer.paddr); const u8* data = getPointerPhys<u8>(buffer.paddr);
@ -223,6 +221,7 @@ namespace Audio {
// TODO // TODO
} }
} }
}
// Update write region of shared memory // Update write region of shared memory
auto& status = write.sourceStatuses.status[i]; auto& status = write.sourceStatuses.status[i];
@ -341,7 +340,8 @@ namespace Audio {
HLE_DSP::SampleBuffer HLE_DSP::decodeADPCM(const u8* data, usize sampleCount, Source& source) { HLE_DSP::SampleBuffer HLE_DSP::decodeADPCM(const u8* data, usize sampleCount, Source& source) {
static constexpr uint samplesPerBlock = 14; static constexpr uint samplesPerBlock = 14;
// An ADPCM block is comprised of a single header which contains the scale and predictor value for the block, and then 14 4bpp samples (hence the / 2) // An ADPCM block is comprised of a single header which contains the scale and predictor value for the block, and then 14 4bpp samples (hence
// the / 2)
static constexpr usize blockSize = sizeof(u8) + samplesPerBlock / 2; static constexpr usize blockSize = sizeof(u8) + samplesPerBlock / 2;
// How many ADPCM blocks we'll be consuming. It's sampleCount / samplesPerBlock, rounded up. // How many ADPCM blocks we'll be consuming. It's sampleCount / samplesPerBlock, rounded up.