Docs: add doxygen compatable documentation to files

pull/5/head
rkcf 2023-02-26 07:22:25 -06:00
parent c2dd910ed7
commit 0c15bd2f72
3 changed files with 44 additions and 11 deletions

View File

@ -1,3 +1,6 @@
/*! @file wave.h
@brief Header for Wave class and associated Wave functions
*/
#ifndef WAVE_H_
#define WAVE_H_
@ -8,21 +11,34 @@
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 {
private:
uint16_t m_id{}; // Unique ID number of wave
std::array<float_t, DEFAULT_N_SAMPLES> m_table; // table data
uint16_t m_id{}; /*!< Unique ID number of wave */
sample_table_t m_table; /*!< Table of sample data */
public:
Wave(uint16_t id) : m_id{id}, m_table{} { /* Do nothing */ }
/*! ID getter */
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();
};
/*! Generate sine wave data
@return a table of values
*/
Wave gen_sin();
#endif // WAVE_H_

View File

@ -1,3 +1,6 @@
/*! @file wavetable.h
@brief Header for Wavetable class and associated table functions
*/
#ifndef WAVETABLE_H_
#define WAVETABLE_H_
@ -7,17 +10,29 @@
#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 {
private:
uint16_t m_id{}; // Unique ID number of wavetable
std::string m_name{}; // String name of wavetable
std::array<Wave, DEFAULT_N_SAMPLES> m_table; // table data
uint16_t m_id{}; /*!< Unique ID number of wavetable */
std::string m_name{}; /*!< String name of wavetable */
wave_table_t m_table; /*!< Table of Wave objects */
public:
/*! Makes formatted name and id string
@return a formatted string in the form "id: 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_

View File

@ -13,7 +13,9 @@
static const uint32_t DEFAULT_SAMPLE_RATE = 44100; // 44.1 kHz sampling rate
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)
{
std::cout << "wtpp: " << message << '\n';