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 
156  std::string id;
158  std::string name;
160  std::string description;
161  };
162 
164  enum class MidiMessageType {
166  NoteOff,
168  NoteOn,
174  PitchBend,
176  Other
177  };
178 
180  struct MidiMessage {
184  uint8_t channel = 0;
186  uint8_t data1 = 0;
188  uint8_t data2 = 0;
190  uint8_t status = 0;
191  };
192 
195  public:
200 
208  MidiInputDevice& operator=(MidiInputDevice&&) noexcept;
209 
211  static std::vector<MidiInputDeviceInfo> inputDevices();
212 
214  bool open(const std::string& deviceId, std::string* error = nullptr);
216  void close();
218  bool isOpen() const;
220  const std::string& deviceId() const;
222  std::vector<MidiMessage> readMessages(size_t maxBytes = 256);
223 
224  private:
225  struct Impl;
226  std::unique_ptr<Impl> pImpl_;
227  };
228 
230  struct AudioBuffer {
234  std::vector<float> interleaved;
235 
237  size_t frameCount() const;
239  double durationSeconds() const;
240  };
241 
243  struct MidiNoteEvent {
245  double startSeconds = 0.0;
247  double durationSeconds = 0.0;
249  uint8_t channel = 0;
251  uint8_t note = 60;
253  uint8_t velocity = 96;
254  };
255 
259  double timeSeconds = 0.0;
261  uint8_t channel = 0;
263  uint8_t bank = 0;
265  uint8_t program = 0;
266  };
267 
269  struct MidiPitchBend {
271  double timeSeconds = 0.0;
273  uint8_t channel = 0;
275  uint16_t value = 8192;
276  };
277 
279  struct MidiClip {
281  uint32_t sampleRate = 48000;
283  uint16_t channels = 2;
285  double durationSeconds = 0.0;
287  double tailSeconds = 0.25;
289  std::vector<MidiNoteEvent> notes;
291  std::vector<MidiProgramChange> programs;
293  std::vector<MidiPitchBend> pitchBends;
294 
296  double resolvedDurationSeconds() const;
297  };
298 
300  enum class MusicXmlStaffMode {
302  Treble,
304  Bass,
306  GrandStaff
307  };
308 
312  int startTicks = 0;
314  int durationTicks = 0;
316  int midiNote = 60;
319  int writtenDurationTicks = 0;
321  int writtenDots = 0;
323  int tupletActualNotes = 0;
325  int tupletNormalNotes = 0;
327  std::string color;
328  };
329 
333  int startTicks = 0;
335  int endTicks = 0;
337  int kind = 1;
338  };
339 
343  int startMeasure = 0;
345  int measureCount = 1;
347  int repeatCount = 1;
348  };
349 
353  int measure = 0;
355  std::string text;
356  };
357 
361  std::string partName = "Part";
363  int divisions = 960;
365  int beats = 4;
367  int beatType = 4;
369  int measureCount = 1;
371  int measuresPerSystem = 4;
373  int systemsPerPage = 5;
377  int grandStaffSplitNote = 60;
379  int keyFifths = 0;
382  std::vector<int> measureKeyFifths;
384  std::vector<MusicXmlHairpinEvent> hairpins;
386  std::vector<MusicXmlRepeatEvent> repeats;
388  std::vector<MusicXmlRehearsalEvent> rehearsals;
389  };
390 
392  class MusicXml {
393  public:
395  static std::string escape(const std::string& value);
397  static std::vector<int> durationChunks(int ticks, int divisions = 960);
399  static std::string partwiseScore(const std::vector<MusicXmlNoteEvent>& notes,
400  const MusicXmlScoreOptions& options, std::string* error = nullptr);
401  };
402 
404  enum class SoundFontType {
406  Unknown,
408  SF2,
410  SF3
411  };
412 
414  struct SoundFontInfo {
416  std::string path;
418  std::string name;
421  };
422 
426  std::string name;
428  uint16_t bank = 0;
430  uint16_t program = 0;
431  };
432 
435  public:
437  static std::vector<std::string> defaultSearchPaths();
439  static bool supportsExtension(const std::string& path);
441  static SoundFontType typeForPath(const std::string& path);
443  static std::vector<SoundFontInfo> scan(const std::vector<std::string>& paths = {});
445  static std::vector<SoundFontPreset> presets(const std::string& path, std::string* error = nullptr);
447  static std::vector<SoundFontPreset> generalMidiPresets();
449  static std::string generalMidiPresetName(uint16_t program);
450  };
451 
459  public:
464 
472  MidiSynthesizer& operator=(MidiSynthesizer&&) noexcept;
473 
475  static bool isAvailable();
477  static std::vector<std::string> defaultSoundFontPaths();
478 
480  bool open(uint32_t sampleRate = 48000, float gain = 0.2f, std::string* error = nullptr);
482  void close();
484  bool isOpen() const;
486  uint32_t sampleRate() const;
487 
489  bool loadSoundFont(const std::string& path, bool resetPresets = true, std::string* error = nullptr);
491  std::optional<AudioBuffer> render(const MidiClip& clip, std::string* error = nullptr);
493  bool beginStream(const MidiClip& clip, std::string* error = nullptr);
495  std::optional<AudioBuffer> renderNext(size_t maxFrames, std::string* error = nullptr);
497  bool streamFinished() const;
499  static std::optional<AudioBuffer> renderClip(const MidiClip& clip, const std::string& soundFontPath,
500  std::string* error = nullptr);
501 
502  private:
503  struct Impl;
504  bool ensureFluidSynthLoaded(uint32_t sampleRate, float gain, std::string* error);
505  std::unique_ptr<Impl> pImpl_;
506  };
507 
509  class AudioDecoder {
510  public:
512  static bool supportsExtension(const std::string& path);
514  static std::optional<AudioBuffer> decodeFile(const std::string& path, std::string* error = nullptr);
516  static std::vector<std::string> supportedExtensions();
517  };
518 
521  public:
526 
531 
533  bool open(const std::string& path, std::string* error = nullptr);
535  void close();
537  bool isOpen() const;
539  bool eof() const;
541  const WavFormat& format() const;
543  size_t readFrames(float* interleaved, size_t maxFrames);
544 
545  private:
546  struct Impl;
547  std::unique_ptr<Impl> pImpl_;
548  };
549 
552  public:
553  RADEvents:
555  RAD_EVENT(started, ());
557  RAD_EVENT(stopped, ());
559  RAD_EVENT(underrun, ());
560 
564  ~RADAudioDevice() override;
565 
567  static bool isFormatSupported(const std::string& deviceId, AudioDeviceDirection direction, const WavFormat& format);
568 
571 
573  void setDeviceId(std::string deviceId);
575  const std::string& deviceId() const;
576 
578  void setFormat(WavFormat format);
580  const WavFormat& format() const;
581 
583  void setFramesPerChunk(size_t frames);
585  size_t framesPerChunk() const;
587  void setTargetLatencyUsec(unsigned int usec);
589  unsigned int targetLatencyUsec() const;
591  void setPeriodFrames(size_t frames);
593  size_t periodFrames() const;
595  void setBufferFrames(size_t frames);
597  size_t bufferFrames() const;
598 
600  void setMaxBufferedBytes(size_t bytes);
602  size_t maxBufferedBytes() const;
604  size_t bytesAvailable() const;
605 
607  bool open(RADCore::OpenMode mode) override;
609  void close() override;
611  bool isOpen() const override;
613  ssize_t readData(void* buffer, size_t maxBytes) override;
615  ssize_t writeData(const void* data, size_t size) override;
617  ssize_t writeFrames(const void* data, size_t frames);
619  size_t delayFrames() const;
621  void drain();
623  void drop();
624 
625  private:
626  struct Impl;
627  std::shared_ptr<Impl> pImpl_;
628  };
629 
632  public:
635  };
636 
639  public:
640  RADEvents:
642  RAD_EVENT(started, ());
644  RAD_EVENT(finished, ());
646  RAD_EVENT(stopped, ());
648  RAD_EVENT(errorOccurred, (std::string));
649 
651  bool play(const WavFile& wav, const std::string& deviceId = "default", std::string* error = nullptr);
653  bool playBuffer(const AudioBuffer& buffer, const std::string& deviceId = "default", std::string* error = nullptr);
655  bool playBufferLowLatency(const AudioBuffer& buffer, const std::string& deviceId = "default",
656  size_t framesPerChunk = 256, unsigned int targetLatencyUsec = 5000, std::string* error = nullptr);
658  bool playFile(const std::string& path, const std::string& deviceId = "default", std::string* error = nullptr);
660  void stop();
662  void playAsync(RADCore::EventLoop& loop, WavFile wav, const std::string& deviceId = "default");
664  void playFileAsync(RADCore::EventLoop& loop, const std::string& path, const std::string& deviceId = "default");
665 
666  private:
667  bool playInternal(const WavFile& wav, const std::string& deviceId, std::string* error, bool resetStopRequest);
668  bool playBufferInternal(const AudioBuffer& buffer, const std::string& deviceId, size_t framesPerChunk,
669  unsigned int targetLatencyUsec, std::string* error, bool resetStopRequest);
670  bool playFileInternal(const std::string& path, const std::string& deviceId, std::string* error, bool resetStopRequest);
671  std::atomic<bool> stopRequested_{false};
672  };
673 
674 } // namespace RADMedia
675 
676 #endif
#define RAD_EVENT(Name, Signature)
Declares a typed RADCore event; example: RAD_EVENT(done, (int)).
Definition: RADCore.h:97
#define RADEvents
Marks a public event declaration block in RADObject-derived classes.
Definition: RADCore.h:75
RADCore task event loop with locked and low-latency scheduling strategies.
Definition: RADCore.h:988
Abstract byte-oriented IO device similar to QIODevice.
Definition: RADCore.h:1286
Base class for event receivers, senders, and thread-affinity aware objects.
Definition: RADCore.h:963
Streaming decoder facade for long audio files.
Definition: RADMedia.h:520
~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:509
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:631
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:638
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.
ALSA raw-MIDI input wrapper for USB MIDI controllers and DIN adapters.
Definition: RADMedia.h:194
MidiInputDevice & operator=(const MidiInputDevice &)=delete
MIDI inputs own native handles and are move-only.
bool open(const std::string &deviceId, std::string *error=nullptr)
Opens deviceId in nonblocking input mode.
std::vector< MidiMessage > readMessages(size_t maxBytes=256)
Reads and decodes all currently available MIDI messages without blocking.
MidiInputDevice(MidiInputDevice &&) noexcept
Moves a MIDI input.
~MidiInputDevice()
Closes the MIDI input if open.
MidiInputDevice(const MidiInputDevice &)=delete
MIDI inputs own native handles and are move-only.
static std::vector< MidiInputDeviceInfo > inputDevices()
Lists detected raw-MIDI input devices.
MidiInputDevice()
Creates a closed MIDI input.
bool isOpen() const
Returns true when open.
void close()
Closes the MIDI input.
const std::string & deviceId() const
Returns the configured ALSA raw-MIDI id.
Definition: RADMedia.h:458
MidiSynthesizer(const MidiSynthesizer &)=delete
Synthesizers own native backend state and are move-only.
~MidiSynthesizer()
Releases the native synth backend if open.
MidiSynthesizer(MidiSynthesizer &&) noexcept
Moves a synthesizer.
MidiSynthesizer & operator=(const MidiSynthesizer &)=delete
Synthesizers own native backend state and are move-only.
MidiSynthesizer()
Creates a closed synthesizer.
MusicXML helper for score export and notation renderers such as Verovio.
Definition: RADMedia.h:392
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:551
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:434
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:325
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:300
@ Treble
Single treble clef staff.
@ Bass
Single bass clef staff.
@ GrandStaff
Two-staff piano style score, split around MusicXmlScoreOptions::grandStaffSplitNote.
MidiMessageType
Decoded real-time MIDI message kind.
Definition: RADMedia.h:164
@ NoteOn
MIDI channel note-on. A note-on with velocity zero is reported as NoteOff.
@ NoteOff
MIDI channel note-off.
@ Other
Other channel/system message not decoded into a richer kind.
@ ControlChange
MIDI channel control-change.
@ PitchBend
MIDI channel pitch-bend.
@ ProgramChange
MIDI channel program-change.
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:404
@ 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:230
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:234
WavFormat format
Audio format for interleaved.
Definition: RADMedia.h:232
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:279
std::vector< MidiPitchBend > pitchBends
Scheduled pitch-bend changes.
Definition: RADMedia.h:293
std::vector< MidiProgramChange > programs
Scheduled program changes.
Definition: RADMedia.h:291
std::vector< MidiNoteEvent > notes
Scheduled notes.
Definition: RADMedia.h:289
double resolvedDurationSeconds() const
Returns explicit duration if set, otherwise derives from notes and tailSeconds.
ALSA raw-MIDI input device descriptor.
Definition: RADMedia.h:154
std::string name
Short display name.
Definition: RADMedia.h:158
std::string description
Longer device description.
Definition: RADMedia.h:160
std::string id
ALSA raw-MIDI id usable with MidiInputDevice.
Definition: RADMedia.h:156
One decoded real-time MIDI message read from an input device.
Definition: RADMedia.h:180
uint8_t status
Raw status byte.
Definition: RADMedia.h:190
uint8_t channel
MIDI channel, 0-15 for channel messages.
Definition: RADMedia.h:184
uint8_t data1
First data byte, commonly note/controller/program.
Definition: RADMedia.h:186
MidiMessageType type
Decoded message type.
Definition: RADMedia.h:182
uint8_t data2
Second data byte, commonly velocity/controller value.
Definition: RADMedia.h:188
One scheduled MIDI note event.
Definition: RADMedia.h:243
One scheduled MIDI pitch-bend event.
Definition: RADMedia.h:269
One scheduled MIDI program change.
Definition: RADMedia.h:257
Crescendo or decrescendo span for MusicXML score generation.
Definition: RADMedia.h:331
MIDI-like note event for MusicXML score generation.
Definition: RADMedia.h:310
std::string color
Optional MusicXML color value such as "#7dd3fc"; empty uses renderer default.
Definition: RADMedia.h:327
Rehearsal/section mark displayed above a measure.
Definition: RADMedia.h:351
std::string text
Mark text such as "A", "B", or "Verse".
Definition: RADMedia.h:355
Repeat barline span for compact MusicXML score notation.
Definition: RADMedia.h:341
Options controlling MusicXML score generation.
Definition: RADMedia.h:359
std::vector< int > measureKeyFifths
Definition: RADMedia.h:382
std::vector< MusicXmlRepeatEvent > repeats
Optional repeat barline spans.
Definition: RADMedia.h:386
std::vector< MusicXmlRehearsalEvent > rehearsals
Optional section/rehearsal marks.
Definition: RADMedia.h:388
std::vector< MusicXmlHairpinEvent > hairpins
Optional crescendo/decrescendo wedge markings.
Definition: RADMedia.h:384
Discovered SoundFont descriptor.
Definition: RADMedia.h:414
std::string path
Absolute or user-provided path.
Definition: RADMedia.h:416
std::string name
Display name derived from the file name.
Definition: RADMedia.h:418
One SoundFont preset/program exposed by a SoundFont file.
Definition: RADMedia.h:424
std::string name
Preset display name from the SoundFont phdr chunk, or a General MIDI fallback name.
Definition: RADMedia.h:426
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