29 lines
563 B
C++
29 lines
563 B
C++
#ifndef WAVE_H_
|
|
#define WAVE_H_
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
|
|
#include <math.h>
|
|
|
|
const uint16_t DEFAULT_N_SAMPLES = 1024;
|
|
|
|
/* Single cycle wave object with lookup table */
|
|
class Wave {
|
|
private:
|
|
uint16_t m_id{}; // Unique ID number of wave
|
|
std::array<float_t, DEFAULT_N_SAMPLES> m_table; // table data
|
|
public:
|
|
Wave(uint16_t id) : m_id{id}, m_table{} { /* Do nothing */ }
|
|
|
|
uint16_t id() { return m_id; }
|
|
|
|
void setTable(std::array<float_t, DEFAULT_N_SAMPLES> table) { m_table = table; }
|
|
|
|
void print_head();
|
|
};
|
|
|
|
Wave gen_sin();
|
|
|
|
#endif // WAVE_H_
|