The audio engine.
More...
#include <src/dsp/engine.h>
|
| enum class | State : std::uint8_t { Uninitialized
, Initialized
, Active
} |
| enum class | ProcessReturnStatus : std::uint8_t { ProcessCompleted
, ProcessSkipped
, ProcessFailed
} |
|
| | AudioEngine (dsp::Transport &transport, IHardwareAudioInterface &hw_interface, dsp::DspGraphDispatcher &graph_dispatcher, const dsp::TempoMap &tempo_map, QObject *parent=nullptr) |
| | Create a new audio engine.
|
|
| ~AudioEngine () override |
| | Closes any connections and free's data.
|
| Q_INVOKABLE int | xRunCount () const |
| Q_INVOKABLE double | loadPercentage () const |
|
int | sampleRate () const |
| | Current sample rate from the hardware interface (QML-friendly).
|
|
int | blockLength () const |
| | Current block length from the hardware interface (QML-friendly).
|
|
Q_SIGNAL void | sampleRateChanged (int sampleRate) |
|
Q_SIGNAL void | blockLengthChanged (int blockLength) |
|
units::sample_rate_t | sample_rate () const |
| | Current sample rate as a unit type.
|
|
units::sample_u32_t | block_length () const |
| | Current block length as a unit type.
|
|
utils::Utf8String | device_name () const |
| | Current audio device name from the hardware interface.
|
| void | wait_for_pause (EngineState &state, bool force_pause, bool with_fadeout) |
|
void | resume (const EngineState &state) |
| Q_INVOKABLE void | activate () |
| | Activate the engine if not already active.
|
| Q_INVOKABLE void | deactivate () |
| | Deactivates the engine if active.
|
| bool | process_prepare (dsp::Transport::TransportSnapshot &transport_snapshot, units::sample_u32_t nframes, SemaphoreRAII< moodycamel::LightweightSemaphore > &sem) noexcept |
| | To be called by each implementation to prepare the structures before processing.
|
| auto | process (const dsp::PlayheadProcessingGuard &playhead_guard, units::sample_u32_t total_frames_to_process) noexcept -> ProcessReturnStatus |
| | Processes current cycle.
|
| void | advance_playhead_after_processing (dsp::Transport::TransportSnapshot &transport_snapshot, const dsp::PlayheadProcessingGuard &playhead_guard, units::sample_u32_t roll_nframes, units::sample_u32_t nframes) noexcept |
| | Advances the playhead if transport is rolling.
|
| auto & | get_monitor_out_port () |
| auto * | midi_panic_processor () const |
| auto * | audio_input_processor () const |
| | Returns the audio input processor, or nullptr if no audio device has started.
|
|
void | panic_all () |
| | Queues MIDI note off to event queues.
|
| bool | activated () const |
| bool | running () const |
| void | set_running (bool run) |
| auto & | graph_dispatcher () |
| bool | exporting () const |
| void | set_exporting (bool exporting) |
| auto | get_processing_lock () |
| void | execute_function_with_paused_processing_synchronously (const std::function< void()> &func, bool recalculate_graph) |
| | Executes the given function after pausing processing and then resumes processing.
|
The audio engine.
Definition at line 24 of file engine.h.
◆ ProcessReturnStatus
| enum class zrythm::dsp::AudioEngine::ProcessReturnStatus : std::uint8_t |
|
strong |
◆ State
| enum class zrythm::dsp::AudioEngine::State : std::uint8_t |
|
strong |
◆ AudioEngine()
Create a new audio engine.
This only initializes the engine and does not connect to any backend.
◆ activate()
| Q_INVOKABLE void zrythm::dsp::AudioEngine::activate |
( |
| ) |
|
Activate the engine if not already active.
This method is idempotent.
◆ activated()
| bool zrythm::dsp::AudioEngine::activated |
( |
| ) |
const |
|
inline |
◆ advance_playhead_after_processing()
Advances the playhead if transport is rolling.
- Parameters
-
| roll_nframes | Frames to roll (add to the playhead - if transport rolling). |
| nframes | Total frames for this processing cycle. |
◆ audio_input_processor()
| auto * zrythm::dsp::AudioEngine::audio_input_processor |
( |
| ) |
const |
|
inline |
Returns the audio input processor, or nullptr if no audio device has started.
Definition at line 186 of file engine.h.
◆ deactivate()
| Q_INVOKABLE void zrythm::dsp::AudioEngine::deactivate |
( |
| ) |
|
Deactivates the engine if active.
This method is idempotent.
◆ execute_function_with_paused_processing_synchronously()
| void zrythm::dsp::AudioEngine::execute_function_with_paused_processing_synchronously |
( |
const std::function< void()> & | func, |
|
|
bool | recalculate_graph ) |
Executes the given function after pausing processing and then resumes processing.
- Parameters
-
| recalculate_graph | Whether to also recreate the processing graph before resuming processing. |
◆ exporting()
| bool zrythm::dsp::AudioEngine::exporting |
( |
| ) |
const |
|
inline |
◆ get_monitor_out_port()
| auto & zrythm::dsp::AudioEngine::get_monitor_out_port |
( |
| ) |
|
|
inline |
◆ get_processing_lock()
| auto zrythm::dsp::AudioEngine::get_processing_lock |
( |
| ) |
|
|
inline |
◆ graph_dispatcher()
| auto & zrythm::dsp::AudioEngine::graph_dispatcher |
( |
| ) |
|
|
inline |
◆ loadPercentage()
| Q_INVOKABLE double zrythm::dsp::AudioEngine::loadPercentage |
( |
| ) |
const |
|
inline |
◆ midi_panic_processor()
| auto * zrythm::dsp::AudioEngine::midi_panic_processor |
( |
| ) |
const |
|
inline |
◆ process()
| auto zrythm::dsp::AudioEngine::process |
( |
const dsp::PlayheadProcessingGuard & | playhead_guard, |
|
|
units::sample_u32_t | total_frames_to_process ) -> ProcessReturnStatus |
|
noexcept |
Processes current cycle.
To be called by each implementation in its callback.
◆ process_prepare()
To be called by each implementation to prepare the structures before processing.
Clears buffers, marks all as unprocessed, etc.
- Parameters
-
| sem | SemamphoreRAII to check if acquired. If not acquired before calling this function, it will only clear output buffers and return true. |
- Returns
- Whether the cycle should be skipped.
◆ running()
| bool zrythm::dsp::AudioEngine::running |
( |
| ) |
const |
|
inline |
◆ set_exporting()
| void zrythm::dsp::AudioEngine::set_exporting |
( |
bool | exporting | ) |
|
|
inline |
◆ set_running()
| void zrythm::dsp::AudioEngine::set_running |
( |
bool | run | ) |
|
|
inline |
◆ wait_for_pause()
| void zrythm::dsp::AudioEngine::wait_for_pause |
( |
EngineState & | state, |
|
|
bool | force_pause, |
|
|
bool | with_fadeout ) |
- Parameters
-
| force_pause | Whether to force transport pause, otherwise for engine to process and handle the pause request. |
◆ xRunCount()
| Q_INVOKABLE int zrythm::dsp::AudioEngine::xRunCount |
( |
| ) |
const |
|
inline |
◆ blockLength
| int zrythm::dsp::AudioEngine::blockLength |
|
read |
◆ sampleRate
| int zrythm::dsp::AudioEngine::sampleRate |
|
read |
The documentation for this class was generated from the following file: