File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ static MusicalNotes AudioFFTNotes;
2121 * @ingroup fft
2222 */
2323struct AudioFFTResult {
24- int bin;
25- float magnitude;
26- float frequency;
24+ int bin = 0 ;
25+ float magnitude = 0 . 0f ;
26+ float frequency = 0 . 0f ;
2727
2828 int frequencyAsInt () { return round (frequency); }
2929 const char *frequencyAsNote () { return AudioFFTNotes.note (frequency); }
@@ -356,7 +356,7 @@ class AudioFFTBase : public AudioStream {
356356 // / Determines the result values in the max magnitude bin
357357 AudioFFTResult result () {
358358 AudioFFTResult ret_value;
359- ret_value.magnitude = 0 ;
359+ ret_value.magnitude = 0 . 0f ;
360360 ret_value.bin = 0 ;
361361 // find max value and index
362362 for (int j = 0 ; j < size (); j++) {
@@ -509,7 +509,9 @@ class AudioFFTBase : public AudioStream {
509509 assert (sample_count == cfg.length );
510510 for (int j=0 ; j< sample_count; j++){
511511 T out_sample = samples[j];
512- p_driver->setValue (j, windowedSample (out_sample, j));
512+ T windowed_sample = windowedSample (out_sample, j);
513+ float scaled_sample = 1 .0f / NumberConverter::maxValueT<T>() * windowed_sample;
514+ p_driver->setValue (j, scaled_sample);
513515 }
514516
515517 fft<T>();
You can’t perform that action at this time.
0 commit comments