RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
retrieving revision 1.54
diff -u -r1.54 adlib.cpp
|
|
|
573 | 573 | bool _isOpen; |
574 | 574 | bool _game_SmallHeader; |
575 | 575 | |
| 576 | static Common::RandomSource _rnd; |
| 577 | |
576 | 578 | FM_OPL *_opl; |
577 | 579 | byte *_adlib_reg_cache; |
578 | 580 | SoundMixer *_mixer; |
… |
… |
|
624 | 626 | void struct10_init(Struct10 * s10, InstrumentExtra * ie); |
625 | 627 | static byte struct10_ontimer(Struct10 * s10, Struct11 * s11); |
626 | 628 | static void struct10_setup(Struct10 * s10); |
627 | | static int random_nr(int a); |
628 | 629 | void mc_key_on(AdlibVoice *voice, AdlibInstrument *instr, byte note, byte velocity); |
629 | 630 | |
630 | 631 | static void premix_proc(void *param, int16 *buf, uint len); |
… |
… |
|
1234 | 1235 | t = s10->table_a[f]; |
1235 | 1236 | e = num_steps_table[lookup_table[t & 0x7F][b]]; |
1236 | 1237 | if (t & 0x80) { |
1237 | | e = random_nr(e); |
| 1238 | e = _rnd.getRandomNumber(e); |
1238 | 1239 | } |
1239 | 1240 | if (e == 0) |
1240 | 1241 | e++; |
… |
… |
|
1247 | 1248 | t = s10->table_b[f]; |
1248 | 1249 | d = lookup_volume(c, (t & 0x7F) - 31); |
1249 | 1250 | if (t & 0x80) { |
1250 | | d = random_nr(d); |
| 1251 | d = _rnd.getRandomNumber(d); |
1251 | 1252 | } |
1252 | 1253 | if (d + g > c) { |
1253 | 1254 | h = c - g; |
… |
… |
|
1309 | 1310 | adlib_write(channel + 0xB0, oct | 0x20); |
1310 | 1311 | } |
1311 | 1312 | |
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 | | |
1323 | 1313 | void MidiDriver_ADLIB::part_key_off(AdlibPart *part, byte note) { |
1324 | 1314 | AdlibVoice *voice; |
1325 | 1315 | |
… |
… |
|
1568 | 1558 | curnote_table[chan] = code; |
1569 | 1559 | adlib_playnote(chan, (int16) channel_table_2[chan] + code); |
1570 | 1560 | } |
| 1561 | |
| 1562 | Common::RandomSource MidiDriver_ADLIB::_rnd; |