libAlgAudio
v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
|
#include <Canvas.hpp>
Classes | |
struct | IOID |
struct | IOIDWithMode |
Public Types | |
enum | DataConnectionMode { DataConnectionMode::Relative, DataConnectionMode::Absolute } |
Public Member Functions | |
void | BlockReordering (bool enable) |
void | Connect (IOID from, IOID to) |
void | ConnectData (IOID from, IOID to, DataConnectionMode m) |
LateReturn< std::shared_ptr < Module > > | CreateModule (std::string id) |
void | Disconnect (IOID from, IOID to) |
void | DisconnectData (IOID from, IOID to) |
std::list< std::shared_ptr < Module > > | GetConnectedModules (std::shared_ptr< Module > m) |
bool | GetDirectAudioConnectionExists (IOID from, IOID to) |
std::pair< bool, DataConnectionMode > | GetDirectDataConnectionExists (IOID from, IOID to) |
std::shared_ptr< Group > | GetGroup () const |
std::shared_ptr< Module::Inlet > | GetInletByIOID (IOID) const |
std::shared_ptr< Module::Outlet > | GetOutletByIOID (IOID) const |
void | RecalculateOrder () |
void | RemoveModule (std::shared_ptr< Module >) |
bool | TestNewConnectionForLoop (IOID from, IOID to) |
virtual | ~Canvas () |
Static Public Member Functions | |
static LateReturn < std::shared_ptr< Canvas > > | CreateEmpty (std::shared_ptr< Canvas > parent) |
Public Attributes | |
std::map< IOID, std::list< IOID > > | audio_connections |
std::map< IOID, std::list < IOIDWithMode > > | data_connections |
std::set< std::shared_ptr < Module > > | modules |
std::shared_ptr< Module > | owner_hint = nullptr |
A Canvas represents a collection of interconnected modules. The Canvas manages connections between them, calculates topological ordering and detects loops. It also sends control data between modules. The Canvas is strictly an abstract representation. Each file consists of a single top-level Canvas. Subpatches maintain their own instance of a Canvas.
The widget CanvasView is specialised for displaying canvas contents.
|
strong |
|
virtual |
void AlgAudio::Canvas::BlockReordering | ( | bool | enable | ) |
If set to true, no synth reordering will happen from now on. When set to false, synths will be topologically reordered immediatelly, and then after each new connection. This is useful if you are performing a lot of new connections at once, for example when loading a save file, and wish to avoid unnecesary order calculations after each of them.
Creates a new audio connection between an outlet and an inlet.
void AlgAudio::Canvas::ConnectData | ( | IOID | from, |
IOID | to, | ||
DataConnectionMode | m | ||
) |
Creates a new data connection between an outlet and an inlet.
|
static |
Creates a new instance of a Canvas with no modules inside.
parent | The parent canvas, or nullptr if this canvas is top-level. The parent canvas must be known in order for modules like SubpatchExit to properly detect parent Subpatch module. |
LateReturn<std::shared_ptr<Module> > AlgAudio::Canvas::CreateModule | ( | std::string | id | ) |
Creates a new module according to the given template id, and places the new module instance on this Canvas.
This is the proper way of adding new modules.
Removes an audio connection between an outlet and an inlet, if it exists.
Removes a data connection between an outlet and an inlet, if it exists.
std::list<std::shared_ptr<Module> > AlgAudio::Canvas::GetConnectedModules | ( | std::shared_ptr< Module > | m | ) |
Returns a list of modules that have an inlet directly connected to any of the outlets of the module given as argument.
Returns true iff the specified connection already exists.
std::pair<bool, DataConnectionMode> AlgAudio::Canvas::GetDirectDataConnectionExists | ( | IOID | from, |
IOID | to | ||
) |
Returns true iff the specified data connection already exists. The returned pair also provides DataConnectionMode for the queried connection.
|
inline |
Returns the SC server group corresponding to this canvas. The returned pointer will never be null.
std::shared_ptr<Module::Inlet > AlgAudio::Canvas::GetInletByIOID | ( | IOID | ) | const |
Searches for an inlet by its IOID.
std::shared_ptr<Module::Outlet> AlgAudio::Canvas::GetOutletByIOID | ( | IOID | ) | const |
Searches for an outlet by its IOID.
void AlgAudio::Canvas::RecalculateOrder | ( | ) |
Updates SC server synth ordering. Calculates a topological ordering for the graph of interconnections, and sends the result to SC so that it can reorder synths.
void AlgAudio::Canvas::RemoveModule | ( | std::shared_ptr< Module > | ) |
Removes a particular module instance from the Canvas.
Returns true iff a new audio connection suggested by method arguments would create a cycle in connections graph.
std::map<IOID, std::list<IOIDWithMode> > AlgAudio::Canvas::data_connections |
The list of all data connections.
std::set<std::shared_ptr<Module> > AlgAudio::Canvas::modules |
The set of all modules that are placed onto (and maintained by) this Canvas.
std::shared_ptr<Module> AlgAudio::Canvas::owner_hint = nullptr |
It this canvas is managed by a module, it should set this pointer to itself, so that everyone else can easlily can tell who owns this module.