Klang C++
Language Reference (draft)
Loading...
Searching...
No Matches
klang::Envelope::Follower

Envelope follower (Peak / RMS) More...

#include <klang.h>

+ Inheritance diagram for klang::Envelope::Follower:

Classes

struct  AR
 Attack / Release IIR Filter (~Butterworth when attack == release) More...
 
struct  Window
 Window-based envelope follower. More...
 

Public Types

using Process = void(Follower::*)()
 

Public Member Functions

 Follower ()
 
void set (param attack, param release)
 
Followeroperator= (klang::Mode mode)
 
void process ()
 
void peak ()
 
void rms ()
 
 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::Envelope::Follower::AR ar
 
Process _process = &Follower::rms
 
signal in
 
signal out
 

Detailed Description

Definition at line 4382 of file klang.h.

Member Typedef Documentation

◆ Process

using klang::Envelope::Follower::Process = void(Follower::*)()

Definition at line 4417 of file klang.h.

Constructor & Destructor Documentation

◆ Follower()

klang::Envelope::Follower::Follower ( )
inline

Definition at line 4407 of file klang.h.

4407{ set(0.01f, 0.1f); }
void set(param attack, param release)
Definition klang.h:4408

References set().

Member Function Documentation

◆ 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

◆ 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=()

Follower & klang::Envelope::Follower::operator= ( klang::Mode mode)
inline

Definition at line 4412 of file klang.h.

4412 {
4414 return *this;
4415 }
Mode mode() const
Definition klang.h:2955
@ RMS
Definition klang.h:83

References _process, peak(), klang::RMS, and rms().

◆ operator>>()

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

Definition at line 1364 of file klang.h.

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

◆ output()

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

Definition at line 1360 of file klang.h.

1360{ return out; }

◆ peak()

void klang::Envelope::Follower::peak ( )
inline

Definition at line 4422 of file klang.h.

4422{ abs(in) >> ar >> out; }
klang::Envelope::Follower::AR ar

References klang::operator>>().

Referenced by operator=().

◆ process()

void klang::Envelope::Follower::process ( )
inlinevirtual

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

Definition at line 4420 of file klang.h.

4420{ (this->*_process)(); }

References _process.

◆ rms()

void klang::Envelope::Follower::rms ( )
inline

Definition at line 4423 of file klang.h.

4423{ (in * in) >> ar >> sqrt >> out; }

References klang::signal::operator*(), klang::operator>>(), and klang::operator>>().

Referenced by operator=().

◆ set()

void klang::Envelope::Follower::set ( param attack,
param release )
inline

Definition at line 4408 of file klang.h.

4408 {
4409 ar.set(attack, release);
4410 }
virtual void release(float time, float level=0.f)
Definition klang.h:2847
void set(param attack, param release)
Definition klang.h:4391

References klang::Envelope::Follower::AR::set().

Referenced by Follower().

Member Data Documentation

◆ _process

Process klang::Envelope::Follower::_process = &Follower::rms

Definition at line 4418 of file klang.h.

Referenced by operator=(), and process().

◆ ar

klang::Envelope::Follower::AR klang::Envelope::Follower::ar

◆ in

Definition at line 1340 of file klang.h.

1340{ 0.f };

◆ out

Definition at line 1357 of file klang.h.

1357{ 0.f };