MultiSampleDecoder.cs 917 B

12345678910111213141516171819202122232425262728
  1. using Concentus.Structs;
  2. namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager
  3. {
  4. class MultiSampleDecoder : IDecoder
  5. {
  6. private readonly OpusMSDecoder _decoder;
  7. public int SampleRate => _decoder.SampleRate;
  8. public int ChannelsCount { get; }
  9. public MultiSampleDecoder(int sampleRate, int channelsCount, int streams, int coupledStreams, byte[] mapping)
  10. {
  11. ChannelsCount = channelsCount;
  12. _decoder = new OpusMSDecoder(sampleRate, channelsCount, streams, coupledStreams, mapping);
  13. }
  14. public int Decode(byte[] inData, int inDataOffset, int len, short[] outPcm, int outPcmOffset, int frameSize)
  15. {
  16. return _decoder.DecodeMultistream(inData, inDataOffset, len, outPcm, outPcmOffset, frameSize, 0);
  17. }
  18. public void ResetState()
  19. {
  20. _decoder.ResetState();
  21. }
  22. }
  23. }