Ticket #8404: mt32-mem.patch

File mt32-mem.patch, 2.8 KB (added by fingolfin, 15 years ago)

The patch

  • sound/softsynth/mt32/partial.cpp

    RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/partial.cpp,v
    retrieving revision 1.1
    diff -u -d -r1.1 partial.cpp
     
    2020 */
    2121
    2222#include <stdlib.h>
     23#include <assert.h>
    2324#include <math.h>
    2425#include <string.h>
    2526
     
    138139        play = true;
    139140        initKeyFollow(poly->freqnum); // Initialises noteVal, filtVal and realVal
    140141#if MT32EMU_ACCURATENOTES == 0
     142        assert(noteLookups);
    141143        noteLookup = &noteLookups[noteVal - LOWEST_NOTE];
    142144#else
    143145        TableInitialiser::initNote(synth, &noteLookupStorage, noteVal, (float)synth->myProp.sampleRate, synth->masterTune, synth->PCMList, NULL);
  • sound/softsynth/mt32/synth.cpp

    RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/synth.cpp,v
    retrieving revision 1.1
    diff -u -d -r1.1 synth.cpp
     
    7979        isOpen = false;
    8080        reverbModel = NULL;
    8181        partialManager = NULL;
    82         memset(noteLookups, 0, sizeof(noteLookups));
    8382        memset(parts, 0, sizeof(parts));
    8483}
    8584
  • sound/softsynth/mt32/tables.cpp

    RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/tables.cpp,v
    retrieving revision 1.1
    diff -u -d -r1.1 tables.cpp
     
    6868float ResonFactor[31];
    6969float ResonInv[31];
    7070
    71 NoteLookup noteLookups[NUM_NOTES];
     71NoteLookup *noteLookups = 0;
     72//NoteLookup noteLookups[NUM_NOTES];
    7273
    7374// Begin filter stuff
    7475
     
    645646        }
    646647#endif
    647648
     649        noteLookups = new NoteLookup[NUM_NOTES];
     650        memset(noteLookups, 0, sizeof(NoteLookup) * NUM_NOTES);
     651
    648652        float progress = 0.0f;
    649653        bool abort = false;
    650654        synth->report(ReportType_progressInit, &progress);
     
    700704                        }
    701705                }
    702706        }
     707        delete [] noteLookups;
    703708        initialisedMasterTune = 0.0f;
    704709}
    705710
  • sound/softsynth/mt32/tables.h

    RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/tables.h,v
    retrieving revision 1.1
    diff -u -d -r1.1 tables.h
     
    8484        Bit32u waveformSize[3];
    8585};
    8686
    87 extern NoteLookup noteLookups[NUM_NOTES];
     87extern NoteLookup *noteLookups;
     88//extern NoteLookup noteLookups[NUM_NOTES];
    8889
    8990class TableInitialiser {
    9091        static void initMT32ConstantTables(Synth *synth);