2018-08-16 19:47:36 -04:00
|
|
|
using System;
|
|
|
|
|
2018-03-15 20:06:24 -04:00
|
|
|
namespace Ryujinx.Audio
|
|
|
|
{
|
2018-08-16 19:47:36 -04:00
|
|
|
public interface IAalOutput : IDisposable
|
2018-03-15 20:06:24 -04:00
|
|
|
{
|
2020-08-18 15:03:55 -04:00
|
|
|
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);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
void CloseTrack(int trackId);
|
2018-03-15 20:06:24 -04:00
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
bool ContainsBuffer(int trackId, long bufferTag);
|
2018-03-15 20:06:24 -04:00
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
long[] GetReleasedBuffers(int trackId, int maxCount);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
2020-08-18 15:03:55 -04:00
|
|
|
void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct;
|
2018-03-15 20:06:24 -04:00
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
void Start(int trackId);
|
2019-10-11 11:54:29 -04:00
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
void Stop(int trackId);
|
2018-03-15 20:06:24 -04:00
|
|
|
|
2019-10-11 11:54:29 -04:00
|
|
|
float GetVolume();
|
|
|
|
|
|
|
|
void SetVolume(float volume);
|
|
|
|
|
2018-11-14 21:22:50 -05:00
|
|
|
PlaybackState GetState(int trackId);
|
2018-03-15 20:06:24 -04:00
|
|
|
}
|
|
|
|
}
|