Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
live_waveform_canvas_item.h
1// SPDX-FileCopyrightText: © 2025-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <optional>
7
8#include "dsp/audio_port.h"
9#include "dsp/port_observation_manager.h"
10#include "gui/qquick/waveform_canvas_item.h"
11
12#include <QPointer>
13#include <QtQmlIntegration/qqmlintegration.h>
14
15namespace zrythm::gui::qquick
16{
17
18class LiveWaveformCanvasItem : public WaveformCanvasItem
19{
20 Q_OBJECT
21 QML_NAMED_ELEMENT (LiveWaveformViewer)
22 Q_PROPERTY (
23 zrythm::dsp::AudioPort * stereoPort READ stereoPort WRITE setStereoPort
24 NOTIFY stereoPortChanged REQUIRED)
25 Q_PROPERTY (
26 zrythm::dsp::PortObservationManager * portObservationManager READ
27 portObservationManager WRITE setPortObservationManager REQUIRED)
28 Q_PROPERTY (
29 int bufferSize READ bufferSize WRITE setBufferSize NOTIFY bufferSizeChanged)
30
31public:
32 explicit LiveWaveformCanvasItem (QQuickItem * parent = nullptr);
33 ~LiveWaveformCanvasItem () override;
34
35 zrythm::dsp::AudioPort * stereoPort () const;
36 void setStereoPort (zrythm::dsp::AudioPort * port);
37
38 zrythm::dsp::PortObservationManager * portObservationManager () const;
39 void
40 setPortObservationManager (zrythm::dsp::PortObservationManager * manager);
41
42 int bufferSize () const;
43 void setBufferSize (int size);
44
45Q_SIGNALS:
46 void stereoPortChanged ();
47 void bufferSizeChanged ();
48
49private:
50 void process_audio ();
51 void try_create_token ();
52
53 struct Impl;
54 std::unique_ptr<Impl> impl_;
55};
56
57}
Manages port observer lifecycle and runs a drain timer.