45using FrequencyTableIndex = NamedType<unsigned int, struct FrequencyTableIndexTag>;
46using VoiceIndex = NamedType<unsigned int, struct VoiceIndexTag>;
49using FrequencyFunc = std::function<nt::OscillatorFrequency()>;
51template <
unsigned int TABLE_HEIGHT,
unsigned int TABLE_WIDTH>
struct FrequencyTable
54 using TableType = std::array<std::array<FrequencyFunc, TABLE_WIDTH>, TABLE_HEIGHT>;
56 explicit FrequencyTable(
const TableType &table)
57 : freq_functions(table)
61 FrequencyTable(
const FrequencyTable<TABLE_HEIGHT, TABLE_WIDTH> &other) =
default;
62 FrequencyTable(FrequencyTable<TABLE_HEIGHT, TABLE_WIDTH> &&other) =
default;
63 FrequencyTable<TABLE_HEIGHT, TABLE_WIDTH> &
64 operator=(
const FrequencyTable<TABLE_HEIGHT, TABLE_WIDTH> &other) =
default;
65 ~FrequencyTable() =
default;
67 nt::OscillatorFrequency get(
const nt::FrequencyTableIndex table_index,
const nt::VoiceIndex voice_index)
const
71 return freq_functions[table_index.get() % TABLE_HEIGHT][voice_index.get() % TABLE_WIDTH]();
75 TableType freq_functions;
Oscillator frequency calculation utilities for the Deep Note synthesizer.
Range constraint and validation utilities for the Deep Note synthesizer.