HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
ChannelMapper.h
Go to the documentation of this file.
1#pragma once
3#include <unordered_map>
4#include <functional>
5
8namespace HephAudio
9{
15 {
16 protected:
18 {
19 size_t operator()(const AudioChannelLayout& chLayout) const;
20 };
21
29 typedef std::unordered_map<
31 std::unordered_map<AudioChannelLayout, std::function<void(heph_audio_sample_t*, heph_audio_sample_t*)>, AudioChannelLayoutHasher>,
33
34 protected:
40
41 protected:
47
48 public:
51
58 explicit ChannelMapper(const AudioChannelLayout& targetLayout);
59
61 virtual ~ChannelMapper() = default;
62
63 virtual std::string Name() const override;
64
69 virtual const AudioChannelLayout& GetTargetLayout() const;
70
77 virtual void SetTargetLayout(const AudioChannelLayout& targetLayout);
78
79 protected:
80 virtual void ProcessST(const AudioBuffer& inputBuffer, AudioBuffer& outputBuffer, size_t startIndex, size_t frameCount) override;
81 virtual AudioBuffer CreateOutputBuffer(const AudioBuffer& inputBuffer, size_t startIndex, size_t frameCount) const override;
82 virtual void InitializeOutputBuffer(const AudioBuffer& inputBuffer, AudioBuffer& outputBuffer, size_t startIndex, size_t frameCount) const override;
83
84 public:
93 static void SetMapping(const AudioChannelLayout& targetLayout, const AudioChannelLayout& inputLayout, const std::function<void(heph_audio_sample_t*, heph_audio_sample_t*)>& f);
94
95 protected:
101 };
102}
float heph_audio_sample_t
Definition HephAudioShared.h:127
#define HEPH_API
Definition HephShared.h:124
class for storing the audio samples in internal format.
Definition AudioBuffer.h:16
remaps the audio channels.
Definition ChannelMapper.h:15
AudioChannelLayout targetLayout
Definition ChannelMapper.h:46
virtual void SetTargetLayout(const AudioChannelLayout &targetLayout)
virtual std::string Name() const override
virtual void ProcessST(const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) override
virtual ~ChannelMapper()=default
std::unordered_map< AudioChannelLayout, std::unordered_map< AudioChannelLayout, std::function< void(heph_audio_sample_t *, heph_audio_sample_t *)>, AudioChannelLayoutHasher >, AudioChannelLayoutHasher > ChannelMapperMap
Definition ChannelMapper.h:32
virtual AudioBuffer CreateOutputBuffer(const AudioBuffer &inputBuffer, size_t startIndex, size_t frameCount) const override
ChannelMapper(const AudioChannelLayout &targetLayout)
static ChannelMapperMap map
Definition ChannelMapper.h:39
static void SetMapping(const AudioChannelLayout &targetLayout, const AudioChannelLayout &inputLayout, const std::function< void(heph_audio_sample_t *, heph_audio_sample_t *)> &f)
virtual void InitializeOutputBuffer(const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) const override
virtual const AudioChannelLayout & GetTargetLayout() const
static ChannelMapperMap CreateMap()
base class for audio effects that use a temporary buffer while processing.
Definition DoubleBufferedAudioEffect.h:13
stores information about the channel layout.
Definition AudioChannelLayout.h:337