Constructor
new ComoNode(host)
- Source:
- See:
Parameters:
| Name | Type | Description |
|---|---|---|
host |
Client | Server | Instance of soundworks client or server |
Attributes
(readonly) audioBufferLoader
- Description:
Instance of
AudioBufferLoader
- Source:
- See:
(readonly) audioContext
- Description:
Instance of
AudioContext
- Source:
- See:
(readonly) audioScheduler
- Description:
Instance of Scheduler, running in AudioContext timeline
- Source:
- See:
(readonly) components :Map.<String, ComoComponent>
- Description:
List of registered components
- Source:
(readonly) host
- Description:
The underlying soundworks client or server instance.
- Source:
- See:
(readonly) id :String
- Description:
Topological id (can be fixed between different restarts):
- For browser clients: generated from soundworks node id, or user defined through query parameter, i.e. http://host.local?id=my-client-id
- For node clients: hostname
- For server: 'server' constant
- Source:
(readonly) nodeId :Number
- Description:
Soundworks id, uniquely generated at runtime
- Source:
(readonly) pluginManager
- Description:
Accessor to the soundworks
PluginManager
- Source:
- See:
(readonly) role :String
- Description:
Role of the node, as defined in soundworks config
- Source:
(readonly) runtime :'node'|'browser'
- Description:
Runtime in which the node is running
- Source:
(readonly) scheduler
- Description:
Instance of Scheduler, running in arbitrary timeline
- Source:
- See:
(readonly) stateManager
- Description:
Accessor to the soundworks
StateManager
- Source:
- See:
Methods
(async) init()
- Description:
The init method is part of the initialization lifecycle of the como node. Most of the time, this method will be implicitly executed by the
ComoNode#startmethod.Note that will automatically call the
initmethod of the soundworks host as well.In some situations you might want to call this method manually, in such cases the method should be called before the
ComoNode#startmethod.`.
- Source:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';
const client = new Client(config);
const como = new ComoClient(client);
// optional explicit call of `init` before `start`
await como.init();
await como.start();
(async) requestRfc(executorNodeId, name, payloadopt) → {Promise.<any>}
- Description:
Request a remote function call on a given node.
Warning - This method should be considered protected and may be subject to change, use at your own risk.
- Source:
- To Do:
-
- - Lazily attach to a peer node owned state to minimize network load - This could be integrated into soundworks
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
executorNodeId |
Number | Id of the node that should execute the procedure |
||
name |
String | Name of the procedure |
||
payload |
Object |
<optional> |
{}
|
Arguments of the procedure |
Returns:
The return value of the remote procedure call
- Type
- Promise.<any>
(async) setProject(projectDirname)
- Description:
Change the current project of the whole Como application.
- Important Calling this method method on any node will change the project for all connected nodes.
- Unstable The signature of this method is subject to change
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
projectDirname |
String | Dirname of the project |
setRfcHandler(name, callback)
- Description:
Function to execute when a remote function call is requested on this node
Warning - This method should be considered protected and may be subject to change, use at your own risk.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | Name of the procedure |
callback |
function | Function to be executed |
setRfcResolverHook(name, callback)
- Description:
Function executed by the requesting node when the rfc is settled to perform additional logic on rfc result before fulfilling the promise.
Warning - This method should be considered protected and may be subject to change, use at your own risk.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
* | |
callback |
* |
(async) start()
- Description:
The start method is part of the initialization lifecycle of the como node. This method will implicitly execute ComoNode#init method if it has not been called manually.
Note that will automatically call the
startmethod of the soundworks host as well.
- Source:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';
const client = new Client(config);
const como = new ComoClient(client);
// implicit execution of `init` method
await como.start();
(async) stop()
- Description:
The stop method is part of the lifecycle of the como node. Notes:
- will automatically call the
stopmethod of the soundworks host as well. - most of the time, you should not have to call this method manually, mainly meant for testing purposes.
- will automatically call the
- Source:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';
const client = new Client(config);
const como = new ComoClient(client);
await como.start();
// ...
await como.stop();