Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_panic_processor.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <atomic>
7
8#include "dsp/processor_base.h"
9
10namespace zrythm::dsp
11{
12
16class MidiPanicProcessor final : public QObject, public dsp::ProcessorBase
17{
18 Q_OBJECT
19
20public:
21 MidiPanicProcessor (
22 utils::IObjectRegistry &registry,
23 QObject * parent = nullptr);
24
30 void request_panic () { panic_.store (true); }
31
32 // ============================================================================
33 // ProcessorBase Interface
34 // ============================================================================
35
38 const dsp::ITransport &transport,
39 const dsp::TempoMap &tempo_map) noexcept override;
40
41 void custom_prepare_for_processing (
42 const graph::GraphNode * node,
43 units::sample_rate_t sample_rate,
44 units::sample_u32_t max_block_length) override
45 {
46 midi_out_ = get_output_ports ().front ().get_object_as<dsp::MidiPort> ();
47 }
48
49 void custom_release_resources () override { midi_out_ = nullptr; }
50
51 // ============================================================================
52
53private:
54 std::atomic_bool panic_;
55
56 // Processing caches
57 dsp::MidiPort * midi_out_{};
58};
59} // namespace zrythm::dsp
Interface for transport.
Definition itransport.h:16
void custom_process_block(dsp::graph::ProcessBlockInfo time_nfo, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) noexcept override
Custom processor logic after processing all owned parameters.
void request_panic()
Request panic messages to be sent.
A base class for processors in the DSP graph.
Represents a node in a DSP graph.
Definition graph_node.h:180
Abstract interface for a UUID-keyed object registry.
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition graph_node.h:51