Reads and writes FL Studio Control Surface plugin states.
npm install @holzchopf/flstudio-control-surface-stateThis file was auto-generated with zdoccer.js 2.0.3
- @holzchopf/flstudio-control-surface-state
- The state format
- State header
- State body
- Events
- 2000 - Surface Settings
- 2002 - Surface Dimensions
- 2003 - unknown
- 2100 - Start Control
- 2101 - End Control
- 2102 - Enable Control
- 2103 - Control Name
- 2104 - Control Dimensions
- 2105 - ILControl
- 2106 - ILControl, Colors
- 2107 - ILControl, Properties
- class FLControlSurfaceState
- version: number = 1
- options = new FLCSSOptions()
- [controls: FLCSSControl[] = []](#controls-flcsscontrol)
- getBinary(): ArrayBuffer
- setBinary(buffer: ArrayBuffer)
- type FLCSSControlTypeName = keyof typeof FLCSSControlTypeRaw
- [type FLCSSControlTypeId = typeof FLCSSControlTypeRaw[FLCSSControlTypeName]](#type-flcsscontroltypeid-typeof-flcsscontroltyperaw-flcsscontroltypename)
- const FLCSSControlType =
- name: (id: number): FLCSSControlTypeName | 'unknown' =>
- byName: (name: string): FLCSSControlTypeId | undefined =>
- class FLCSSEventGroup
- getEventOfType
- getEventOfTypeName
- [getEventsOfType](#geteventsoftype-t-extends-flcssevent-type-flcsseventtypeid-t-undefined)
- [getEventsOfTypeName](#geteventsoftypename-t-extends-flcssevent-type-flcsseventtypename-t-undefined)
- [getEvents(): FLCSSEvent[]](#getevents-flcssevent)
- [setEvents(events: FLCSSEvent[])](#setevents-events-flcssevent)
- type FLCSSEventTypeName = keyof typeof FLCSSEventTypeRaw
- [type FLCSSEventTypeId = typeof FLCSSEventTypeRaw[FLCSSEventTypeName]](#type-flcsseventtypeid-typeof-flcsseventtyperaw-flcsseventtypename)
- const FLCSSEventType =
- name: (id: number): FLCSSEventTypeName | 'unknown' =>
- byName: (name: string): FLCSSEventTypeId | undefined =>
- abstract class FLCSSEvent
- type: number
- get typeName()
- abstract getBinary(): ArrayBuffer
- abstract setBinary(buffer: ArrayBuffer): void
- class FLCSSBinaryEvent extends FLCSSEvent
- class FLCSSStringEvent extends FLCSSEvent
- class FLCSSStartControlEvent extends FLCSSEvent
- class FLCSSEnableControlEvent extends FLCSSEvent
- function createEvent(type: number, buffer?: ArrayBuffer)
- class FLCSSOptions extends FLCSSEventGroup
- settings?: FLCSSSettingsEvent
- dimensions?: FLCSSDimensionsEvent
- class FLCSSControl extends FLCSSEventGroup
- start?: FLCSSStartControlEvent
- end?: FLCSSEvent
- [enable?: FLCSSEnableControlEvent[]](#enable-flcssenablecontrolevent)
- name?: FLCSSStringEvent
- dimensions?: FLCSSControlDimensionsEvent
- ILControl?: FLCSSControlDefinitionsEvent
- colors?: FLCSSControlDefinitionsEvent
- properties?: FLCSSControlDefinitionsEvent
---
original Markdown from src/_preamble.md
Allows to read and write FL Studio Control Surface states. The main goal of this package is to modify Control Surface states.
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.
The header typically 4 bytes long. Probably indicating the format version, it is usually the number 1 stored as uint32le
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | uint32le | version | 0x01 00 00 00
The body is of variable length and consists of events. Each event has this structure:
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | uint32le | type
| 4 | uint64le | size (byte) of event data
| 12 | - | event data
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:
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | uint32le | skip (skip # numbers for the next control's name)
| 4 | uint32le | flags
Bit 0: edit
Bit 1: hide buttons
Bit 2: hide labels
| 8 | uint32le | grid size
The rest of the data is typically set to 0x00.
#### 2002 - Surface Dimensions
This event is typically 8 bytes long.
| Offset | Format | Description
| ---: | --- | ---
| 0 | uint32le | width
| 4 | uint32le | height
#### 2003 - unknown
This event is typically 4 bytes long.
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | uint32le | unknown | 0x02 00 00 00
#### 2100 - Start Control
This event is typically 32 bytes long.
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | uint32le | control 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).
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | float32le | current value
| 4 | float32le | default value
| 8 | uint32le | list 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.
| Offset | Format | Description | Typical Value
| ---: | --- | --- | ---
| 0 | float32le | x center coordinate
| 4 | float32le | y center coordinate
| 8 | float32le | width
| 12 | float32le | height
#### 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.
State version number.
Surface options.
Controls on this surface.
Creates the binary data for this surface and returns it.
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 🡵.
Returns the name of a given control type ID, or 'unknown'.
- param id — Control type ID.
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.
Returns the first event in this group of given type id.
- param type — FLCSSEventTypeId 🡵
Returns the first event in this group of given type name.
- param type — FLCSSEventTypeName 🡵
Returns all events in this group of given type id.
- param type — FLCSSEventTypeId 🡵
Returns all events in this group of given type name.
- param type — FLCSSEventTypeName 🡵
Returns the FLCSSEvent 🡵s making up this group.
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 🡵.
Returns the name of a given event ID, or 'unknown'.
- param id — Event ID.
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.
Numeric FLCSSEventType 🡵.
Name of FLCSSEventType 🡵. Readonly.
Returns this event's binary data.
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 event.
Settings event.
---
transformed Javadoc from src/flcss-surface-control.ts
class FLCSSControl extends FLCSSEventGroup
Class representing a control on the surface. Extends FLCSSEventGroup 🡵.
Start event.
End event.
Enable events.
Name event.
Dimension event.
ILControl event.
Color event.
Properties event.