wtpp/src/wtpp.cpp

48 lines
924 B
C++

#include <array>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <string>
#include <type_traits>
#include <math.h>
#include "wave.h"
#include "generators.h"
#include "wavetable.h"
static const uint32_t DEFAULT_SAMPLE_RATE = 44100; // 44.1 kHz sampling rate
static const uint8_t DEFAULT_BIT_DEPTH = 12;
/*! Logs a message
@param message The string to be logged
*/
static void log(std::string message)
{
std::cout << "wtpp: " << message << '\n';
}
int main()
{
// Generate basic wave lookup tables
log("Generating wave cycle lookup tables");
// Generate sine wave cycle object
Wave sin_wave;
// Calculate sine values
sample_table_t sin_vals = gen_sin();
// Set wave lookup table values
sin_wave.setTable(sin_vals);
// Create Wavetable object
Wavetable wt_01{"Basic Sine"};
log(wt_01.name());
log("Printing head of sine table");
sin_wave.print_head();
return 0;
}