Docs: add doxygen compatable documentation to files
parent
c2dd910ed7
commit
0c15bd2f72
24
src/wave.h
24
src/wave.h
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*! @file wave.h
|
||||||
|
@brief Header for Wave class and associated Wave functions
|
||||||
|
*/
|
||||||
#ifndef WAVE_H_
|
#ifndef WAVE_H_
|
||||||
#define WAVE_H_
|
#define WAVE_H_
|
||||||
|
|
||||||
|
|
@ -8,21 +11,34 @@
|
||||||
|
|
||||||
const uint16_t DEFAULT_N_SAMPLES = 1024;
|
const uint16_t DEFAULT_N_SAMPLES = 1024;
|
||||||
|
|
||||||
/* Single cycle wave object with lookup table */
|
using sample_table_t = std::array<float_t, DEFAULT_N_SAMPLES>;
|
||||||
|
|
||||||
|
/*! @class Wave wave.h "wave.h"
|
||||||
|
@brief Single cycle wave object with lookup table
|
||||||
|
*/
|
||||||
class Wave {
|
class Wave {
|
||||||
private:
|
private:
|
||||||
uint16_t m_id{}; // Unique ID number of wave
|
uint16_t m_id{}; /*!< Unique ID number of wave */
|
||||||
std::array<float_t, DEFAULT_N_SAMPLES> m_table; // table data
|
sample_table_t m_table; /*!< Table of sample data */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Wave(uint16_t id) : m_id{id}, m_table{} { /* Do nothing */ }
|
Wave(uint16_t id) : m_id{id}, m_table{} { /* Do nothing */ }
|
||||||
|
|
||||||
|
/*! ID getter */
|
||||||
uint16_t id() { return m_id; }
|
uint16_t id() { return m_id; }
|
||||||
|
|
||||||
void setTable(std::array<float_t, DEFAULT_N_SAMPLES> table) { m_table = table; }
|
/*! Sample data table setter
|
||||||
|
@param table Sample data table
|
||||||
|
*/
|
||||||
|
void setTable(sample_table_t table) { m_table = table; }
|
||||||
|
|
||||||
|
/*! Prints the first 10 values of sample data */
|
||||||
void print_head();
|
void print_head();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! Generate sine wave data
|
||||||
|
@return a table of values
|
||||||
|
*/
|
||||||
Wave gen_sin();
|
Wave gen_sin();
|
||||||
|
|
||||||
#endif // WAVE_H_
|
#endif // WAVE_H_
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*! @file wavetable.h
|
||||||
|
@brief Header for Wavetable class and associated table functions
|
||||||
|
*/
|
||||||
#ifndef WAVETABLE_H_
|
#ifndef WAVETABLE_H_
|
||||||
#define WAVETABLE_H_
|
#define WAVETABLE_H_
|
||||||
|
|
||||||
|
|
@ -7,17 +10,29 @@
|
||||||
|
|
||||||
#include "wave.h"
|
#include "wave.h"
|
||||||
|
|
||||||
/* Table of single cycle wave lookup tables */
|
const uint8_t DEFAULT_N_WAVES = 256;
|
||||||
|
|
||||||
|
using wave_table_t = std::array<Wave, DEFAULT_N_WAVES>;
|
||||||
|
|
||||||
|
/*! @class Wavetable wavetable.h "wavetable.h"
|
||||||
|
@brief Object containing a table of single cycle Wave objects
|
||||||
|
*/
|
||||||
class Wavetable {
|
class Wavetable {
|
||||||
private:
|
private:
|
||||||
uint16_t m_id{}; // Unique ID number of wavetable
|
uint16_t m_id{}; /*!< Unique ID number of wavetable */
|
||||||
std::string m_name{}; // String name of wavetable
|
std::string m_name{}; /*!< String name of wavetable */
|
||||||
std::array<Wave, DEFAULT_N_SAMPLES> m_table; // table data
|
wave_table_t m_table; /*!< Table of Wave objects */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/*! Makes formatted name and id string
|
||||||
|
@return a formatted string in the form "id: name"
|
||||||
|
*/
|
||||||
std::string name();
|
std::string name();
|
||||||
|
|
||||||
void set_table(std::array<Wave, DEFAULT_N_SAMPLES> table) { m_table = table; }
|
/*! setter for wave table
|
||||||
|
@param table Table of Wave objects
|
||||||
|
*/
|
||||||
|
void set_table(wave_table_t table) { m_table = table; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WAVETABLE_H_
|
#endif // WAVETABLE_H_
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@
|
||||||
static const uint32_t DEFAULT_SAMPLE_RATE = 44100; // 44.1 kHz sampling rate
|
static const uint32_t DEFAULT_SAMPLE_RATE = 44100; // 44.1 kHz sampling rate
|
||||||
static const uint8_t DEFAULT_BIT_DEPTH = 12;
|
static const uint8_t DEFAULT_BIT_DEPTH = 12;
|
||||||
|
|
||||||
/* Logs a message */
|
/*! Logs a message
|
||||||
|
@param message The string to be logged
|
||||||
|
*/
|
||||||
static void log(std::string message)
|
static void log(std::string message)
|
||||||
{
|
{
|
||||||
std::cout << "wtpp: " << message << '\n';
|
std::cout << "wtpp: " << message << '\n';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue