Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_port.h
1// SPDX-FileCopyrightText: © 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/midi_event_buffer.h"
7#include "dsp/port.h"
8#include "utils/icloneable.h"
9
10namespace zrythm::dsp
11{
12
13class MidiPort final : public Port, public PortConnectionsCacheMixin<MidiPort>
14{
15 Q_OBJECT
16 QML_ELEMENT
17 QML_UNCREATABLE ("")
18
19public:
20 MidiPort (utils::Utf8String label, PortFlow flow);
21
22 [[gnu::hot]] void process_block (
24 const dsp::ITransport &transport,
25 const dsp::TempoMap &tempo_map) noexcept override;
26
27 void prepare_for_processing_impl (
28 const graph::GraphNode * node,
29 units::sample_rate_t sample_rate,
30 units::sample_u32_t max_block_length) override;
31
32 void release_resources () override;
33
34 void clear_buffer (std::size_t offset, std::size_t nframes) override;
35
36 friend void init_from (
37 MidiPort &obj,
38 const MidiPort &other,
39 utils::ObjectCloneType clone_type);
40
41private:
42 friend void to_json (nlohmann::json &j, const MidiPort &p)
43 {
44 to_json (j, static_cast<const Port &> (p));
45 }
46 friend void from_json (const nlohmann::json &j, MidiPort &p)
47 {
48 from_json (j, static_cast<Port &> (p));
49 }
50
51public:
53
54 BOOST_DESCRIBE_CLASS (MidiPort, (Port), (), (), ())
55};
56
57} // namespace zrythm::dsp
Interface for transport.
Definition itransport.h:47
Packed contiguous buffer for RT MIDI events.
void release_resources() override
Called to release resources allocated by prepare_for_processing().
void clear_buffer(std::size_t offset, std::size_t nframes) override
Clears the port buffer.
A base class for ports used for connecting processors in the DSP graph.
Definition port.h:37
Represents a node in a DSP graph.
Definition graph_node.h:180
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition graph_node.h:51