Compare commits
No commits in common. "3742e75309dd2ebb24beb8d2a87334df485740be" and "19788cee005216d9458a3cc4f979f017fd61a65f" have entirely different histories.
3742e75309
...
19788cee00
4
Makefile
4
Makefile
|
|
@ -3,11 +3,11 @@ CC = /usr/bin/clang++
|
||||||
GDB = /usr/bin/gdb
|
GDB = /usr/bin/gdb
|
||||||
OLEVEL = -O2
|
OLEVEL = -O2
|
||||||
|
|
||||||
CFLAGS = -Wall -std=c++17 $(OLEVEL) -o $(PROJ)
|
CFLAGS = -Wall -std=c++20 $(OLEVEL) -o $(PROJ)
|
||||||
|
|
||||||
OBJECTS = src/wtpp.cpp
|
OBJECTS = src/wtpp.cpp
|
||||||
|
|
||||||
build: clean
|
build:
|
||||||
$(CC) $(CFLAGS) $(OBJECTS)
|
$(CC) $(CFLAGS) $(OBJECTS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
57
src/wtpp.cpp
57
src/wtpp.cpp
|
|
@ -1,57 +0,0 @@
|
||||||
#include <array>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
static const std::uint_fast32_t DEFAULT_SAMPLE_RATE = 44100; // 44.1 kHz sampling rate
|
|
||||||
static const std::uint_fast8_t DEFAULT_BIT_DEPTH = 12;
|
|
||||||
|
|
||||||
|
|
||||||
class Wavetable
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::uint_fast16_t m_id {};
|
|
||||||
std::string m_name {};
|
|
||||||
std::array<std::uint_fast32_t, 1024> m_table;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Wavetable(std::uint_fast16_t id, std::string name)
|
|
||||||
: m_id{ id }, m_name{ name }, m_table {}
|
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string name()
|
|
||||||
{
|
|
||||||
std::string id_str = std::to_string(m_id);
|
|
||||||
id_str.append(": ");
|
|
||||||
id_str.append(m_name);
|
|
||||||
return id_str;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Logs a message */
|
|
||||||
static void log(std::string message)
|
|
||||||
{
|
|
||||||
std::cout << "wtpp: " << message << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generates basic sine wave table */
|
|
||||||
static Wavetable gen_sin_tbl()
|
|
||||||
{
|
|
||||||
Wavetable table = {0, "sine"};
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Generate wavetables
|
|
||||||
log("Generating wavetables");
|
|
||||||
|
|
||||||
// Generate sine table
|
|
||||||
Wavetable sin_tbl = gen_sin_tbl();
|
|
||||||
log(sin_tbl.name());
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue