def OnInit():
    device.setHasMeters()
    global trackOffset
    trackOffset = 1
    if general.getVersion() >= minimumAPIVersion:
        setTrackData()
    else:
        raise Exception(
            "Your version of FL Studio is too old to use this script. Please update to a newer version."
        )
def sharedInit():
    """Performs initialisation actions common to both scripts
    """
    global PORT
    global SHARED_INIT_STATE

    SHARED_INIT_STATE = consts.INIT_OK

    # Refresh snap mode
    snap.refresh()

    PORT = device.getPortNumber()

    sendUniversalDeviceEnquiry()
    
    sendCompleteInternalMidiMessage(consts.MESSAGE_RESTART_DEVICE)

    print(getLineBreak())

    print(consts.SCRIPT_NAME + " - Version: " + getVersionStr() + " " + consts.SCRIPT_VERSION_SUFFIX)
    print(" - " + consts.SCRIPT_AUTHOR)
    print("")
    print("Running in FL Studio Version: " + ui.getVersion())


    # Check for script updates - UNCOMMENT THIS WHEN MODULES ADDED
    """
    if updatecheck.check():
        SHARED_INIT_STATE = consts.INIT_UPDATE_AVAILABLE
        printLineBreak()
        print("An update to this script is available!")
        print("Follow this link to download it: " + consts.SCRIPT_URL)
        printLineBreak()
    """
    
    if PORT != config.DEVICE_PORT_BASIC and PORT != config.DEVICE_PORT_EXTENDED:
        print("It appears that the device ports are not configured correctly. Please edit config.py to rectify this.")
        SHARED_INIT_STATE = consts.INIT_PORT_MISMATCH

    # Check FL Scripting version
    midi_script_version = general.getVersion()
    print("FL Studio Scripting version: " + str(midi_script_version) + ". Minimum recommended version: " + str(consts.MIN_FL_SCRIPT_VERSION))
    # Outdated FL version
    if midi_script_version < consts.MIN_FL_SCRIPT_VERSION:
        print("You may encounter issues using this script. Consider updating to the latest version FL Studio.")
        SHARED_INIT_STATE = consts.INIT_API_OUTDATED

    # Check debug mode
    if config.CONSOLE_DEBUG_MODE != []:
        print("Advanced debugging is enabled:", config.CONSOLE_DEBUG_MODE)
    print("")
Example #3
0
import device
import general
import midi
import mixer
import patterns
import transport
import ui

import arturia_leds
import arturia_midi
import config
from arturia_display import ArturiaDisplay
from arturia_leds import ArturiaLights
from debug import log

SCRIPT_VERSION = general.getVersion()

if SCRIPT_VERSION >= 8:
    import plugins


def _auto_generate_knobs_mapping(plugin_idx):
    if SCRIPT_VERSION < 8:
        return False
    params = _get_param_names(plugin_idx)
    map_idx = [
        _find_parameter_index(params, 'cutoff', 'filter', '1'),
        _find_parameter_index(params, 'resonance', 'filter', '1'),
        _find_parameter_index(params, 'lfo', 'delay', '1'),
        _find_parameter_index(params, 'lfo', 'rate', '1'),
        _find_parameter_index(params, 'macro', '1'),