Debian Codegraph @

examples/hid/kbhit/kbhit2.ck

raw
1 // name: kbhit2.ck
2 // desc: KBHit (terminal only) is a simple mechanism for capturing
3 // keyboard ouly; for more flexible keyboard input, see HID
4
5 // computer key input, with sound
6 KBHit kb;
7
8 // patch
9 Impulse i => BiQuad f => dac;
10 // set the filter's pole radius
11 .99 => f.prad;
12 // set equal gain zeros
13 1 => f.eqzs;
14 // initialize float variable
15 0.0 => float v;
16 // set filter gain
17 .5 => f.gain;
18
19 // time-loop
20 while( true )
21 {
22 // wait on event
23 kb => now;
24 // generate impulse
25 1.0 => i.next;
26
27 // loop through 1 or more keys
28 while( kb.more() )
29 {
30 // set filtre freq
31 kb.getchar() => int c => Std.mtof => f.pfreq;
32 // print int value
33 <<< "ascii:", c >>>;
34 }
35 }