hrev47895 adds 1 changeset to branch 'master' old head: e4c33a936dfb2c2b77fd3958714a98bc5635310f new head: 1d5966ca12b838e711b3951abb5dc864a495a881 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=1d5966c+%5Ee4c33a9 ---------------------------------------------------------------------------- 1d5966c: BSoftSynth: Revert to Pete's original code When you change code that you don't understand correctly... just DON'T. Fixes a crash. [ Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47895 Commit: 1d5966ca12b838e711b3951abb5dc864a495a881 URL: http://cgit.haiku-os.org/haiku/commit/?id=1d5966c Author: Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> Date: Mon Sep 22 05:20:52 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 5 insertions(+), 8 deletions(-) src/kits/midi/SoftSynth.cpp | 13 +++++-------- ---------------------------------------------------------------------------- diff --git a/src/kits/midi/SoftSynth.cpp b/src/kits/midi/SoftSynth.cpp index f2ca29c..ac4190d 100644 --- a/src/kits/midi/SoftSynth.cpp +++ b/src/kits/midi/SoftSynth.cpp @@ -531,10 +531,12 @@ BSoftSynth::PlayBuffer(void* cookie, void* data, size_t size, { BSoftSynth* synth = (BSoftSynth*)cookie; - if (synth->fMonitor != NULL) { - delete[] synth->fMonitor; - synth->fMonitor = NULL; + if (synth->fMonitorSize == 0) { + synth->fMonitor = (float*)new void*[size]; + synth->fMonitorSize = size; + synth->fMonitorChans = format.channel_count; } + // we use float samples if (synth->fSynth) { fluid_synth_write_float( @@ -542,12 +544,7 @@ BSoftSynth::PlayBuffer(void* cookie, void* data, size_t size, data, 0, 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); } - - }