BSoftSynth: Revert to Pete's original code

When you change code that you don't understand correctly... just DON'T.
Fixes a crash.
This commit is contained in:
Stefano Ceccherini
2014-09-22 07:24:16 +02:00
parent e4c33a936d
commit 1d5966ca12
+5 -8
View File
@@ -531,10 +531,12 @@ BSoftSynth::PlayBuffer(void* cookie, void* data, size_t size,
{ {
BSoftSynth* synth = (BSoftSynth*)cookie; BSoftSynth* synth = (BSoftSynth*)cookie;
if (synth->fMonitor != NULL) { if (synth->fMonitorSize == 0) {
delete[] synth->fMonitor; synth->fMonitor = (float*)new void*[size];
synth->fMonitor = NULL; synth->fMonitorSize = size;
synth->fMonitorChans = format.channel_count;
} }
// we use float samples // we use float samples
if (synth->fSynth) { if (synth->fSynth) {
fluid_synth_write_float( fluid_synth_write_float(
@@ -542,12 +544,7 @@ BSoftSynth::PlayBuffer(void* cookie, void* data, size_t size,
data, 0, format.channel_count, data, 0, format.channel_count,
data, 1, format.channel_count); data, 1, format.channel_count);
synth->fMonitor = new float[size];
synth->fMonitorSize = size;
synth->fMonitorChans = format.channel_count;
memcpy(synth->fMonitor, data, size); memcpy(synth->fMonitor, data, size);
} }
} }