|
RADLib
RADical C++ application framework
|
#include <RADMedia.h>
Public Member Functions | |
| MidiSynthesizer () | |
| Creates a closed synthesizer. More... | |
| ~MidiSynthesizer () | |
| Releases the native synth backend if open. More... | |
| MidiSynthesizer (const MidiSynthesizer &)=delete | |
| Synthesizers own native backend state and are move-only. More... | |
| MidiSynthesizer & | operator= (const MidiSynthesizer &)=delete |
| Synthesizers own native backend state and are move-only. More... | |
| MidiSynthesizer (MidiSynthesizer &&) noexcept | |
| Moves a synthesizer. More... | |
| MidiSynthesizer & | operator= (MidiSynthesizer &&) noexcept |
| Moves a synthesizer. More... | |
| bool | open (uint32_t sampleRate=48000, float gain=0.2f, std::string *error=nullptr) |
| Opens or reopens the synth at sampleRate and gain. More... | |
| void | close () |
| Closes the synth and unloads native resources. More... | |
| bool | isOpen () const |
| Returns true when native synth resources are open. More... | |
| uint32_t | sampleRate () const |
| Returns the current synth sample rate. More... | |
| bool | loadSoundFont (const std::string &path, bool resetPresets=true, std::string *error=nullptr) |
| Loads a SoundFont into the synth, optionally resetting presets. More... | |
| std::optional< AudioBuffer > | render (const MidiClip &clip, std::string *error=nullptr) |
| Renders clip to interleaved Float32 audio. More... | |
| bool | beginStream (const MidiClip &clip, std::string *error=nullptr) |
| Starts stateful small-buffer rendering for clip. More... | |
| std::optional< AudioBuffer > | renderNext (size_t maxFrames, std::string *error=nullptr) |
| Renders the next streaming block. Empty buffer means end of stream. More... | |
| bool | streamFinished () const |
| Returns true once a stream has no more frames to render. More... | |
Static Public Member Functions | |
| static bool | isAvailable () |
| Returns true when RADMedia can render MIDI preview audio. More... | |
| static std::vector< std::string > | defaultSoundFontPaths () |
| Returns existing common system SoundFont paths. More... | |
| static std::optional< AudioBuffer > | renderClip (const MidiClip &clip, const std::string &soundFontPath, std::string *error=nullptr) |
| Convenience helper that opens, loads soundFontPath, renders clip, and closes. More... | |
Backend-neutral MIDI preview renderer facade.
RADMedia includes a lightweight built-in MIDI preview renderer so applications can play edited clips without depending on FluidSynth. Loading a SoundFont validates/selects the preset source for track configuration; richer SF2/SF3 sample playback can be attached later behind this same facade.
| RADMedia::MidiSynthesizer::MidiSynthesizer | ( | ) |
Creates a closed synthesizer.
| RADMedia::MidiSynthesizer::~MidiSynthesizer | ( | ) |
Releases the native synth backend if open.
|
delete |
Synthesizers own native backend state and are move-only.
|
noexcept |
Moves a synthesizer.
| bool RADMedia::MidiSynthesizer::beginStream | ( | const MidiClip & | clip, |
| std::string * | error = nullptr |
||
| ) |
Starts stateful small-buffer rendering for clip.
| void RADMedia::MidiSynthesizer::close | ( | ) |
Closes the synth and unloads native resources.
|
static |
Returns existing common system SoundFont paths.
|
static |
Returns true when RADMedia can render MIDI preview audio.
| bool RADMedia::MidiSynthesizer::isOpen | ( | ) | const |
Returns true when native synth resources are open.
| bool RADMedia::MidiSynthesizer::loadSoundFont | ( | const std::string & | path, |
| bool | resetPresets = true, |
||
| std::string * | error = nullptr |
||
| ) |
Loads a SoundFont into the synth, optionally resetting presets.
| bool RADMedia::MidiSynthesizer::open | ( | uint32_t | sampleRate = 48000, |
| float | gain = 0.2f, |
||
| std::string * | error = nullptr |
||
| ) |
Opens or reopens the synth at sampleRate and gain.
|
delete |
Synthesizers own native backend state and are move-only.
|
noexcept |
Moves a synthesizer.
| std::optional<AudioBuffer> RADMedia::MidiSynthesizer::render | ( | const MidiClip & | clip, |
| std::string * | error = nullptr |
||
| ) |
Renders clip to interleaved Float32 audio.
|
static |
Convenience helper that opens, loads soundFontPath, renders clip, and closes.
| std::optional<AudioBuffer> RADMedia::MidiSynthesizer::renderNext | ( | size_t | maxFrames, |
| std::string * | error = nullptr |
||
| ) |
Renders the next streaming block. Empty buffer means end of stream.
| uint32_t RADMedia::MidiSynthesizer::sampleRate | ( | ) | const |
Returns the current synth sample rate.
| bool RADMedia::MidiSynthesizer::streamFinished | ( | ) | const |
Returns true once a stream has no more frames to render.