8#include "signals/hart_signal.hpp"
18template<
typename SampleType>
25 void prepare (
double , size_t , size_t )
override {}
29 hassert (output.getNumChannels() >= 1);
30 const size_t numFrames = output.getNumFrames();
32 for (size_t channel = 0; channel < output.getNumChannels(); ++channel)
34 SampleType* channelData = output[channel];
36 const SampleType evenFrameValues = m_nextBlockStartValue;
37 const SampleType oddFrameValues = -m_nextBlockStartValue;
39 for (size_t frame = 0; frame < numFrames; frame += 2)
40 channelData[frame] = evenFrameValues;
42 for (size_t frame = 1; frame < numFrames; frame += 2)
43 channelData[frame] = oddFrameValues;
46 if (numFrames % 2 != 0)
47 m_nextBlockStartValue = -m_nextBlockStartValue;
52 m_nextBlockStartValue = 1.0;
58 SampleType m_nextBlockStartValue = 1.0;
Container for audio data.
Produces a Nyquist signal.
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 channels.
void prepare(double, size_t, size_t) override
Prepare the signal for rendering.
void reset() override
Resets the Signal to initial state.
#define hassert(condition)
Triggers a HartAssertException if the condition is false
#define HART_DEFINE_GENERIC_REPRESENT(ClassName)
Defines a basic string representation of your class.
#define HART_SIGNAL_DECLARE_ALIASES_FOR(ClassName)