reVeno/Source/Veno/Audio/WaveTable/WaveTableGenerator.h

52 lines
1 KiB
C
Raw Normal View History

2020-06-13 10:56:20 +02:00
//
// Created by versustune on 08.06.20.
//
#ifndef VENO_WAVETABLEGENERATOR_H
#define VENO_WAVETABLEGENERATOR_H
struct WaveTableObject
{
2020-06-13 10:56:20 +02:00
double m_topFreq;
int m_waveTableLen;
float* m_waveTable;
2020-06-13 10:56:20 +02:00
};
struct WaveTableGroup
{
2020-06-13 10:56:20 +02:00
static constexpr int numWaveTableSlots = 40;
WaveTableObject* m_WaveTables[numWaveTableSlots] = {};
2020-06-13 10:56:20 +02:00
int m_numWaveTables = 0;
};
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
};
class WaveTableGenerator
{
2020-06-13 10:56:20 +02:00
private:
static constexpr int numWaveTableSlots = 40;
WaveTableGroup* m_waveTables[numWaveTableSlots] = {};
2020-06-13 10:56:20 +02:00
public:
static WaveTableGenerator& getInstance ()
{
2020-06-13 10:56:20 +02:00
static WaveTableGenerator instance;
return instance;
}
WaveTableGroup* getGroup (int id);
void init ();
void cleanTables ();
2020-06-13 10:56:20 +02:00
protected:
bool m_isInit = false;
WaveTableGenerator () = default;
~WaveTableGenerator () = default;
2020-06-13 10:56:20 +02:00
};
#endif //VENO_WAVETABLEGENERATOR_H