mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-08-18 16:29:16 +00:00
HLE DSP: Implement partial embedded buffer updates (#782)
Some checks are pending
Android Build / x64 (release) (push) Waiting to run
Android Build / arm64 (release) (push) Waiting to run
HTTP Server Build / build (push) Waiting to run
Hydra Core Build / Windows (push) Waiting to run
Hydra Core Build / MacOS (push) Waiting to run
Hydra Core Build / Linux (push) Waiting to run
Hydra Core Build / Android-x64 (push) Waiting to run
Hydra Core Build / ARM-Libretro (push) Waiting to run
Linux AppImage Build / build (push) Waiting to run
Linux Build / build (push) Waiting to run
MacOS Build / MacOS-arm64 (push) Waiting to run
MacOS Build / MacOS-x86_64 (push) Waiting to run
MacOS Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Windows (push) Waiting to run
Qt Build / MacOS-arm64 (push) Waiting to run
Qt Build / MacOS-x86_64 (push) Waiting to run
Qt Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Linux (push) Waiting to run
Windows Build / build (push) Waiting to run
iOS Simulator Build / build (push) Waiting to run
Some checks are pending
Android Build / x64 (release) (push) Waiting to run
Android Build / arm64 (release) (push) Waiting to run
HTTP Server Build / build (push) Waiting to run
Hydra Core Build / Windows (push) Waiting to run
Hydra Core Build / MacOS (push) Waiting to run
Hydra Core Build / Linux (push) Waiting to run
Hydra Core Build / Android-x64 (push) Waiting to run
Hydra Core Build / ARM-Libretro (push) Waiting to run
Linux AppImage Build / build (push) Waiting to run
Linux Build / build (push) Waiting to run
MacOS Build / MacOS-arm64 (push) Waiting to run
MacOS Build / MacOS-x86_64 (push) Waiting to run
MacOS Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Windows (push) Waiting to run
Qt Build / MacOS-arm64 (push) Waiting to run
Qt Build / MacOS-x86_64 (push) Waiting to run
Qt Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Linux (push) Waiting to run
Windows Build / build (push) Waiting to run
iOS Simulator Build / build (push) Waiting to run
This commit is contained in:
parent
146dc92a0f
commit
2ccb264a86
2 changed files with 27 additions and 2 deletions
|
@ -70,6 +70,8 @@ namespace Audio {
|
||||||
uint enabledMixStages = 0;
|
uint enabledMixStages = 0;
|
||||||
|
|
||||||
u32 samplePosition; // Sample number into the current audio buffer
|
u32 samplePosition; // Sample number into the current audio buffer
|
||||||
|
u32 currentBufferPaddr; // Physical address of current audio buffer
|
||||||
|
|
||||||
float rateMultiplier;
|
float rateMultiplier;
|
||||||
u16 syncCount;
|
u16 syncCount;
|
||||||
u16 currentBufferID;
|
u16 currentBufferID;
|
||||||
|
|
|
@ -396,7 +396,28 @@ namespace Audio {
|
||||||
|
|
||||||
if (config.partialEmbeddedBufferDirty) {
|
if (config.partialEmbeddedBufferDirty) {
|
||||||
config.partialEmbeddedBufferDirty = 0;
|
config.partialEmbeddedBufferDirty = 0;
|
||||||
printf("Partial embedded buffer dirty for voice %d\n", source.index);
|
|
||||||
|
const u8* data = getPointerPhys<u8>(source.currentBufferPaddr & ~0x3);
|
||||||
|
|
||||||
|
if (data != nullptr) {
|
||||||
|
switch (source.sampleFormat) {
|
||||||
|
case SampleFormat::PCM8: source.currentSamples = decodePCM8(data, config.length, source); break;
|
||||||
|
case SampleFormat::PCM16: source.currentSamples = decodePCM16(data, config.length, source); break;
|
||||||
|
case SampleFormat::ADPCM: source.currentSamples = decodeADPCM(data, config.length, source); break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Helpers::warn("Invalid DSP sample format");
|
||||||
|
source.currentSamples = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We're skipping the first samplePosition samples, so remove them from the buffer so as not to consume them later
|
||||||
|
if (source.samplePosition > 0) {
|
||||||
|
auto start = source.currentSamples.begin();
|
||||||
|
auto end = std::next(start, source.samplePosition);
|
||||||
|
source.currentSamples.erase(start, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.bufferQueueDirty) {
|
if (config.bufferQueueDirty) {
|
||||||
|
@ -478,6 +499,7 @@ namespace Audio {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source.currentBufferPaddr = buffer.paddr;
|
||||||
source.currentBufferID = buffer.bufferID;
|
source.currentBufferID = buffer.bufferID;
|
||||||
source.previousBufferID = 0;
|
source.previousBufferID = 0;
|
||||||
// For looping buffers, this is only set for the first time we play it. Loops do not set the dirty bit.
|
// For looping buffers, this is only set for the first time we play it. Loops do not set the dirty bit.
|
||||||
|
@ -766,6 +788,7 @@ namespace Audio {
|
||||||
interpolationMode = InterpolationMode::Linear;
|
interpolationMode = InterpolationMode::Linear;
|
||||||
|
|
||||||
samplePosition = 0;
|
samplePosition = 0;
|
||||||
|
currentBufferPaddr = 0;
|
||||||
previousBufferID = 0;
|
previousBufferID = 0;
|
||||||
currentBufferID = 0;
|
currentBufferID = 0;
|
||||||
syncCount = 0;
|
syncCount = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue