File clockednoise.h¶
File List > DaisySP > Source > Noise > clockednoise.h
Go to the documentation of this file
Source Code¶
/*
Copyright (c) 2020 Electrosmith, Corp, Emilie Gillet
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
#pragma once
#ifndef DSY_CLOCKEDNOISE_H
#define DSY_CLOCKEDNOISE_H
#include <stdint.h>
#ifdef __cplusplus
namespace daisysp
{
class ClockedNoise
{
public:
ClockedNoise() {}
~ClockedNoise() {}
void Init(float sample_rate);
float Process();
void SetFreq(float freq);
void Sync();
private:
// Oscillator state.
float phase_;
float sample_;
float next_sample_;
// For interpolation of parameters.
float frequency_;
float sample_rate_;
static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
};
} // namespace daisysp
#endif
#endif