HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
AudioBuffer.h
Go to the documentation of this file.
1#pragma once
2#include "HephAudioShared.h"
3#include "AudioFormatInfo.h"
6
9namespace HephAudio
10{
15 class HEPH_API AudioBuffer final : public Heph::SignedArithmeticBuffer<AudioBuffer, heph_audio_sample_t>
16 {
17 friend class AudioProcessor;
18
19 private:
20 size_t frameCount;
21 AudioFormatInfo formatInfo;
22
23 public:
26
34 AudioBuffer(size_t frameCount, const AudioChannelLayout& channelLayout, uint32_t sampleRate);
35
41 AudioBuffer(size_t frameCount, const AudioChannelLayout& channelLayout, uint32_t sampleRate, Heph::BufferFlags flags);
42
45
47 AudioBuffer(AudioBuffer&& rhs) noexcept;
48
51
52 AudioBuffer& operator=(const AudioBuffer& rhs);
53 AudioBuffer& operator=(AudioBuffer&& rhs) noexcept;
54 AudioBuffer operator<<(size_t rhs) const override;
55 AudioBuffer& operator<<=(size_t rhs) override;
56 AudioBuffer operator>>(size_t rhs) const override;
57 AudioBuffer& operator>>=(size_t rhs) override;
58 bool operator==(const AudioBuffer& rhs) const override;
59
64 heph_audio_sample_t* operator[](size_t frameIndex) const;
65
66 void Release() override;
67 AudioBuffer SubBuffer(size_t frameIndex, size_t frameCount) const override;
68 void Prepend(const AudioBuffer& rhs) override;
69 void Append(const AudioBuffer& rhs) override;
70 void Insert(const AudioBuffer& rhs, size_t frameIndex) override;
71 void Cut(size_t frameIndex, size_t frameCount) override;
72 void Replace(const AudioBuffer& rhs, size_t frameIndex, size_t frameCount) override;
73 void Resize(size_t newFrameCount) override;
74 void Reverse() override;
75
80 size_t FrameCount() const;
81
87
92 void SetChannelLayout(const AudioChannelLayout& channelLayout);
93
98 void SetSampleRate(uint32_t sampleRate);
99
100 private:
101 static inline bool ADD_EVENT_HANDLERS = false;
102 static void AddEventHandlers();
103 static void ResultCreatedEventHandler(const Heph::EventParams& params);
104 static void ResultCreatedEventHandlerBuffer(const Heph::EventParams& params);
105 };
106}
BufferFlags
Definition BufferBase.h:13
float heph_audio_sample_t
Definition HephAudioShared.h:133
#define HEPH_API
Definition HephShared.h:132
class for storing the audio samples in internal format.
Definition AudioBuffer.h:16
AudioBuffer & operator>>=(size_t rhs) override
AudioBuffer SubBuffer(size_t frameIndex, size_t frameCount) const override
void Cut(size_t frameIndex, size_t frameCount) override
AudioBuffer operator<<(size_t rhs) const override
AudioBuffer(size_t frameCount, const AudioChannelLayout &channelLayout, uint32_t sampleRate)
AudioBuffer & operator<<=(size_t rhs) override
void Resize(size_t newFrameCount) override
void SetSampleRate(uint32_t sampleRate)
void Reverse() override
AudioBuffer operator>>(size_t rhs) const override
const AudioFormatInfo & FormatInfo() const
size_t FrameCount() const
void SetChannelLayout(const AudioChannelLayout &channelLayout)
AudioBuffer(AudioBuffer &&rhs) noexcept
AudioBuffer(const AudioBuffer &rhs)
void Release() override
AudioBuffer(size_t frameCount, const AudioChannelLayout &channelLayout, uint32_t sampleRate, Heph::BufferFlags flags)
heph_audio_sample_t * operator[](size_t frameIndex) const
provides sound effects and filters.
Definition AudioProcessor.h:21
base class for buffers that store signed arithmetic types. Provides operations and methods for signed...
Definition ArithmeticBuffer.h:147
stores information about the channel layout.
Definition AudioChannelLayout.h:136
stores the properties of the audio signals
Definition AudioFormatInfo.h:20
stores the information required to handle an event.
Definition EventParams.h:16