|
HART
0.2.0
High level Audio Regression and Testing
|
Plays audio from a pre-rendered AudioBuffer. More...
#include <hart_audio_buffer_signal.hpp>
Public Types | |
| enum class | Loop { yes , no } |
Public Member Functions | |
| AudioBufferSignal (std::shared_ptr< AudioBuffer< SampleType > > buffer, Loop loop=Loop::no) | |
| Construct from a shared_ptr (shared ownership) | |
| AudioBufferSignal (const AudioBuffer< SampleType > &buffer, Loop loop=Loop::no) | |
| Construct by copying a buffer (takes ownership of a copy) | |
| AudioBufferSignal (AudioBuffer< SampleType > &&buffer, Loop loop=Loop::no) | |
| Construct by moving a buffer (takes ownership) | |
| bool | supportsNumChannels (size_t numChannels) const override |
| Tells the host whether this Signal is capable of generating audio for a certain amount of channels. | |
| bool | supportsSampleRate (double sampleRateHz) const override |
| Tells whether this Signal supports given sample rate. | |
| void | prepare (double sampleRateHz, size_t numOutputChannels, size_t) override |
| Prepare the signal for rendering. | |
| void | renderNextBlock (AudioBuffer< SampleType > &output) override |
| Renders next block audio for the signal. | |
| void | reset () override |
| Resets the Signal to initial state. | |
| void | represent (std::ostream &stream) const override |
| Makes a text representation of this Signal for test failure outputs. | |
| std::unique_ptr< SignalBase< SampleType > > | copy () const override |
| Returns a smart pointer with a copy of this object. | |
| std::unique_ptr< SignalBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
Public Member Functions inherited from Signal< SampleType, AudioBufferSignal< SampleType > > | |
| AudioBufferSignal< SampleType > & | followedBy (DerivedDSP &&dsp) & |
| Adds a DSP effect to the end of signal's DSP chain. | |
| AudioBufferSignal< SampleType > && | followedBy (DerivedDSP &&dsp) && |
| Adds a DSP effect to the end of signal's DSP chain. | |
| AudioBufferSignal< SampleType > & | followedBy (std::unique_ptr< DSPBase< SampleType > > dsp) & |
| Adds a DSP effect to the end of signal's DSP chain. | |
| AudioBufferSignal< SampleType > && | followedBy (std::unique_ptr< DSPBase< SampleType > > dsp) && |
| Adds a DSP effect to the end of signal's DSP chain. | |
| std::unique_ptr< SignalBase< SampleType > > | copy () const override |
| Returns a smart pointer with a copy of this object. | |
| std::unique_ptr< SignalBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
| AudioBufferSignal< SampleType > & | skipTo (double startTimestampSeconds) & |
| Skips the signal to a specific timestamp. | |
| AudioBufferSignal< SampleType > && | skipTo (double startTimestampSeconds) && |
| Skips the signal to a specific timestamp. | |
| AudioBufferSignal< SampleType > | operator- () const |
| Returns a copy of this signal, but with flipped phase. | |
| AudioBufferSignal< SampleType > | operator~ () const |
| Returns a copy of this signal, but with flipped phase. | |
Public Member Functions inherited from SignalBase< SampleType > | |
| SignalBase ()=default | |
| Default constructor. | |
| SignalBase (const SignalBase &other) | |
| Copies other signal. | |
| SignalBase (SignalBase &&other) noexcept | |
| Moves from other signal. | |
| virtual | ~SignalBase ()=default |
| Destructor. | |
| SignalBase & | operator= (const SignalBase &other) |
| Copies from other signal. | |
| SignalBase & | operator= (SignalBase &&other) noexcept |
| Moves from other signal. | |
| void | prepareWithDSPChain (double sampleRateHz, size_t numOutputChannels, size_t maxBlockSizeFrames) |
| Prepares the signal and all attached effects in the DSP chain for rendering. | |
| void | renderNextBlockWithDSPChain (AudioBuffer< SampleType > &output) |
| Renders next block audio for the signal and all the effects in the DSP chain. | |
| virtual void | resetWithDSPChain () |
| Resets to Signal and all the effects attached to its DSP chain to initial state. | |
| size_t | getDSPChainSize () const |
| Returns the size of the DSP chain attached to the Signal. | |
| DSPBase< SampleType > * | getDSP (int index=-1) const |
| Access a specific element in the DSP chain. | |
| std::unique_ptr< DSPBase< SampleType > > | popDSP (int index=-1) |
| Extract a specific element in the DSP chain by removing it. | |
Additional Inherited Members | |
Protected Member Functions inherited from SignalBase< SampleType > | |
| void | setNumChannels (size_t numChannels) |
| size_t | getNumChannels () |
Protected Attributes inherited from SignalBase< SampleType > | |
| size_t | m_numChannels = 1 |
| double | m_startTimestampSeconds = 0.0 |
| std::vector< std::unique_ptr< DSPBase< SampleType > > > | m_dspChain |
Related Symbols inherited from Signal< SampleType, AudioBufferSignal< SampleType > > | |
| MixedSignal< SampleType > | operator- (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs) |
| Subtracts one signal from another, resulting in a new mixed signal. | |
| MixedSignal< SampleType > | operator+ (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs) |
| Adds one signal to another, resulting in a new mixed signal. | |
| std::ostream & | operator<< (std::ostream &stream, const SignalBase< SampleType > &signal) |
| Prints readable text representation of the Signal object into the I/O stream. | |
| auto | operator>> (AudioBufferSignal< SampleType > &signal, DerivedDSP &&dsp) -> decltype(signal.followedBy(std::forward< DerivedDSP >(dsp))) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
| auto | operator>> (AudioBufferSignal< SampleType > &&signal, DerivedDSP &&dsp) -> decltype(std::move(signal).followedBy(std::forward< DerivedDSP >(dsp))) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
Plays audio from a pre-rendered AudioBuffer.
Definition at line 15 of file hart_audio_buffer_signal.hpp.
|
strong |
| Enumerator | |
|---|---|
| yes | |
| no | |
Definition at line 19 of file hart_audio_buffer_signal.hpp.
|
inlineexplicit |
Construct from a shared_ptr (shared ownership)
Definition at line 26 of file hart_audio_buffer_signal.hpp.
|
inlineexplicit |
Construct by copying a buffer (takes ownership of a copy)
Definition at line 37 of file hart_audio_buffer_signal.hpp.
|
inlineexplicit |
Construct by moving a buffer (takes ownership)
Definition at line 45 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Tells the host whether this Signal is capable of generating audio for a certain amount of channels.
It is guaranteed that the signal will not receive unsupported number of channels in renderNextBlock(). This method is guaranteed to be called at least once before prepare()
| numChannels | Number of output channels that will need to be filled |
Reimplemented from SignalBase< SampleType >.
Definition at line 52 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Tells whether this Signal supports given sample rate.
It is guaranteed to be called before prepare()
| sampleRateHz | sample rate at which the audio should be generated |
Reimplemented from SignalBase< SampleType >.
Definition at line 57 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Prepare the signal for rendering.
This method is guaranteed to be called after supportsNumChannels() and supportsSampleRate(), but before renderNextBlock(). It is guaranteed that numChannels obeys supportsNumChannels() preferences, same with sampleRateHz and supportsSampleRate(). It is guaranteed that all subsequent renderNextBlock() calls will be in line with the arguments received in this callback.
| sampleRateHz | sample rate at which the audio should be generated |
| numOutputChannels | Number of output channels to be filled |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implements SignalBase< SampleType >.
Definition at line 66 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Renders next block audio for the signal.
Depending on circumstances, this callback will either be called once to generate an entire piece of audio from start to finish, or called repeatedly, one block at a time. This method is guaranteed to be called strictly after prepare(), or not called at all. Number of channels and max block size are guaranteed to be in line with the ones set by prepare() callback. Assume sample rate to always be equal to the one received in the last prepare() callback. All audio blocks except the last one are guaranteed to be equal to maxBlockSizeFrames set in prepare() callback.
| output | Output audio block |
Implements SignalBase< SampleType >.
Definition at line 78 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Resets the Signal to initial state.
Ideally should be implemented in a way that audio produced after resetting is identical to audio produced after instantiation
Implements SignalBase< SampleType >.
Definition at line 122 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Makes a text representation of this Signal for test failure outputs.
It is strongly encouraged to follow python's repr() conventions for returned text - basically, put something like "MyClass(value1, value2)" (with no quotes) into the stream whenever possible, or "<Readable info in angled brackets>" otherwise. Also, use built-in stream manipulators like dbPrecision wherever applicable. Use HART_DEFINE_GENERIC_REPRESENT() to get a basic implementation for this method.
| [out] | stream | Output stream to write to |
Implements SignalBase< SampleType >.
Definition at line 127 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Returns a smart pointer with a copy of this object.
Implements SignalBase< SampleType >.
Definition at line 139 of file hart_audio_buffer_signal.hpp.
|
inlineoverridevirtual |
Returns a smart pointer with a moved instance of this object.
Implements SignalBase< SampleType >.
Definition at line 144 of file hart_audio_buffer_signal.hpp.