-
-
Notifications
You must be signed in to change notification settings - Fork 923
Sonic Pi Internals GUI Ruby API
The Sonic Pi GUI connects to the Ruby backend via OSC messages. This is an informal description of the API based on the current codebase (circa 2.6):
Runs the provided code in a new Sonic Pi thread via __spider_eval_code
. Not actually used by GUI at this time, more for interoperability with other front-ends.
Used by the GUI when the Run button is hit, saves the code to a file and commits it to the internal Git repo. The workspace name is passed to eval
and used to identify the code in error traces.
Saves the buffer contents to a file, used when the GUI is exiting.
GUI is exiting and requests the backend to exit.
GUI Stop
button, kills all running threads
GUI requests to load the buffer contents from disk at startup
Called when TAB
is pressed in the GUI, to auto-indent the current line or selection via RBeautify, or complete a snippet (work in progress).
The align
button, passes the entire buffer to RBeautify for cleanup
Called from the GUI at startup while waiting for the server to start, triggers an /ack
from the server.
Tell SuperCollider to start recording to a temporary file.
Tell SuperCollider to stop recording.
Discard the temporary recording file.
Save the temporary file to the given filename.
Not currently used, may be useful in development. Theoretically restarts the server and SC without needing to restart the GUI.
SuperCollider mixer controls. HPF and LPF are not currently visible in the GUI.
Allow/disallow the server to check for new versions of Sonic Pi, controlled from the Prefs pane.
Add a log entry with one or more lines that occured at a given timestamp. Types are magic numbers right now, currently:
-
- default
-
- user message (print, etc.)
-
- warning
-
- serious warning
-
- highlighted (pink)
-
- highlight v2 (blue - cue -- not shown?)
-
- highlight v3 (orange - sync -- not shown?)
Add an info log message.
Add an error log message.
All-purpose routine for loading new buffers in, and updating buffers after beautify (Align
). Updates cursor position and scroll position so they stay the same.
Replace part of a buffer after auto-indent.
Server has exited, GUI shuts down too
Server exited after a failed startup, message is hopefully informative about the startup error
Sent in response to a /ping
from the GUI, indicates server is alive.