Refactor: create common.h and move logging function there

pull/13/head
rkcf 2023-02-27 03:52:01 -06:00
parent 33b615261f
commit 52a22d53c4
2 changed files with 20 additions and 9 deletions

17
src/common.h Normal file
View File

@ -0,0 +1,17 @@
/*! @file common.h
@brief Header for shared utilities and constants
*/
#ifndef COMMON_H_
#define COMMON_H_
#include <string>
#include <iostream>
/*! Logs a message
@param message The string to be logged
*/
static void log(std::string message) {
std::cout << "wtpp: " << message << '\n';
}
#endif // COMMON_H_

View File

@ -1,12 +1,14 @@
#include <array> #include <array>
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <iostream>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <math.h> #include <math.h>
#include "ini.h"
#include "common.h"
#include "wave.h" #include "wave.h"
#include "generators.h" #include "generators.h"
#include "wavetable.h" #include "wavetable.h"
@ -14,14 +16,6 @@
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
@param message The string to be logged
*/
static void log(std::string message)
{
std::cout << "wtpp: " << message << '\n';
}
int main() int main()
{ {
log("Generating wave cycle lookup tables"); log("Generating wave cycle lookup tables");