HART  0.1.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
hart_silence.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5
6#include "signals/hart_signal.hpp"
7#include "hart_utils.hpp" // HART_DEFINE_GENERIC_REPRESENT()
8
9namespace hart
10{
11
12/// @brief Produces silence (zeros)
13/// @ingroup Signals
14template<typename SampleType>
15class Silence:
16 public Signal<SampleType>
17{
18public:
19 bool supportsNumChannels (size_t /* numChannels */) const override { return true; };
20
21 void prepare (double /* sampleRateHz */, size_t /* numOutputChannels */, size_t /* maxBlockSizeFrames */) override
22 {
23 }
24
25 void renderNextBlock (AudioBuffer<SampleType>& output) override
26 {
27 for (size_t channel = 0; channel < output.getNumChannels(); ++channel)
28 for (size_t frame = 0; frame < output.getNumFrames(); ++frame)
29 output[channel][frame] = (SampleType) 0;
30 }
31
32 void reset() override {}
33
36};
37
39
40} // namespace hart
Base class for signals.
Produces silence (zeros)
void renderNextBlock(AudioBuffer< SampleType > &output) override
Renders next block audio for the signal.
bool supportsNumChannels(size_t) const override
Tells the host whether this Signal is capable of generating audio for a certain amount of cchannels.
void prepare(double, size_t, size_t) override
Prepare the signal for rendering.
void reset() override
Resets the Signal to initial state.
#define HART_SIGNAL_DEFINE_COPY_AND_MOVE(ClassName)
Defines hart::Signal::copy() and hart::Signal::move() methods.
#define HART_DEFINE_GENERIC_REPRESENT(ClassName)
Defines a basic string representation of your class.
#define HART_SIGNAL_DECLARE_ALIASES_FOR(ClassName)