| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- namespace Ryujinx.Audio
- {
- public interface IAalOutput : IDisposable
- {
- bool SupportsChannelCount(int channels);
- private int SelectHardwareChannelCount(int targetChannelCount)
- {
- if (SupportsChannelCount(targetChannelCount))
- {
- return targetChannelCount;
- }
- switch (targetChannelCount)
- {
- case 6:
- return SelectHardwareChannelCount(2);
- case 2:
- return SelectHardwareChannelCount(1);
- case 1:
- throw new ArgumentException("No valid channel configuration found!");
- default:
- throw new ArgumentException($"Invalid targetChannelCount {targetChannelCount}");
- }
- }
- int OpenTrack(int sampleRate, int channels, ReleaseCallback callback)
- {
- return OpenHardwareTrack(sampleRate, SelectHardwareChannelCount(channels), channels, callback);
- }
- int OpenHardwareTrack(int sampleRate, int hardwareChannels, int virtualChannels, ReleaseCallback callback);
- void CloseTrack(int trackId);
- bool ContainsBuffer(int trackId, long bufferTag);
- long[] GetReleasedBuffers(int trackId, int maxCount);
- void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct;
- void Start(int trackId);
- void Stop(int trackId);
- float GetVolume();
- void SetVolume(float volume);
- PlaybackState GetState(int trackId);
- }
- }
|