Suggested Macro API

Discussion about: tracktion.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Just for fun (yes, I have strange ideas of what is fun), I tried creating a new macro API design for Waveform. This is almost certainly not perfect, but should be taken as a start on how I think it should have been set up to begin with, and a direction in which I think it should go:

Code: Select all

special global object Tracktion
    property currentWindow (Window)
        the current (front-most) window

    property currentTab (Tab)
        the current tab of the current window
        (equivalent to Tracktion.currentWindow.currentTab)

    property currentEdit (read-only Edit)
        the edit associated with the current tab if any
        (equivalent to Tracktion.currentTab.edit)

    property projects (read-only Array of Project)
        the projects listed under “Active Projects” on the Projects tab

    property welcomeTab (read-only Tab)
        the Welcome tab

    property projectsTab (read-only Tab)
        the Projects tab

    property settingsTab (read-only Tab)
        the Settings tab

    property windows (Array of Window)
        all currently opened windows

    property tabs (Array of Tab)
        all currently opened tabs (across all windows)

    property isPopupHelpActive (Boolean)
        true if popup help is enabled

    property isSafeRecordModeActive (Boolean)
        true if “safe record” mode is active

    property plugins (read-only Array of Plugin)
        the enabled plugins known to Waveform

    property isIgnoringEditMixGroups (Boolean)
        if true, edit mix groups are temporarily disabled

    property hasMIDINotePreview (Boolean)
        if true, MIDI note preview is enabled while editing

    property isAudioEngineEnabledWhileStopped (Boolean)
        true if the audio engine is enabled while the transport is stopped

    property quickActions (Array of QuickAction)
        the quick actions

    property presets (Array of PluginPreset)
        presets in the plugin preset library

    property viewStates (Array of ViewState)
        the set of saved view states


    findPlugin(name, ?format) -> Plugin
        find a plugin by name

    showHelp()
        show the user guide

    showPopupHelpAtMousePosition()
        show popup help once at the current mouse position, for the 
        item under the pointer

    showMessage(message, ?where)
        show a message
            where=”mouse” or omitted: at the current mouse position
            where=”properties”: above the properties panel

    showScriptMenu()
        show the popup script menu for visually triggering another script

    panic()
        stop audio playback and reset plugins

    saveAll()
        save all open edits with unsaved changes

    quit(?discardAllChanges)
        quit the app; if discardAllChanges is specified as true,
        does not prompt to save changes


class QuickAction
    property name (String)
        the name of the quick action

    
    perform()
        perform the quick action



class ViewState
    property name (String)


    applyTo(etab)
        apply the view state to a specified EditTab

    saveAs(name)
        save a copy of the view state

    remove()
        remove the view state from the set of saved view states



class Window
    property isCurrent (read-only Boolean)
        true if the window is the “current” one (the one with the focus)

    property currentTab (Tab)
        the current tab of the window


    makeCurrent()
        make the window the current one

    close()
        close the window



class Tab
    property isCurrent (read-only Boolean)
        true if the tab is the “current” one (the one with the focus)

    property name (read-only String)
        the name displayed on the tab

    property window (Window)
        the window containing the tab 
        (set this to move the tab into another window)

    newWindow()
        move the tab to a new window of its own

    makeCurrent()
        make the tab the current one within its window and make its
        window the current window



class EditTab extends Tab
    property edit (read-only Edit)
        the edit associated with the tab

    property hasInputs (Boolean)
        true if track inputs are visible

    property hasPlugins (Boolean)
        true if plugins are visible

    property hasControlPanel (Boolean)
        true if the control panel is visible

    property hasFullControlPanel (Boolean)
        true if the full control panel is showing;
        false if the minimal control panel is showing

    property isPropertiesPanelLocked (Boolean)
        true if the properties panel is locked to showing what it 
        already is; false if it is following the selection

    property hasMIDIEditor (Boolean)
        true if the MIDI editor is visible

    property hasVelocityLane (Boolean)
        true if the velocity lane is visible in the MIDI editor

    property hasControllersLane (Boolean)
        true if the controllers lane is visible in the MIDI editor

    property hasStepEntry (Boolean)
        true if MIDI step entry is enabled

    property hasMIDIToolbarAutoHide (Boolean)
        true if the MIDI toolbar auto-hides

    property midiTool (String)
        one of “selection”, “pencil”, “eraser” or “line”

    property hasMixer (Boolean)
        true if the mixer is visible

    property isMixerDocked (Boolean)
        true if the mixer is docked; false if it is detached into
        a separate window

    property mixer (read-only Mixer)
        the mixer associated with the edit tab

    property hasVideo (Boolean)
        true if the video associated with the edit is visible

    property hasStepClipVelocity (Boolean)
        true if step clip velocity is visible

    property hasActionsMenu (Boolean)
        true if the actions menu is visible

    property hasFloatingPropertiesPanel (Boolean)
        true if the floating properties panel is visible

    property isShowingClipTakes (Boolean)
        true if takes are shown for selected clips

    property hasVisiblePluginSelector (Boolean)
        true if the plugin selector is visible

    property browsers (Array of BrowserPane)
        array of open browser panes

    property leftPosition (Position)
        the position at the left edge of the arrange view;
        modifying this property scrolls the view

    property rightPosition (Position)
        the position at the right edge of the arrange view;
        modifying this property scrolls the view

    property horizontalZoom (Number)
        horizontal zoom factor

    property verticalZoom (Number)
        vertical zoom factor

    property totalTrackHeight (read-only Number)
        total height of the tracks in the track area in pixels

    property trackAreaHeight (read-only Number)
        height of the track area in pixels

    property trackAreaVerticalOffset (Number)
        the offset in pixels of the top of the track area
        (scrolling position)

    property waveformHeightScale (Number)
        audio clip waveform height scale factor

    property isSelectedWaveformHeightReduced (Boolean)
        true if the waveform height is reduced on selected clips

    property currentState (ViewState)
        the current view state of the edit


    scrollToTop()
        scroll to the top of the tab’s arrange view

    scrollToBottom()
        scroll to the bottom of the tab’s arrange view

    scrollToReveal(Track|Clip)
        scroll to make the indicated track or clip visible

    scrollByPixels(h, v)
        scroll the arrange view by some number of pixels

    setViewBounds(leftPosition, rightPosition)
        scroll and zoom horizontally so that the indicated positions
        are at the left and right bounds of the arrange view

    zoomToFit()
        zoom to fit horizontally and vertically

    zoomToFitHorizontal()
        zoom to fit horizontally

    zoomToFitVertical()
        zoom to fit vertically

    zoomAroundMarkedRegion()
        zoom around the marked region

    zoomAroundSelection()
        zoom around the selection

    rescaleTracksToFit()
        rescale tracks to try to make them fit in the arrange view

    resetTrackHeightsToDefault()
        reset all tracks to their default heights

    undoSelectZoom()
        undo mouse select+zoom

    redoSelectZoom()
        redo mouse select+zoom

    openBrowser() -> BrowserPane
        opens a new browser pane and returns it

    closeAllBrowsers()
        closes all open browser panes

    close(?discardChanges)
        close the tab; if the tab is the last open tab of an edit and
        discardChanges is specified as true, do not prompt to save changes



class BrowserPane
    property editTab (EditTab)
        the edit tab the browser pane is located on

    property currentTab (String)
        one of ‘actions’, ‘files’, ‘search’, ‘groups’, ‘tracks’ or ‘markers’

    property searchText (String)
        the search text on the search tab of the browser pane

    property isSearchingLoops (Boolean)
        true if searching of loops is enabled

    property isSearchingPresets (Boolean)
        true if searching of presets is enabled

    property isSearchingPlugins (Boolean)
        true if searching of plugins is enabled


    close()
        close the browser pane



class Mixer
    property edit (read-only Edit)
        the edit associated with the mixer

    property hasBigMeters (Boolean)
        true if the mixer has big meters

    property hasMeterOverview (Boolean)
        true if the mixer has the meter overview visible

    property hasModifiers (Boolean)
        true if the modifiers are visible in the mixer

    property hasPlugins (Boolean)
        true if the plugins are visible in the mixer

    property hasOutputs (Boolean)
        true if the outputs are visible in the mixer

    property trackWidth (Number)
        0 = small tracks, 1 = medium tracks, 2 = large tracks



class MixerTab extends Tab
    property edit (read-only Edit)
        the edit associated with the tab

    property mixer (read-only Mixer)
        the mixer associated with the mixer tab


    close(?discardChanges)
        close the tab; if the tab is the last open tab of an edit and
        discardChanges is specified as true, do not prompt to save changes
    


class Project
    property name (String)
        the name of the project

    property edits (read-only Array of Edit)
        the edits which belong to the project


    close(?discardChanges)
        close all edits associated with the project and remove the
        project from the Active Projects list; if discardChanges is
        specified as true and there are open edits with unsaved changes,
        does not prompt to save changes



class Edit
    property name (String)
        the name of the edit

    property project (read-only Project)
        the project that the edit belongs to

    property arrangerTrack (read-only Track)
        the arranger track

    property tempoTrack (read-only Track)
        the tempo track

    property markerTrack (read-only MarkerTrack)
        the marker track

    property chordTrack (read-only Track)
        the chord track

    property masterPlugins (Array of PluginInstance)
        array of the master plugins

    property masterVolume (Number)
        the master volume level

    property masterPan (Number)
        the master pan

    property tracks (Array of MusicTrack objects)
        the “normal” (music) tracks

    property visibleTracks (Array of Track objects)
        the visible (non-hidden) “normal” (music) tracks

    property selectedTracks (Array of Track objects)
        the selected tracks

    property clips (Array of Clip objects)
        all clips across all tracks of the edit

    property selectedClips (Array of Clip objects)
        the selected clips

    property markers (Array of Marker objects)
        the markers in the edit

    property previousMarker (read-only Marker)
        the closest marker prior to the transportPosition

    property nextMarker (read-only Marker)
        the closest marker after the transportPosition

    property tabs (Array of EditTab objects)
        array of tabs opened for the edit

    property isPlaying (Boolean)
        true if the edit is playing (set to true to start playing;
        set to false to stop playing)

    property isFastForwarding (Boolean)
        true if the fast forward feature is active

    property isRewinding (Boolean)
        true if the rewind feature is active

    property isRecording (Boolean)
        true if the edit is recording (set to true to start recording;
        set to false to stop the recording and keep it)

    property isLooping (Boolean)
        true if the edit is set to loop playback

    property isClickEnabled (Boolean)
        true if the metronome is enabled

    property isSnapping (Boolean)
        true if snapping is enabled

    property isPunch (Boolean)
        true if punch in/out is enabled

    property isScrolling (Boolean)
        true if scrolling is enabled while playing

    property hasMIDITimecode (Boolean)
        true if following incoming MIDI timecode

    property isLearningMIDI (Boolean)
        true if MIDI learn mode is enabled

    property isAutomationLocked (Boolean)
        true if automation is locked to clips

    property isReadingAutomation (Boolean)
        true if automation read mode is enabled

    property isWritingAutomation (Boolean)
        true if automation write mode is enabled

    property isCursorResetOnStop (Boolean)
        true if the cursor position resets when the transport is stopped

    property transportPosition (Position)
        the current position of the transport

    property cursorPosition (Position)
        the current position of the cursor

    property selectedStartPosition (Position)
        the start position of the earliest selected clip; modifying this
        property moves the selected clips accordingly

    property selectedEndPosition (Position)
        the end position of the latest selected clip; modifying this
        property moves the selected clips accordingly

    property endPosition (read-only Position)
        the end position of the edit

    property inPosition (Position)
        the position of the “in” point

    property outPosition (Position)
        the position of the “out” point

    property previousPointOfInterest (read-only Position)
        the closest point of interest prior to the transport position

    property nextPointOfInterest (read-only Position)
        the closest point of interest after the transport position

    property selectedItems (Array)
        an array of all selected items 
        (clips, tracks, plugin instances, etc.)

    property groups (Array of EditMixGroup)
        the edit mix groups in the edit

    property auxBusses (read-only Array of AuxBus)
        the aux busses defined in the edit

    property masterVolumeParameter (read-only AutomationParameter)
        the automation parameter for the master volume

    property masterPanParameter (read-only AutomationParameter)
        the automation parameter for the master pan


    open()
        open the edit if it has no open tabs, or switch to one of its
        tabs if it already has open tabs

    close(?discardChanges)
        close all open tabs of the edit - if discardChanges is provided
        as true, does not prompt to save changes

    save()
        save any changes to the edit

    saveAs(newName)
        save a copy of the edit with a new name and switch to that copy

    saveCopyAs(newName)
        save a copy of the edit with a new name but stay on the current one

    import(?fileName)
        import an audio or MIDI file into the edit (if fileName is omitted,
        displays the import file dialog)

    stopRecordingAndDiscard()
        stop recording and discard newly recorded material

    applyRetrospectiveRecord()
        apply retrospective record to any enabled inputs

    automationPunchOut(?clearAutomation)
        automation punch out; if clearAutomation is specified as true, also
        clears any automation beyond the transport

    cut()
        move selected items to the clipboard

    copy()
        copy selected items to the clipboard

    duplicate()
        duplicate selected items

    deselectAll()
        deselect everything - equivalent of deselect((edit).selectedItems)

    undo()
        performs undo

    redo()
        performs redo

    paste(?inserting)
        paste clipboard content into the edit; if inserting is
        specified as true, moves existing edit content to make room

    insertSpace(atPosition, seconds)
        insert blank space into the edit

    autoCrossfadeSelectedClips()
        crossfade overlapping region of selected clips

    clearMarkedRegion()
        clear the marked region of the selected clips

    removeMarkedRegion(?closeGaps)
        delete the marked region of the selected clips

    mergeSelectedClips(onSeparateTracks)
        merge the selected clips

    freezeAllTracksWithoutInputs()
        freeze all tracks in the edit which do not have inputs on them

    groupSelectedClips()
        adds the selected clips into a new group

    ungroupSelectedClips()
        remove the selected clips from any group they may be in

    groupSelectedTracks()
        adds the selected tracks to a new Edit Mix Group

    ungroupSelectedTracks()
        removes the selected tracks from any Edit Mix Group they may
        be in and deletes the group if left empty

    resetOverloads()
        reset level meter overload indicators

    addTrackSnapshot(tracks)
        snapshot the indicated tracks (tracks is an Array of MusicTrack
        objects)

    insertRest()
        moves the transport position forward to effectively insert a
        rest when performing MIDI step editing

    insertTrack(atPosition, trackType)
        insert a new track before an existing track

    appendTrack(trackType)
        append a new track to the end of the list of tracks

    insertGlobalChange(ofType, ?atPosition)
        insert a global change at the specified position, or at the
        transportPosition if atPosition is omitted

    assignAllInputstoConsecutiveTracks()
        assign all available inputs to consecutive tracks

    transpose(numSemitones)
        transpose all MIDI and step clips in the edit by a specified 
        number of semitones

    transposeSelected(numSemitones)
        transpose all selected MIDI and step clips in the edit by a 
        specified number of semitones

    showMappingsWindow()
        shows the MIDI mappings window

    showColorEditor()
        shows the color editor window



class AuxBus
    property name (String)
        the name of the aux bus



class Track
    property name (String)
        the name of the track

    property edit (read-only Edit)
        the Edit containing the track

    property isVisible (Boolean)
        true if the track is visible

    property isSmall (Boolean)
        true if the track is showing with small height

    property height (Number)
        the display height of the track

    property isSelected (Boolean)
        true if the track is selected

    property currentAutomationParameter (AutomationParameter)
        the currently displayed automation parameter on the track

    property automationTracks (Array of AutomationTrack)
        the set of automation tracks associated with the track

    property modifiers (Array of Modifier)
        the set of all modifiers placed on the track

    property selectedModifiers (Array of Modifier)
        the set of selected modifiers placed on the track

    property isAutomationVisible (Boolean)
        true if automation is visible for the track


    appendAutomationTrack(?parameter)
        append a new automation track (empty unless a parameter is
        specified)

    insertAutomationTrack(atIndex, ?parameter)
        insert a new automation track (empty unless a parameter is
        specified)

    appendModifier(ofType, ?parameter)
        append a modifier to the track

    insertModifier(atIndex, ofType, ?parameter)
        insert a modifier onto the track

    selectAllModifiers()
        select all modifiers on the track

    deselectAllModifiers()
        deselect all modifiers on the track

    resetHeightToDefault()
        reset the track to its default height

    remove(?withSourceFiles)
        delete the track from the edit; if withSourceFiles
        is specified as true, also deletes the source files of any
        clips on the track



class Modifier
    property type (read-only String)
        the type of the modifier

    property track (read-only Track)
        the track the modifier is located on

    property edit (read-only Edit)
        the edit containing the modifier (same as (modifier).track.edit)

    property assignments (Array of ModifierAssignment)
        the collection of parameters the modifier is assigned to control

    property automationParameters(read-only Array of AutomationParameter)
        the set of parameters of the modifier itself which can be
        automated or modified


    assignTo(automationParameter, ?offset, ?value)
        add a new assignment

    removeAllAssignments()
        remove all assignments from the modifier



class ModifierAssignment
    property modifier (read-only Modifier)
        the modifier the assignment was made to

    property parameter (read-only AutomationParameter)
        the parameter being modified

    property offset (Number)
        the offset of the assignment

    property value (Number)
        the value of the assignment


    copyToParameter(automationParameter)
        create a duplicate assignemnt for a different parameter
        under the same modifier

    copyToModifier(modifier)
        create a duplicate assignment for the same paraemter under
        a different modifier

    remove()
        remove the assignment from the modifier



class AutomationParameter
    property source (read-only Object)
        the plugin instance or modifier that the parameter is tied
        to, or an Edit object if the parameter is tied to the master
        volume or pan

    property name (read-only String)
        the name of the parameter which can be automated



class AutomationTrack
    property currentAutomationParameter (AutomationParameter)
        the currently displayed automation parameter on the track


    remove()
        remove the automation track



class MusicTrack extends Track
    property isExpanded (Boolean)
        true if the track is expanded to show automation lanes or 
        folder/submix content

    property isMuted (Boolean)
        true if the track is muted

    property isSoloed (Boolean)
        true if the track is soloed

    property isSoloIsolated (Boolean)
        true if the track has solo isolate status

    property isFrozen (Boolean)
        true if the track is frozen

    property parent (Track)
        the folder or submix track containing this track

    property clips (Array of Clip)
        the clips on the track

    property selectedClips (Array of Clip)
        the selected clips on the track

    property groups (Array of EditMixGroup)
        an array of edit mix groups the track belongs to

    property plugins (Array of PluginInstance)
        the plugin instances attached to the track

    property selectedPlugins (Array of PluginInstance)
        the selected plugin instances attached to the track


    insertClip(clipType, ?atPosition, ?withLength, ?overwrite)
        insert a new clip onto the track; if overwrite is specified as true,
        then any existing clip which overalps the provided time range is
        split as needed and the portion of the clip overlapping the new one
        is removed

    insertPlugin(atPosition, plugin|preset) -> PluginInstance
        insert a new plugin instance before an existing instance

    appendPlugin(plugin|preset) -> PluginInstance
        append a new plugin instance at the end of the list

    transpose(numSemitones)
        transpose all MIDI and step clips on the track by a specified 
        number of semitones

    transposeSelected(numSemitones)
        transpose all selected MIDI and step clips on the track by a 
        specified number of semitones

    ungroup(?fromGroup)
        remove the track from any edit mix groups it is in, or
        from the specified group if provided

    selectAllClips()
        select all clips on the track

    deselectAllClips()
        deselect all clips on the track

    selectAllPlugins()
        select all plugins on the track

    deselectAllPlugins()
        deselect all plugins on the track

    enableAllPlugins()
        enable all plugins on the track

    disableAllPlugins()
        disable all plugins on the track




class MarkerTrack extends Track
    property markers (Array of Marker)
        the set of all markers

    property selectedMarkers (Array of Marker)
        the set of markers which are currently selected


    insertBarsAndBeatsMarker(atPosition, ?withLength, ?withName)
        insert a bars and beats marker at the specified position

    insertAbsoluteTimeMarker(atPosition, ?withLength, ?withName)
        insert an absolute time marker at the specified position

    selectAll()
        select all markers on the marker track

    deselectAll()
        deselect all currently selected markers



class FolderTrack extends Track
    property isExpanded (Boolean)
        true if the track is expanded to show automation lanes or 
        folder/submix content

    property isMuted (Boolean)
        true if the track is muted

    property isSoloed (Boolean)
        true if the track is soloed

    property children (read-only Array of Track)
        the tracks which are children of this track

    property parent (Track)
        the folder or submix track containing this track



class SubmixTrack extends FolderTrack
    property plugins (Array of PluginInstance)
        the plugin instances attached to the track

    property selectedPlugins (Array of PluginInstance)
        the selected plugin instances attached to the track


    insertPlugin(atPosition, plugin|preset) -> PluginInstance
        insert a new plugin instance before an existing instance

    appendPlugin(plugin|preset) -> PluginInstance
        append a new plugin instance at the end of the list

    selectAllPlugins()
        select all plugins on the track

    deselectAllPlugins()
        deselect all plugins on the track

    enableAllPlugins()
        enable all plugins on the track

    disableAllPlugins()
        disable all plugins on the track



class EditMixGroup
    property name (String)
        the name of the edit mix group

    property tracks (Array of MusicTrack)
        the tracks contained in the group

    property isEnabled (Boolean)
        true if the edit mix group is enabled

    property isForEditing (Boolean)
        true if applied to editing operations

    property isForVolume (Boolean)
        true if applied to volume changes

    property isForMute (Boolean)
        true if applied to mute status changes

    property isForRecord (Boolean)
        true if applied to recording operations

    property isForColor (Boolean)
        true if applied to color changes

    property isForVisibility (Boolean)
        true if applied to visibility chnages

    property isForPan (Boolean)
        true if applied to pan changes

    property isForSolo (Boolean)
        true if applied to solo status changes

    property isForSend (Boolean)
        true if applied to send operations

    property isForTrackHeight (Boolean)
        true if applied to track height changes


    addTrack(what)
        add a specified MusicTrack to the group

    removeTrack(what)
        remove a specified MusicTrack from the group

    remove()
        remove the edit mix group



class Plugin
    property name (read-only String)
        the name of the plugin

    property manufacturer (read-only String)
        the manufacturer of the plugin

    property format (read-only String)
        ”Builtin”, “AudioUnit”, “VST”, “VST3”, “SOUL”, etc.

    property category (read-only String)
        “Effect”, “Generator”, etc.

    property isShowing (Boolean)
        is the “Show” checkbox checked for the plugin

    property isSandboxed (Boolean)
        is the plugin set to be sandboxed?

    property presets (Array of PluginPreset)
        available presets that include the plugin



class PluginInstance
    property plugin (read-only Plugin)
        the plugin object representing the plugin associated with
        this instance

    property connectedTo (read-only Object)
        the track or clip that the plugin instance is connected to

    property edit (read-only Edit)
        the edit containing the plugin instance

    property isSelected (Boolean)
        true if the plugin instance is selected

    property isEnabled (Boolean)
        true if the plugin instance is enabled

    property currentState (PluginPreset)
        the current state of the plugin, represented as a preset

    property automationParameters (read-only Array of AutomationParameter)
        the set of automation parameters available for the plugin instance


    changePreset(delta)
        change the preset of the plugin instance if possible

    remove()
        delete the plugin instance



class PluginPreset
    property name (String)
        the name of the preset

    property plugins (Array of PluginPreset)
        plugins which are used by the preset


    saveToLibrary(?withName)
        save the preset to the preset library

    removeFromLibrary()
        remove the preset from the preset library



class Marker
    property name (String)
        the name of the marker

    property position (Position)
        the position of the marker

    property isAbsoluteTimecode (Boolean)
        true if the marker is an absolute timecode marker;
        false if it is a bars and beats marker


    remove()
        delete the marker



class Clip
    property name (String)
        the name of the clip

    property track (read-only Track)
        the track containing the clip

    property edit (read-only Edit)
        the edit containing the clip (same as (clip).track.edit)

    property isSelected (Boolean)
        true if the clip is selected

    property isMuted (Boolean)
        true if the clip is muted

    property startPosition (Position)
        the start posiiton of the clip on the track; setting this
        moves the clip

    property endPosition (Position)
        the end position of the clip on the track; setting this
        moves the clip

    property length (Number)
        the length of the clip on the track, in seconds; setting
        this changes the length of the clip, anchoring its start
        position and altering its end position to match the new 
        length

    property beatLength (Number)
        the length of the clip on the track, in beats; setting
        this changes the length of the clip, anchoring its start
        position and altering its end position to match the new 
        length

    property takes (Array of Take)
        the set of takes in the clip

    property currentTake (Take)
        the clip’s currently active take


    remove(?withSourceFiles)
        delete the clip; if withSourceFiles is specified
        as true, also deletes the source file(s) of the clip

    split(?atPosition)
        split the clip at the specified position
        (or at the cursor position if atPosition is omitted or null)

    removeMarkedRegion()
        delete the marked region of the clip

    moveToBack()
        move the clip behind any other content on the track

    trimLeft(Position)
        trim the left end of the clip through the indicated position

    trimRight(Position)
        trim the right end of the clip through the indicated position

    nudgeLeft()
        nudge the clip left by a small amount

    nudgeRight()
        nudge the clip right by a small amount

    ungroup()
        extract the clip from any groups it may be part of



class Take
    property name (String)
        the name of the take

    property clip (read-only Clip)
        the clip containing the take

    property track (read-only Track)
        the track containing the take (same as (take).clip.track)

    property edit (read-only Edit)
        the edit containing the clip (same as (take).track.edit)

    property isCurrent (read-only Boolean)
        whether or not the take is the currently active one

    property previousTake (read-only Take)
        the take prior to this one within the same clip (null if none)

    property nextTake (read-only Take)
        the take after this one within the same clip (null if none)


    activate()
        make the take the currently active one for the clip



class AudioClip extends Clip
    property source (read-only String)
        the filename acting as a source for the audio clip

    property sourceStart (Position)
        the position within the underlying source clip which
        corresponds to the startPosition of the clip; changing
        this shifts the portion of the source clip which is
        used by the clip

    property sourceEnd (Position)
        the position within the underlying source clip which
        corresponds to the endPosition of the clip; changing
        this shifts the portion of the source clip which is
        used by the clip

    property sourceLength (Number)
        the total length of the underlying source clip, in seconds

    property sourceBeatLength (Number)
        the total length of the underlying source clip, in beats

    property plugins (Array of PluginInstance)
        the plugin instances attached to the track

    property selectedPlugins (Array of PluginInstance)
        the selected plugin instances attached to the track

    property transients (read-only Array of Position)
        the set of transients detected on the clip


    insertPlugin(atPosition, plugin|preset) -> PluginInstance
        insert a new plugin instance before an existing instance

    appendPlugin(plugin|preset) -> PluginInstance
        append a new plugin instance at the end of the list

    launchExternalEditor()
        launch the external editor for the source clip



class MIDIClip extends Clip
    property notes (Array of Note)
        the notes contained within the MIDI clip

    property selectedNotes (Array of Note)
        the selected notes within the MIDI clip


    addNote(startPosition, beatLength, which, 
            ?attackVelocity, ?releaseVelocity) -> Note
        adds a note to the MIDI clip and returns the new Note object

    extractGroove()
        extract the groove from the clip

    nudgeSelectedUp()
        nudge the selected notes up by a small amount

    nudgeSelectedDown()
        nudge the selected notes down by a small amount

    nudgeSelectedLeft()
        nudge the selected notes left by a small amount

    nudgeSelectedRight()
        nudge the selected notes right by a small amount

    transpose(numSemitones)
        transpose the clip by a specified number of semitones



class StepClip extends Clip
    property patterns (Array of Pattern)
        the patterns within the step clip


    addPattern() -> Pattern
        add a new pattern and return it

    transpose(numSemitones)
        transpose all patterns in the clip by a specified number
        of semitones
    


class Pattern
    property clip (read-only StepClip)
        the clip containing the pattern

    property length (Number)
        the length of the pattern in seconds

    property stepLength (Number)
        the length of the pattern in steps

    property notes (Array of Note)
        the notes contained within the MIDI clip

    property selectedNotes (Array of Note)
        the selected notes within the MIDI clip


    addNote(startPosition, beatLength, which, 
            ?attackVelocity, ?releaseVelocity) -> Note
        adds a note to the MIDI clip and returns the new Note object

    nudgeSelectedUp()
        nudge the selected notes up by a small amount

    nudgeSelectedDown()
        nudge the selected notes down by a small amount

    nudgeSelectedLeft()
        nudge the selected notes left by a small amount

    nudgeSelectedRight()
        nudge the selected notes right by a small amount

    transpose(numSemitones)
        transpose the pattern by a specified number of semitones

    duplicate() -> Pattern
        duplicate the pattern and return the copy

    remove()
        remove the pattern



class EditClip
    property plugins (Array of PluginInstance)
        the plugin instances attached to the track

    property selectedPlugins (Array of PluginInstance)
        the selected plugin instances attached to the track


    insertPlugin(atPosition, plugin|preset) -> PluginInstance
        insert a new plugin instance before an existing instance

    appendPlugin(plugin|preset) -> PluginInstance
        append a new plugin instance at the end of the list



class Note
    property clip (read-only MIDIClip|Pattern)
        the MIDI clip or Pattern containing the note

    property which (Number)
        the MIDI note number (0-127) of the note

    property attackVelocity (Number)
        the attack velocity (0-127) of the note

    property releaseVelocity (Number)
        the release velocity (0-127) of the note

    property startPosition (Position)
        the start position of the note; changing this property
        moves the note and extends the clip as needed

    property endPosition (Position)
        the end position of the note; changing this property
        moves the note and extends the clip as needed

    property length (Number)
        the length of the note in seconds; changing this
        anchors the startPosition of the note and adjusts the
        endPosition as needed

    property beatLength (Number)
        the length of the note in beats; changing this
        anchors the startPosition of the note and adjusts the
        endPosition as needed


    nudgeUp()
        nudge the note up by a small amount

    nudgeDown()
        nudge the note down by a small amount

    nudgeLeft()
        nudge the note left by a small amount

    nudgeRight()
        nudge the note right by a small amount

    remove()
        remove the note from the clip



class Position
    property barNumber (read-only Number)
        the number of the bar

    property beatNumber (read-only Number)
        the (fractional) beat number

    property seconds (read-only Number)
        the number of seconds from the start of the edit

    property timecode (read-only String)
        the position represented as a string for the user
        (based on current display settings)


    offsetBarsBeats(barOffset, beatOffset)
        return a new Position offset by some amount

    offsetSeconds(secondsOffset)
        return a new Position offset by some amount



function barsBeatsPosition(barNumber, beatNumber)
    return a new Position object for a specific position


function secondsPosition(seconds)
    return a new Position object for a specific position


function remove(what, ?withSourceFiles)
    remove the item(s) specified as what; if there are clips or
    tracks among them and withSourceFiles is specified as true,
    also deletes the source files for the indicated clips and for
    clips on the indicated tracks: what is any of the objects with
    a “remove” method specified above, or an array of such objects


function split(what, ?atPosition)
    split the indicated clip(s) at the specified position
    (or at the cursor position if atPosition is omitted or null)
    what is a Clip or an Array of Clips


function mute(what)
    mute indicated track(s) or clip(s) - what is a MusicTrack, a Clip,
    a PluginInstance, or an array of such objects (for a PluginInstance,
    the instance is disabled)

function unmute(what)
    unmute indicated track(s) or clip(s) - what is a MusicTrack, a Clip,
    a PluginInstance, or an array of such objects (for a PluginInstance,
    the instance is enabled)

function solo(what)
    solo indicated track(s) - what is a MusicTrack or an array of such

function unsolo(what)
    unsolo indicated track(s) - what is a MusicTrack or an array of such

function freeze(what)
    freeze indicated track(s) - what is a MusicTrack or an array of such

function unfreeze(what)
    unfreeze indicated track(s) - what is a MusicTrack or an array of such

function moveToBack(what)
    move indicated clip(s) behind other objects on the track - what
    is a Clip or an array of clips

function select(what)
    select the item(s) specified as what - what is any of the objects with
    an “isSelected” property specified above, or an array of such objects

function deselect(what)
    deselect the item(s) specified as what - what is any of the objects with
    an “isSelected” property specified above, or an array of such objects



/// FOR EXAMPLE, function mute would be the equivalent of:

function mute(what)
{
    if (! Array.isArray(what))
        what = [ what ];

    for (const x of what)
    {
        if (x instanceof PluginInstance)
            x.isEnabled = false;
        else if ((x instanceof MusicTrack) || (x instanceof Clip))
            x.isMuted   = true;
    }
}

Post Reply

Return to “Tracktion”