2018-08-16 17:47:36 -06:00
|
|
|
using System;
|
|
|
|
|
2018-03-15 18:06:24 -06:00
|
|
|
namespace Ryujinx.Audio
|
|
|
|
{
|
2018-08-16 17:47:36 -06:00
|
|
|
public interface IAalOutput : IDisposable
|
2018-03-15 18:06:24 -06:00
|
|
|
{
|
2020-08-18 13:03:55 -06:00
|
|
|
bool SupportsChannelCount(int channels);
|
|
|
|
|
|
|
|
private int SelectHardwareChannelCount(int targetChannelCount)
|
|
|
|
{
|
|
|
|
if (SupportsChannelCount(targetChannelCount))
|
|
|
|
{
|
|
|
|
return targetChannelCount;
|
|
|
|
}
|
|
|
|
|
2020-11-27 12:55:00 -07:00
|
|
|
return targetChannelCount switch
|
2020-08-18 13:03:55 -06:00
|
|
|
{
|
2020-11-27 12:55:00 -07:00
|
|
|
6 => SelectHardwareChannelCount(2),
|
|
|
|
2 => SelectHardwareChannelCount(1),
|
|
|
|
1 => throw new ArgumentException("No valid channel configuration found!"),
|
|
|
|
_ => throw new ArgumentException($"Invalid targetChannelCount {targetChannelCount}"),
|
|
|
|
};
|
2020-08-18 13:03:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
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 21:42:44 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
void CloseTrack(int trackId);
|
2018-03-15 18:06:24 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
bool ContainsBuffer(int trackId, long bufferTag);
|
2018-03-15 18:06:24 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
long[] GetReleasedBuffers(int trackId, int maxCount);
|
2018-03-15 21:42:44 -06:00
|
|
|
|
2020-08-18 13:03:55 -06:00
|
|
|
void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct;
|
2018-03-15 18:06:24 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
void Start(int trackId);
|
2019-10-11 09:54:29 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
void Stop(int trackId);
|
2018-03-15 18:06:24 -06:00
|
|
|
|
2020-11-20 13:59:01 -07:00
|
|
|
uint GetBufferCount(int trackId);
|
2019-10-11 09:54:29 -06:00
|
|
|
|
2020-11-20 13:59:01 -07:00
|
|
|
ulong GetPlayedSampleCount(int trackId);
|
|
|
|
|
|
|
|
bool FlushBuffers(int trackId);
|
|
|
|
|
|
|
|
float GetVolume(int trackId);
|
|
|
|
|
|
|
|
void SetVolume(int trackId, float volume);
|
2019-10-11 09:54:29 -06:00
|
|
|
|
2018-11-14 19:22:50 -07:00
|
|
|
PlaybackState GetState(int trackId);
|
2018-03-15 18:06:24 -06:00
|
|
|
}
|
|
|
|
}
|