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

Constant scalar (pre-converted to double, float and int). More...

#include <klang.h>

Public Member Functions

constexpr constant (double value) noexcept
 Create a constant from the given value.
 
constexpr operator float () const noexcept
 
float operator^ (float x) const
 Constant raised to the power, x.
 
float operator^ (int x) const
 
float operator^ (double x) const
 

Public Attributes

const double d
 Constant as double.
 
const float f
 Constant as float.
 
const int i
 Constant as integer.
 
const float inv
 Inverse of constant.
 

Detailed Description

Definition at line 88 of file klang.h.

Constructor & Destructor Documentation

◆ constant()

klang::constant::constant ( double value)
inlineconstexprnoexcept

Definition at line 91 of file klang.h.

92 : d(value), f(static_cast<float>(value)), i(static_cast<int>(value)), inv(value == 0.0f ? 0.0f : static_cast<float>(1.0 / value)) { }
const float inv
Inverse of constant.
Definition klang.h:97
const double d
Constant as double.
Definition klang.h:94
const float f
Constant as float.
Definition klang.h:95
const int i
Constant as integer.
Definition klang.h:96

References d, f, i, and inv.

Referenced by klang::Filters::Biquad::APF::init(), klang::Filters::Biquad::BRF::init(), klang::Filters::Biquad::HPF::init(), klang::Filters::Biquad::LPF::init(), klang::Filters::Butterworth::LPF::init(), klang::Filters::Biquad::BPF::init_peak(), and klang::Filters::Biquad::BPF::init_skirt().

Member Function Documentation

◆ operator float()

klang::constant::operator float ( ) const
inlineconstexprnoexcept

Definition at line 99 of file klang.h.

99{ return f; }

References f.

◆ operator^() [1/3]

float klang::constant::operator^ ( double x) const
inline

Definition at line 104 of file klang.h.

104{ return static_cast<float>(std::pow(d, x)); }

References d.

◆ operator^() [2/3]

float klang::constant::operator^ ( float x) const
inline

Definition at line 102 of file klang.h.

102{ return std::pow(f, x); }

References f.

◆ operator^() [3/3]

float klang::constant::operator^ ( int x) const
inline

Definition at line 103 of file klang.h.

103{ return static_cast<float>(std::pow(d, x)); }

References d.

Member Data Documentation

◆ d

const double klang::constant::d

Definition at line 94 of file klang.h.

Referenced by constant(), operator^(), and operator^().

◆ f

const float klang::constant::f

◆ i

const int klang::constant::i

Definition at line 96 of file klang.h.

Referenced by constant().

◆ inv