ScinServer:
Filter:
Scintillator/Classes (extension) | Quarks > Scintillator > Server

ScinServer
ExtensionExtension

Represents a Scintillator server application.

Description

This class is analagous to the SuperCollider Server class. It is a client-side representation of an instance of the Scintillator video synthesis server.

Class Methods

.default

Get or set the default Scintillator server. This is the server reference that will be used as the default in all server arguments to ScinthDef and others that accept an optional server argument. By default is the local server instance.

.new

Creates a new ScinServer instance. For now only local servers are supported.

Arguments:

options

An optional instance of ScinServerOptions. If nil, an instance of ScinServerOptions will be created using the default values.

Instance Methods

.boot

It not already booted, boots the Scintillator synthesis server.

.numberOfWarnings

Returns the current number of errors reported by the server since boot.

.numberOfErrors

Returns the current number of errors reported by the server since boot.

.options

Provides access to the ScinServerOptions object that was or will be used to boot the Server. This allows for convenient modifications of the options before boot, without having to create a separate ScinServerOptions object to provide on the call to new().

.defaultGroup

On boot ScinServer creates this group. It is the group that by default any new groups or Scinths will be added to. It is also the group that is emptied when Cmd+Period is pressed.

.logLevel

Updates the logging level on the server to the provided argument. Lower log levels are inclusive of all higher log levels, so they tend to log more, and the highest log level turns off logging. This overrides any command-line argument supplied to scinsynth at startup.

Arguments:

level

The values for the log level are as follows:

0Trace
1Debug
2Informational
3Warnings
4Errors
5Critical Errors
6Disable Logging

.screenShot

Requests the server to take a screen shot of the next frame rendered, encode it into the provided file format, and save to disk.

NOTE: The screenShot functionality is only supported in non-realtime rendering modes. See ScinServer-Recording for more information.

Arguments:

fileName

A string with the full path and file name, including extension, of the desired file to save the screenshot image to.

mimeType

An optional string. A hint to the image encoder as to which file format is desired, for example "image/png", "image/gif", "image/jpeg".

onReady

An optional function to call when the ScinServer responds that it has enqueued the screenshot for encode on the next rendered frame.

onComplete

An optional function to call when the ScinServer responds that it has completed encoding and writing the image to disc.

.advanceFrame

If the server is configured with zero frame rate, will advance the time on the synth by the provided fraction of time in seconds and render a new frame. Otherwise this command is ignored.

Arguments:

num

An integer representing the numerator in the fraction of time to advance the frame by.

denom

An integer representing the denominator in the fraction of time to advance the frame by. Sending time in terms of fractions allows for traditional media frame rates (like 24 frames per second).

.dumpOSC

Controls if the server should dump received OSC messages to the log or not.

NOTE: The server writes OSC messages to the log at the Informational level, meaning that any logLevel higher than that will not show the OSC messages. Also note that the default log level for ScinServer is at the Warning level, meaning that at default logging dumpOSC will not appear to work.

Arguments:

on

A boolean. If true, the server will start dumping incoming OSC messages to the log. If false, the server will stop.

.sendMsg

Sends the provided arguments as an OSC message to the associated server process.

Arguments:

... msg

The OSC message to send, typically starting with an OSC path like /scin_logLevel. For documentation about supported command consult the Scintillator-Scinth-Server-Command-Reference.

.serverBooting

Returns true if the server is in the process of booting, specifically that the ScinServer instance object has started the server but not yet heard back a response to the status polling.

.quit

Requests the server stop immediately.

.doWhenBooted

Adds the provided function to the list of functions to be called after the ScinServer instance object detects that the server has booted.

Arguments:

onComplete

A function, the method to be called when boot is detected. The function is called with one argument, which is the ScinServer object which just booted.

.serverRunning

Returns true if the server associated with this ScinServer instance object is currently running.

.waitForBoot

Convenience method that adds the provided function to the boot callbacks list and then boots the server if it is not currently running.

Arguments:

onComplete

The function to call when the server is detected as booted. The function is called with one argument, the ScinServer object which just booted.

.reorder

Moves a list of nodes in order to a new location. This is used to control rendering order, an important consideration when blending between Scinths.

Arguments:

nodeList

The list of ScinNodes, in order, to move.

target

An optional ScinNode, The target node to move the list of nodes relative to. If nil the target will be the defaultGroup on the server.

addAction

An optional symbol describing which behavior to use when placing the nodes. If nil the default is \addToTail.

\addToHeadtarget must be a group, the nodes will be added in order to the beginning of the group.
\addToTailtarget must be a group, the nodes will be added in order to the end of the group. This is the default if no action is specified.
\addBeforeplace all nodes immediately before target and in the same group.
\addAfterplace all nodes immediately after target and in the same group.

Synchronous Commands

The server provides support for waiting on the completion of asynchronous OSC-commands such as reading or writing sound files, making them synchronous.

NOTE: The following methods must be called from within a running Routine. Explicitly passing in a Condition allows multiple elements to depend on different conditions. The examples below should make clear how all this works.

.sync

Sends a request to the server to finish all asynchronous commands, such as compiling a ScinthDef or decoding an image. Will block the calling thread until the completion of all pending tasks is reported by the server.

Arguments:

condition

An optional Condition to use to block the Routine. If not provided ScinServer will make a new one for use.

.queueScreenShotSync

Call from a Routine. Requests the server take a screenshot and blocks the calling thread until the screenshot is queued to render on the next frame.

NOTE: The screenshot functionality is only supported in non-realtime rendering modes. See ScinServer-Recording for more information.

Arguments:

fileName

A string containing the path and file name to save the resulting image to.

mimeType

An optional string with a mime type to provide additional context to the image encoder (in addition to the fileName extension) about what image encoding type is requested for saving the image as.

onComplete

An optional function to callback when the screenshot has been completed, meaning the render has completed and the file has been saved to disc.

condition

An optional Condition object to use to wait on. If not provided ScinServer will create its own.

.bootSync

Boot the server, then block the Routine until the server is detected as having booted.

Arguments:

condition

An optional Condition object to use to wait on. If not provided ScinServer will create its own.

Developer and Diagnostic Commands

.postCrashReports

Requests the server to post some detail about any server crash reports that have been stored in the crash report database. Will produce output in the post window that looks something like:

[1594932178.669] 285299 [info] Crash report database contains 3 reports:
[1594932178.669] 285299 [info]     id: 1a77de76-f2c2-4b22-9d2a-bd5016772a2f, on: Thu 16 Jul 13:26:37 2020, uploaded: no
[1594932178.669] 285299 [info]     id: bac6608c-05cd-4f03-827b-780588d5ee1c, on: Thu 16 Jul 13:07:48 2020, uploaded: no
[1594932178.669] 285299 [info]     id: 250c0c0d-8b2c-4a16-8240-576cc26e80d1, on: Thu 16 Jul 13:14:25 2020, uploaded: yes

The id field can be copied and pasted into a request to upload individual crash reports, as well as posted in bug reports to the Scintillator developers.

NOTE: Please read the Scintillator-Crash-Reports-And-Privacy discussion before uploading crash reports.

.uploadCrashReport

Marks a crash report as ok to upload. The reports will generally be uploaded shortly after the next time the Scintillator Server boots, assuming the computer is connected to the internet and the crash report server is available.

NOTE: Please read the Scintillator-Crash-Reports-And-Privacy discussion before uploading crash reports.

Arguments:

id

A string with the complete crash report id.

.uploadAllCrashReports

Marks all un-uploaded crash reports with a request for upload.

NOTE: Please read the Scintillator-Crash-Reports-And-Privacy discussion before uploading crash reports.

Examples