summaryrefslogtreecommitdiff
path: root/media-sound/cvoicecontrol/files/cvoicecontrol-0.9_alpha-gentoo-2.patch
blob: 2316e92ba96c7a59c3529be7e5857415461fe53b (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
--- a/cvoicecontrol/audio.c
+++ b/cvoicecontrol/audio.c
@@ -32,6 +32,10 @@
 
 int is_open = 0;
 
+int   fd_audio;
+char *dev_audio;
+signed short rec_level, stop_level, silence_level;
+
 /********************************************************************************
  * set name of audio device
  ********************************************************************************/
--- a/cvoicecontrol/audio.h
+++ b/cvoicecontrol/audio.h
@@ -31,8 +31,8 @@
 #define CONSECUTIVE_SPEECH_BLOCKS_THRESHOLD    3
 #define CONSECUTIVE_NONSPEECH_BLOCKS_THRESHOLD 5
 
-int   fd_audio;
-char *dev_audio;
+extern int   fd_audio;
+extern char *dev_audio;
 
 /********************************************************************************
  * For now, microphone input level is used to start and stop recording
@@ -43,7 +43,7 @@
  * silence_level  average micro level of silence
  ********************************************************************************/
 
-signed short rec_level, stop_level, silence_level;
+extern signed short rec_level, stop_level, silence_level;
 
 typedef struct
 {
--- a/cvoicecontrol/cvoicecontrol.c
+++ b/cvoicecontrol/cvoicecontrol.c
@@ -38,6 +38,8 @@
 #include<sys/select.h>
 #endif
 
+#include <values.h>
+
 #include "cvoicecontrol.h"
 
 #include "model.h"
@@ -53,6 +55,10 @@
 #include "mixer.h"
 #include "preprocess.h"
 
+int adjust_window_width;
+int sloppy_corner;
+float float_max;
+
 Model *model; /***** speaker model */
 
 Queue queue1; /***** thread-safe queue used to hand data from 'recording' to 'preprocessing' */
@@ -341,7 +347,7 @@
  * calculate euklidian distance of two feature vectors
  ********************************************************************************/
 
-inline float euklid_distance(float *a, float *b)
+float euklid_distance(float *a, float *b)
 {
   float result = 0; /***** resulting distance */
   int i;
--- a/cvoicecontrol/cvoicecontrol.h
+++ b/cvoicecontrol/cvoicecontrol.h
@@ -66,7 +66,7 @@
  *
  *       Legend:  w = adjust_window_width
  */
-int adjust_window_width;
+extern int adjust_window_width;
 
 /*
  * strictly speaking, time-alignment in the DTW matrix starts
@@ -87,19 +87,19 @@
  *
  *    Legend: x = distance value,  o = (infinity)
  */
-int sloppy_corner;
+extern int sloppy_corner;
 
 /*****
   time alignment scores must stay below this value
   otherwise the according samples are ignored in
   the further evaluation process
   *****/
-float score_threshold;
+extern float score_threshold;
 
 /*****
   a (very high) float value that is considered "infinity"
   *****/
-float float_max;
+extern float float_max;
 
 /***** these macros are used in the DTW warping function
   to calculate the maximum/minimum of two or three
--- a/cvoicecontrol/microphone_config.c
+++ b/cvoicecontrol/microphone_config.c
@@ -1099,8 +1099,6 @@
       free(command);
     }
     fclose(f);
-
-    free(home);
   }
   else /***** couldn't retrieve home directory -> store results in /tmp/ */
   {
--- a/cvoicecontrol/mixer.c
+++ b/cvoicecontrol/mixer.c
@@ -30,6 +30,9 @@
 
 char *dev_mixer = NULL;
 
+int mic_level;
+int igain_level;
+
 /********************************************************************************
  * set mixer device name
  ********************************************************************************/
--- a/cvoicecontrol/mixer.h
+++ b/cvoicecontrol/mixer.h
@@ -37,7 +37,7 @@
 #define MIXER_ERR -1
 #define MIXER_OK  1
 
-int mic_level;
-int igain_level;
+extern int mic_level;
+extern int igain_level;
 
 #endif
--- a/cvoicecontrol/preprocess.c
+++ b/cvoicecontrol/preprocess.c
@@ -23,6 +23,13 @@
 
 int i,j; /***** counter variables */
 
+int   filter_banks[17];
+float power_spec[POWER_SPEC_SIZE];
+float hamming_window[HAMMING_SIZE];
+int   do_mean_sub;
+float channel_mean[FEAT_VEC_SIZE];
+float score_threshold;
+
 /********************************************************************************
  * initialize preprocessing s tuff
  ********************************************************************************/
--- a/cvoicecontrol/preprocess.h
+++ b/cvoicecontrol/preprocess.h
@@ -51,12 +51,12 @@
 /*****
   used for reduction of short-time spectrum to mel scale coefficients
   *****/
-int   filter_banks[17];
+extern int   filter_banks[17];
 
 /*****
   contains the power spectrum
   *****/
-float power_spec[POWER_SPEC_SIZE];
+extern float power_spec[POWER_SPEC_SIZE];
 
 /********************************************************************************
  * Hamming window width = 16ms ! (256 Frames)
@@ -68,15 +68,15 @@
  * to reduce the number of artefacts in the power spectrum
  ********************************************************************************/
 
-float hamming_window[HAMMING_SIZE];
+extern float hamming_window[HAMMING_SIZE];
 
 /*****
   The characteristics of the recording channel
   This is substracted from each feature vector to reduce
   channel effects
   *****/
-int   do_mean_sub;
-float channel_mean[FEAT_VEC_SIZE];
+extern int   do_mean_sub;
+extern float channel_mean[FEAT_VEC_SIZE];
 
 
 int  initPreprocess();
--- a/cvoicecontrol/semaphore.c
+++ b/cvoicecontrol/semaphore.c
@@ -26,6 +26,7 @@
 ****************************************************************************/
 
 #include "semaphore.h"
+#include <stdlib.h>
 
 /********************************************************************************
  * function must be called prior to semaphore use.