11 #include <RADCore/RADCore.h>
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);
82 std::vector<uint8_t> audioData_;
99 bool open(
const std::string& path, std::string* error =
nullptr);
121 std::unique_ptr<Impl> pImpl_;
226 std::unique_ptr<Impl> pImpl_;
245 double startSeconds = 0.0;
247 double durationSeconds = 0.0;
253 uint8_t velocity = 96;
259 double timeSeconds = 0.0;
271 double timeSeconds = 0.0;
275 uint16_t value = 8192;
281 uint32_t sampleRate = 48000;
283 uint16_t channels = 2;
285 double durationSeconds = 0.0;
287 double tailSeconds = 0.25;
314 int durationTicks = 0;
319 int writtenDurationTicks = 0;
323 int tupletActualNotes = 0;
325 int tupletNormalNotes = 0;
343 int startMeasure = 0;
345 int measureCount = 1;
361 std::string partName =
"Part";
369 int measureCount = 1;
371 int measuresPerSystem = 4;
373 int systemsPerPage = 5;
377 int grandStaffSplitNote = 60;
395 static std::string
escape(
const std::string& value);
399 static std::string
partwiseScore(
const std::vector<MusicXmlNoteEvent>& notes,
430 uint16_t program = 0;
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);
475 static
bool isAvailable();
477 static std::vector<std::
string> defaultSoundFontPaths();
480 bool open(uint32_t sampleRate = 48000,
float gain = 0.2f, std::
string* error =
nullptr);
486 uint32_t sampleRate() const;
489 bool loadSoundFont(const std::
string& path,
bool resetPresets = true, 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;
500 std::
string* error =
nullptr);
504 bool ensureFluidSynthLoaded(uint32_t sampleRate,
float gain, std::
string* error);
505 std::unique_ptr<Impl> pImpl_;
514 static std::optional<AudioBuffer>
decodeFile(
const std::string& path, std::string* error =
nullptr);
533 bool open(
const std::string& path, std::string* error =
nullptr);
547 std::unique_ptr<Impl> pImpl_;
613 ssize_t
readData(
void* buffer,
size_t maxBytes)
override;
615 ssize_t
writeData(
const void* data,
size_t size)
override;
627 std::shared_ptr<Impl> pImpl_;
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);
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};
#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
OpenMode
Open mode flags shared by RADIODevice, RADFile, and RADBuffer.
Definition: RADCore.h:325