fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
Synth.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include "MidiEvent.h"
24#include "Voice.h"
25#include <juce_audio_basics/juce_audio_basics.h>
26
27namespace fsh::synth
28{
40class Synth
41{
42public:
44 struct Params
45 {
47 };
48
50 void setSampleRate(double sampleRate);
51
53 void setParams(const Params&);
54
56 void process(juce::AudioBuffer<float>&, juce::MidiBuffer&);
57
59 void reset();
60
62 auto numActiveVoices() const -> size_t; // TODO: currently only returns 0!
63
64private:
65 void handleMIDIEvent(const MidiEvent&);
66
67 // Limited for now because sawtooth algorithm is very inefficient:
68 static const auto numVoices = 6;
69 std::array<Voice, numVoices> _voices;
70};
71} // namespace fsh::synth
Represents a MIDI event, such as a note on/off or pitch bend.
Definition MidiEvent.h:31
Polyphonic synthesizer.
Definition Synth.h:41
void process(juce::AudioBuffer< float > &, juce::MidiBuffer &)
Process a block of audio samples with the given MIDI input.
Definition Synth.cpp:72
void reset()
Reset the synthesizer's state.
Definition Synth.cpp:35
void setParams(const Params &)
Set the synthesizer's parameters.
Definition Synth.cpp:66
void setSampleRate(double sampleRate)
Set the sample rate in Hz.
Definition Synth.cpp:29
auto numActiveVoices() const -> size_t
Queries the number of currently active voices.
Definition Synth.cpp:99
Represents a single voice of a polyphonic synthesizer.
Definition Voice.h:47
Synthesizer parameters.
Definition Synth.h:45
Voice::Params voice
Voice parameters.
Definition Synth.h:46
Voice parameters.
Definition Voice.h:51