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

Control parameter (frequency) More...

#include <klang.h>

+ Inheritance diagram for klang::Frequency:

Public Member Functions

 Frequency (float f=1000.f)
 
 param (constant in)
 
 param (const float initial=0.f)
 
 param (const signal &in)
 
 param (signal &in)
 
 param (Control &in)
 
paramoperator+= (const increment &increment)
 
signaloperator+= (Output &in)
 Adds processed output of in to signal.
 
signaloperator+= (const signal &x)
 Add (mix) another signal to the signal.
 
signaloperator+= (float x)
 Add the specified amount to the signal.
 
signaloperator+= (double x)
 Add the specified amount to the signal.
 
signaloperator+= (int x)
 Add the specified amount to the signal.
 
const signaloperator<< (const signal &input)
 Feedback operator (prevents further processing of returned value).
 
signaloperator>> (signal &destination) const
 Stream operator (feedforward; allows further processing)
 
signaloperator-= (const signal &x)
 Subtract another signal from the signal.
 
signaloperator-= (float x)
 Subtract the specified amount from the signal.
 
signaloperator-= (double x)
 Subtract the specified amount from the signal.
 
signaloperator-= (int x)
 Subtract the specified amount from the signal.
 
signaloperator*= (const signal &x)
 Multiply (modulate) signal by another signal.
 
signaloperator*= (float x)
 Multiply signal by the specified amount.
 
signaloperator*= (double x)
 Multiply signal by the specified amount.
 
signaloperator*= (int x)
 Multiply signal by the specified amount.
 
signaloperator/= (const signal &x)
 Divide signal by another signal.
 
signaloperator/= (float x)
 Divide signal by the specified amount.
 
signaloperator/= (double x)
 Divide signal by the specified amount.
 
signaloperator/= (int x)
 Divide signal by the specified amount.
 
signal operator+ (float x) const
 Add two signals together.
 
signal operator+ (double 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.
 
relative operator+ () const
 Returns a copy of the signal to treat as a relative offset (e.g. for phase modulation).
 
signal operator- (float x) const
 Subtract one signal from another.
 
signal operator- (double 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* (float x) const
 Multiply (modulate) two signals.
 
signal operator* (double x) const
 Return a copy of the signal scaled by x.
 
signal operator* (int x) const
 Return a copy of the signal scaled by x.
 
signal operator/ (float x) const
 Divide one signal by another.
 
signal operator/ (double x) const
 Return a copy of the signal divided by.
 
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 relative () const
 Returns a copy of the signal to treat as a relative offset (e.g. for phase modulation).
 

Public Attributes

float value
 

Detailed Description

Definition at line 884 of file klang.h.

Constructor & Destructor Documentation

◆ Frequency()

klang::Frequency::Frequency ( float f = 1000.f)
inline

Definition at line 887 of file klang.h.

887: param(f) { };
param(constant in)
Definition klang.h:658

References klang::param::param().

Member Function Documentation

◆ channels()

int klang::signal::channels ( ) const
inlineinherited

Definition at line 474 of file klang.h.

474{ return 1; }

◆ isDenormal()

bool klang::signal::isDenormal ( ) const
inlineinherited

Definition at line 468 of file klang.h.

468 {
469 const unsigned int bits = *(const unsigned int*)&value;
470 return !(bits & 0x7F800000) && (bits & 0x007FFFFF);
471 }
float value
Definition klang.h:363

References klang::signal::value.

◆ operator const float()

klang::signal::operator const float ( ) const
inlineinherited

Definition at line 464 of file klang.h.

464{ return value; }

References klang::signal::value.

◆ operator float &()

klang::signal::operator float & ( )
inlineinherited

Definition at line 465 of file klang.h.

465{ return value; }

References klang::signal::value.

◆ operator*() [1/3]

signal klang::signal::operator* ( double x) const
inlineinherited

Definition at line 444 of file klang.h.

444{ return value * (float)x; }

References klang::signal::value.

◆ operator*() [2/3]

◆ operator*() [3/3]

signal klang::signal::operator* ( int x) const
inlineinherited

Definition at line 453 of file klang.h.

453{ return value * (float)x; }

References klang::signal::value.

◆ operator*=() [1/4]

signal & klang::signal::operator*= ( const signal & x)
inlineinherited

◆ operator*=() [2/4]

signal & klang::signal::operator*= ( double x)
inlineinherited

Definition at line 417 of file klang.h.

417{ value *= (float)x; return *this; }

References klang::signal::value.

◆ operator*=() [3/4]

signal & klang::signal::operator*= ( float x)
inlineinherited

◆ operator*=() [4/4]

signal & klang::signal::operator*= ( int x)
inlineinherited

Definition at line 426 of file klang.h.

426{ value *= (float)x; return *this; }

References klang::signal::value.

◆ operator+() [1/4]

relative klang::signal::operator+ ( ) const
inlineinherited

Definition at line 490 of file klang.h.

490{ return { value }; }

References klang::signal::value.

◆ operator+() [2/4]

signal klang::signal::operator+ ( double x) const
inlineinherited

Definition at line 440 of file klang.h.

440{ return value + (float)x; }

References klang::signal::value.

◆ operator+() [3/4]

◆ operator+() [4/4]

signal klang::signal::operator+ ( int x) const
inlineinherited

Definition at line 449 of file klang.h.

449{ return value + (float)x; }

References klang::signal::value.

◆ operator+=() [1/6]

param & klang::param::operator+= ( const increment & increment)
inlineinherited

Definition at line 664 of file klang.h.

664 {
665 value += increment.amount;
666 if (value >= increment.size)
667 value -= increment.size;
668 return *this;
669 }

References klang::increment::amount, klang::increment::size, and klang::signal::value.

◆ operator+=() [2/6]

signal & klang::signal::operator+= ( const signal & x)
inlineinherited

◆ operator+=() [3/6]

signal & klang::signal::operator+= ( double x)
inlineinherited

Definition at line 413 of file klang.h.

413{ value += (float)x; return *this; }

References klang::signal::value.

◆ operator+=() [4/6]

signal & klang::signal::operator+= ( float x)
inlineinherited

◆ operator+=() [5/6]

signal & klang::signal::operator+= ( int x)
inlineinherited

Definition at line 422 of file klang.h.

422{ value += (float)x; return *this; }

References klang::signal::value.

◆ operator+=() [6/6]

signal & klang::signal::operator+= ( Output & in)
inlineinherited

Definition at line 2155 of file klang.h.

2155 { // e.g. out += osc;
2156 value += signal(in);
2157 return *this;
2158 }
signal(constant initial)
Create signal from a constant.
Definition klang.h:366

References klang::signal::value.

◆ operator-() [1/3]

signal klang::signal::operator- ( double x) const
inlineinherited

Definition at line 442 of file klang.h.

442{ return value - (float)x; }

References klang::signal::value.

◆ operator-() [2/3]

◆ operator-() [3/3]

signal klang::signal::operator- ( int x) const
inlineinherited

Definition at line 451 of file klang.h.

451{ return value - (float)x; }

References klang::signal::value.

◆ operator-=() [1/4]

signal & klang::signal::operator-= ( const signal & x)
inlineinherited

Definition at line 397 of file klang.h.

397{ value -= x.value; return *this; }

References klang::signal::value.

Referenced by klang::Stereo::frame::operator-=(), klang::Stereo::frame::operator-=(), and klang::Stereo::frame::operator-=().

◆ operator-=() [2/4]

signal & klang::signal::operator-= ( double x)
inlineinherited

Definition at line 415 of file klang.h.

415{ value -= (float)x; return *this; }

References klang::signal::value.

◆ operator-=() [3/4]

signal & klang::signal::operator-= ( float x)
inlineinherited

◆ operator-=() [4/4]

signal & klang::signal::operator-= ( int x)
inlineinherited

Definition at line 424 of file klang.h.

424{ value -= (float)x; return *this; }

References klang::signal::value.

◆ operator/() [1/3]

signal klang::signal::operator/ ( double x) const
inlineinherited

Definition at line 446 of file klang.h.

446{ return value / (float)x; }

References klang::signal::value.

◆ operator/() [2/3]

◆ operator/() [3/3]

signal klang::signal::operator/ ( int x) const
inlineinherited

Definition at line 455 of file klang.h.

455{ return value / (float)x; }

References klang::signal::value.

◆ operator/=() [1/4]

signal & klang::signal::operator/= ( const signal & x)
inlineinherited

Definition at line 401 of file klang.h.

401{ value /= x.value; return *this; }

References klang::signal::value.

Referenced by klang::Stereo::frame::operator/=(), klang::Stereo::frame::operator/=(), and klang::Stereo::frame::operator/=().

◆ operator/=() [2/4]

signal & klang::signal::operator/= ( double x)
inlineinherited

Definition at line 419 of file klang.h.

419{ value /= (float)x; return *this; }

References klang::signal::value.

◆ operator/=() [3/4]

signal & klang::signal::operator/= ( float x)
inlineinherited

◆ operator/=() [4/4]

signal & klang::signal::operator/= ( int x)
inlineinherited

Definition at line 428 of file klang.h.

428{ value /= (float)x; return *this; }

References klang::signal::value.

◆ operator<<()

const signal & klang::signal::operator<< ( const signal & input)
inlineinherited

Definition at line 378 of file klang.h.

378 {
379 value = input;
380 return *this;
381 }

References klang::signal::value.

◆ operator>>()

signal & klang::signal::operator>> ( signal & destination) const
inlineinherited

Definition at line 384 of file klang.h.

384 {
385 destination.value = value;
386 return destination;
387 }

References klang::signal::value.

Referenced by klang::Envelope::Follower::AR::process().

◆ operator^() [1/3]

signal klang::signal::operator^ ( double x) const
inlineinherited

Definition at line 460 of file klang.h.

460{ return power(value, x); }
constexpr power_t< BASE, EXP > power(BASE base, EXP exp)
Raise base to the power exp.
Definition klang.h:150

References klang::power(), and klang::signal::value.

◆ operator^() [2/3]

signal klang::signal::operator^ ( float x) const
inlineinherited

Definition at line 458 of file klang.h.

458{ return power(value, x); }

References klang::power(), and klang::signal::value.

◆ operator^() [3/3]

signal klang::signal::operator^ ( int x) const
inlineinherited

Definition at line 462 of file klang.h.

462{ return power(value, x); }

References klang::power(), and klang::signal::value.

◆ param() [1/5]

klang::param::param ( const float initial = 0.f)
inline

Definition at line 659 of file klang.h.

659: signal(initial) { }

◆ param() [2/5]

klang::param::param ( const signal & in)
inline

Definition at line 660 of file klang.h.

660: signal(in) { }

◆ param() [3/5]

klang::param::param ( constant in)
inline

Definition at line 658 of file klang.h.

658: signal(in.f) { }

◆ param() [4/5]

klang::param::param ( Control & in)
inline

Definition at line 662 of file klang.h.

1061: signal(in.value) { }

◆ param() [5/5]

klang::param::param ( signal & in)
inline

Definition at line 661 of file klang.h.

661: signal(in) { }

◆ relative()

relative klang::signal::relative ( ) const
inlineinherited

Definition at line 492 of file klang.h.

492{ return { value }; }

References klang::signal::value.

Member Data Documentation

◆ value

float klang::signal::value
inherited

Definition at line 363 of file klang.h.

Referenced by klang::Amplitude::Amplitude(), klang::signal::signal(), klang::signal::signal(), klang::signal::signal(), klang::signal::signal(), klang::signal::isDenormal(), klang::signal::operator const float(), klang::Control::operator float(), klang::signal::operator float &(), klang::Phase::operator%(), klang::signal::operator*(), klang::signal::operator*(), klang::signal::operator*(), klang::signal::operator*=(), klang::signal::operator*=(), klang::signal::operator*=(), klang::signal::operator*=(), klang::Phase::operator+(), klang::signal::operator+(), klang::signal::operator+(), klang::signal::operator+(), klang::signal::operator+(), klang::param::operator+=(), klang::Phase::operator+=(), klang::Phase::operator+=(), klang::signal::operator+=(), klang::signal::operator+=(), klang::signal::operator+=(), klang::signal::operator+=(), klang::signal::operator+=(), klang::signal::operator-(), klang::signal::operator-(), klang::signal::operator-(), klang::signal::operator-=(), klang::signal::operator-=(), klang::signal::operator-=(), klang::signal::operator-=(), klang::Amplitude::operator->(), klang::dB::operator->(), klang::Pitch::operator->(), klang::signal::operator/(), klang::signal::operator/(), klang::signal::operator/(), klang::signal::operator/=(), klang::signal::operator/=(), klang::signal::operator/=(), klang::signal::operator/=(), klang::signal::operator<<(), klang::signal::operator>>(), klang::signal::operator^(), klang::signal::operator^(), klang::signal::operator^(), klang::signal::relative(), and klang::Pitch::text().