RADLib
RADical C++ application framework
RADMedia.h
Go to the documentation of this file.
1 #ifndef RADMEDIA_H
2 #define RADMEDIA_H
3 
9 #pragma once
10 
11 #include <RADCore/RADCore.h>
12 
13 #include <atomic>
14 #include <cstdint>
15 #include <memory>
16 #include <optional>
17 #include <string>
18 #include <vector>
19 
20 namespace RADMedia {
21 
23  enum class AudioSampleFormat {
25  Unknown,
27  UInt8,
29  Int16,
31  Int24,
33  Int32,
35  Float32
36  };
37 
39  enum class AudioDeviceDirection {
41  Input,
43  Output
44  };
45 
47  struct WavFormat {
49  uint16_t channels = 0;
51  uint32_t sampleRate = 0;
53  uint16_t bitsPerSample = 0;
55  uint16_t blockAlign = 0;
57  uint32_t byteRate = 0;
60  };
61 
63  class WavFile {
64  public:
66  static std::optional<WavFile> load(const std::string& path, std::string* error = nullptr);
68  static bool savePcm16(const std::string& path, uint16_t channels, uint32_t sampleRate,
69  const std::vector<int16_t>& interleavedSamples, std::string* error = nullptr);
70 
72  const WavFormat& format() const;
74  const std::vector<uint8_t>& audioData() const;
76  size_t frameCount() const;
78  double durationSeconds() const;
79 
80  private:
81  WavFormat format_;
82  std::vector<uint8_t> audioData_;
83  };
84 
87  public:
92 
94  WavStreamReader(const WavStreamReader&) = delete;
97 
99  bool open(const std::string& path, std::string* error = nullptr);
101  void close();
103  bool isOpen() const;
104 
106  const WavFormat& format() const;
108  size_t totalFrames() const;
110  size_t framesRemaining() const;
112  double durationSeconds() const;
114  bool eof() const;
115 
117  ssize_t readFrames(void* buffer, size_t maxFrames);
118 
119  private:
120  struct Impl;
121  std::unique_ptr<Impl> pImpl_;
122  };
123 
127  std::string id;
129  std::string name;
131  std::string description;
132  };
133 
137  std::string id;
139  std::string name;
141  std::string description;
142  };
143 
145  class AudioDevice {
146  public:
148  static std::vector<AudioSinkDevice> outputDevices();
150  static std::vector<AudioSourceDevice> inputDevices();
151  };
152 
154  struct AudioBuffer {
158  std::vector<float> interleaved;
159 
161  size_t frameCount() const;
163  double durationSeconds() const;
164  };
165 
167  struct MidiNoteEvent {
169  double startSeconds = 0.0;
171  double durationSeconds = 0.0;
173  uint8_t channel = 0;
175  uint8_t note = 60;
177  uint8_t velocity = 96;
178  };
179 
183  double timeSeconds = 0.0;
185  uint8_t channel = 0;
187  uint8_t bank = 0;
189  uint8_t program = 0;
190  };
191 
193  struct MidiPitchBend {
195  double timeSeconds = 0.0;
197  uint8_t channel = 0;
199  uint16_t value = 8192;
200  };
201 
203  struct MidiClip {
205  uint32_t sampleRate = 48000;
207  uint16_t channels = 2;
209  double durationSeconds = 0.0;
211  double tailSeconds = 0.25;
213  std::vector<MidiNoteEvent> notes;
215  std::vector<MidiProgramChange> programs;
217  std::vector<MidiPitchBend> pitchBends;
218 
220  double resolvedDurationSeconds() const;
221  };
222 
224  enum class MusicXmlStaffMode {
226  Treble,
228  Bass,
230  GrandStaff
231  };
232 
236  int startTicks = 0;
238  int durationTicks = 0;
240  int midiNote = 60;
245  int writtenDots = 0;
251  std::string color;
252  };
253 
257  int startTicks = 0;
259  int endTicks = 0;
261  int kind = 1;
262  };
263 
267  int startMeasure = 0;
269  int measureCount = 1;
271  int repeatCount = 1;
272  };
273 
277  int measure = 0;
279  std::string text;
280  };
281 
285  std::string partName = "Part";
287  int divisions = 960;
289  int beats = 4;
291  int beatType = 4;
293  int measureCount = 1;
297  int systemsPerPage = 5;
303  int keyFifths = 0;
306  std::vector<int> measureKeyFifths;
308  std::vector<MusicXmlHairpinEvent> hairpins;
310  std::vector<MusicXmlRepeatEvent> repeats;
312  std::vector<MusicXmlRehearsalEvent> rehearsals;
313  };
314 
316  class MusicXml {
317  public:
319  static std::string escape(const std::string& value);
321  static std::vector<int> durationChunks(int ticks, int divisions = 960);
323  static std::string partwiseScore(const std::vector<MusicXmlNoteEvent>& notes,
324  const MusicXmlScoreOptions& options, std::string* error = nullptr);
325  };
326 
328  enum class SoundFontType {
330  Unknown,
332  SF2,
334  SF3
335  };
336 
338  struct SoundFontInfo {
340  std::string path;
342  std::string name;
345  };
346 
350  std::string name;
352  uint16_t bank = 0;
354  uint16_t program = 0;
355  };
356 
359  public:
361  static std::vector<std::string> defaultSearchPaths();
363  static bool supportsExtension(const std::string& path);
365  static SoundFontType typeForPath(const std::string& path);
367  static std::vector<SoundFontInfo> scan(const std::vector<std::string>& paths = {});
369  static std::vector<SoundFontPreset> presets(const std::string& path, std::string* error = nullptr);
371  static std::vector<SoundFontPreset> generalMidiPresets();
373  static std::string generalMidiPresetName(uint16_t program);
374  };
375 
383  public:
388 
396  MidiSynthesizer& operator=(MidiSynthesizer&&) noexcept;
397 
399  static bool isAvailable();
401  static std::vector<std::string> defaultSoundFontPaths();
402 
404  bool open(uint32_t sampleRate = 48000, float gain = 0.2f, std::string* error = nullptr);
406  void close();
408  bool isOpen() const;
410  uint32_t sampleRate() const;
411 
413  bool loadSoundFont(const std::string& path, bool resetPresets = true, std::string* error = nullptr);
415  std::optional<AudioBuffer> render(const MidiClip& clip, std::string* error = nullptr);
417  bool beginStream(const MidiClip& clip, std::string* error = nullptr);
419  std::optional<AudioBuffer> renderNext(size_t maxFrames, std::string* error = nullptr);
421  bool streamFinished() const;
423  static std::optional<AudioBuffer> renderClip(const MidiClip& clip, const std::string& soundFontPath,
424  std::string* error = nullptr);
425 
426  private:
427  struct Impl;
428  bool ensureFluidSynthLoaded(uint32_t sampleRate, float gain, std::string* error);
429  std::unique_ptr<Impl> pImpl_;
430  };
431 
433  class AudioDecoder {
434  public:
436  static bool supportsExtension(const std::string& path);
438  static std::optional<AudioBuffer> decodeFile(const std::string& path, std::string* error = nullptr);
440  static std::vector<std::string> supportedExtensions();
441  };
442 
445  public:
450 
455 
457  bool open(const std::string& path, std::string* error = nullptr);
459  void close();
461  bool isOpen() const;
463  bool eof() const;
465  const WavFormat& format() const;
467  size_t readFrames(float* interleaved, size_t maxFrames);
468 
469  private:
470  struct Impl;
471  std::unique_ptr<Impl> pImpl_;
472  };
473 
476  public:
477  RADEvents:
479  RAD_EVENT(started, ());
481  RAD_EVENT(stopped, ());
483  RAD_EVENT(underrun, ());
484 
488  ~RADAudioDevice() override;
489 
491  static bool isFormatSupported(const std::string& deviceId, AudioDeviceDirection direction, const WavFormat& format);
492 
495 
497  void setDeviceId(std::string deviceId);
499  const std::string& deviceId() const;
500 
502  void setFormat(WavFormat format);
504  const WavFormat& format() const;
505 
507  void setFramesPerChunk(size_t frames);
509  size_t framesPerChunk() const;
511  void setTargetLatencyUsec(unsigned int usec);
513  unsigned int targetLatencyUsec() const;
515  void setPeriodFrames(size_t frames);
517  size_t periodFrames() const;
519  void setBufferFrames(size_t frames);
521  size_t bufferFrames() const;
522 
524  void setMaxBufferedBytes(size_t bytes);
526  size_t maxBufferedBytes() const;
528  size_t bytesAvailable() const;
529 
531  bool open(RADCore::OpenMode mode) override;
533  void close() override;
535  bool isOpen() const override;
537  ssize_t readData(void* buffer, size_t maxBytes) override;
539  ssize_t writeData(const void* data, size_t size) override;
541  ssize_t writeFrames(const void* data, size_t frames);
543  size_t delayFrames() const;
545  void drain();
547  void drop();
548 
549  private:
550  struct Impl;
551  std::shared_ptr<Impl> pImpl_;
552  };
553 
556  public:
559  };
560 
563  public:
564  RADEvents:
566  RAD_EVENT(started, ());
568  RAD_EVENT(finished, ());
570  RAD_EVENT(stopped, ());
572  RAD_EVENT(errorOccurred, (std::string));
573 
575  bool play(const WavFile& wav, const std::string& deviceId = "default", std::string* error = nullptr);
577  bool playBuffer(const AudioBuffer& buffer, const std::string& deviceId = "default", std::string* error = nullptr);
579  bool playBufferLowLatency(const AudioBuffer& buffer, const std::string& deviceId = "default",
580  size_t framesPerChunk = 256, unsigned int targetLatencyUsec = 5000, std::string* error = nullptr);
582  bool playFile(const std::string& path, const std::string& deviceId = "default", std::string* error = nullptr);
584  void stop();
586  void playAsync(RADCore::EventLoop& loop, WavFile wav, const std::string& deviceId = "default");
588  void playFileAsync(RADCore::EventLoop& loop, const std::string& path, const std::string& deviceId = "default");
589 
590  private:
591  bool playInternal(const WavFile& wav, const std::string& deviceId, std::string* error, bool resetStopRequest);
592  bool playBufferInternal(const AudioBuffer& buffer, const std::string& deviceId, size_t framesPerChunk,
593  unsigned int targetLatencyUsec, std::string* error, bool resetStopRequest);
594  bool playFileInternal(const std::string& path, const std::string& deviceId, std::string* error, bool resetStopRequest);
595  std::atomic<bool> stopRequested_{false};
596  };
597 
598 } // namespace RADMedia
599 
600 #endif
#define RAD_EVENT(Name, Signature)
Declares a typed RADCore event; example: RAD_EVENT(done, (int)).
Definition: RADCore.h:65
#define RADEvents
Marks a public event declaration block in RADObject-derived classes.
Definition: RADCore.h:43
RADCore task event loop with locked and low-latency scheduling strategies.
Definition: RADCore.h:956
Abstract byte-oriented IO device similar to QIODevice.
Definition: RADCore.h:1254
Base class for event receivers, senders, and thread-affinity aware objects.
Definition: RADCore.h:931
Streaming decoder facade for long audio files.
Definition: RADMedia.h:444
~AudioDecoderStream()
Closes the stream if open.
bool isOpen() const
Returns true when a stream is open.
bool eof() const
Returns true when no decoded frames remain.
size_t readFrames(float *interleaved, size_t maxFrames)
Reads up to maxFrames into interleaved Float32 output.
void close()
Closes the stream.
const WavFormat & format() const
Returns the decoded stream format.
AudioDecoderStream()
Creates a closed decoder stream.
bool open(const std::string &path, std::string *error=nullptr)
Opens path for streaming decode.
AudioDecoderStream(const AudioDecoderStream &)=delete
Decoder streams are move-only by ownership design.
AudioDecoderStream & operator=(const AudioDecoderStream &)=delete
Decoder streams are move-only by ownership design.
Whole-file audio decoder facade.
Definition: RADMedia.h:433
static std::vector< std::string > supportedExtensions()
Returns supported audio file extensions.
static bool supportsExtension(const std::string &path)
Returns true when path has an extension RADMedia can decode.
static std::optional< AudioBuffer > decodeFile(const std::string &path, std::string *error=nullptr)
Decodes path into Float32 interleaved samples.
Static audio device enumeration helpers.
Definition: RADMedia.h:145
static std::vector< AudioSourceDevice > inputDevices()
Lists detected capture devices.
static std::vector< AudioSinkDevice > outputDevices()
Lists detected playback devices.
Convenience input-only audio device.
Definition: RADMedia.h:555
AudioInputDevice(RADCore::EventLoop &loop)
Creates an input audio device using loop for capture events.
Convenience WAV/audio playback object with sync and async APIs.
Definition: RADMedia.h:562
void playAsync(RADCore::EventLoop &loop, WavFile wav, const std::string &deviceId="default")
Plays an already-loaded WAV file on a background task and emits events on loop.
bool play(const WavFile &wav, const std::string &deviceId="default", std::string *error=nullptr)
Plays an already-loaded WAV file synchronously.
bool playFile(const std::string &path, const std::string &deviceId="default", std::string *error=nullptr)
Loads and plays a WAV file synchronously.
void stop()
Requests that current playback stop.
bool playBufferLowLatency(const AudioBuffer &buffer, const std::string &deviceId="default", size_t framesPerChunk=256, unsigned int targetLatencyUsec=5000, std::string *error=nullptr)
Plays an interleaved Float32 buffer synchronously with explicit low-level buffer settings.
bool playBuffer(const AudioBuffer &buffer, const std::string &deviceId="default", std::string *error=nullptr)
Plays an interleaved Float32 buffer synchronously using default low-latency settings.
void playFileAsync(RADCore::EventLoop &loop, const std::string &path, const std::string &deviceId="default")
Loads and plays a WAV file on a background task and emits events on loop.
Definition: RADMedia.h:382
MidiSynthesizer(const MidiSynthesizer &)=delete
Synthesizers own native backend state and are move-only.
bool open(uint32_t sampleRate=48000, float gain=0.2f, std::string *error=nullptr)
Opens or reopens the synth at sampleRate and gain.
void close()
Closes the synth and unloads native resources.
bool isOpen() const
Returns true when native synth resources are open.
~MidiSynthesizer()
Releases the native synth backend if open.
bool beginStream(const MidiClip &clip, std::string *error=nullptr)
Starts stateful small-buffer rendering for clip.
MidiSynthesizer(MidiSynthesizer &&) noexcept
Moves a synthesizer.
MidiSynthesizer & operator=(const MidiSynthesizer &)=delete
Synthesizers own native backend state and are move-only.
bool streamFinished() const
Returns true once a stream has no more frames to render.
std::optional< AudioBuffer > render(const MidiClip &clip, std::string *error=nullptr)
Renders clip to interleaved Float32 audio.
MidiSynthesizer()
Creates a closed synthesizer.
uint32_t sampleRate() const
Returns the current synth sample rate.
static bool isAvailable()
Returns true when RADMedia can render MIDI preview audio.
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.
static std::vector< std::string > defaultSoundFontPaths()
Returns existing common system SoundFont paths.
std::optional< AudioBuffer > renderNext(size_t maxFrames, std::string *error=nullptr)
Renders the next streaming block. Empty buffer means end of stream.
bool loadSoundFont(const std::string &path, bool resetPresets=true, std::string *error=nullptr)
Loads a SoundFont into the synth, optionally resetting presets.
MusicXML helper for score export and notation renderers such as Verovio.
Definition: RADMedia.h:316
static std::string partwiseScore(const std::vector< MusicXmlNoteEvent > &notes, const MusicXmlScoreOptions &options, std::string *error=nullptr)
Builds a MusicXML 3.1 partwise score from absolute MIDI-style note events.
static std::vector< int > durationChunks(int ticks, int divisions=960)
Splits a duration into MusicXML-friendly note/rest chunks for the given divisions.
static std::string escape(const std::string &value)
Escapes text for XML element/attribute content.
ALSA-backed input or output audio device implementing RADIODevice.
Definition: RADMedia.h:475
size_t framesPerChunk() const
Returns frames transferred per low-level chunk.
void setBufferFrames(size_t frames)
Sets the requested ALSA hardware buffer size in frames. Zero uses targetLatencyUsec().
bool open(RADCore::OpenMode mode) override
Opens the device for read or write depending on direction.
static bool isFormatSupported(const std::string &deviceId, AudioDeviceDirection direction, const WavFormat &format)
Returns true when ALSA reports deviceId can use format for direction.
~RADAudioDevice() override
Closes the device if still open.
void drain()
Drains queued playback frames.
void setPeriodFrames(size_t frames)
Sets the requested ALSA hardware period size in frames. Zero uses framesPerChunk().
RADAudioDevice(RADCore::EventLoop &loop, AudioDeviceDirection direction)
Creates an input or output audio device using loop for events.
ssize_t readData(void *buffer, size_t maxBytes) override
Reads captured bytes from the input buffer.
const std::string & deviceId() const
Returns the configured ALSA device id.
unsigned int targetLatencyUsec() const
Returns the requested ALSA device latency in microseconds.
void setDeviceId(std::string deviceId)
Sets the ALSA device id, usually "default" or an enumerated id.
bool isOpen() const override
Returns true when the ALSA device is open.
size_t periodFrames() const
Returns the requested ALSA hardware period size in frames, or zero for automatic.
size_t maxBufferedBytes() const
Returns the maximum queued input bytes.
size_t bytesAvailable() const
Returns queued readable bytes for input devices.
void drop()
Drops queued playback/capture frames.
void setFormat(WavFormat format)
Sets the desired audio format.
void close() override
Closes the ALSA handle and worker thread.
size_t delayFrames() const
Returns ALSA's current playback/capture delay in frames, or zero when unavailable.
size_t bufferFrames() const
Returns the requested ALSA hardware buffer size in frames, or zero for automatic.
AudioDeviceDirection direction() const
Returns whether this device captures input or plays output.
void setMaxBufferedBytes(size_t bytes)
Sets the maximum queued input bytes retained for reads.
void setTargetLatencyUsec(unsigned int usec)
Sets the requested ALSA device latency in microseconds before opening.
const WavFormat & format() const
Returns the configured audio format.
ssize_t writeData(const void *data, size_t size) override
Writes bytes to the output device.
ssize_t writeFrames(const void *data, size_t frames)
Writes complete frames to the output device.
void setFramesPerChunk(size_t frames)
Sets how many frames are transferred per low-level chunk.
SoundFont file discovery helpers. This does not load or link a synth engine.
Definition: RADMedia.h:358
static std::vector< SoundFontInfo > scan(const std::vector< std::string > &paths={})
Scans paths for .sf2/.sf3 files. Empty paths use defaultSearchPaths().
static SoundFontType typeForPath(const std::string &path)
Returns SoundFont type from extension.
static std::vector< std::string > defaultSearchPaths()
Returns common system/user SoundFont directories.
static std::vector< SoundFontPreset > generalMidiPresets()
Returns the 128 General MIDI melodic program names as bank 0 presets.
static std::vector< SoundFontPreset > presets(const std::string &path, std::string *error=nullptr)
Reads SoundFont preset names from the SF2/SF3 RIFF pdta/phdr chunk.
static std::string generalMidiPresetName(uint16_t program)
Returns one General MIDI melodic program name, clamping program into 0-127.
static bool supportsExtension(const std::string &path)
Returns true when path has a supported SoundFont extension.
In-memory WAV file representation for smaller files and tests.
Definition: RADMedia.h:63
const std::vector< uint8_t > & audioData() const
Returns raw encoded PCM audio bytes.
size_t frameCount() const
Returns the number of complete frames in audioData().
const WavFormat & format() const
Returns the parsed audio format.
static std::optional< WavFile > load(const std::string &path, std::string *error=nullptr)
Loads and validates a WAV file into memory.
double durationSeconds() const
Returns duration in seconds based on frame count and sample rate.
static bool savePcm16(const std::string &path, uint16_t channels, uint32_t sampleRate, const std::vector< int16_t > &interleavedSamples, std::string *error=nullptr)
Writes signed 16-bit interleaved PCM samples as a WAV file.
Streaming WAV reader that avoids loading the whole file up front.
Definition: RADMedia.h:86
bool open(const std::string &path, std::string *error=nullptr)
Opens path and parses its WAV header.
const WavFormat & format() const
Returns the parsed stream format.
WavStreamReader(const WavStreamReader &)=delete
Streaming readers are move-only by ownership design.
size_t totalFrames() const
Returns the total number of audio frames.
~WavStreamReader()
Closes the file if still open.
bool isOpen() const
Returns true when a WAV stream is open.
ssize_t readFrames(void *buffer, size_t maxFrames)
Reads up to maxFrames into buffer and returns frames read.
void close()
Closes the stream.
WavStreamReader()
Creates a closed stream reader.
WavStreamReader & operator=(const WavStreamReader &)=delete
Streaming readers are move-only by ownership design.
double durationSeconds() const
Returns total duration in seconds.
bool eof() const
Returns true once no frames remain.
size_t framesRemaining() const
Returns frames not yet read.
OpenMode
Open mode flags shared by RADIODevice, RADFile, and RADBuffer.
Definition: RADCore.h:293
Definition: RADMedia.h:20
AudioSampleFormat
Sample encodings supported by RADMedia audio paths.
Definition: RADMedia.h:23
@ Float32
32-bit floating-point PCM.
@ Int16
Signed 16-bit PCM.
@ Int24
Signed packed 24-bit PCM.
@ Unknown
Unknown or unsupported sample format.
@ UInt8
Unsigned 8-bit PCM.
@ Int32
Signed 32-bit PCM.
MusicXmlStaffMode
Staff layout used when generating MusicXML from MIDI-style note events.
Definition: RADMedia.h:224
@ Treble
Single treble clef staff.
@ Bass
Single bass clef staff.
@ GrandStaff
Two-staff piano style score, split around MusicXmlScoreOptions::grandStaffSplitNote.
AudioDeviceDirection
Direction used when opening or enumerating audio devices.
Definition: RADMedia.h:39
@ Output
Play audio to an output device.
@ Input
Capture audio from an input device.
SoundFontType
Known SoundFont file type.
Definition: RADMedia.h:328
@ SF2
SF2 SoundFont 2 file.
@ Unknown
Unknown or unsupported SoundFont-like file.
@ SF3
SF3 compressed SoundFont file.
Float32 interleaved decoded audio buffer.
Definition: RADMedia.h:154
size_t frameCount() const
Returns number of complete interleaved frames.
double durationSeconds() const
Returns duration in seconds.
std::vector< float > interleaved
Interleaved Float32 samples.
Definition: RADMedia.h:158
WavFormat format
Audio format for interleaved.
Definition: RADMedia.h:156
Output audio device descriptor.
Definition: RADMedia.h:125
std::string id
ALSA device id usable with RADAudioDevice output.
Definition: RADMedia.h:127
std::string description
Longer device description.
Definition: RADMedia.h:131
std::string name
Short display name.
Definition: RADMedia.h:129
Input audio device descriptor.
Definition: RADMedia.h:135
std::string id
ALSA device id usable with RADAudioDevice input.
Definition: RADMedia.h:137
std::string description
Longer device description.
Definition: RADMedia.h:141
std::string name
Short display name.
Definition: RADMedia.h:139
Lightweight MIDI clip for preview rendering and RADBard score/piano-roll playback.
Definition: RADMedia.h:203
std::vector< MidiPitchBend > pitchBends
Scheduled pitch-bend changes.
Definition: RADMedia.h:217
std::vector< MidiProgramChange > programs
Scheduled program changes.
Definition: RADMedia.h:215
double tailSeconds
Extra decay/release time appended when durationSeconds is derived.
Definition: RADMedia.h:211
std::vector< MidiNoteEvent > notes
Scheduled notes.
Definition: RADMedia.h:213
double durationSeconds
Explicit render duration. Zero derives duration from scheduled events.
Definition: RADMedia.h:209
uint16_t channels
Output channel count. RADMedia currently renders mono or stereo.
Definition: RADMedia.h:207
uint32_t sampleRate
Output sample rate.
Definition: RADMedia.h:205
double resolvedDurationSeconds() const
Returns explicit duration if set, otherwise derives from notes and tailSeconds.
One scheduled MIDI note event.
Definition: RADMedia.h:167
double startSeconds
Note start time in seconds from clip start.
Definition: RADMedia.h:169
uint8_t velocity
MIDI velocity, 0-127.
Definition: RADMedia.h:177
uint8_t note
MIDI note number, 0-127.
Definition: RADMedia.h:175
uint8_t channel
MIDI channel, 0-15.
Definition: RADMedia.h:173
double durationSeconds
Note duration in seconds.
Definition: RADMedia.h:171
One scheduled MIDI pitch-bend event.
Definition: RADMedia.h:193
uint16_t value
Raw MIDI pitch-bend value, clamped to 0-16383. Center is 8192.
Definition: RADMedia.h:199
uint8_t channel
MIDI channel, 0-15.
Definition: RADMedia.h:197
double timeSeconds
Pitch-bend time in seconds from clip start.
Definition: RADMedia.h:195
One scheduled MIDI program change.
Definition: RADMedia.h:181
uint8_t program
MIDI program number, 0-127.
Definition: RADMedia.h:189
double timeSeconds
Program change time in seconds from clip start.
Definition: RADMedia.h:183
uint8_t bank
MIDI bank number, clamped to 0-127 for General MIDI style preview.
Definition: RADMedia.h:187
uint8_t channel
MIDI channel, 0-15.
Definition: RADMedia.h:185
Crescendo or decrescendo span for MusicXML score generation.
Definition: RADMedia.h:255
int kind
One for crescendo, two for decrescendo/diminuendo.
Definition: RADMedia.h:261
int endTicks
Absolute hairpin end in MusicXML divisions.
Definition: RADMedia.h:259
int startTicks
Absolute hairpin start in MusicXML divisions.
Definition: RADMedia.h:257
MIDI-like note event for MusicXML score generation.
Definition: RADMedia.h:234
int writtenDurationTicks
Definition: RADMedia.h:243
std::string color
Optional MusicXML color value such as "#7dd3fc"; empty uses renderer default.
Definition: RADMedia.h:251
int startTicks
Absolute note start in MusicXML divisions.
Definition: RADMedia.h:236
int writtenDots
Optional number of written augmentation dots when writtenDurationTicks is set.
Definition: RADMedia.h:245
int durationTicks
Note duration in MusicXML divisions.
Definition: RADMedia.h:238
int tupletNormalNotes
Optional tuplet normal-note count, e.g. 2 for a triplet.
Definition: RADMedia.h:249
int tupletActualNotes
Optional tuplet actual-note count, e.g. 3 for a triplet.
Definition: RADMedia.h:247
int midiNote
MIDI note number, 0-127.
Definition: RADMedia.h:240
Rehearsal/section mark displayed above a measure.
Definition: RADMedia.h:275
std::string text
Mark text such as "A", "B", or "Verse".
Definition: RADMedia.h:279
int measure
Zero-based measure where the mark is placed.
Definition: RADMedia.h:277
Repeat barline span for compact MusicXML score notation.
Definition: RADMedia.h:265
int startMeasure
Zero-based first measure in the repeated section.
Definition: RADMedia.h:267
int measureCount
Number of measures in the repeated section.
Definition: RADMedia.h:269
int repeatCount
Number of extra repeats after the first pass.
Definition: RADMedia.h:271
Options controlling MusicXML score generation.
Definition: RADMedia.h:283
int divisions
MusicXML divisions per quarter note.
Definition: RADMedia.h:287
int keyFifths
Key signature fifths field.
Definition: RADMedia.h:303
MusicXmlStaffMode staffMode
Staff/clef layout.
Definition: RADMedia.h:299
std::vector< int > measureKeyFifths
Definition: RADMedia.h:306
int systemsPerPage
Systems per rendered page. Zero disables encoded page breaks.
Definition: RADMedia.h:297
std::string partName
Part display name written into the MusicXML part-list.
Definition: RADMedia.h:285
int measuresPerSystem
Measures per rendered system. Zero disables encoded system breaks.
Definition: RADMedia.h:295
int beatType
Time signature denominator.
Definition: RADMedia.h:291
int measureCount
Number of measures to emit.
Definition: RADMedia.h:293
std::vector< MusicXmlRepeatEvent > repeats
Optional repeat barline spans.
Definition: RADMedia.h:310
int grandStaffSplitNote
Notes at or above this MIDI note go to treble staff in GrandStaff mode.
Definition: RADMedia.h:301
std::vector< MusicXmlRehearsalEvent > rehearsals
Optional section/rehearsal marks.
Definition: RADMedia.h:312
std::vector< MusicXmlHairpinEvent > hairpins
Optional crescendo/decrescendo wedge markings.
Definition: RADMedia.h:308
int beats
Time signature numerator.
Definition: RADMedia.h:289
Discovered SoundFont descriptor.
Definition: RADMedia.h:338
SoundFontType type
SoundFont container type.
Definition: RADMedia.h:344
std::string path
Absolute or user-provided path.
Definition: RADMedia.h:340
std::string name
Display name derived from the file name.
Definition: RADMedia.h:342
One SoundFont preset/program exposed by a SoundFont file.
Definition: RADMedia.h:348
std::string name
Preset display name from the SoundFont phdr chunk, or a General MIDI fallback name.
Definition: RADMedia.h:350
uint16_t program
MIDI program number.
Definition: RADMedia.h:354
uint16_t bank
MIDI bank number.
Definition: RADMedia.h:352
PCM/WAV stream format description.
Definition: RADMedia.h:47
uint16_t blockAlign
Bytes per interleaved frame.
Definition: RADMedia.h:55
AudioSampleFormat sampleFormat
Decoded sample format.
Definition: RADMedia.h:59
uint32_t byteRate
Bytes per second.
Definition: RADMedia.h:57
uint32_t sampleRate
Samples per second.
Definition: RADMedia.h:51
uint16_t channels
Number of interleaved channels.
Definition: RADMedia.h:49
uint16_t bitsPerSample
Bits per sample in the source representation.
Definition: RADMedia.h:53