/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard.
*
* Ingen is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "OSCClientSender.h"
#include These are all the messages sent from the engine to the client.
* Communication takes place over two distinct bands: control band and
* notification band. The control band is where clients send commands, and receive a simple
* response, either OK or an error. All notifications of engine state (ie new nodes) are sent over the
* notification band which is seperate from the control band. The
* reasoning behind this is that many clients may be connected at the same
* time - a client may receive notifications that are not a direct consequence
* of some message it sent. The notification band can be thought of as a stream of events representing
* the changing engine state. For example, It is possible for a client to send
* commands and receive aknowledgements, and not listen to the notification band
* at all; or (in the near future anyway) for a client to use UDP for the control
* band (for speed), and TCP for the notification band (for reliability and
* order guarantees). \b /om/response/ok - Respond successfully to a user command
* \arg \b responder-id (int) - Responder ID this is a response to
* \b /om/response/error - Respond negatively to a user command
* \arg \b responder-id (int) - Request ID this is a response to
* \arg \b message (string) - Error message (natural language text)
* \b /om/error - Notification that an error has occurred
* \arg \b message (string) - Error message (natural language text)
*
* \li This is for notification of errors that aren't a direct response to a
* user command, ie "unexpected" errors. \b /om/num_plugins
* \arg \b num (int) - Number of plugins engine has loaded
* \li This is sent before sending the list of plugins, so the client is aware
* of how many plugins (/om/plugin messages) to expect. \b /om/num_plugins
* \arg \b num (int) - Number of plugins engine has loaded
* \li This is sent before sending the list of plugins, so the client is aware
* of how many plugins (/om/plugin messages) to expect. \b /om/plugin - Notification of the existance of a plugin
* \arg \b type (string) - Type if plugin ("LADSPA", "DSSI", or "Internal")
* \arg \b uri (string) - URI of the plugin (see engine namespace documentation) \n
* \arg \b lib-name (string) - Name of shared library plugin resides in (ie "cmt.so")
* \arg \b plug-label (string) - Label of the plugin (ie "dahdsr_iaoa")
* \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope")
* \b /om/new_node - Notification of a new node's creation.
* \arg \b plug-uri (string) - URI of the plugin new node is an instance of
* \arg \b path (string) - Path of the new node
* \arg \b polyphonic (integer-boolean) - Node is polyphonic (1 = yes, 0 = no)
* \arg \b num-ports (integer) - Number of ports (number of new_port messages to expect)
* \li New nodes are sent as a bundle. The first message in the bundle will be
* this one (/om/new_node), followed by a series of /om/new_port commands,
* followed by /om/new_node_end. \b /om/new_port - Notification of a new port's creation.
* \arg \b path (string) - Path of new port
* \arg \b data-type (string) - Type of port (CONTROL or AUDIO)
* \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1)
*
* \li Note that in the event of loading a patch, this message could be
* followed immediately by a control change, meaning the default-value is
* not actually the current value of the port.
* \li The minimum and maximum values are suggestions only, they are not
* enforced in any way, and going outside them is perfectly fine. Also note
* that the port ranges in om_gtk are not these ones! Those ranges are set
* as metadata. \b /om/destroyed - Notification an object has been destroyed
* \arg \b path (string) - Path of object (which no longer exists) \b /om/patch_cleared - Notification a patch has been cleared (all children destroyed)
* \arg \b path (string) - Path of patch (which is now empty) \b /om/patch_enabled - Notification a patch's DSP processing has been enabled.
* \arg \b path (string) - Path of enabled patch \b /om/patch_disabled - Notification a patch's DSP processing has been disabled.
* \arg \b path (string) - Path of disabled patch \b /om/new_connection - Notification a new connection has been made.
* \arg \b src-path (string) - Path of the source port
* \arg \b dst-path (string) - Path of the destination port \b /om/disconnection - Notification a connection has been unmade.
* \arg \b src-path (string) - Path of the source port
* \arg \b dst-path (string) - Path of the destination port \b /om/metadata/update - Notification of a piece of metadata.
* \arg \b path (string) - Path of the object associated with metadata (can be a node, patch, or port)
* \arg \b key (string)
* \arg \b value (string) \b /om/control_change - Notification the value of a port has changed
* \arg \b path (string) - Path of port
* \arg \b value (float) - New value of port
*
* \li This will only send updates for values set by clients of course - not values
* changing because of connections to other ports! \b /om/plugin - Notification of the existance of a plugin
* \arg \b type (string) - Type if plugin ("LADSPA", "DSSI", or "Internal")Notification Band
*/
/** \page client_osc_namespace
* Notification Band
*/
/** \page client_osc_namespace
*
\b /om/new_patch - Notification of a new patch * \arg \b path (string) - Path of new patch * \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node)
\n \n */ void OSCClientSender::new_patch(const string& path, uint32_t poly) { lo_send(_address, "/om/new_patch", "si", path.c_str(), poly); /* if (p->process()) patch_enabled(p->path()); // Send metadata const map\b /om/object_renamed - Notification of an object's renaming * \arg \b old-path (string) - Old path of object * \arg \b new-path (string) - New path of object
\n \n */ void OSCClientSender::object_renamed(const string& old_path, const string& new_path) { lo_send(_address, "/om/object_renamed", "ss", old_path.c_str(), new_path.c_str()); } /** Sends information about a program associated with a DSSI plugin node. */ void OSCClientSender::program_add(const string& node_path, uint32_t bank, uint32_t program, const string& name) { lo_send(_address, "/om/program_add", "siis", node_path.c_str(), bank, program, name.c_str()); } void OSCClientSender::program_remove(const string& node_path, uint32_t bank, uint32_t program) { lo_send(_address, "/om/program_remove", "sii", node_path.c_str(), bank, program); } } // namespace Ingen