File: Nil.sc

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (125 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download | duplicates (6)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Nil {
	*new { ^this.shouldNotImplement(thisMethod) }

	isNil { ^true }
	notNil { ^false }
	? { arg obj; ^obj }
	?? { arg obj; ^obj.value }
	!? {}
	asBoolean    { ^false }
	booleanValue { ^false } // TODO in the long-run, deprecate for asBoolean

	// support a nil Environment
	push { arg function; ^function.value }
	appendStream { arg stream; ^stream }
	pop {}

	// support a nil Plug
	source {}
	source_ {}

	// rate access support
	rate { ^nil }
	numChannels { ^nil }
	isPlaying { ^false }

	do {}
	reverseDo {}
	pairsDo {}
	collect {}
	select {}
	reject {}
	detect {}
	collectAs {}
	selectAs {}
	rejectAs {}
	collectInPlace {}
	collectCopy {}

	// dependancy operators are no-ops
	dependants {
		^IdentitySet.new
	}
	changed {}
	addDependant {}
	removeDependant {}
	release {}
	update {}

	// nil Event support
	transformEvent { arg event;
		^event
	}
	awake { arg inBeats, inSeconds, inClock;
		var temp;
		temp = inBeats; // prevent optimization
		^nil
	}
	play {}

	nextTimeOnGrid { arg clock; ^clock !? { clock.nextTimeOnGrid } }
	asQuant { ^Quant.default }  //  { ^Quant.new }

	swapThisGroup {}

	performMsg {}

	printOn { arg stream;
		stream.putAll("nil");
	}
	storeOn { arg stream;
		stream.putAll("nil");
	}

	matchItem { ^true } // nil matches anything

	// Array support
	add { arg value;
		// This makes it unecessary to check for array.isNil when doing:
		// array = array.add(thing);     Instead, it just works.
		^[value]
	}
	addAll { arg array; ^array.asArray }
	++ { arg array; ^array }
	asCollection { ^[] }
	remove {}

	// ControlView support
	set {}
	get { arg prevVal; ^prevVal }

	// FunctionList support
	addFunc { arg ... functions;
		^if(functions.size <= 1) {functions[0] } { FunctionList(functions) }
	}
	removeFunc { ^this }

	replaceFunc { }

	// if Main-startup fails then AppClock scheduler may be nil. If that happens an
	// endless cascade of doesNotUnderstand messages gets printed in response to each clock tick
	// unless we do this.
	seconds_ {}

	// throwing Nil
	throw {}

	handleError { arg error;
		Error.handling = true;
		if (Error.debug) {
			{ error.inspect }.defer;
		} {
			error.reportError
		};
		Error.handling = false;
		this.halt;
	}

	archiveAsCompileString { ^true }

	asSpec {
		^ControlSpec.new;
	}

	superclassesDo {}
}