File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -57,31 +57,25 @@ class BufferedWindow : public WindowFunction {
57
57
BufferedWindow (BufferedWindow const &) = delete ;
58
58
BufferedWindow& operator =(BufferedWindow const &) = delete ;
59
59
60
-
61
60
virtual void begin (int samples) {
62
61
// process only if there is a change
63
62
if (p_wf->samples () != samples) {
64
63
p_wf->begin (samples);
65
64
len = samples / 2 ;
66
- if (p_buffer != nullptr ) delete[] p_buffer;
67
- p_buffer = new float [len];
65
+ buffer.resize (len);
68
66
for (int j = 0 ; j < len; j++) {
69
- p_buffer [j] = p_wf->factor (j);
67
+ buffer [j] = p_wf->factor (j);
70
68
}
71
69
}
72
70
}
73
71
74
- ~BufferedWindow () {
75
- if (p_buffer != nullptr ) delete[] p_buffer;
76
- }
77
-
78
72
inline float factor (int idx) {
79
- return idx < len ? p_buffer [idx] : p_buffer [i_samples - idx];
73
+ return idx < len ? buffer [idx] : buffer [i_samples - idx];
80
74
}
81
75
82
76
protected:
83
77
WindowFunction* p_wf = nullptr ;
84
- float * p_buffer = nullptr ;
78
+ Vector< float > buffer{ 0 } ;
85
79
int len;
86
80
};
87
81
You can’t perform that action at this time.
0 commit comments