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

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

        public int SampleRate => _decoder.SampleRate;
        public int ChannelsCount => _decoder.NumChannels;

        public Decoder(int sampleRate, int channelsCount)
        {
            _decoder = new OpusDecoder(sampleRate, channelsCount);
        }

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

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