![]() |
Klang C++ 0.7.15
Language Reference (draft)
|
Language Guide / Plugin Architecture
klang::Stereo::Sound
Base class for stereo sound sources.
Derive from Stereo::Sound for procedural audio such as game sound effects. Implement process() to generate one frame at a time. Keep oscillators and other stateful processors as members so their state carries from frame to frame.
Write the left and right samples to out.l and out.r. Store a generated sample before sending it to both channels so the generator advances once per frame.
Stereo::Sound inherits the Plugin interface through Stereo::Effect. Use controls to expose settings such as engine speed or surface type, and presets to supply named sets of values.
struct StereoTone : Stereo::Sound {
Sine sine;
void process() {
const signal sample = sine(220) * 0.1;
sample >> out.l;
sample >> out.r;
}
};See also Sound.
#include <klang.h>
Inheritance diagram for klang::Stereo::Sound:Public Member Functions | |
| void | process () override |
| virtual void | process (Stereo::buffer buffer) |
| virtual void | process (interleaved::buffer buffer) |
| Process interleaved host frames; inherited by the current Stereo::Sound. | |
| virtual void | prepare () |
| virtual void | onControl (int index, float value) |
| virtual void | onPreset (int index) |
| virtual void | onMIDI (int status, int byte1, int byte2) |
| operator const signal & () override | |
| operator const signal & () const override | |
| Modifier< signal > & | operator() (params &&... p) |
| virtual const signal & | input () const |
| virtual void | input (const signal &source) |
| virtual void | operator<< (const signal &source) |
| virtual const signal & | output () const |
| TYPE & | operator>> (TYPE &destination) |
| signal | operator+ (TYPE &other) |
| signal | operator* (TYPE &other) |
| signal | operator- (TYPE &other) |
| signal | operator/ (TYPE &other) |
| void | reset () |
Static Public Member Functions | |
| template<typename DERIVED , typename... ARGS> | |
| static DERIVED * | Create (ARGS &&... args) |
Public Attributes | |
| Controls | controls |
| Presets | presets |
| signal | in |
| signal | out |
Sound mini-plugin (stereo). Input is available through in, but is silent unless a model explicitly routes it to out or debug.
|
inlineprotectedvirtualinherited |
|
inlinestaticinherited |
|
inlineprotectedvirtualinherited |
Reimplemented in klang::Debug, klang::Delay< SIZE >, klang::Delay< 0 >, klang::Generic::Function< signal, Args... >, klang::Generic::Graph< SIZE >::Series, and klang::Modifiers::Modal.
Definition at line 2955 of file klang.h.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
inlineprotectedvirtualinherited |
|
inlinevirtualinherited |
Reimplemented in klang::Stereo::Synth, and klang::Synth.
Definition at line 5513 of file klang.h.
|
inlinevirtualinherited |
Reimplemented in klang::Stereo::Synth, and klang::Synth.
Definition at line 5515 of file klang.h.
|
inlinevirtualinherited |
Reimplemented in klang::Stereo::Synth, and klang::Synth.
Definition at line 5514 of file klang.h.
|
inlineoverridevirtualinherited |
|
inlineoverridevirtualinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinevirtualinherited |
Reimplemented in klang::Debug.
|
inlineinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
inlineprotectedvirtualinherited |
|
inlineoverridevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlineinherited |
|
inherited |
Definition at line 2944 of file klang.h.
Referenced by klang::Generic::Graph< SIZE >::Series::input(), klang::Generic::Graph< SIZE >::Series::operator!=(), and klang::Generic::Graph< SIZE >::Series::operator==().
|
inherited |