Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
juce_hardware_audio_interface.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <memory>
7
8#include "dsp/hardware_audio_interface.h"
9
10#include <juce_wrapper.h>
11
12namespace zrythm::dsp
13{
14
20class JuceHardwareAudioInterface : public IHardwareAudioInterface
21{
22public:
23 explicit JuceHardwareAudioInterface (
24 std::shared_ptr<juce::AudioDeviceManager> device_manager);
25
26 ~JuceHardwareAudioInterface () override;
27
28 [[nodiscard]] nframes_t get_block_length () const override;
29 [[nodiscard]] units::sample_rate_t get_sample_rate () const override;
30
31 void add_audio_callback (juce::AudioIODeviceCallback * callback) override;
32
33 void remove_audio_callback (juce::AudioIODeviceCallback * callback) override;
34
35 juce::AudioWorkgroup get_device_audio_workgroup () const override;
36
40 static std::unique_ptr<IHardwareAudioInterface>
41 create (std::shared_ptr<juce::AudioDeviceManager> device_manager);
42
43private:
44 std::shared_ptr<juce::AudioDeviceManager> device_manager_;
45};
46
47} // namespace zrythm::dsp
Abstraction for hardware audio interface.
static std::unique_ptr< IHardwareAudioInterface > create(std::shared_ptr< juce::AudioDeviceManager > device_manager)
Creates a JUCE-based hardware audio interface.
void remove_audio_callback(juce::AudioIODeviceCallback *callback) override
Removes an audio callback.
juce::AudioWorkgroup get_device_audio_workgroup() const override
Returns the audio workgroup for the current device (if available).
nframes_t get_block_length() const override
Returns the current block length (buffer size) in frames.
units::sample_rate_t get_sample_rate() const override
Returns the current sample rate.
void add_audio_callback(juce::AudioIODeviceCallback *callback) override
Adds an audio callback to receive audio I/O events.
uint32_t nframes_t
Frame count.
Definition types.h:58