Skip to content

Commit 04f2f43

Browse files
authored
Replace non-standard VLAs with std::vector in Visualizer stereo mode (#654)
Co-authored-by: Devon Kirk <hyder365@users.noreply.github.com>
1 parent cb9c8df commit 04f2f43

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/screens/visualizer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <fcntl.h>
3434
#include <netdb.h>
3535
#include <cassert>
36+
#include <vector>
3637

3738
#include "global.h"
3839
#include "settings.h"
@@ -219,15 +220,15 @@ void Visualizer::update()
219220
if (Config.visualizer_in_stereo)
220221
{
221222
auto chan_samples = m_rendered_samples.size()/2;
222-
int16_t buf_left[chan_samples], buf_right[chan_samples];
223+
std::vector<int16_t> buf_left(chan_samples), buf_right(chan_samples);
223224
for (size_t i = 0, j = 0; i < m_rendered_samples.size(); i += 2, ++j)
224225
{
225226
buf_left[j] = m_rendered_samples[i];
226227
buf_right[j] = m_rendered_samples[i+1];
227228
}
228229
size_t half_height = w.getHeight()/2;
229230

230-
(this->*drawStereo)(buf_left, buf_right, chan_samples, half_height);
231+
(this->*drawStereo)(buf_left.data(), buf_right.data(), chan_samples, half_height);
231232
}
232233
else
233234
{

0 commit comments

Comments
 (0)