mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-28 18:10:50 +01:00
57c4e6ef21
* audout: Implement GetAudioOutBufferCount, GetAudioOutPlayedSampleCount and FlushAudioOutBuffers This PR implement audout service calls: - GetAudioOutBufferCount - GetAudioOutPlayedSampleCount - FlushAudioOutBuffers The RE calls just give some hints about no extra checks. Since we use a totally different implementation because of our backend, I can't do something better for now. SetAudioOutVolume and GetAudioOutVolume are fixed too by set/get the volume of the current opened track, previous implementation was wrong. This fix #1133, fix #1258 and fix #1519. Thanks to @jduncanator for this help during the implementation and all his precious advices. * Fix some debug leftovers * Address jD feedback
60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
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);
|
|
|
|
uint GetBufferCount(int trackId);
|
|
|
|
ulong GetPlayedSampleCount(int trackId);
|
|
|
|
bool FlushBuffers(int trackId);
|
|
|
|
float GetVolume(int trackId);
|
|
|
|
void SetVolume(int trackId, float volume);
|
|
|
|
PlaybackState GetState(int trackId);
|
|
}
|
|
} |