mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-06-02 21:28:46 +02:00
d4d0a48bfe
* 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
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|