Skip to content

This is sort of a guide for future devs stumbling upon flapi #32

Description

@stet-stet

OS: Win 10 Home, 10.0.19045.5072

So this is intended as a guide for users who want to start developing on this, but would like to save some time needed to get it to work in its current state.

Installation commands:

conda create fl -n python==3.12
(navigate to directory)
pip install -e .
flapi install

I ran into two problems so far,

Problem 1 with MIDI ports

I made ports with LoopMIDI but for some reason there was no response.

I was able to mitigate this problem by using the trial version of LoopBe30 instead, also modifying the _consts.py file and setting everything up manually.

DEFAULT_REQ_PORT = "01. Internal MIDI"
DEFAULT_RES_PORT = "02. Internal MIDI"

However, this (allegedly) only works for 60 minutes after each boot, not sure if there is any other free solution that works

Problem 2 with message mismatch between server-side and client

this is from server-side consts.py , found on C:\Users\(user name)\Documents\Image-Line\FL Studio\Settings\Hardware\Flapi Server

    EXEC = 0x04
    """
    Exec message - this is used to run an `exec` command in FL Studio, with no
    return type (just a success, or an exception raised).
    """

    EVAL = 0x05
    """
    Eval message - this is used to run an `eval` command in FL Studio, where
    the value that it produces is returned.
    """

this is client-side _consts.py, found on this repo

    REGISTER_MESSAGE_TYPE = 0x04
    """
    Register a new message type for the client.
    """

    EXEC = 0x05
    """
    Exec message - this is used to run an `exec` command in FL Studio, with no
    return type (just a success, or an exception raised).
    """

Due to this mismatch, the import statements sent with fl_exec in setup_server() is actually eval'd, returning a syntax error and crashing the whole thing.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\(username)\anaconda3\envs\fl\Scripts\flapi.exe\__main__.py", line 7, in <module>
  File "C:\Users\(username)\anaconda3\envs\fl\Lib\site-packages\click\core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\anaconda3\envs\fl\Lib\site-packages\click\core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\anaconda3\envs\fl\Lib\site-packages\click\core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\anaconda3\envs\fl\Lib\site-packages\click\core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\anaconda3\envs\fl\Lib\site-packages\click\core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\cli\repl.py", line 230, in repl
    status = enable(req, res)
             ^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\__enable.py", line 123, in enable
    return try_init(random.randrange(1, 0x7F))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\__enable.py", line 146, in try_init
    setup_server()
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\__enable.py", line 162, in setup_server
    fl_exec(f"import {', '.join(consts.FL_MODULES)}")
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\__comms.py", line 252, in fl_exec
    assert_response_is_ok(response, MessageType.EXEC)
  File "C:\Users\(username)\Desktop\fl_antics\Flapi\flapi\__comms.py", line 116, in assert_response_is_ok
    raise decode_python_object(msg[2:])
  File "<string>", line 1
    import playlist, channels, mixer, patterns, arrangement, ui, transport, plugins, general
    ^^^^^^
SyntaxError: invalid syntax

After manually fixing these two points, stuff written on the README starts to work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions