MSVC: Fix SID (#4505)

Use the provided working buffer instead of a local one to avoid use of VLA
This commit is contained in:
Lukas W
2019-01-07 01:27:58 +01:00
committed by Tres Finocchiaro
parent 5ebe0e002d
commit a0ace860f4
2 changed files with 4 additions and 4 deletions

View File

@@ -91,8 +91,6 @@ ENDIF("${PLUGIN_LIST}" STREQUAL "")
IF(MSVC)
SET(MSVC_INCOMPATIBLE_PLUGINS
LadspaEffect
sid
#VstEffect
zynaddsubfx
)
message(WARNING "Compiling with MSVC. The following plugins are not available: ${MSVC_INCOMPATIBLE_PLUGINS}")

View File

@@ -324,7 +324,8 @@ void sidInstrument::playNote( NotePlayHandle * _n,
cSID *sid = static_cast<cSID *>( _n->m_pluginData );
int delta_t = clockrate * frames / samplerate + 4;
short buf[frames];
// avoid variable length array for msvc compat
short* buf = reinterpret_cast<short*>(_working_buffer + offset);
unsigned char sidreg[NUMSIDREGS];
for (int c = 0; c < NUMSIDREGS; c++)
@@ -429,7 +430,8 @@ void sidInstrument::playNote( NotePlayHandle * _n,
if(num!=frames)
printf("!!!Not enough samples\n");
for( fpp_t frame = 0; frame < frames; ++frame )
// loop backwards to avoid overwriting data in the short-to-float conversion
for( fpp_t frame = frames - 1; frame >= 0; frame-- )
{
sample_t s = float(buf[frame])/32768.0;
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )