SPAOP
|
The main communication node that keeps track of all virtual sources and enables the host DAW to control one of them. More...
#include <SourceController.h>
Classes | |
class | Listener |
An interface for a listener that listens to various callbacks triggered by incoming messages or connection timeout alerts. More... | |
Public Member Functions | |
SourceController (VisualStreamReceiver::Factory *vsFactory, Listener *listener, ConnectionTimer::Factory *timerFactory, XmlParser *xmlParser, int maxSources) | |
Constructor. More... | |
virtual | ~SourceController () |
Destructor. More... | |
const Source & | getSource () const |
Returns the Source object that is controlled by this SourceController. More... | |
std::shared_ptr< const SourceCollection > | getSources () const |
Returns a (reference-counting) shared pointer to the SourceCollection object that is controlled by this SourceController. More... | |
bool | setSource (const Source &source) |
Copies the parameters of a given Source object to the internal SourceCollection (overwriting the Source with the same ID) and sets the source's ID as the one controlled by this SourceController. More... | |
bool | setID (int sourceID) |
Sets the ID of the source that is controlled by this SourceController. More... | |
void | setParameterAndSendChange (int paramIndex, float normalizedValue) |
Sets a parameter of the source that is controlled by this SourceController and sends it to cWONDER (if its value's difference from the value that was sent last is relevant). More... | |
void | setCoordinatesAndSendChange (float normalizedX, float normalizedY) |
Sets the coordinates of the source that is controlled by this SourceController and sends them to cWONDER (if the values' difference from the values that were sent last is relevant). More... | |
void | updateSourceName (const std::string &newSourceName) |
Updates the name of the source that is controlled by this SourceController and sends out the corresponding OSC message (if the ID is locked). More... | |
void | updateSourceColour (const Colour colour) |
Updates the colour of the source that is controlled by this SourceController and sends out the corresponding OSC message (if the ID is locked). More... | |
void | setLinkedToWonder (bool linked, bool notifyPeers=true) |
Sets whether this SourceController shall communicate with WONDER ("linked to wonder") or not. More... | |
bool | isLinkedToWonder () const |
Returns the linkedToWonder status. More... | |
bool | setCWonderAddress (const std::string &ip, const std::string &port) |
Sets the address where outgoing OSC messages will be sent in "linked to
WONDER" mode will be sent (i.e. More... | |
std::string | getCWonderHost () const |
Returns the IP or hostname that is set for cWONDER. More... | |
std::string | getCWonderPort () const |
Returns the port that is set for cWONDER. More... | |
void | setIdIsLocked (bool isLocked) |
Sets the ID locked status. More... | |
bool | idIsLocked () const |
Returns true if the source ID is locked. More... | |
ConnectionStates | connectionStatus () const |
Returns the current status of the incoming connection. More... | |
std::string | connectionStatusString () const |
Returns a string representation of the current status of the incoming "Visual Stream" connection. More... | |
int | rcvPort () const |
Returns the port this instance is listening on. More... | |
const std::string | getDataDestHostAndPort () const |
Returns the Address where the WONDER control message are sent to. More... | |
std::shared_ptr< const Room > | getRoom () const |
Returns a (reference-counting) shared pointer to the Room object stored internally. More... | |
void | setRoom (const Room &room) |
Sets the internal Room object to the parameters of a given Room object. More... | |
The main communication node that keeps track of all virtual sources and enables the host DAW to control one of them.
wonder::SourceController::SourceController | ( | VisualStreamReceiver::Factory * | vsFactory, |
Listener * | listener, | ||
ConnectionTimer::Factory * | timerFactory, | ||
XmlParser * | xmlParser, | ||
int | maxSources | ||
) |
Constructor.
In order to be able to use own derived implementations, the main components are passed via this constructor.
vsFactory | A VisualStreamReceiver::Factory that will be used to create the VisualStreamReceiver that this SourceController will use to receive OSC messages. |
listener | A listener listening to incoming parameter changes and connection timeouts. This will usually be a SpaopAudioProcessor. |
timerFactory | A ConnectionTimer::Factory that will be used to create the ConnectionTimer that this SourceController will use to keep track of ping timeouts. |
xmlParser | An XmlParser that this SourceController will use to parse incoming WONDER project XML strings. |
maxSources | the maximum number of sources allowed by the system. |
|
virtual |
Destructor.
ConnectionStates wonder::SourceController::connectionStatus | ( | ) | const |
Returns the current status of the incoming connection.
This is only significant if the SourceController is linked to WONDER. If it is not linked to WONDER, the returned status is always inactive.
std::string wonder::SourceController::connectionStatusString | ( | ) | const |
Returns a string representation of the current status of the incoming "Visual Stream" connection.
This is only significant if the SourceController is linked to WONDER.
std::string wonder::SourceController::getCWonderHost | ( | ) | const |
Returns the IP or hostname that is set for cWONDER.
This may be used for storing the cWONDER address settings.
std::string wonder::SourceController::getCWonderPort | ( | ) | const |
Returns the port that is set for cWONDER.
This may be used for storing the cWONDER address settings.
const std::string wonder::SourceController::getDataDestHostAndPort | ( | ) | const |
Returns the Address where the WONDER control message are sent to.
In standalone mode, this is the address of the multicast group, in linked to WONDER mode, this is the address of cWONDER.
std::shared_ptr< const Room > wonder::SourceController::getRoom | ( | ) | const |
const Source & wonder::SourceController::getSource | ( | ) | const |
Returns the Source object that is controlled by this SourceController.
std::shared_ptr< const SourceCollection > wonder::SourceController::getSources | ( | ) | const |
Returns a (reference-counting) shared pointer to the SourceCollection object that is controlled by this SourceController.
bool wonder::SourceController::idIsLocked | ( | ) | const |
Returns true if the source ID is locked.
bool wonder::SourceController::isLinkedToWonder | ( | ) | const |
Returns the linkedToWonder status.
int wonder::SourceController::rcvPort | ( | ) | const |
Returns the port this instance is listening on.
void wonder::SourceController::setCoordinatesAndSendChange | ( | float | normalizedX, |
float | normalizedY | ||
) |
Sets the coordinates of the source that is controlled by this SourceController and sends them to cWONDER (if the values' difference from the values that were sent last is relevant).
For coordinate changes, this is to be prefered since it will only send one OSC message while two separate calls to setParameterAndSendChange might result in two messages.
normalizedX | The new value for the x-coordinate, normalized within [0.0 , 1.0]. |
normalizedY | The new value for the y-coordinate, normalized within [0.0 , 1.0]. |
bool wonder::SourceController::setCWonderAddress | ( | const std::string & | ip, |
const std::string & | port | ||
) |
Sets the address where outgoing OSC messages will be sent in "linked to WONDER" mode will be sent (i.e.
the address of cWONDER).
ip | A valid (IPv4) ip string. |
port | A valid port number between 1024 and 65535. |
bool wonder::SourceController::setID | ( | int | sourceID | ) |
Sets the ID of the source that is controlled by this SourceController.
Changing the ID is only allowed while the ID is not locked.
sourceID | The new ID of the controlled source. |
void wonder::SourceController::setIdIsLocked | ( | bool | isLocked | ) |
Sets the ID locked status.
If the sourceID is locked, it cannot be changed, and listening to incoming messages is enabled. If it is not locked, the ID can be changed, but listening to incoming messages is disabled. On switching from !isLocked to isLocked, a /WONDER/source/activate message will be sent, on switching from isLocked to !isLocked, a /WONDER/source/deactivate message will be sent.
isLocked | true if changing the ID shall be disabled and listening to incoming messages enabled. |
void wonder::SourceController::setLinkedToWonder | ( | bool | linked, |
bool | notifyPeers = true |
||
) |
Sets whether this SourceController shall communicate with WONDER ("linked to wonder") or not.
If it is linked to WONDER, source control messages (position, angle, etc) are sent to WONDER, visual stream connect message is sent to the multicaster. Otherwise (stand-alone-mode), all messages are sent to the plugin's peers via the multicast group.
linked | true, if this plugin shall communicate to WONDER, false for stand-alone-mode. |
notifyPeers | true if a /WONDER/plugin/standalone message shall be sent to the multicast group to notify the peer plugins about the change. |
void wonder::SourceController::setParameterAndSendChange | ( | int | paramIndex, |
float | normalizedValue | ||
) |
Sets a parameter of the source that is controlled by this SourceController and sends it to cWONDER (if its value's difference from the value that was sent last is relevant).
Depending on the parameter, the right message format is chosen.
paramIndex | A parameter index value as defined in the enum Source::AutomatedParameters. |
normalizedValue | The new value for that parameter, normalized within [0.0 , 1.0]. |
void wonder::SourceController::setRoom | ( | const Room & | room | ) |
bool wonder::SourceController::setSource | ( | const Source & | source | ) |
Copies the parameters of a given Source object to the internal SourceCollection (overwriting the Source with the same ID) and sets the source's ID as the one controlled by this SourceController.
This is meant to be used for restoring states from saved files (e.g. the audio-plugin's presets) and is only allowed while the the ID is not locked.
void wonder::SourceController::updateSourceColour | ( | const Colour | colour | ) |
Updates the colour of the source that is controlled by this SourceController and sends out the corresponding OSC message (if the ID is locked).
colour | The new colour of the source. |
void wonder::SourceController::updateSourceName | ( | const std::string & | newSourceName | ) |
Updates the name of the source that is controlled by this SourceController and sends out the corresponding OSC message (if the ID is locked).
newSourceName | The new name of the source. |