Allolib  1.0
C++ Components For Interactive Multimedia
al::PresetServer Class Reference
Inheritance diagram for al::PresetServer:
al::osc::PacketHandler al::OSCNotifier

Public Member Functions

 PresetServer (std::string oscAddress="127.0.0.1", int oscPort=9011)
 PresetServer constructor. More...
 
 PresetServer (ParameterServer &paramServer)
 using this constructor reuses the existing osc::Recv server from the ParameterServer object More...
 
void print ()
 print prints information about the server to std::out
 
void stopServer ()
 stopServer stops the OSC server thread. Calling this function is sometimes required when this object is destroyed abruptly and the destructor is not called
 
bool serverRunning ()
 
void allowStore (bool allow)
 
bool allowStore ()
 
virtual void onMessage (osc::Message &m)
 Called for each message contained in packet.
 
PresetServerregisterPresetHandler (PresetHandler &presetHandler)
 
PresetServeroperator<< (PresetHandler &presetHandler)
 
void setAddress (std::string address)
 
std::string getAddress ()
 
void notifyPresetChange (bool notify)
 
void attachPacketHandler (osc::PacketHandler *handler)
 
virtual void addListener (std::string IPaddress, uint16_t oscPort)
 addListener enables notifiying via OSC that a preset has changed More...
 
void notifyListeners (std::string OSCaddress, float value, ValueSource *src=nullptr)
 Notify the listeners of value changes. More...
 
void notifyListeners (std::string OSCaddress, int value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, std::string value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, Vec3f value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, Vec4f value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, Pose value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, Color value, ValueSource *src=nullptr)
 
void notifyListeners (std::string OSCaddress, ParameterMeta *param, ValueSource *src)
 
void send (osc::Packet &p)
 
void startHandshakeServer (std::string address="0.0.0.0")
 
void appendCommandHandler (osc::PacketHandler &handler)
 

Static Protected Member Functions

static void changeCallback (int value, void *sender, void *userData)
 

Protected Attributes

std::mutex mListenerLock
 
std::vector< osc::Send * > mOSCSenders
 
std::vector< std::pair< std::string, int > > mConnectedNodes
 
al::OSCNotifier::HandshakeHandler mHandshakeHandler
 
osc::Recv mHandshakeServer
 
std::vector< std::pair< std::string, uint16_t > > mNodes
 
std::mutex mNodeLock
 

Detailed Description

Definition at line 51 of file al_PresetServer.hpp.

Constructor & Destructor Documentation

◆ PresetServer() [1/2]

al::PresetServer::PresetServer ( std::string  oscAddress = "127.0.0.1",
int  oscPort = 9011 
)

PresetServer constructor.

Parameters
oscAddressThe network address on which to listen to. If empty use all available network interfaces. Defaults to "127.0.0.1".
oscPortThe network port on which to listen. Defaults to 9011.

◆ PresetServer() [2/2]

al::PresetServer::PresetServer ( ParameterServer paramServer)

using this constructor reuses the existing osc::Recv server from the ParameterServer object

Parameters
paramServeran existing ParameterServer object

You will want to reuse an osc::Recv server when you want to expose the interface thorugh the same network port. Since network ports are exclusive, once a port is bound, it can't be used. You might need to expose the parameters on the same network port when using things like interface.simpleserver.js That must connect all interfaces to the same network port.

Member Function Documentation

◆ addListener()

virtual void al::OSCNotifier::addListener ( std::string  IPaddress,
uint16_t  oscPort 
)
inlinevirtualinherited

addListener enables notifiying via OSC that a preset has changed

Parameters
IPaddressThe IP address of the listener
oscPortThe network port so send the value changes on

Definition at line 95 of file al_ParameterServer.hpp.

◆ notifyListeners()

void al::OSCNotifier::notifyListeners ( std::string  OSCaddress,
float  value,
ValueSource src = nullptr 
)
inherited

Notify the listeners of value changes.

Parameters
OSCaddressThe OSC path to send the value on
valueThe value to send

This will send all registered data to the listeners. This is useful to force a resfresh of an interface, e.g. when it just came online and is unaware of state. Otherwise, when calling addListener, you should register to be notified when the data changes to only do notifications then.


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