Ticket #8370: kyra-music.diff
File kyra-music.diff, 2.8 KB (added by , 20 years ago) |
---|
-
kyra/kyra.cpp
diff -ur ScummVM-cvs20041113/kyra/kyra.cpp ScummVM-cvs20041113+hack/kyra/kyra.cpp
old new 121 121 } else { 122 122 error("unknown game"); 123 123 } 124 125 MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_PREFER_NATIVE)); 126 if (driver) { 127 if (ConfMan.getBool("native_mt32")) 128 driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); 129 _midiDriver = new MusicPlayer(driver, this); 130 assert(_midiDriver); 131 _midiDriver->hasNativeMT32(ConfMan.getBool("native_mt32")); 132 _midiDriver->setVolume(255); 133 } else { 134 warning("Couldn't create MIDI driver... No music!"); 135 _midiDriver = NULL; 136 }; 124 125 int midiDrv = GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE); 126 bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDrv == MD_MT32)); 127 128 MidiDriver *driver = GameDetector::createMidi(midiDrv); 129 if (!driver) { 130 // In this case we should play the Adlib tracks, but for now 131 // the automagic MIDI-to-Adlib conversion will do. 132 driver = MidiDriver_ADLIB_create(_mixer); 133 } else if (native_mt32) 134 driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); 135 136 _midiDriver = new MusicPlayer(driver, this); 137 assert(_midiDriver); 138 _midiDriver->hasNativeMT32(native_mt32); 139 _midiDriver->setVolume(255); 140 141 if (midiDrv == MD_MT32) 142 _midiDriver->setPassThrough(true); 137 143 138 144 // Initialize backen 139 145 syst->initSize(320, 200); -
kyra/sound.cpp
diff -ur ScummVM-cvs20041113/kyra/sound.cpp ScummVM-cvs20041113+hack/kyra/sound.cpp
old new 18 18 MusicPlayer::MusicPlayer(MidiDriver* driver, KyraEngine* engine) { 19 19 _engine = engine; 20 20 _driver = driver; 21 _passThrough = false; 21 22 _isPlaying = _nativeMT32 = false; 22 23 23 24 memset(_channel, 0, sizeof(MidiChannel*) * 16); … … 73 74 } 74 75 75 76 void MusicPlayer::send(uint32 b) { 77 if (_passThrough) { 78 _driver->send(b); 79 return; 80 } 81 76 82 uint8 channel = (byte)(b & 0x0F); 77 83 if ((b & 0xFFF0) == 0x07B0) { 78 84 // Adjust volume changes by master volume -
kyra/sound.h
diff -ur ScummVM-cvs20041113/kyra/sound.h ScummVM-cvs20041113+hack/kyra/sound.h
old new 25 25 void stopMusic(); 26 26 27 27 void playTrack(uint8 track); 28 void setPassThrough(bool b) { _passThrough = b; } 28 29 29 30 //MidiDriver interface implementation 30 31 int open(); … … 47 48 uint8 _channelVolume[16]; 48 49 MidiDriver* _driver; 49 50 bool _nativeMT32; 51 bool _passThrough; 50 52 uint8 _volume; 51 53 bool _isPlaying; 52 54 MidiParser* _parser;