File: Getenv.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.7.1~repack-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,332 kB
  • ctags: 11,704
  • sloc: cpp: 140,180; lisp: 14,746; ansic: 2,133; xml: 86; makefile: 82; haskell: 21; sh: 8
file content (36 lines) | stat: -rw-r--r-- 996 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
CLASS:: Getenv
summary:: Read (numeric) shell environment variables into a synth
categories:: UGens

DESCRIPTION::
Tries to grab a shell environment variable (with name key) and convert it to a floating-point value, which is output.

If the environment variable is not set, defaultval is output.

If the environment variable cannot be converted to a floating-point value, the output is zero.

NOTE: the shell context is that of the server, not the client.


EXAMPLES::
code::
Server.local.quit; // If server running, need to stop it for this example

// We'll modify the server boot procedure to set our env var...
~realserverprogram = Server.program;
Server.program = "export PANCREAS=220;" + Server.program
s.boot;

(
x = {
// Env var specifies frequency.
// If you change the env var name to one that isn't set, 440 is used.
SinOsc.ar(Getenv(\PANCREAS, 440), 0, 0.1);
}.play(Server.local);
)
x.free;

// This should restore the variable to what it was
Server.program = ~realserverprogram;
::