2020-06-13 10:56:20 +02:00
|
|
|
//
|
|
|
|
// Created by versustune on 08.06.20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef VENO_WAVETABLEGENERATOR_H
|
|
|
|
#define VENO_WAVETABLEGENERATOR_H
|
2020-06-13 16:52:16 +02:00
|
|
|
struct WaveTableObject
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
double m_topFreq;
|
|
|
|
int m_waveTableLen;
|
2020-06-13 16:52:16 +02:00
|
|
|
float* m_waveTable;
|
2020-06-13 10:56:20 +02:00
|
|
|
};
|
2020-06-13 16:52:16 +02:00
|
|
|
struct WaveTableGroup
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
static constexpr int numWaveTableSlots = 40;
|
2020-06-13 16:52:16 +02:00
|
|
|
WaveTableObject* m_WaveTables[numWaveTableSlots] = {};
|
2020-06-13 10:56:20 +02:00
|
|
|
int m_numWaveTables = 0;
|
|
|
|
};
|
2020-06-13 16:52:16 +02:00
|
|
|
enum WaveForms
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
SAW = 0,
|
|
|
|
SINE,
|
|
|
|
SQUARE,
|
|
|
|
TRIANGLE,
|
|
|
|
wSaw,
|
|
|
|
wSQUARE, //that stuff is to dirty xD,
|
|
|
|
SYNTHONE,
|
|
|
|
SYNTHTWO,
|
|
|
|
VENOX
|
|
|
|
};
|
2020-06-13 16:52:16 +02:00
|
|
|
class WaveTableGenerator
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
private:
|
|
|
|
static constexpr int numWaveTableSlots = 40;
|
2020-06-13 16:52:16 +02:00
|
|
|
WaveTableGroup* m_waveTables[numWaveTableSlots] = {};
|
2020-06-13 10:56:20 +02:00
|
|
|
public:
|
2020-06-13 16:52:16 +02:00
|
|
|
static WaveTableGenerator& getInstance ()
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
static WaveTableGenerator instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
WaveTableGroup* getGroup (int id);
|
|
|
|
void init ();
|
|
|
|
void cleanTables ();
|
2020-06-13 10:56:20 +02:00
|
|
|
protected:
|
|
|
|
bool m_isInit = false;
|
2020-06-13 16:52:16 +02:00
|
|
|
WaveTableGenerator () = default;
|
|
|
|
~WaveTableGenerator () = default;
|
2020-06-13 10:56:20 +02:00
|
|
|
};
|
|
|
|
#endif //VENO_WAVETABLEGENERATOR_H
|