SessionManager

The SourceManager component is responsible for creating and managing sessions within a project. At its core, a session the association of a script and of a subset of the project soundfiles.

Como players can be associated to session.

Como sessions are represented as soundworks SharedState defined by the following parameters:

  • uuid - Unique id, stable across restarts
  • name - User defined name
  • defaultScript - The script associated with the session
  • soundbank - The list of files associated to the session
  • mute - Whether the audio output is muted
  • volume - Volume of the audio output of the session

Attributes

sessions

Description:
  • SharedStateCollection of all existing sessions

Source:

Methods

(async) createSession(sessionName) → {String}

Description:
  • Create a new session in the current project

Source:
Parameters:
Name Type Description
sessionName String

Name of the session

Returns:

Unique id of the new session

Type
String

(async) deleteSession(sessionId)

Description:
  • Delete the session

    • All players within this session will be removed from it
    • All associated files will be deleted
Source:
Parameters:
Name Type Description
sessionId String

Unique id of the session

getSession(sessionId)

Description:
  • Get a session SharedState from its unique id.

Source:
Parameters:
Name Type Description
sessionId string

Unique id of the session

Returns:

GainNode|null - returns null if session does not exists

getSessionBus(sessionId)

Description:
  • Get the audio destination of a session from its unique id.

    The audio bus is lazily created on first call of this function on a given node.

Source:
Parameters:
Name Type Description
sessionId String

Unique id of the session

Returns:

GainNode|null - returns null if session does not exists

(async) getSessionSoundbank(sessionId) → {Object.<String, AudioBuffer>}

Description:
  • Get the AudioBuffers associated to the session

Source:
Parameters:
Name Type Description
sessionId String
Returns:
Type
Object.<String, AudioBuffer>

(async) persistSession(sessionId)

Description:
  • Save the session in the filesystem

Source:
Parameters:
Name Type Description
sessionId String

Unique id of the session

(async) renameSession(sessionId, newName)

Description:
  • Change the name of the session

Source:
Parameters:
Name Type Description
sessionId String

Unique id of the session

newName *

New name of the session