![]() |
Klang C++ 0.7.15
Language Reference (draft)
|
Language Guide / Signal Flow
klang::signal
The fundamental type for audio samples in Klang.
A signal holds one 32-bit float. The compiler can optimise its wrapper away, leaving ordinary float operations. Use signals to hold samples, scale or mix them with arithmetic, and express routing with >>.
const signal sample = in * 0.5;
sample >> out;A generator advances when read as a signal. Store the result to send that same sample down multiple paths.
const signal sample = sine;
sample >> out.l;
sample * 0.5 >> out.r;A mono audio signal (equivalent to a float). More...
#include <klang.h>
Inheritance diagram for klang::signal:Public Member Functions | |
| signal (constant initial) | |
| Create signal from a constant. | |
| signal (const float initial=0.f) | |
| Create signal from a 32-bit float.. | |
| signal (const double initial) | |
| Create signal from a 64-bit double. | |
| signal (const int value) | |
| Create signal from an 32-bit signed integer. | |
| const signal & | operator<< (const signal &input) |
| Feedback operator (prevents further processing of returned value). | |
| signal & | operator>> (signal &destination) const |
| Stream operator (feedforward; allows further processing) | |
| signal & | operator= (Output &in) |
| Assign processed output of in to signal. | |
| signal & | operator+= (Output &in) |
| Adds processed output of in to signal. | |
| signal & | operator+= (const signal &x) |
| Add (mix) another signal to the signal. | |
| signal & | operator-= (const signal &x) |
| Subtract another signal from the signal. | |
| signal & | operator*= (const signal &x) |
| Multiply (modulate) signal by another signal. | |
| signal & | operator/= (const signal &x) |
| Divide signal by another signal. | |
| signal & | operator+= (float x) |
| Add the specified amount to the signal. | |
| signal & | operator-= (float x) |
| Subtract the specified amount from the signal. | |
| signal & | operator*= (float x) |
| Multiply signal by the specified amount. | |
| signal & | operator/= (float x) |
| Divide signal by the specified amount. | |
| signal & | operator+= (double x) |
| Add the specified amount to the signal. | |
| signal & | operator-= (double x) |
| Subtract the specified amount from the signal. | |
| signal & | operator*= (double x) |
| Multiply signal by the specified amount. | |
| signal & | operator/= (double x) |
| Divide signal by the specified amount. | |
| signal & | operator+= (int x) |
| Add the specified amount to the signal. | |
| signal & | operator-= (int x) |
| Subtract the specified amount from the signal. | |
| signal & | operator*= (int x) |
| Multiply signal by the specified amount. | |
| signal & | operator/= (int x) |
| Divide signal by the specified amount. | |
| signal | operator+ (float x) const |
| Add two signals together. | |
| signal | operator- (float x) const |
| Subtract one signal from another. | |
| signal | operator* (float x) const |
| Multiply (modulate) two signals. | |
| signal | operator/ (float x) const |
| Divide one signal by another. | |
| signal | operator+ (double x) const |
| Return a copy of the signal offset by x. | |
| signal | operator- (double x) const |
| Return a copy of the signal offset by -x. | |
| signal | operator* (double x) const |
| Return a copy of the signal scaled by x. | |
| signal | operator/ (double x) const |
| Return a copy of the signal divided by. | |
| signal | operator+ (int x) const |
| Return a copy of the signal offset by x. | |
| signal | operator- (int x) const |
| Return a copy of the signal offset by -x. | |
| signal | operator* (int x) const |
| Return a copy of the signal scaled by x. | |
| signal | operator/ (int x) const |
| Return a copy of the signal divided by x. | |
| signal | operator^ (float x) const |
| Return a copy of the signal raised to the power of x. | |
| signal | operator^ (double x) const |
| Return a copy of the signal raised to the power of x. | |
| signal | operator^ (int x) const |
| Return a copy of the signal raised to the power of x. | |
| operator const float () const | |
| operator float & () | |
| bool | isDenormal () const |
| Check if the signal contains a denormal value. | |
| int | channels () const |
| Returns the number of channels (1 = mono). | |
| relative | operator+ () const |
| Returns a copy of the signal to treat as a relative offset (e.g. for phase modulation). | |
| relative | relative () const |
| Returns a copy of the signal to treat as a relative offset (e.g. for phase modulation). | |
Public Attributes | |
| float | value |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1221 of file klang.h.
References klang::power(), and value.
|
inline |
|
inline |
|
inline |
| float klang::signal::value |
Definition at line 1124 of file klang.h.
Referenced by klang::Amplitude::Amplitude(), klang::Controls::add(), isDenormal(), klang::Control::normalised(), operator const float(), klang::Control::operator float(), operator float &(), operator*(), operator*(), operator*(), operator*=(), operator*=(), operator*=(), operator*=(), operator+(), operator+(), operator+(), operator+(), operator+=(), operator+=(), operator+=(), operator+=(), operator-(), operator-(), operator-(), operator-=(), operator-=(), operator-=(), operator-=(), operator/(), operator/(), operator/(), operator/=(), operator/=(), operator/=(), operator/=(), operator<<(), operator>>(), operator^(), operator^(), operator^(), relative(), klang::Modifiers::Modal::set(), and klang::Control::setNormalised().