This class knows how to synthesize real-time sound as a function of MIDI messages and WaveTableData.
More...
#include <SampleBasedSynth.h>
This class knows how to synthesize real-time sound as a function of MIDI messages and WaveTableData.
◆ SampleBasedSynth()
| SampleBasedSynth::SampleBasedSynth |
( |
| ) |
|
◆ ~SampleBasedSynth()
| SampleBasedSynth::~SampleBasedSynth |
( |
| ) |
|
|
virtual |
◆ Clear()
| void SampleBasedSynth::Clear |
( |
| ) |
|
◆ GetChannelInstrument()
| bool SampleBasedSynth::GetChannelInstrument |
( |
uint8_t | channel, |
|
|
uint8_t & | instrument ) const |
◆ GetReverbEnabled()
| bool AudioDataLib::SampleBasedSynth::GetReverbEnabled |
( |
| ) |
|
|
inline |
◆ GetRootModule()
| SynthModule * SampleBasedSynth::GetRootModule |
( |
uint16_t | channel | ) |
|
|
overridevirtual |
A derived class must impliment this method to provide a SynthModule that can feed the given channel. Note that the term "channel" is overloaded. It can refer to a channel in a stream of audio (e.g., left, right, mono, etc.), as is the case here, or it can mean a MIDI channel, of which there are 16, so don't get them confused. Context usually makes it clear.
Implements AudioDataLib::MidiSynth.
◆ GetWaveTableData()
| std::shared_ptr< WaveTableData > AudioDataLib::SampleBasedSynth::GetWaveTableData |
( |
| ) |
|
|
inline |
◆ Initialize()
| bool SampleBasedSynth::Initialize |
( |
Error & | error | ) |
|
|
overridevirtual |
This method will get called by the MidiMsgSource class during its own initialization.
- Parameters
-
| [out] | error | This should be populated with error information if false is returned. |
- Returns
- True should be returned on success; false otherwise.
Reimplemented from AudioDataLib::MidiMsgDestination.
◆ Process()
| bool SampleBasedSynth::Process |
( |
Error & | error | ) |
|
|
overridevirtual |
This is where we strike a balance between keeping enough audio data buffered in our audio stream to prevent an audio drop-out while also not buffering too much so as to maintain the lowest possible latency. If we don't feed the audio buffer quick enough, we periodically have to feed silence to the audio stream. If we feed the audio buffer too much, then changes to the audio (such as a note turnning on or off) don't happen soon enough, or as close to when they actually happend as we would like. As far as drop-outs are concerned, this class is really at the mercy of the SynthModule implimentations, which needs to be as quick as they possibly can be.
A derived class might override this to do its own processing, but should call this base-class method as well.
Reimplemented from AudioDataLib::MidiSynth.
◆ ReceiveMessage()
| bool SampleBasedSynth::ReceiveMessage |
( |
double | deltaTimeSeconds, |
|
|
const uint8_t * | message, |
|
|
uint64_t | messageSize, |
|
|
Error & | error ) |
|
overridevirtual |
This method will be called when this destination is to receive the given MIDI message. Note that it's important that no heavy processing be done in this method (such as is the mentality when writing an audio callback), because the timing of MIDI message reception and processing can effect the quality of audio playback.
- Parameters
-
| [in] | deltaTimeSeconds | This is typically, but not always, set to the amount of time (in seconds) between now and the last time the function was called. |
| [in] | message | This is the payload of the message, which can be decoded using a derivative of the MidiData::Event class. |
| [in] | messageSize | This is the size of the payload in bytes. |
| [out] | error | This should be populated with error information if false is returned. |
- Returns
- True should be returned on success; false otherwise.
Reimplemented from AudioDataLib::MidiMsgDestination.
◆ SetChannelInstrument()
| bool SampleBasedSynth::SetChannelInstrument |
( |
uint8_t | channel, |
|
|
uint8_t | instrument, |
|
|
Error & | error ) |
◆ SetReverbEnabled()
| void SampleBasedSynth::SetReverbEnabled |
( |
bool | reverbEnabled | ) |
|
◆ SetWaveTableData()
| void AudioDataLib::SampleBasedSynth::SetWaveTableData |
( |
std::shared_ptr< WaveTableData > & | waveTableData | ) |
|
|
inline |
The documentation for this class was generated from the following files: