22 #ifndef EDSP_OSCILLATOR_SQUARE_HPP 23 #define EDSP_OSCILLATOR_SQUARE_HPP 28 namespace edsp {
namespace oscillators {
101 template <
typename T>
106 template <
typename T>
109 const value_type result = (t >= duty_) ? -1 : 1;
117 #endif // EDSP_OSCILLATOR_SQUARE_HPP T value_type
Definition: square.hpp:51
constexpr value_type timestamp() const noexcept
Returns the current timestamp of the signal in seconds.
Definition: sinusoidal.hpp:213
constexpr value_type sampling_period() const noexcept
Returns the sampling period in secs.
Definition: sinusoidal.hpp:269
constexpr value_type duty() const noexcept
Returns the current duty cycle.
Definition: square.hpp:102
The oscillator class generates a periodic signal.
Definition: sinusoidal.hpp:48
T value_type
Definition: sinusoidal.hpp:50
constexpr value_type frequency() const noexcept
Returns the fundamental frequency in Hz.
Definition: sinusoidal.hpp:239
The class square_oscillator generates a square signal.
Definition: square.hpp:49
constexpr value_type samplerate() const noexcept
Returns the sampling frequency in Hz.
Definition: sinusoidal.hpp:228
constexpr void set_duty(value_type duty) noexcept
Set the duty cycle of the oscillator.
Definition: square.hpp:97
constexpr T inv(T x)
Computes the inverse value of the input number.
Definition: numeric.hpp:208
constexpr value_type amplitude() const noexcept
Returns the amplitude of the periodic signal.
Definition: sinusoidal.hpp:259
constexpr void set_timestamp(value_type timestamp) noexcept
Sets the current timestamp of the periodic signal.
Definition: sinusoidal.hpp:218
constexpr value_type operator()()
Generates one step.
Definition: square.hpp:107
constexpr square_oscillator(value_type amplitude, value_type samplerate, value_type frequency, value_type duty) noexcept
Creates a square oscillator that generates a waveform with the configuration.
Definition: square.hpp:91
Definition: amplifier.hpp:29