-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmandarinbass.c
87 lines (73 loc) · 1.55 KB
/
mandarinbass.c
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
#include <stdio.h>
#include <unistd.h>
#include <term.h>
#include <termios.h>
#define yrt(ch,nm)\
case ch: \
fprintf(stdout,"i 3 0 1 8000 %f\n",nm); break
#define art(ch,nm)\
case ch: \
fprintf(stdout,"i 2 0 1 8000 %f\n",nm); break
#define qrt(ch,nm)\
case ch: \
fprintf(stdout,"i 4 0 1 8000 %f\n",nm); break
#define drt(ch,nm)\
case ch: \
fprintf(stdout,"i %d 0 1 8000 \n",nm); break
#define prt(ch,nm)\
case ch: \
p = nm; break
int main(void){
int p;
int c;
static struct termios oldt, newt;
p = 1;
tcgetattr( STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr( STDIN_FILENO, TCSANOW, &newt);
while((c=getchar())!= 27) {
switch(c) {
yrt('z',1.0);
yrt('x',27.0/22.0);
yrt('c',4.0/3.0);
yrt('v',3.0/2.0);
yrt('b',7.0/5.0);
yrt('n',5.0/3.0);
yrt('m',49.0/27.0);
yrt(',',170);
yrt('.',180);
yrt('<',190);
art('a',1.0);
art('s',27.0/22.0);
art('d',4.0/3.0);
art('f',3.0/2.0);
art('g',7.0/5.0);
art('h',5.0/3.0);
art('j',49.0/27.0);
art('k',1800);
art('l',1900);
art(';',2000);
qrt('q',1.0);
qrt('w',27.0/22.0);
qrt('e',4.0/3.0);
qrt('r',3.0/2.0);
qrt('t',7.0/5.0);
qrt('y',5.0/3.0);
qrt('u',49.0/27.0);
qrt('i',1800);
qrt('o',1900);
qrt('p',2000);
drt('4',4);
drt('5',5);
drt('6',6);
case '7':
fprintf(stdout,"i 2 0 1 1 1.22\ni 2 1 1 3 4.33\ni 2 2 1 3 4.33\n");
break;
}
// fflush( csound_pointer );
fflush(stdout);
}
tcsetattr( STDIN_FILENO, TCSANOW, &oldt);
return 0;
}