mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-10-03 10:15:51 -05:00
Migrate Audio service to new IPC (#6285)
* Migrate audren to new IPC * Migrate audout * Migrate audin * Migrate hwopus * Bye bye old audio service * Switch volume control to IHardwareDeviceDriver * Somewhat unrelated changes * Remove Concentus reference from HLE * Implement OpenAudioRendererForManualExecution * Remove SetVolume/GetVolume methods that are not necessary * Remove SetVolume/GetVolume methods that are not necessary (2) * Fix incorrect volume update * PR feedback * PR feedback * Stub audrec * Init outParameter * Make FinalOutputRecorderParameter/Internal readonly * Make FinalOutputRecorder IDisposable * Fix HardwareOpusDecoderManager parameter buffers * Opus work buffer size and error handling improvements * Add AudioInProtocolName enum * Fix potential divisions by zero
This commit is contained in:
50
src/Ryujinx.Horizon/Sdk/Audio/AudioEvent.cs
Normal file
50
src/Ryujinx.Horizon/Sdk/Audio/AudioEvent.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Ryujinx.Audio.Integration;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using Ryujinx.Horizon.Sdk.OsTypes;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.Audio
|
||||
{
|
||||
class AudioEvent : IWritableEvent, IDisposable
|
||||
{
|
||||
private SystemEventType _systemEvent;
|
||||
private readonly IExternalEvent _externalEvent;
|
||||
|
||||
public AudioEvent()
|
||||
{
|
||||
Os.CreateSystemEvent(out _systemEvent, EventClearMode.ManualClear, interProcess: true);
|
||||
|
||||
// We need to do this because the event will be signalled from a different thread.
|
||||
_externalEvent = HorizonStatic.Syscall.GetExternalEvent(Os.GetWritableHandleOfSystemEvent(ref _systemEvent));
|
||||
}
|
||||
|
||||
public void Signal()
|
||||
{
|
||||
_externalEvent.Signal();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_externalEvent.Clear();
|
||||
}
|
||||
|
||||
public int GetReadableHandle()
|
||||
{
|
||||
return Os.GetReadableHandleOfSystemEvent(ref _systemEvent);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Os.DestroySystemEvent(ref _systemEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user