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

Abstract envelope ramp type. More...

#include <klang.h>

+ Inheritance diagram for klang::Envelope::Ramp:

Public Member Functions

 Ramp (float value=1.f)
 
 Ramp (float start, float target, float time)
 
virtual ~Ramp ()
 
bool isActive () const
 
virtual void setTarget (float target)
 
virtual void setValue (float value)
 
virtual void setRate (float rate)
 
virtual void setTime (float time)
 
virtual signal operator++ (int)=0
 
void process () override
 
Output< signal > & operator() (params... p)
 
 operator const signal & () override
 
 operator const signal & () const override
 
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

float target
 
float rate
 
bool active = false
 
signal out
 

Detailed Description

Definition at line 2617 of file klang.h.

Constructor & Destructor Documentation

◆ Ramp() [1/2]

klang::Envelope::Ramp::Ramp ( float value = 1.f)
inline

Definition at line 2624 of file klang.h.

2624 {
2625 setValue(value);
2626 }
virtual void setValue(float value)
Definition klang.h:2649

References setValue().

◆ Ramp() [2/2]

klang::Envelope::Ramp::Ramp ( float start,
float target,
float time )
inline

Definition at line 2629 of file klang.h.

2629 {
2630 setValue(start);
2632 setTime(time);
2633 }
virtual void setTime(float time)
Definition klang.h:2659
virtual void setTarget(float target)
Definition klang.h:2643

References setTarget(), setTime(), and setValue().

◆ ~Ramp()

virtual klang::Envelope::Ramp::~Ramp ( )
inlinevirtual

Definition at line 2635 of file klang.h.

2635{ }

Member Function Documentation

◆ isActive()

bool klang::Envelope::Ramp::isActive ( ) const
inline

Definition at line 2638 of file klang.h.

2638 {
2639 return active;
2640 }

References active.

Referenced by klang::Envelope::operator++().

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

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

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

Definition at line 1416 of file klang.h.

1416{ return out; } // return last output

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

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

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

Definition at line 1415 of file klang.h.

1415{ process(); return out; } // return processed output

◆ operator()()

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

Definition at line 1409 of file klang.h.

1409 {
1410 set(p...); return *this;
1411 }

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

virtual signal klang::Envelope::Ramp::operator++ ( int )
pure virtual

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

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; }

◆ process()

void klang::Envelope::Ramp::process ( )
inlineoverridevirtual

Implements klang::Generic::Output< signal >.

Definition at line 2664 of file klang.h.

2664{ /* do nothing -> only process on ++ */ }

◆ setRate()

virtual void klang::Envelope::Ramp::setRate ( float rate)
inlinevirtual

Definition at line 2656 of file klang.h.

2656{ Ramp::rate = rate; }

References rate.

Referenced by klang::Envelope::setTargetRate(), and klang::Envelope::setTargetTime().

◆ setTarget()

virtual void klang::Envelope::Ramp::setTarget ( float target)
inlinevirtual

Definition at line 2643 of file klang.h.

2643 {
2645 active = (out != target);
2646 }

References active, and target.

Referenced by Ramp(), klang::Envelope::setTargetRate(), and klang::Envelope::setTargetTime().

◆ setTime()

virtual void klang::Envelope::Ramp::setTime ( float time)
inlinevirtual

Definition at line 2659 of file klang.h.

2659{ Ramp::rate = time ? 1.f / (time * fs) : 0; }
klang::dB fs

References rate.

Referenced by Ramp().

◆ setValue()

virtual void klang::Envelope::Ramp::setValue ( float value)
inlinevirtual

Definition at line 2649 of file klang.h.

2649 {
2650 out = value;
2651 Ramp::target = value;
2652 active = false;
2653 }

References active, and target.

Referenced by Ramp(), Ramp(), klang::Envelope::initialise(), klang::Envelope::operator++(), and klang::Envelope::setTargetRate().

Member Data Documentation

◆ active

bool klang::Envelope::Ramp::active = false

Definition at line 2620 of file klang.h.

Referenced by isActive(), klang::Envelope::Linear::operator++(), setTarget(), and setValue().

◆ out

Definition at line 1357 of file klang.h.

1357{ 0.f };

◆ rate

float klang::Envelope::Ramp::rate

Definition at line 2619 of file klang.h.

Referenced by klang::Envelope::Linear::operator++(), setRate(), and setTime().

◆ target

float klang::Envelope::Ramp::target

Definition at line 2618 of file klang.h.

Referenced by klang::Envelope::Linear::operator++(), setTarget(), and setValue().