Ticket #8332: adlib.cpp.diff

File adlib.cpp.diff, 1.7 KB (added by SF/damienguard, 20 years ago)
  • adlib.cpp

    RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
    retrieving revision 1.54
    diff -u -r1.54 adlib.cpp
     
    573573        bool _isOpen;
    574574        bool _game_SmallHeader;
    575575
     576        static Common::RandomSource _rnd;
     577
    576578        FM_OPL *_opl;
    577579        byte *_adlib_reg_cache;
    578580        SoundMixer *_mixer;
     
    624626        void struct10_init(Struct10 * s10, InstrumentExtra * ie);
    625627        static byte struct10_ontimer(Struct10 * s10, Struct11 * s11);
    626628        static void struct10_setup(Struct10 * s10);
    627         static int random_nr(int a);
    628629        void mc_key_on(AdlibVoice *voice, AdlibInstrument *instr, byte note, byte velocity);
    629630
    630631        static void premix_proc(void *param, int16 *buf, uint len);
     
    12341235        t = s10->table_a[f];
    12351236        e = num_steps_table[lookup_table[t & 0x7F][b]];
    12361237        if (t & 0x80) {
    1237                 e = random_nr(e);
     1238                e = _rnd.getRandomNumber(e);
    12381239        }
    12391240        if (e == 0)
    12401241                e++;
     
    12471248                t = s10->table_b[f];
    12481249                d = lookup_volume(c, (t & 0x7F) - 31);
    12491250                if (t & 0x80) {
    1250                         d = random_nr(d);
     1251                        d = _rnd.getRandomNumber(d);
    12511252                }
    12521253                if (d + g > c) {
    12531254                        h = c - g;
     
    13091310        adlib_write(channel + 0xB0, oct | 0x20);
    13101311}
    13111312
    1312 int MidiDriver_ADLIB::random_nr(int a) {
    1313         static byte _rand_seed = 1;
    1314         if (_rand_seed & 1) {
    1315                 _rand_seed >>= 1;
    1316                 _rand_seed ^= 0xB8;
    1317         } else {
    1318                 _rand_seed >>= 1;
    1319         }
    1320         return _rand_seed * a >> 8;
    1321 }
    1322 
    13231313void MidiDriver_ADLIB::part_key_off(AdlibPart *part, byte note) {
    13241314        AdlibVoice *voice;
    13251315
     
    15681558        curnote_table[chan] = code;
    15691559        adlib_playnote(chan, (int16) channel_table_2[chan] + code);
    15701560}
     1561
     1562Common::RandomSource MidiDriver_ADLIB::_rnd;