@@ -31,18 +31,18 @@ class WindowFunction {
31
31
32
32
inline float ratio (int idx) {
33
33
float result = (static_cast <float >(idx)) / samples_minus_1;
34
- return result>1.0 ? 1.0 : result;
34
+ return result>1 .0f ? 1 .0f : result;
35
35
}
36
36
37
37
inline int samples () { return i_samples; }
38
38
virtual float factor (int idx) = 0;
39
39
40
40
protected:
41
- float samples_minus_1 = 0 ;
41
+ float samples_minus_1 = 0 . 0f ;
42
42
int i_samples = 0 ;
43
- const float twoPi = 6.28318531 ;
44
- const float fourPi = 12.56637061 ;
45
- const float sixPi = 18.84955593 ;
43
+ const float twoPi = 6 .28318531f ;
44
+ const float fourPi = 12 .56637061f ;
45
+ const float sixPi = 18 .84955593f ;
46
46
};
47
47
48
48
/* *
@@ -93,7 +93,7 @@ class BufferedWindow : public WindowFunction {
93
93
class Rectange : public WindowFunction {
94
94
public:
95
95
Rectange () = default ;
96
- float factor (int idx) { return 1.0 ; }
96
+ float factor (int idx) { return 1 .0f ; }
97
97
};
98
98
99
99
/* *
@@ -105,7 +105,7 @@ class Hamming : public WindowFunction {
105
105
public:
106
106
Hamming () = default ;
107
107
float factor (int idx) {
108
- return 0.54 - (0.46 * cos (twoPi * ratio (idx)));
108
+ return 0 .54f - (0 .46f * cos (twoPi * ratio (idx)));
109
109
}
110
110
};
111
111
@@ -118,7 +118,7 @@ class Hann : public WindowFunction {
118
118
public:
119
119
Hann () = default ;
120
120
float factor (int idx) {
121
- return 0.54 * (1.0 - cos (twoPi * ratio (idx)));
121
+ return 0 .54f * (1 .0f - cos (twoPi * ratio (idx)));
122
122
}
123
123
};
124
124
@@ -131,8 +131,8 @@ class Triangle : public WindowFunction {
131
131
public:
132
132
Triangle () = default ;
133
133
float factor (int idx) {
134
- return 1.0 - ((2.0 * fabs ((idx - 1 ) -
135
- (static_cast <float >(i_samples - 1 ) / 2.0 ))) /
134
+ return 1 .0f - ((2 .0f * fabs ((idx - 1 ) -
135
+ (static_cast <float >(i_samples - 1 ) / 2 .0f ))) /
136
136
samples_minus_1);
137
137
}
138
138
};
@@ -148,8 +148,8 @@ class Nuttall : public WindowFunction {
148
148
Nuttall () = default ;
149
149
float factor (int idx) {
150
150
float r = ratio (idx);
151
- return 0.355768 - (0.487396 * (cos (twoPi * r))) +
152
- (0.144232 * (cos (fourPi * r))) - (0.012604 * (cos (sixPi * r)));
151
+ return 0 .355768f - (0 .487396f * (cos (twoPi * r))) +
152
+ (0 .144232f * (cos (fourPi * r))) - (0 .012604f * (cos (sixPi * r)));
153
153
}
154
154
};
155
155
@@ -164,8 +164,8 @@ class Blackman : public WindowFunction {
164
164
Blackman () = default ;
165
165
float factor (int idx) {
166
166
float r = ratio (idx);
167
- return 0.42323 - (0.49755 * (cos (twoPi * r))) +
168
- (0.07922 * (cos (fourPi * r)));
167
+ return 0 .42323f - (0 .49755f * (cos (twoPi * r))) +
168
+ (0 .07922f * (cos (fourPi * r)));
169
169
}
170
170
};
171
171
@@ -179,8 +179,8 @@ class BlackmanNuttall : public WindowFunction {
179
179
BlackmanNuttall () = default ;
180
180
float factor (int idx) {
181
181
float r = ratio (idx);
182
- return 0.3635819 - (0.4891775 * (cos (twoPi * r))) +
183
- (0.1365995 * (cos (fourPi * r))) - (0.0106411 * (cos (sixPi * r)));
182
+ return 0 .3635819f - (0 .4891775f * (cos (twoPi * r))) +
183
+ (0 .1365995f * (cos (fourPi * r))) - (0 .0106411f * (cos (sixPi * r)));
184
184
}
185
185
};
186
186
@@ -194,8 +194,8 @@ class BlackmanHarris : public WindowFunction {
194
194
BlackmanHarris () = default ;
195
195
float factor (int idx) {
196
196
float r = ratio (idx);
197
- return 0.35875 - (0.48829 * (cos (twoPi * r))) +
198
- (0.14128 * (cos (fourPi * r))) - (0.01168 * (cos (sixPi * r)));
197
+ return 0 .35875f - (0 .48829f * (cos (twoPi * r))) +
198
+ (0 .14128f * (cos (fourPi * r))) - (0 .01168f * (cos (sixPi * r)));
199
199
}
200
200
};
201
201
@@ -209,8 +209,8 @@ class FlatTop : public WindowFunction {
209
209
FlatTop () = default ;
210
210
float factor (int idx) {
211
211
float r = ratio (idx);
212
- return 0.2810639 - (0.5208972 * cos (twoPi * r)) +
213
- (0.1980399 * cos (fourPi * r));
212
+ return 0 .2810639f - (0 .5208972f * cos (twoPi * r)) +
213
+ (0 .1980399f * cos (fourPi * r));
214
214
}
215
215
};
216
216
@@ -223,8 +223,8 @@ class Welch : public WindowFunction {
223
223
public:
224
224
Welch () = default ;
225
225
float factor (int idx) {
226
- float tmp = (((idx - 1 ) - samples_minus_1 / 2.0 ) / (samples_minus_1 / 2.0 ));
227
- return 1.0 - (tmp*tmp);
226
+ float tmp = (((idx - 1 ) - samples_minus_1 / 2 .0f ) / (samples_minus_1 / 2 .0f ));
227
+ return 1 .0f - (tmp*tmp);
228
228
}
229
229
};
230
230
0 commit comments