File blosc.h¶
File List > DaisySP > DaisySP-LGPL > Source > Synthesis > blosc.h
Go to the documentation of this file
Source Code¶
/*
Copyright (c) 2023 Electrosmith, Corp, GRAME, Centre National de Creation Musicale.
Use of this source code is governed by the LGPL V2.1
license that can be found in the LICENSE file or at
https://opensource.org/license/lgpl-2-1/
*/
#pragma once
#ifndef DSY_BLOSC_H
#define DSY_BLOSC_H
#include <stdint.h>
#ifdef __cplusplus
namespace daisysp
{
class BlOsc
{
public:
BlOsc() {}
~BlOsc() {}
enum Waveforms
{
WAVE_TRIANGLE,
WAVE_SAW,
WAVE_SQUARE,
WAVE_OFF,
};
void Init(float sample_rate);
float Process();
inline void SetFreq(float freq) { freq_ = freq; };
inline void SetAmp(float amp) { amp_ = amp; };
inline void SetPw(float pw) { pw_ = 1 - pw; };
inline void SetWaveform(uint8_t waveform) { mode_ = waveform; }
void Reset();
private:
float rec0_[2], rec1_[2], vec0_[2], vec1_[2], vec2_[4096], freq_, amp_, pw_,
sampling_freq_, half_sr_, quarter_sr_, sec_per_sample_, two_over_sr_,
four_over_sr_;
uint8_t mode_;
int iota_;
float ProcessSquare();
float ProcessTriangle();
float ProcessSaw();
};
} // namespace daisysp
#endif
#endif