22. openFrameworks + ofxStateMachine
‣ 使い方は簡単!
‣ ofxState : それぞれの状態のテンプレートとなるクラス、継承
して使用する
‣ SharedData : 全てのクラスで共有するデータ
ofxState
継承
State A
State B
State C
SharedData
参照
26. openFrameworks + ofxStateMachine
‣ 各Stateは、名前を呼ぶと表示される
‣ 《Stateのインスタンス》.getName() で名前を返すようにする
‣ testAppから名前を呼ぶと、Stateが選択される
testApp
State A
state_a
State B
state_b
State C
state_c
27. openFrameworks + ofxStateMachine
‣ 各Stateは、名前を呼ぶと表示される
‣ 《Stateのインスタンス》.getName() で名前を返すようにする
‣ testAppから名前を呼ぶと、Stateが選択される
changeState( state_b )
testApp
State A
state_a
State B
state_b
State C
state_c
28. openFrameworks + ofxStateMachine
‣ 各Stateは、名前を呼ぶと表示される
‣ 《Stateのインスタンス》.getName() で名前を返すようにする
‣ testAppから名前を呼ぶと、Stateが選択される
changeState( state_b )
testApp
State A
表示
state_a
State B
state_b
State C
state_c
76. SuperCollider Basics
‣ 参考図書:The SuperCollider Book
‣ Wilson, S., Cottle, D. and Collins, N. (eds). 2011. The
SuperCollider Book. Cambridge, MA: MIT Press
79. The SuperCollider Language
‣ SuperColliderの独特な文法
‣ Smalltalkのオブジェクト指向な言語構造と、C言語系の制御構
造などの機能を足したような感じ
// print "Hello world!"!
"Hello world!".postln;!
// play a mixture of an 800 Hz sine tone and pink noise!
{ SinOsc.ar(800, 0, 0.1) + PinkNoise.ar(0.01) }.play;!
// modulate a sine frequency and a noise amplitude with another sine!
// whose frequency depends on the horizontal mouse pointer position!
{ !
var x = SinOsc.ar(MouseX.kr(1, 100));!
SinOsc.ar(300 * x + 800, 0, 0.1) !
+ !
PinkNoise.ar(0.1 * x + 0.1) !
}.play;!
// list iteration: multiply the elements of a collection by their indices!
[1, 2, 5, 10, -3].collect { !
arg elem, idx;!
elem * idx;!
};!
// factorial function!
f = {!
arg x;!
if(x == 0) { 1 } { f.(x-1) * x }!
};
80. The SuperCollider Language
‣ 冒頭のドローン系の音を解説
‣ 楽器はこんな感じ - 1.5倍の比率でノコギリ波を重ねている
//楽器基本
SynthDef("col_closesaw", {
arg fadeTime = 10, n = 0, rq = 0.3, detune = 0.001, base = 20,
ratio = 1.5, harm = 1.5, amp = 0.2, gate=0;
var lfo, env, out;
env = EnvGen.kr(Env.new([0,1], [fadeTime], 'sine'));
lfo = SinOsc.ar(rrand(0.03, 0.05), 0, 100, 600);
out = Saw.ar([base+detune.rand, base+detune.rand]
* (ratio ** n)) * amp
+ Saw.ar([base*harm+detune.rand, base*harm+detune.rand]
* (ratio ** n)) * amp;
out = out * env;
out = RLPF.ar(out, lfo * (1.5 ** n), rq).clip2 * 0.5;
out = out * EnvGen.kr(Env.adsr(releaseTime:20), gate,
doneAction: 2);
Out.ar(0, out);
}).store;