Klang C++
Language Reference (draft)
Loading...
Searching...
No Matches
klang::Stereo::Synth

Synthesier mini-plugin (stereo) More...

#include <klang.h>

+ Inheritance diagram for klang::Stereo::Synth:

Classes

struct  Notes
 Synthesiser note array (stereo) More...
 

Public Types

typedef Stereo::Note Note
 

Public Member Functions

 Synth ()
 
virtual ~Synth ()
 
virtual void presetLoaded (int preset)
 
virtual void optionChanged (int param, int item)
 
virtual void buttonPressed (int param)
 
int indexOf (Note *note) const
 
virtual void prepare ()
 
virtual void process ()
 
virtual void process (Stereo::buffer buffer)
 
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 signalinput () const
 
virtual void input (const signal &source)
 
virtual void operator<< (const signal &source)
 
virtual const signaloutput () const
 
TYPE & operator>> (TYPE &destination)
 
signal operator+ (TYPE &other)
 
signal operator* (TYPE &other)
 
signal operator- (TYPE &other)
 
signal operator/ (TYPE &other)
 

Public Attributes

klang::Stereo::Synth::Notes notes
 
Controls controls
 
Presets presets
 
signal in
 
signal out
 

Detailed Description

Definition at line 3566 of file klang.h.

Member Typedef Documentation

◆ Note

Definition at line 3567 of file klang.h.

Constructor & Destructor Documentation

◆ Synth()

klang::Stereo::Synth::Synth ( )
inline

Definition at line 3574 of file klang.h.

3574: notes(this) { }
klang::Stereo::Synth::Notes notes

◆ ~Synth()

virtual klang::Stereo::Synth::~Synth ( )
inlinevirtual

Definition at line 3575 of file klang.h.

3575{ }

Member Function Documentation

◆ buttonPressed()

virtual void klang::Stereo::Synth::buttonPressed ( int param)
inlinevirtual

Definition at line 3579 of file klang.h.

3579{ };

◆ control()

virtual event klang::Controller::control ( int index,
float value )
inlineprotectedvirtualinherited

Definition at line 3068 of file klang.h.

3068{ };

Referenced by klang::Controller::onControl(), and klang::Synth::onControl().

◆ indexOf()

int klang::Stereo::Synth::indexOf ( Note * note) const
inline

Definition at line 3581 of file klang.h.

3581 {
3582 int index = 0;
3583 for (const auto* n : notes.items) {
3584 if (note == n) return
3585 index;
3586 index++;
3587 }
3588 return -1; // not found
3589 }
TYPE items[CAPACITY]
Definition klang.h:239

◆ input() [1/3]

virtual void klang::Generic::Input< signal >::input ( )
inlineprotectedvirtualinherited

◆ input() [2/3]

virtual const signal & klang::Generic::Input< signal >::input ( ) const
inlinevirtualinherited

Reimplemented in klang::Generic::Graph< SIZE >::Series.

Definition at line 1343 of file klang.h.

1343{ return in; }

◆ input() [3/3]

virtual void klang::Generic::Input< signal >::input ( const signal & source)
inlinevirtualinherited

Definition at line 1347 of file klang.h.

1347{ in = source; input(); }
virtual const signal & input() const
Definition klang.h:1343

◆ midi()

virtual event klang::Controller::midi ( int status,
int byte1,
int byte2 )
inlineprotectedvirtualinherited

Definition at line 3070 of file klang.h.

3070{ };

Referenced by klang::NoteBase< SYNTH >::controlChange(), and klang::Controller::onMIDI().

◆ onControl()

virtual void klang::Controller::onControl ( int index,
float value )
inlinevirtualinherited

Reimplemented in klang::Synth.

Definition at line 3072 of file klang.h.

3072{ control(index, value); };
virtual event control(int index, float value)
Definition klang.h:3068

References klang::Controller::control().

Referenced by klang::Synth::onControl().

◆ onMIDI()

virtual void klang::Controller::onMIDI ( int status,
int byte1,
int byte2 )
inlinevirtualinherited

Definition at line 3074 of file klang.h.

3074{ midi(status, byte1, byte2); }
virtual event midi(int status, int byte1, int byte2)
Definition klang.h:3070

References klang::Controller::midi().

◆ onPreset()

virtual void klang::Controller::onPreset ( int index)
inlinevirtualinherited

Reimplemented in klang::Synth.

Definition at line 3073 of file klang.h.

3073{ preset(index); };
virtual event preset(int index)
Definition klang.h:3069

References klang::Controller::preset().

Referenced by klang::Synth::onPreset().

◆ operator const signal &() [1/2]

klang::Generic::Modifier< signal >::operator const signal & ( ) const
inlineoverridevirtualinherited

Reimplemented from klang::Generic::Output< signal >.

Definition at line 1450 of file klang.h.

1450{ return out; } // return last output

◆ operator const signal &() [2/2]

klang::Generic::Modifier< signal >::operator const signal & ( )
inlineoverridevirtualinherited

Reimplemented from klang::Generic::Output< signal >.

Definition at line 1449 of file klang.h.

1449{ process(); return out; } // return processed output
virtual void process() override
Definition klang.h:1453

◆ operator()()

Modifier< signal > & klang::Generic::Modifier< signal >::operator() ( params... p)
inlineinherited

Definition at line 1457 of file klang.h.

1457 {
1458 set(p...); return *this;
1459 }

◆ operator*()

signal klang::Generic::Output< signal >::operator* ( TYPE & other)
inlineinherited

Definition at line 1372 of file klang.h.

1372{ process(); return out * (other); }

◆ operator+()

signal klang::Generic::Output< signal >::operator+ ( TYPE & other)
inlineinherited

Definition at line 1371 of file klang.h.

1371{ process(); return out + (other); }

◆ operator-()

signal klang::Generic::Output< signal >::operator- ( TYPE & other)
inlineinherited

Definition at line 1373 of file klang.h.

1373{ process(); return out - (other); }

◆ operator/()

signal klang::Generic::Output< signal >::operator/ ( TYPE & other)
inlineinherited

Definition at line 1374 of file klang.h.

1374{ process(); return out / (other); }

◆ operator<<()

virtual void klang::Generic::Input< signal >::operator<< ( const signal & source)
inlinevirtualinherited

Definition at line 1346 of file klang.h.

1346{ in = source; input(); }

◆ operator>>()

TYPE & klang::Generic::Output< signal >::operator>> ( TYPE & destination)
inlineinherited

Definition at line 1364 of file klang.h.

1364{ process(); return destination = out; }

◆ optionChanged()

virtual void klang::Stereo::Synth::optionChanged ( int param,
int item )
inlinevirtual

Definition at line 3578 of file klang.h.

3578{ }

◆ output()

virtual const signal & klang::Generic::Output< signal >::output ( ) const
inlinevirtualinherited

Definition at line 1360 of file klang.h.

1360{ return out; }

◆ prepare()

virtual void klang::Stereo::Effect::prepare ( )
inlinevirtualinherited

Definition at line 3530 of file klang.h.

3530{ };

Referenced by klang::Stereo::Effect::process().

◆ preset()

virtual event klang::Controller::preset ( int index)
inlineprotectedvirtualinherited

Definition at line 3069 of file klang.h.

3069{ };

Referenced by klang::Controller::onPreset(), and klang::Synth::onPreset().

◆ presetLoaded()

virtual void klang::Stereo::Synth::presetLoaded ( int preset)
inlinevirtual

Definition at line 3577 of file klang.h.

3577{ }

◆ process() [1/2]

virtual void klang::Stereo::Effect::process ( )
inlinevirtualinherited

Reimplemented from klang::Generic::Modifier< signal >.

Definition at line 3531 of file klang.h.

3531{ out = in; };

Referenced by klang::Stereo::Effect::process().

◆ process() [2/2]

virtual void klang::Stereo::Effect::process ( Stereo::buffer buffer)
inlinevirtualinherited

Definition at line 3532 of file klang.h.

3532 {
3533 prepare();
3534 while (!buffer.finished()) {
3535 input(buffer);
3536 process();
3537 buffer++ = out;
3538 debug.buffer++;
3539 }
3540 }
static Debug debug
Definition klang.h:2397
static THREAD_LOCAL Buffer buffer
Definition klang.h:2294
virtual void prepare()
Definition klang.h:3530
virtual void process()
Definition klang.h:3531

References klang::Debug::buffer, klang::debug, klang::Stereo::buffer::finished(), klang::Generic::Input< SIGNAL >::input(), klang::buffer::operator++(), klang::Stereo::buffer::operator++(), klang::Stereo::frame::operator=(), klang::Stereo::Effect::prepare(), and klang::Stereo::Effect::process().

Member Data Documentation

◆ controls

Controls klang::Plugin::controls
inherited

Definition at line 3081 of file klang.h.

◆ in

Definition at line 1340 of file klang.h.

1340{ 0.f };

◆ notes

klang::Stereo::Synth::Notes klang::Stereo::Synth::notes

◆ out

Definition at line 1357 of file klang.h.

1357{ 0.f };

◆ presets

Presets klang::Plugin::presets
inherited

Definition at line 3082 of file klang.h.