3 The RT Engine
The main purpose of the RT Engine is to receive <realtime>
objects
and provide ways to control exactly when a <realtime>
objects
processing function is being called. The API for doing this is hidden from the user, and is accessed by calling methods
in the <realtime>
class.
3.1 Features
Realtime safe
Jack driver
Unlimited number of input and outputs
The RT Engine is a class, and unlimited number of
<RT-Engine>
-instances can run simultaneously. 1Protection mechanism provided to avoid locking up the computer when using too much CPU.
Properly made priority queue system for events to ensure a stable CPU load (At least, I hope so).
Controlled entirely from scheme using Guile
3.2 Guile Functions to control the Realtime Engine
(rte-pause)
-
Pause the engine. (rte-continue)
-
Starts running the engine after being paused. (rte-restart #:key num-input-ports num-output-ports)
-
Stops and starts engine. If you only have stuck sounds, use(rte-silence!)
instead. (Warning, theres a huge memory-leak when using this function.) (rte-silence!)
-
Call this function if you have stuck sounds or<realtime>
instances running. (This function is equivilant to thefreeAll
OSC message for Supercollider3) (rte-time)
-
Returns the time in seconds since the engine was started.(rte-time)
=(rte-frames)
/(rte-samplerate)
(rte-samplerate)
-
Returns the samplerate. (rte-frames)
-
Returns the number of frames since the engine was started. (rte-is-running?)
-
Returns true if engine is running. (Ie. not paused) (rte-max-cpu-usage)
-
This is a setter-function. The engine will stop calling further<realtime>
instances if the cpu-usage for the jack client is higher than(rte-max-cpu-usage)
. This is a safety mechanism to avoid locking up the computer or jack to kill the client, which can be unfortunate or embarrassing in certain situations. Note however that if exactly 1<realtime>
instance is using too much cpu, this mechanism will not work. The default value is set to 80. At least on my machine, this is a comfortable value, because the machine is still quite responsive at 80%. (rte-info)
-
Returns a list of 7 elements:Current size of the priority queue.
Size of the priority queue.
Number of lost events because the priority queue was full.
Number of events waiting to be run.
Number of
<realtime>
instances currently running.CPU load reported by the jack client.
Number of times the execution of
<realtime>
instances have been stopped because the cpu-usage was higher than(rte-max-cpu-usage)
. This number is mostly useful when being compared to a previous value, or to check whether its higher than 0.
3.3 Global variables
*rt-engine*
-
The main object, an instance of<rt-engine>
. Evaluate(-> *rt-engine* dir)
to get the name of all the methods and subclasses. *rt-num-input-ports*
-
Number of input jack ports. You can define this variable before loading rt-compiler.scm or rt-engine.scm to override the default value of 8. *rt-num-output-ports*
-
Number of output jack ports. You can define this variable before loading rt-compiler.scm or rt-engine.scm to override the default value of 8. *out-bus*
-
The bus connected to the soundcard output. *in-bus*
-
The bus connected to the soundcard input.
1 Well, actually just 16.