Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Port connections manager. More...
#include <src/dsp/port_connections_manager.h>
Public Types | |
using | PortConnection = dsp::PortConnection |
using | PortUuid = PortConnection::PortUuid |
using | ConnectionsVector = std::vector<PortConnection *> |
Public Member Functions | |
PortConnectionsManager (QObject *parent=nullptr) | |
void | regenerate_hashtables () |
Regenerates the hash tables. | |
int | get_sources_or_dests (ConnectionsVector *arr, const PortUuid &id, bool sources) const |
Adds the sources/destinations of id in the given array. | |
int | get_sources (ConnectionsVector *arr, const PortUuid &id) const |
int | get_dests (ConnectionsVector *arr, const PortUuid &id) const |
int | get_num_sources (const PortUuid &id) const |
int | get_num_dests (const PortUuid &id) const |
auto | get_connection_count () const noexcept |
int | get_unlocked_sources_or_dests (ConnectionsVector *arr, const PortUuid &id, bool sources) const |
Adds the sources/destinations of id in the given array. | |
PortConnection * | get_source_or_dest (const PortUuid &id, bool sources) const |
Wrapper over get_sources_or_dests() that returns the first connection. | |
PortConnection * | get_connection (const PortUuid &src, const PortUuid &dest) const |
bool | connection_exists (const PortUuid &src, const PortUuid &dest) const |
bool | update_connection (const PortConnection &before, const PortConnection &after) |
Replaces the given before connection with after . | |
bool | update_connection (const PortUuid &src, const PortUuid &dest, float multiplier, bool locked, bool enabled) |
const PortConnection * | add_connection (const PortUuid &src, const PortUuid &dest, float multiplier, bool locked, bool enabled) |
Stores the connection for the given ports if it doesn't exist, otherwise updates the existing connection. | |
const PortConnection * | add_default_connection (const PortUuid &src, const PortUuid &dest, bool locked) |
Overload for default settings (multiplier = 1.0, enabled = true). | |
const PortConnection * | add_connection (const PortConnection &conn) |
bool | remove_connection (const PortUuid &src, const PortUuid &dest) |
Removes the connection for the given ports if it exists. | |
void | remove_all_connections (const PortUuid &pi) |
Disconnect all sources and dests of the given port identifier. | |
void | reset_connections_from_other (const PortConnectionsManager *other) |
Removes all connections from this. | |
bool | contains_connection (const PortConnection &conn) const |
void | print_ht (const ConnectionHashTable &ht) |
void | print () const |
void | clear_all () |
Friends | |
void | init_from (PortConnectionsManager &obj, const PortConnectionsManager &other, utils::ObjectCloneType clone_type) |
void | to_json (nlohmann::json &j, const PortConnectionsManager &pcm) |
void | from_json (const nlohmann::json &j, PortConnectionsManager &pcm) |
Port connections manager.
Definition at line 17 of file port_connections_manager.h.
using zrythm::dsp::PortConnectionsManager::ConnectionsVector = std::vector<PortConnection *> |
Definition at line 25 of file port_connections_manager.h.
Definition at line 23 of file port_connections_manager.h.
Definition at line 24 of file port_connections_manager.h.
|
inline |
Definition at line 169 of file port_connections_manager.h.
const PortConnection * zrythm::dsp::PortConnectionsManager::add_connection | ( | const PortUuid & | src, |
const PortUuid & | dest, | ||
float | multiplier, | ||
bool | locked, | ||
bool | enabled ) |
Stores the connection for the given ports if it doesn't exist, otherwise updates the existing connection.
|
inline |
Overload for default settings (multiplier = 1.0, enabled = true).
Definition at line 164 of file port_connections_manager.h.
|
inline |
Definition at line 220 of file port_connections_manager.h.
|
inline |
Definition at line 125 of file port_connections_manager.h.
PortConnection * zrythm::dsp::PortConnectionsManager::get_connection | ( | const PortUuid & | src, |
const PortUuid & | dest ) const |
src | |
dest |
|
inlinenoexcept |
Definition at line 86 of file port_connections_manager.h.
|
inline |
Definition at line 72 of file port_connections_manager.h.
|
inline |
Definition at line 81 of file port_connections_manager.h.
|
inline |
Definition at line 77 of file port_connections_manager.h.
PortConnection * zrythm::dsp::PortConnectionsManager::get_source_or_dest | ( | const PortUuid & | id, |
bool | sources ) const |
Wrapper over get_sources_or_dests() that returns the first connection.
It is a programming error to call this for ports that are not expected to have exactly 1 matching connection.
|
inline |
Definition at line 67 of file port_connections_manager.h.
int zrythm::dsp::PortConnectionsManager::get_sources_or_dests | ( | ConnectionsVector * | arr, |
const PortUuid & | id, | ||
bool | sources ) const |
Adds the sources/destinations of id in the given array.
The returned instances of PortConnection are owned by this and must not be free'd.
id | The identifier of the port to look for. |
arr | Optional array to fill. |
sources | True to look for sources, false for destinations. |
int zrythm::dsp::PortConnectionsManager::get_unlocked_sources_or_dests | ( | ConnectionsVector * | arr, |
const PortUuid & | id, | ||
bool | sources ) const |
Adds the sources/destinations of id in the given array.
The returned instances of PortConnection are owned by this and must not be free'd.
id | The identifier of the port to look for. |
arr | Optional array to fill. |
sources | True to look for sources, false for destinations. |
void zrythm::dsp::PortConnectionsManager::regenerate_hashtables | ( | ) |
Regenerates the hash tables.
Must be called when a change is made in the connections.
void zrythm::dsp::PortConnectionsManager::remove_all_connections | ( | const PortUuid & | pi | ) |
Disconnect all sources and dests of the given port identifier.
bool zrythm::dsp::PortConnectionsManager::remove_connection | ( | const PortUuid & | src, |
const PortUuid & | dest ) |
Removes the connection for the given ports if it exists.
void zrythm::dsp::PortConnectionsManager::reset_connections_from_other | ( | const PortConnectionsManager * | other | ) |
Removes all connections from this.
src | If non-nullptr, the connections are copied from this to this. |
bool zrythm::dsp::PortConnectionsManager::update_connection | ( | const PortConnection & | before, |
const PortConnection & | after ) |
Replaces the given before
connection with after
.
|
friend |
Definition at line 232 of file port_connections_manager.h.
|
friend |
Definition at line 228 of file port_connections_manager.h.