Skip to content

Commit

Permalink
Attempt to hunt down FL Studio crash
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed Jan 14, 2024
1 parent b44d5eb commit ea41f3e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion flapi/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Constants used by Flapi
"""

VERSION = (0, 3, 1)
VERSION = (0, 3, 2)
"""
The version of Flapi in the format (major, minor, revision)
"""
Expand Down Expand Up @@ -133,6 +133,7 @@
DEVICE_ENQUIRY_MESSAGE = bytes([
# 0xF0 - begin sysex (omitted by Mido)
0x7E, # Universal sysex message
# FIXME: This is 0x7F on MacOS
0x00, # Device ID (assume zero?)
0x06, # General information
0x01, # Identity request
Expand Down
2 changes: 1 addition & 1 deletion flapi/script/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Constants used by Flapi
"""

VERSION = (0, 3, 1)
VERSION = (0, 3, 2)
"""
The version of Flapi in the format (major, minor, revision)
"""
Expand Down
17 changes: 17 additions & 0 deletions flapi/script/device_flapi_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
pass


def log_decorator(fn):
fn_name = fn.__name__

def decorator(*args, **kwargs):
capout.fl_print(f"> {fn_name}")
res = fn(*args, **kwargs)
capout.fl_print(f"< {fn_name}")
return res

return decorator


def send_stdout(text: str):
"""
Callback for Capout, sending stdout to the client console
Expand Down Expand Up @@ -119,13 +131,15 @@ def send_fail(msg_type: int, message: str):
)


@log_decorator
def heartbeat():
"""
Received a heartbeat message
"""
return send_ok(consts.MSG_TYPE_HEARTBEAT)


@log_decorator
def version_query():
"""
Return the version of the Flapi server
Expand All @@ -136,6 +150,7 @@ def version_query():
)


# @log_decorator
def fl_exec(code: str):
"""
Execute some code
Expand All @@ -152,6 +167,7 @@ def fl_exec(code: str):
return send_ok(consts.MSG_TYPE_EXEC)


@log_decorator
def fl_eval(expression: str):
"""
Evaluate an expression
Expand Down Expand Up @@ -189,6 +205,7 @@ def __call__(self, code: int = 0):
exit = __ExitCommand()


@log_decorator
def OnSysEx(event: 'FlMidiMsg'):
header = event.sysex[1:7] # Sysex header
data = event.sysex[7:-1] # Any remaining sysex data
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flapi"
version = "0.3.1"
version = "0.3.2"
description = "Remotely control FL Studio using the MIDI Controller Scripting API"
authors = ["Miguel Guthridge <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit ea41f3e

Please sign in to comment.