summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/SurroundDecoder.h
blob: 06d4cf55002f656c786811a1e1e2835e7affe5b5 (plain)
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
29
30
31
32
33
34
35
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <array>
#include <memory>

#include "Common/CommonTypes.h"
#include "Common/FixedSizeQueue.h"

class DPL2FSDecoder;

namespace AudioCommon
{
class SurroundDecoder
{
public:
  explicit SurroundDecoder(u32 sample_rate, u32 frame_block_size);
  ~SurroundDecoder();
  size_t QueryFramesNeededForSurroundOutput(const size_t output_frames) const;
  void PutFrames(const short* in, const size_t num_frames_in);
  void ReceiveFrames(float* out, const size_t num_frames_out);
  void Clear();

private:
  u32 m_sample_rate;
  u32 m_frame_block_size;

  std::unique_ptr<DPL2FSDecoder> m_fsdecoder;
  std::array<float, 32768> m_float_conversion_buffer;
  Common::FixedSizeQueue<float, 32768> m_decoded_fifo;
};

}  // namespace AudioCommon