aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/MultiSampleDecoder.cs
blob: 23721d3bf2506e090333bfe950ebe9047d1b118e (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
using Concentus.Structs;

namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager
{
    class MultiSampleDecoder : IDecoder
    {
        private readonly OpusMSDecoder _decoder;

        public int SampleRate => _decoder.SampleRate;
        public int ChannelsCount { get; }

        public MultiSampleDecoder(int sampleRate, int channelsCount, int streams, int coupledStreams, byte[] mapping)
        {
            ChannelsCount = channelsCount;
            _decoder = new OpusMSDecoder(sampleRate, channelsCount, streams, coupledStreams, mapping);
        }

        public int Decode(byte[] inData, int inDataOffset, int len, short[] outPcm, int outPcmOffset, int frameSize)
        {
            return _decoder.DecodeMultistream(inData, inDataOffset, len, outPcm, outPcmOffset, frameSize, 0);
        }

        public void ResetState()
        {
            _decoder.ResetState();
        }
    }
}