Support dynamically changing audio::oscillator frequency
This commit is contained in:
parent
6a38c127c6
commit
31e1e84c69
1 changed files with 9 additions and 3 deletions
|
|
@ -10,9 +10,15 @@ namespace psemek::audio
|
||||||
|
|
||||||
struct oscillator
|
struct oscillator
|
||||||
{
|
{
|
||||||
oscillator(float frequency)
|
oscillator(float f)
|
||||||
: m_(std::exp(std::complex<float>{0.f, 2.f * geom::pi * frequency * inv_frequency}))
|
{
|
||||||
{}
|
frequency(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void frequency(float f)
|
||||||
|
{
|
||||||
|
m_ = std::exp(std::complex<float>{0.f, 2.f * geom::pi * f * inv_frequency});
|
||||||
|
}
|
||||||
|
|
||||||
std::complex<float> phase() const
|
std::complex<float> phase() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue