mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Merge pull request #9829 from sepalani/ai-samples
AudioInterface: Fix sample counter
This commit is contained in:
commit
9476733a80
@ -241,9 +241,10 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
mmio->Register(base | AI_SAMPLE_COUNTER, MMIO::ComplexRead<u32>([](u32) {
|
mmio->Register(base | AI_SAMPLE_COUNTER, MMIO::ComplexRead<u32>([](u32) {
|
||||||
|
const u64 cycles_streamed =
|
||||||
|
IsPlaying() ? (CoreTiming::GetTicks() - s_last_cpu_time) : s_last_cpu_time;
|
||||||
return s_sample_counter +
|
return s_sample_counter +
|
||||||
static_cast<u32>((CoreTiming::GetTicks() - s_last_cpu_time) /
|
static_cast<u32>(cycles_streamed / s_cpu_cycles_per_sample);
|
||||||
s_cpu_cycles_per_sample);
|
|
||||||
}),
|
}),
|
||||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||||
s_sample_counter = val;
|
s_sample_counter = val;
|
||||||
|
Loading…
Reference in New Issue
Block a user