blob: 493a6f9b582e7f4875e3add9a4aafdc7b4f08e5c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
using Ryujinx.Audio;
using Ryujinx.Audio.Input;
using Ryujinx.Audio.Integration;
using Ryujinx.Audio.Output;
using Ryujinx.Audio.Renderer.Device;
using Ryujinx.Audio.Renderer.Server;
using Ryujinx.Cpu;
using Ryujinx.Horizon.Sdk.Audio;
using System;
namespace Ryujinx.Horizon.Audio
{
class AudioManagers : IDisposable
{
public AudioManager AudioManager { get; }
public AudioOutputManager AudioOutputManager { get; }
public AudioInputManager AudioInputManager { get; }
public AudioRendererManager AudioRendererManager { get; }
public VirtualDeviceSessionRegistry AudioDeviceSessionRegistry { get; }
public AudioManagers(IHardwareDeviceDriver audioDeviceDriver, ITickSource tickSource)
{
AudioManager = new AudioManager();
AudioOutputManager = new AudioOutputManager();
AudioInputManager = new AudioInputManager();
AudioRendererManager = new AudioRendererManager(tickSource);
AudioDeviceSessionRegistry = new VirtualDeviceSessionRegistry(audioDeviceDriver);
IWritableEvent[] audioOutputRegisterBufferEvents = new IWritableEvent[Constants.AudioOutSessionCountMax];
for (int i = 0; i < audioOutputRegisterBufferEvents.Length; i++)
{
audioOutputRegisterBufferEvents[i] = new AudioEvent();
}
AudioOutputManager.Initialize(audioDeviceDriver, audioOutputRegisterBufferEvents);
IWritableEvent[] audioInputRegisterBufferEvents = new IWritableEvent[Constants.AudioInSessionCountMax];
for (int i = 0; i < audioInputRegisterBufferEvents.Length; i++)
{
audioInputRegisterBufferEvents[i] = new AudioEvent();
}
AudioInputManager.Initialize(audioDeviceDriver, audioInputRegisterBufferEvents);
IWritableEvent[] systemEvents = new IWritableEvent[Constants.AudioRendererSessionCountMax];
for (int i = 0; i < systemEvents.Length; i++)
{
systemEvents[i] = new AudioEvent();
}
AudioManager.Initialize(audioDeviceDriver.GetUpdateRequiredEvent(), AudioOutputManager.Update, AudioInputManager.Update);
AudioRendererManager.Initialize(systemEvents, audioDeviceDriver);
AudioManager.Start();
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
AudioManager.Dispose();
AudioOutputManager.Dispose();
AudioInputManager.Dispose();
AudioRendererManager.Dispose();
}
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}
|