libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgAudio::Module Class Reference

#include <Module.hpp>

Inheritance diagram for AlgAudio::Module:
AlgAudio::DynamicallyLoadableClass AlgAudio::SubscriptionsManager AlgAudio::TimerHandleManager AlgAudio::Builtin::Subpatch AlgAudio::Builtin::SubpatchEntrance AlgAudio::Builtin::SubpatchExit

Classes

class  Inlet
 
class  Outlet
 

Public Member Functions

virtual std::shared_ptr
< ModuleGUI
BuildGUI (std::shared_ptr< Window > parent_window)
 
LateReturn CreateIOFromTemplate (bool fake=false)
 
void DropGUI ()
 
std::shared_ptr< ModuleGUIGetGUI () const
 
std::shared_ptr< InletGetInletByID (std::string id) const
 
std::shared_ptr< OutletGetOutletByID (std::string id) const
 
std::shared_ptr< ParamControllerGetParamControllerByID (std::string) const
 
 Module (const Module &other)=delete
 
virtual void on_destroy ()
 
virtual void on_gui_build (std::shared_ptr< ModuleGUI >)
 
virtual void on_init ()
 
virtual LateReturn on_init_latereturn ()
 
virtual void on_param_set (std::string, float)
 
void PrepareParamControllers ()
 
void ResetControllers ()
 
virtual void state_load_string (std::string)
 
virtual void state_load_xml (rapidxml::xml_node< char > *)
 
virtual std::string state_store_string () const
 
virtual void state_store_xml (rapidxml::xml_node< char > *) const
 
virtual ~Module ()
 
 Module ()
 
 Module (void(*deleter)(void *))
 
 Module (std::shared_ptr< ModuleTemplate > t)
 
- Public Member Functions inherited from AlgAudio::DynamicallyLoadableClass
 DynamicallyLoadableClass (void(*d)(void *))
 
 DynamicallyLoadableClass ()
 
void SelfDestruct ()
 
void SetDeleter (void(*d)(void *))
 
virtual ~DynamicallyLoadableClass ()
 

Public Attributes

std::weak_ptr< Canvascanvas
 
bool enabled_by_factory = false
 
std::vector< std::shared_ptr
< Inlet > > 
inlets
 
std::vector< std::shared_ptr
< Outlet > > 
outlets
 
std::vector< std::shared_ptr
< ParamController > > 
param_controllers
 
Point2D position_in_canvas
 
std::vector< std::shared_ptr
< SendReplyController > > 
reply_controllers
 
int sc_id = -1
 
std::shared_ptr< ModuleTemplatetempl
 
- Public Attributes inherited from AlgAudio::SubscriptionsManager
SubscriptionList subscriptions
 
- Public Attributes inherited from AlgAudio::TimerHandleManager
TimerHandleList timerhandles
 

Protected Attributes

std::shared_ptr< ModuleGUImodulegui
 

Detailed Description

This is the module, the main class that represents any module instance. It is intended to:

  1. serve as a client-side representation of a SC Synth instance
  2. provide an interface to be overriden by third-party module extensions.

Constructor & Destructor Documentation

AlgAudio::Module::Module ( )
inline

You don't usually this constructor. Create a module instance using ModuleFactory instead, this will ensure proper initialisation.

AlgAudio::Module::Module ( void(*)(void *)  deleter)
inline

You don't usually this constructor. Create a module instance using ModuleFactory instead, this will ensure proper initialisation.

AlgAudio::Module::Module ( std::shared_ptr< ModuleTemplate t)
inline

You don't usually this constructor. Create a module instance using ModuleFactory instead, this will ensure proper initialisation.

AlgAudio::Module::Module ( const Module other)
delete

No copy constructing.

virtual AlgAudio::Module::~Module ( )
virtual

Member Function Documentation

virtual std::shared_ptr<ModuleGUI> AlgAudio::Module::BuildGUI ( std::shared_ptr< Window parent_window)
virtual

This function is used to create a new ModuleGUI that will represent this module instance in a CanvasView. Custom modules can override this function with anything they desire, as long as it returns any ModuleGUI. It can be a custom class that derives from ModuleGUI. However, there is no necessity to override this method - the default implementation will create the GUI hierarchy according to the description from collection XML. The only argument to this function is the value of "type" attribute of xml's "gui" node. Whoever calls this function claims the ownership of the returned pointer, it will not be owned by the module instance.

LateReturn AlgAudio::Module::CreateIOFromTemplate ( bool  fake = false)

Creates and allocates Inlets and Outlets for this instance, according to the data in template info.

void AlgAudio::Module::DropGUI ( )
inline
std::shared_ptr<ModuleGUI> AlgAudio::Module::GetGUI ( ) const

Returns a reference to the ModuleGUI that represents this particular module instance. If the GUI was not yet build, or was already deleted, this function will return nullptr.

std::shared_ptr<Inlet > AlgAudio::Module::GetInletByID ( std::string  id) const

Returns inlets by their ID.

std::shared_ptr<Outlet> AlgAudio::Module::GetOutletByID ( std::string  id) const

Returns outlets by their ID.

std::shared_ptr<ParamController> AlgAudio::Module::GetParamControllerByID ( std::string  ) const

Returns a ParamController by given ID.

virtual void AlgAudio::Module::on_destroy ( )
inlinevirtual

Reimplemented in AlgAudio::Builtin::Subpatch.

virtual void AlgAudio::Module::on_gui_build ( std::shared_ptr< ModuleGUI )
inlinevirtual

This method will be called when the module GUI is ready to be displayed. If you wish to modify the GUI but do not want to override BuildGUI with custom builder, you override on_gui_build and modify the UI from there.

Reimplemented in AlgAudio::Builtin::Subpatch.

virtual void AlgAudio::Module::on_init ( )
inlinevirtual

Custom module implementations will prefer to override on_init and on_destroy, instead of creating a custom constructor/destructor. on_init is guaranteed to run when the module is ready to work - the corresponding SC instance was created etc. Similarly, on_destroy is called before the SC instance is removed, while the buses still exist etc.

Reimplemented in AlgAudio::Builtin::SubpatchEntrance.

virtual LateReturn AlgAudio::Module::on_init_latereturn ( )
inlinevirtual
virtual void AlgAudio::Module::on_param_set ( std::string  ,
float   
)
inlinevirtual

This method is used for params defined with action="custom" attribute.

void AlgAudio::Module::PrepareParamControllers ( )
void AlgAudio::Module::ResetControllers ( )

Sets all controllers to default values

virtual void AlgAudio::Module::state_load_string ( std::string  )
inlinevirtual
virtual void AlgAudio::Module::state_load_xml ( rapidxml::xml_node< char > *  )
inlinevirtual

Reimplemented in AlgAudio::Builtin::Subpatch.

virtual std::string AlgAudio::Module::state_store_string ( ) const
inlinevirtual

These methods are used for storing and loading internal module state. They are mostly used when a canvas is saved, or when a module is copied to clipboard. State loading will never happen before on_init.

virtual void AlgAudio::Module::state_store_xml ( rapidxml::xml_node< char > *  ) const
inlinevirtual

Reimplemented in AlgAudio::Builtin::Subpatch.

Member Data Documentation

std::weak_ptr<Canvas> AlgAudio::Module::canvas

The canvas this module belongs to.

bool AlgAudio::Module::enabled_by_factory = false

This flag marks whether this module was initialized by ModuleFactory. When ModuleFactory destoys a module, this flag is set back to false. This way it's easy to detect whether the module was correctly created, and when it's destructed witout havning been destroyed by the factory.

std::vector<std::shared_ptr<Inlet> > AlgAudio::Module::inlets
std::shared_ptr<ModuleGUI> AlgAudio::Module::modulegui
protected
std::vector<std::shared_ptr<Outlet> > AlgAudio::Module::outlets
std::vector<std::shared_ptr<ParamController> > AlgAudio::Module::param_controllers
Point2D AlgAudio::Module::position_in_canvas

This variable stores the widget position in canvas.

std::vector<std::shared_ptr<SendReplyController> > AlgAudio::Module::reply_controllers
int AlgAudio::Module::sc_id = -1

The id of the supercollider synth instance this Module represents and manages.

std::shared_ptr<ModuleTemplate> AlgAudio::Module::templ

The documentation for this class was generated from the following file: