|
AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
|
#include <SimpleSynth.h>
Public Member Functions | |
| SimpleSynth () | |
| virtual | ~SimpleSynth () |
| virtual bool | ReceiveMessage (double deltaTimeSeconds, const uint8_t *message, uint64_t messageSize, Error &error) override |
| virtual SynthModule * | GetRootModule (uint16_t channel) override |
Public Member Functions inherited from AudioDataLib::MidiSynth | |
| MidiSynth () | |
| virtual | ~MidiSynth () |
| virtual bool | Process (Error &error) override |
| void | SetAudioStream (std::shared_ptr< AudioStream > audioStream) |
| std::shared_ptr< AudioStream > | GetAudioStream () |
| void | SetMinMaxLatency (double minLatencySeconds, double maxLatencySeconds) |
| void | GetMinMaxLatency (double &minLatencySeconds, double &maxLatencySeconds) const |
Public Member Functions inherited from AudioDataLib::MidiMsgDestination | |
| MidiMsgDestination () | |
| virtual | ~MidiMsgDestination () |
| virtual bool | Initialize (Error &error) |
| virtual bool | Finalize (Error &error) |
Additional Inherited Members | |
Static Public Member Functions inherited from AudioDataLib::MidiSynth | |
| static double | MidiPitchToFrequency (uint8_t pitchValue) |
| static double | MidiVelocityToAmplitude (uint8_t velocityValue) |
Protected Attributes inherited from AudioDataLib::MidiSynth | |
| std::shared_ptr< AudioStream > * | audioStream |
| double | minLatencySeconds |
| This is the minimum amount of audio (measured in seconds) that should always be buffered at any given time. | |
| double | maxLatencySeconds |
| This is the maximum amount of audio (measured in seconds) that should always be buffered at any given time. | |
The idea here is to impliment a musical instrument that can be recognized as such, even if it doesn't sound interesting at all. There is nothing fancy going on here like modulation, envelopes, filters, harmonics, etc. Can I just make something that plays musical notes at the desired pitches for the desired ranges?
| SimpleSynth::SimpleSynth | ( | ) |
|
virtual |
|
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.
|
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.
| [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. |
Reimplemented from AudioDataLib::MidiMsgDestination.