aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/Decoder.cs
blob: c5dd2f00d113730a26a8af68797f1d759a3903c0 (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();
        }
    }
}