Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FluidSession

Hierarchy

  • FluidSession

Index

Constructors

constructor

Properties

bpm

bpm: number = 120

editCursorTime

editCursorTime: number = 0

Position of the edit cursor, measured in whole notes

finalizers

finalizers: Map<(FluidSession: any) => any, any> = ...

loopEnabled

loopEnabled: boolean = false

loopRegion

loopRegion: Event = ...

Loop region, measured in whole notes

regions

regions: any[] = []

scoreConfig

scoreConfig: ScoreConfig = {}

tracks

tracks: FluidTrack[] = []

Methods

createContext

  • createContext(options: ContextOptions): UseContext
  • Create a UseContext object. If no startTime is specified, use the session's editCursor as the start Time

    Parameters

    • options: ContextOptions

    Returns UseContext

finalize

  • If any techniques were inserted that have a .finalize(session) method, invoke each unique method once, passing in the FluidSession instance. Calling finalize a second time will have no effect unless new techniques that have a .finalize method were inserted (via FluidSession.insertScore between subsequent calls to finalize.

    Returns FluidSession

forEachTrack

  • forEachTrack<T>(func: (track: FluidTrack, index: number, ancestors: FluidTrack[]) => T): undefined | T
  • Recursively iterate over all tracks, including track folders and their children, passing each track in to the supplied function as the first argument. If the supplied function returns anything other than undefined, the iteration is interrupted, and forEachTrack will return the value returned by func.

    Note that iteration will be interrupted when func returns ANY value other than undefined. This includes falsy values like null and 0.

    IMPORTANT: This iterates over the underlying arrays directly, so you should not add or remove tracks to the session during iteration.

    Type parameters

    • T

    Parameters

    • func: (track: FluidTrack, index: number, ancestors: FluidTrack[]) => T

      for each track, func will be called with three arguments: (1) a FluidTrack (2) an index which specifies the position of the track within its immediate parent (3) a 'ancestors' array, which contains the track's parent, (and its parent's parent, etc) starting with the 'oldest' grandparent, and ending with the tracks immediate parent.

    Returns undefined | T

getOrCreateTrackAncestorsByName

  • getOrCreateTrackAncestorsByName(name: string): FluidTrack[]
  • Find a track by name, returning that track and all of its ancestors in an array. The first track in the array will always be a track at the root level of the session. Every track in the array except for the last one, is guaranteed to be a track folder (meaning its .children.length property will be non-zero).

    If the track is not found, it will be created at the root level, and returned in an array with .length == 1.

    Parameters

    • name: string

    Returns FluidTrack[]

getOrCreateTrackByName

  • getOrCreateTrackByName(name: string): FluidTrack

getTrackByName

insertScore

  • Insert a score object into the session.

    The contents of the score will be inserted at session.editCursorTime, unless a config.startTime is specified.

    Inserting moves session.editCursorTime to the end of newly inserted content. (When no config.startTime is specified, calling insertScore multiple times inserts contents sequentially)

    chainable

    Parameters

    Returns FluidSession

processEvents

  • processEvents(): void
  • Iterate over tracks and their clips, calling each technique's .use(context) method.

    This is called internally by FluidSession.insertScore, and does not need to be called by consuming code.

    internal

    Returns void

resolveSends

  • resolveSends(): void
  • Iterate over the tracks, and resolve any unresolved sends. This is used internally by FluidSession.constructor. It does not need to be called by consuming code unless you manually add tracks with unresolved sends to FluidSession.tracks.

    Sends are specified on sending tracks, but stored in receiving tracks. This makes it easy to delete a track without having to go hunt down all the tracks that send to it.

    internal

    Returns void

resolveSidechainReceives

  • resolveSidechainReceives(): void
  • Iterate over track's plugins, and resolve sidechain receives. This is used internally by FluidSession.constructor. It does not need to be called from consuming code unless you manually add unresolved sidechain receives to a new or existing track plugin.

    internal

    Returns void

saveAsReaperFile

  • saveAsReaperFile(filename?: string, client?: IpcClient): Promise<void>
  • Save the session as a Reaper .RPP file. If the session contains any VST plugins, the cybr server must be running (and it must be compiled with VST support).

    Parameters

    • filename: string = 'fluid'

      can be absolute or relative to the working directory. The .RPP file extension will be added if it is not already present.

    • Optional client: IpcClient

      an IpcClient will be created (and closed) automatically when not provided

    Returns Promise<void>

saveAsTracktionFile

  • saveAsTracktionFile(filename?: string, client?: IpcClient): Promise<void>
  • Create a .tracktionedit file from the session. The cybr server must be running when this is called.

    WARNING: sessionToTracktionEdit may not be called simultaneously with other methods that access the cybr server. Use await or .then to make sure that this method finishes before using communicating with the server

    Parameters

    • filename: string = 'session'

      can be absolute or relative to the working directory. The .tracktionedit file extension will be added if it is not present

    • Optional client: IpcClient

      an IpcClient will be created (and closed) automatically when not provided. When you do provide a client, that client must be configured with keepOpen=true.

    Returns Promise<void>

sendToServer

  • sendToServer(filename?: string, client?: IpcClient): Promise<void>
  • Send the entire session to the cybr server. If the server already has an active session, it will be replaced by this session.

    Parameters

    • filename: string = 'session'

      can be absolute or relative to the working directory. The .tracktionedit. This file extension will be added if it is not present

    • Optional client: IpcClient

      an IpcClient will be created (and closed) automatically when not provided. When you do provide a client, that client must be configured with keepOpen=true.

    Returns Promise<void>

timeSecondsToWholeNotes

  • timeSecondsToWholeNotes(timeInSeconds: number): number

timeWholeNotesToSeconds

  • timeWholeNotesToSeconds(timeInWholeNotes: number): number

useTechnique