forked from suyu/suyu
Merge pull request #5868 from german77/HandheldFix
Prevent over scheduling audio events and add motion update unschedule event
This commit is contained in:
commit
7666c0994c
2 changed files with 9 additions and 1 deletions
|
@ -111,7 +111,14 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
|
||||||
|
|
||||||
sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
|
sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
|
||||||
|
|
||||||
core_timing.ScheduleEvent(GetBufferReleaseNS(*active_buffer) - ns_late, release_event, {});
|
const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer);
|
||||||
|
|
||||||
|
// If ns_late is higher than the update rate ignore the delay
|
||||||
|
if (ns_late > buffer_release_ns) {
|
||||||
|
ns_late = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::ReleaseActiveBuffer(std::chrono::nanoseconds ns_late) {
|
void Stream::ReleaseActiveBuffer(std::chrono::nanoseconds ns_late) {
|
||||||
|
|
|
@ -110,6 +110,7 @@ void IAppletResource::DeactivateController(HidController controller) {
|
||||||
|
|
||||||
IAppletResource ::~IAppletResource() {
|
IAppletResource ::~IAppletResource() {
|
||||||
system.CoreTiming().UnscheduleEvent(pad_update_event, 0);
|
system.CoreTiming().UnscheduleEvent(pad_update_event, 0);
|
||||||
|
system.CoreTiming().UnscheduleEvent(motion_update_event, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
|
void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
Loading…
Reference in a new issue