/
vocab.cpp
executable file
·64 lines (59 loc) · 1.14 KB
/
vocab.cpp
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
#include "uspeech.h"
syllable::syllable(){
f = 0; e = 0; o = 0; s = 0; h = 0; v = 0;
}
/***
* Classify a character into f,e,o,s,h; Call during main loop
* @param c the phoneme
*/
void syllable::classify(char c){
switch (c) {
case 'f':
f++;
break;
case 'e':
e++;
break;
case 'o':
o++;
break;
case 'v':
v++;
break;
case 'h':
h++;
break;
case 's':
s++;
break;
default:
break;
}
}
#if ARDUINO_ENVIRONMENT > 0
void syllable::debugPrint(){
Serial.print("[ ");
Serial.print(f);
Serial.print(", ");
Serial.print(e);
Serial.print(", ");
Serial.print(o);
Serial.print(", ");
Serial.print(v);
Serial.print(", ");
Serial.print(h);
Serial.print(", ");
Serial.print(s);
Serial.print("]");
}
#endif
int* syllable::tointptr(){
static int matrix[6];
matrix[0] = f;
matrix[1] = e;
matrix[2] = o;
matrix[3] = v;
matrix[4] = h;
matrix[5] = s;
return matrix;
}