4.0.1 • Published 9 months ago

@holzchopf/flstudio-control-surface-state v4.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

This file was auto-generated with zdoccer.js 2.0.3

Index


original Markdown from src/_preamble.md

@holzchopf/flstudio-control-surface-state

Allows to read and write FL Studio Control Surface states. The main goal of this package is to modify Control Surface states.

The state format

The state consists of a header, followed by body consisting of a variable number of events. I chose the name event because the official documentation for the .flp file format - which used a similar "event" based approach - called those data packages events.

State header

The header typically 4 bytes long. Probably indicating the format version, it is usually the number 1 stored as uint32le

OffsetFormatDescriptionTypical Value
0uint32leversion0x01 00 00 00

State body

The body is of variable length and consists of events. Each event has this structure:

OffsetFormatDescriptionTypical Value
0uint32letype
4uint64lesize (byte) of event data
12-event data

Events

All events can be grouped into Control Surface options (types 20xx) or controls (types 21xx). Listed here are event types typically found:

2000 - Surface Settings

This event is typically 64 bytes long and contains Control Surface settings:

OffsetFormatDescriptionTypical Value
0uint32leskip (skip # numbers for the next control's name)
4uint32leflags Bit 0: editBit 1: hide buttonsBit 2: hide labels
8uint32legrid size

The rest of the data is typically set to 0x00.

2002 - Surface Dimensions

This event is typically 8 bytes long.

OffsetFormatDescription
0uint32lewidth
4uint32leheight

2003 - unknown

This event is typically 4 bytes long.

OffsetFormatDescriptionTypical Value
0uint32leunknown0x02 00 00 00

2100 - Start Control

This event is typically 32 bytes long.

OffsetFormatDescriptionTypical Value
0uint32lecontrol type

The rest of the data is typically set to 0x00.

2101 - End Control

This event is typically 0 bytes long.

2102 - Enable Control

This event is typically 12 bytes long and describes how to expose this control. A Control can have multiple of these events (i.e. X/Y Controllers have two).

OffsetFormatDescriptionTypical Value
0float32lecurrent value
4float32ledefault value
8uint32lelist index

2103 - Control Name

The value of this event is a utf-16le string.

2104 - Control Dimensions

This event is typically 16 bytes long and describes the position and size of the control.

OffsetFormatDescriptionTypical Value
0float32lex center coordinate
4float32ley center coordinate
8float32lewidth
12float32leheight

2105 - ILControl

The value of this event is a utf-16le string. It typically contains all the definitons a .ilcontrol file contains.

2106 - ILControl, Colors

The value of this event is a utf-16le string. It typically contains the color definitions from the ILControl event.

2107 - ILControl, Properties

The value of this event is a utf-16le string. It typically contains the property definitions from the ILControl event.


transformed Javadoc from src/fl-control-surface.ts

class FLControlSurfaceState

Class representing an FL Studio Control Surface plugin state.

version: number = 1

State version number.

options = new FLCSSOptions()

Surface options.

controls: FLCSSControl[] = []

Controls on this surface.

getBinary(): ArrayBuffer

Creates the binary data for this surface and returns it.

setBinary(buffer: ArrayBuffer)

Sets this surface's values from binary data.

  • param buffer Binary data.

transformed Javadoc from src/flcss-control-type.ts

type FLCSSControlTypeName = keyof typeof FLCSSControlTypeRaw

Known control type names.

type FLCSSControlTypeId = typeof FLCSSControlTypeRaw[FLCSSControlTypeName]

Known control type IDs.

const FLCSSControlType =

Types of controls in a FLCSSStartControlEvent 🡵.

name: (id: number): FLCSSControlTypeName | 'unknown' =>

Returns the name of a given control type ID, or 'unknown'.

  • param id Control type ID.

byName: (name: string): FLCSSControlTypeId | undefined =>

Returns the ID for a given control type name, or undefined

  • param name Control type name.

transformed Javadoc from src/flcss-event-group.ts

class FLCSSEventGroup

Class representing a group of FLCSSEvent 🡵s.

getEventOfType<T extends FLCSSEvent>(type: FLCSSEventTypeId): T|undefined

Returns the first event in this group of given type id.

getEventOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T|undefined

Returns the first event in this group of given type name.

getEventsOfType<T extends FLCSSEvent>(type: FLCSSEventTypeId): T[]|undefined

Returns all events in this group of given type id.

getEventsOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T[]|undefined

Returns all events in this group of given type name.

getEvents(): FLCSSEvent[]

Returns the FLCSSEvent 🡵s making up this group.

setEvents(events: FLCSSEvent[])

Sets the FLCSSEvent 🡵s making up this group.


transformed Javadoc from src/flcss-event-type.ts

type FLCSSEventTypeName = keyof typeof FLCSSEventTypeRaw

Known event names.

type FLCSSEventTypeId = typeof FLCSSEventTypeRaw[FLCSSEventTypeName]

Known event IDs.

const FLCSSEventType =

Types of the events in an FLCSSEventGroup 🡵.

name: (id: number): FLCSSEventTypeName | 'unknown' =>

Returns the name of a given event ID, or 'unknown'.

  • param id Event ID.

byName: (name: string): FLCSSEventTypeId | undefined =>

Returns the ID for a given event name, or undefined

  • param name Event name.

transformed Javadoc from src/flcss-event.ts

abstract class FLCSSEvent

Base class for state events.

type: number

Numeric FLCSSEventType 🡵.

get typeName()

Name of FLCSSEventType 🡵. Readonly.

abstract getBinary(): ArrayBuffer

Returns this event's binary data.

abstract setBinary(buffer: ArrayBuffer): void

Sets this event's binary data.

  • param buffer Binary data.

class FLCSSBinaryEvent extends FLCSSEvent

Event with unspecified binary data.

class FLCSSStringEvent extends FLCSSEvent

Event with string value data.

class FLCSSStartControlEvent extends FLCSSEvent

Event starting a new FLCSSControl 🡵

class FLCSSEnableControlEvent extends FLCSSEvent

Describes how a control is exposed. Enabled controls will have at least one of these events.

function createEvent(type: number, buffer?: ArrayBuffer)

Factory function to create a new specific FLCSSEvent.

  • param type FLCSSEventType.
  • param value Binary data for this event.

transformed Javadoc from src/flcss-options.ts

class FLCSSOptions extends FLCSSEventGroup

Class representing control surface options. Extends FLCSSEventGroup 🡵.

settings?: FLCSSSettingsEvent

Settings event.

dimensions?: FLCSSDimensionsEvent

Settings event.


transformed Javadoc from src/flcss-surface-control.ts

class FLCSSControl extends FLCSSEventGroup

Class representing a control on the surface. Extends FLCSSEventGroup 🡵.

start?: FLCSSStartControlEvent

Start event.

end?: FLCSSEvent

End event.

enable?: FLCSSEnableControlEvent[]

Enable events.

name?: FLCSSStringEvent

Name event.

dimensions?: FLCSSControlDimensionsEvent

Dimension event.

ILControl?: FLCSSControlDefinitionsEvent

ILControl event.

colors?: FLCSSControlDefinitionsEvent

Color event.

properties?: FLCSSControlDefinitionsEvent

Properties event.

4.0.1

9 months ago

4.0.0

9 months ago