Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
AudioFlowGraph.h
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <string>
6
7namespace Engine::Core {
8
28 public:
51
54
57
64 Result load(const char* flowJson, const char* baseDir);
65
71 Result build(uint32_t sampleRate, uint32_t frameSize);
72
77 Result setParam(uint32_t settingIndex, float value);
78
87 uint64_t render(float* out, uint64_t frameCount);
88
91
98
101
103 void setLooping(bool loop);
104
110
112 [[nodiscard]] bool isPlaying() const;
113
119 uint64_t readForPlayback(float* out, uint64_t frameCount);
120
125 [[nodiscard]] uint64_t playbackPosition() const;
126
130 [[nodiscard]] uint64_t duration() const;
131
133 void free();
134
135 [[nodiscard]] bool isBuilt() const;
136 [[nodiscard]] bool isLoaded() const;
137 [[nodiscard]] bool isSpatialized() const;
138 [[nodiscard]] uint32_t channels() const;
139 [[nodiscard]] uint32_t sampleRate() const;
140 [[nodiscard]] const std::string& name() const;
141 [[nodiscard]] uint32_t settingCount() const;
142 [[nodiscard]] const std::string& lastError() const;
143 [[nodiscard]] Result errorCode() const;
144
145 private:
146 struct Impl;
147 std::unique_ptr<Impl> impl_;
148 };
149
150} // namespace Engine::Core
Result build(uint32_t sampleRate, uint32_t frameSize)
Decode clips and build the miniaudio node graph.
bool isPlaying() const
True while the flow is playing on the device.
AudioFlowGraph(const AudioFlowGraph &)=delete
uint64_t readForPlayback(float *out, uint64_t frameCount)
Pull the next chunk of interleaved PCM for the device thread. Only valid while the flow is playing; t...
Result setParam(uint32_t settingIndex, float value)
Apply a value (clamped to the setting range) to a setting.
const std::string & name() const
const std::string & lastError() const
void free()
Release the built graph so the flow can be load()/build()ed again.
uint64_t render(float *out, uint64_t frameCount)
Pull the next chunk of interleaved f32 PCM from the flow cursor.
Result
Result codes; numbering mirrors the sab_* ABI (AudioBridge.h).
void finishPlayback()
Mark playback as finished (called from the device thread when a finite, non-looping flow reaches its ...
void setLooping(bool loop)
Override looping on all clip data sources (per-instance).
Result startPlayback()
Enter realtime playback mode for this flow. Rewinds to frame 0 and marks the flow as playing....
Result load(const char *flowJson, const char *baseDir)
Parse and validate a flow JSON document (schema version 1).
uint64_t playbackPosition() const
Frames consumed during the current playback session. Updated by the audio thread; clamped by callers ...
uint32_t sampleRate() const
void stopPlayback()
Leave realtime playback mode.
uint32_t settingCount() const
std::unique_ptr< Impl > impl_
Result reset()
Rewind the cursor to frame 0; current param values are re-applied.
uint64_t duration() const
Total frames of the flow, or 0 when it loops forever.
AudioFlowGraph & operator=(const AudioFlowGraph &)=delete