Debian Codegraph @

examples/wii.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -+rtaudio=alsa -o dac:hw:0
4 </CsOptions>
5 <CsInstruments>
6 nchnls = 2
7 ksmps = 400
8
9 #define WII_B #3#
10 #define WII_A #4#
11 #define WII_R_A #304#
12 #define WII_PITCH #20#
13 #define WII_ROLL #21#
14 #define WII_BATTERY #27#
15
16 #define WII_RUMBLE #3#
17 #define WII_SET_LEDS #4#
18
19 gkcnt init 1
20
21 instr 1
22 i1 wiiconnect 3,1
23
24 wiirange $WII_PITCH., -20, 0
25 kb wiidata $WII_BATTERY.
26 kt wiidata $WII_B.
27 ka wiidata $WII_A.
28 kra wiidata $WII_R_A.
29 gka wiidata $WII_PITCH.
30 gkp wiidata $WII_ROLL.
31 ; If the B (trigger) button is pressed then activate a note
32 if (kt==0) goto ee
33 event "i", 2, 0, 5
34 gkcnt = gkcnt + 1
35 wiisend $WII_SET_LEDS., gkcnt
36 ee:
37 if (ka==0) goto ff
38 wiisend $WII_RUMBLE., 1
39 ff:
40 if (kra==0) goto gg
41 wiisend $WII_RUMBLE., 0
42 gg:
43 printk2 kb
44 endin
45
46 instr 2
47 a1 oscil ampdbfs(gka), 440+gkp, 1
48 outs a1, a1
49 endin
50
51 </CsInstruments>
52
53 <CsScore>
54 f1 0 4096 10 1
55 i1 0 300
56
57 </CsScore>
58
59 </CsoundSynthesizer>