Skip to content

Index

Deprecated as of v33.0.0

This module is deprecated, and intended to be removed in a future version of FL Studio API Stubs.

Provides a model of FL Studio, which integrates with the other stub files in order to facilitate testing of MIDI scripts.

NOTE: This module is not included in FL Studio's runtime, and should not be imported from within your main script. It is intended to be used within a testing framework in order to help validate the behavior of MIDI scripts.

FlContext

A context manager that can be used to temporarily modify the FL Studio model's state. When the context is entered, a reference to the state is given, so that modifications to the state can be made easily. At the end of the context, the state is reset to what it was when the state was created.

Example Usage

# Create a copy of the state
with FlContext() as fl:
    # Set the state, so that playback is happening
    fl.transport.playing = True
    assert transport.isPlaying()
# When the context closes, the state is reset
assert not transport.isPlaying()

getState()

Returns a reference to the current state of the FL Studio model

This state can be modified as required, and changes will be reflected in the current state

Returns:

  • Model: FL state

Example Usage

resetState()

Resets the state of the FL Studio model to the default

setState(new_state)

Sets the current state of the FL Studio model

The new_state is copied before setting it, so that the original state won't be modified by future changes

Args:

  • new_state (Model): state to set to