comparison widgets/WindowShapePreview.cpp @ 1150:0edfed2c8482 msvc2015_64

MSVC build fixes
author Chris Cannam
date Tue, 18 Oct 2016 15:55:50 +0100
parents 6645b6b8356f
children c5a82068bd60
comparison
equal deleted inserted replaced
1149:0d04b1cdb9f9 1150:0edfed2c8482
24 24
25 #include "data/fft/FFTapi.h" 25 #include "data/fft/FFTapi.h"
26 26
27 #include <iostream> 27 #include <iostream>
28 28
29 #ifndef __GNUC__
30 #include <alloca.h>
31 #endif
32 29
33 WindowShapePreview::WindowShapePreview(QWidget *parent) : 30 WindowShapePreview::WindowShapePreview(QWidget *parent) :
34 QFrame(parent), 31 QFrame(parent),
35 m_windowType(HanningWindow) 32 m_windowType(HanningWindow)
36 { 33 {
69 timePainter.setRenderHint(QPainter::Antialiasing, true); 66 timePainter.setRenderHint(QPainter::Antialiasing, true);
70 timePainter.drawPath(path); 67 timePainter.drawPath(path);
71 68
72 path = QPainterPath(); 69 path = QPainterPath();
73 70
74 #ifdef __GNUC__ 71 float *acc = new float(w);
75 float acc[w];
76 #else
77 float *acc = (float *)alloca(w * sizeof(float));
78 #endif
79
80 for (int i = 0; i < w; ++i) acc[i] = 0.f; 72 for (int i = 0; i < w; ++i) acc[i] = 0.f;
81 for (int j = 0; j < 3; ++j) { 73 for (int j = 0; j < 3; ++j) {
82 for (int i = 0; i < step * 2; ++i) { 74 for (int i = 0; i < step * 2; ++i) {
83 acc[j * step + i] += windower.getValue(i); 75 acc[j * step + i] += windower.getValue(i);
84 } 76 }
86 for (int i = 0; i < w; ++i) { 78 for (int i = 0; i < w; ++i) {
87 int y = h - int(peak * acc[i] + 0.001f) + 1; 79 int y = h - int(peak * acc[i] + 0.001f) + 1;
88 if (i == 0) path.moveTo(i, y); 80 if (i == 0) path.moveTo(i, y);
89 else path.lineTo(i, y); 81 else path.lineTo(i, y);
90 } 82 }
83 delete[] acc;
91 84
92 timePainter.drawPath(path); 85 timePainter.drawPath(path);
93 timePainter.setRenderHint(QPainter::Antialiasing, false); 86 timePainter.setRenderHint(QPainter::Antialiasing, false);
94 87
95 path = QPainterPath(); 88 path = QPainterPath();