Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
cv_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/port.h"
7#include "utils/icloneable.h"
8
9namespace zrythm::dsp
10{
11
20class CVPort final : public Port, public PortConnectionsCacheMixin<CVPort>
21{
22 Q_OBJECT
23 QML_ELEMENT
24 QML_UNCREATABLE ("")
25
26public:
27 CVPort (utils::Utf8String label, PortFlow flow);
28
29 [[gnu::hot]] void process_block (
31 const dsp::ITransport &transport,
32 const dsp::TempoMap &tempo_map) noexcept override;
33
34 void clear_buffer (std::size_t offset, std::size_t nframes) override;
35
36 friend void
37 init_from (CVPort &obj, const CVPort &other, utils::ObjectCloneType clone_type);
38
39 void prepare_for_processing_impl (
40 const graph::GraphNode * node,
41 units::sample_rate_t sample_rate,
42 units::sample_u32_t max_block_length) override;
43 void release_resources () override;
44
45private:
46 static constexpr std::string_view kRangeKey = "range";
47 friend void to_json (nlohmann::json &j, const CVPort &p)
48 {
49 to_json (j, static_cast<const Port &> (p));
50 }
51 friend void from_json (const nlohmann::json &j, CVPort &p)
52 {
53 from_json (j, static_cast<Port &> (p));
54 }
55
56public:
57 std::vector<float> buf_;
58
59private:
60 BOOST_DESCRIBE_CLASS (CVPort, (Port), (), (), ())
61};
62
63} // namespace zrythm::dsp
Control Voltage port.
Definition cv_port.h:21
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.
Interface for transport.
Definition itransport.h:47
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