-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vumeter-qt: Do not use variable length arrays
They are not officially supported in C++.
- Loading branch information
1 parent
1f02fb1
commit 9154d19
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ void VUMeterQtWidget::render_multi_pcm (const float * pcm, int channels) | |
{ | ||
nchannels = aud::clamp(channels, 0, max_channels); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
radioactiveman
Author
Member
|
||
|
||
float peaks[nchannels]; | ||
float * peaks = new float[nchannels]; | ||
for (int channel = 0; channel < nchannels; channel++) | ||
{ | ||
peaks[channel] = fabsf(pcm[channel]); | ||
|
@@ -120,6 +120,8 @@ void VUMeterQtWidget::render_multi_pcm (const float * pcm, int channels) | |
last_peak_times[i].start(); | ||
} | ||
} | ||
|
||
delete[] peaks; | ||
} | ||
|
||
void VUMeterQtWidget::redraw_timer_expired() | ||
|
If
nchannels
was declared here asconstexpr
, it would have worked as you wanted, without the need to introducenew[]
/[]delete
operators.