@holzchopf/flstudio-control-surface-state v4.0.1
This file was auto-generated with zdoccer.js 2.0.3
Index
- @holzchopf/flstudio-control-surface-state
- The state format
 class FLControlSurfaceStatetype FLCSSControlTypeName = keyof typeof FLCSSControlTypeRawtype FLCSSControlTypeId = typeof FLCSSControlTypeRaw[FLCSSControlTypeName]const FLCSSControlType =class FLCSSEventGroupgetEventOfType<T extends FLCSSEvent>(type: FLCSSEventTypeId): T|undefinedgetEventOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T|undefinedgetEventsOfType<T extends FLCSSEvent>(type: FLCSSEventTypeId): T[]|undefinedgetEventsOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T[]|undefinedgetEvents(): FLCSSEvent[]setEvents(events: FLCSSEvent[])
type FLCSSEventTypeName = keyof typeof FLCSSEventTypeRawtype FLCSSEventTypeId = typeof FLCSSEventTypeRaw[FLCSSEventTypeName]const FLCSSEventType =abstract class FLCSSEventclass FLCSSBinaryEvent extends FLCSSEventclass FLCSSStringEvent extends FLCSSEventclass FLCSSStartControlEvent extends FLCSSEventclass FLCSSEnableControlEvent extends FLCSSEventfunction createEvent(type: number, buffer?: ArrayBuffer)class FLCSSOptions extends FLCSSEventGroupclass FLCSSControl extends FLCSSEventGroup
 
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
| Offset | Format | Description | Typical Value | 
|---|---|---|---|
| 0 | uint32le | version | 0x01 00 00 00 | 
State body
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 | 
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:
| Offset | Format | Description | Typical Value | 
|---|---|---|---|
| 0 | uint32le | skip (skip # numbers for the next control's name) | |
| 4 | uint32le | flags Bit 0: editBit 1: hide buttonsBit 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.
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.
- param 
type— FLCSSEventTypeId 🡵 
getEventOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T|undefined
Returns the first event in this group of given type name.
- param 
type— FLCSSEventTypeName 🡵 
getEventsOfType<T extends FLCSSEvent>(type: FLCSSEventTypeId): T[]|undefined
Returns all events in this group of given type id.
- param 
type— FLCSSEventTypeId 🡵 
getEventsOfTypeName<T extends FLCSSEvent>(type: FLCSSEventTypeName): T[]|undefined
Returns all events in this group of given type name.
- param 
type— FLCSSEventTypeName 🡵 
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.