ENGINES: Remove unused MIDI pass-through code

This commit is contained in:
Max Horn 2011-03-23 17:07:48 +01:00
parent e70fd59b35
commit 088bd7a70b
12 changed files with 22 additions and 76 deletions

View file

@ -71,7 +71,7 @@ MIDISound::MIDISound(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : A
warning("Error creating MIDI sound from resource %d (Type %d, length %d)", resnum, _type, len); warning("Error creating MIDI sound from resource %d (Type %d, length %d)", resnum, _type, len);
} }
SoundGenMIDI::SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _parser(0), _isPlaying(false), _passThrough(false), _isGM(false) { SoundGenMIDI::SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _parser(0), _isPlaying(false), _isGM(false) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB); MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
_driver = MidiDriver::createMidi(dev); _driver = MidiDriver::createMidi(dev);
assert(_driver); assert(_driver);
@ -135,11 +135,6 @@ void SoundGenMIDI::setVolume(int volume) {
} }
void SoundGenMIDI::send(uint32 b) { void SoundGenMIDI::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F); byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) { if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume // Adjust volume changes by master volume

View file

@ -54,19 +54,18 @@ public:
void play(int resnum); void play(int resnum);
void stop(); void stop();
bool isPlaying() { return _isPlaying; } bool isPlaying() const { return _isPlaying; }
void setPlaying(bool playing) { _isPlaying = playing; } void setPlaying(bool playing) { _isPlaying = playing; }
void setVolume(int volume); void setVolume(int volume);
int getVolume() { return _masterVolume; } int getVolume() const { return _masterVolume; }
void syncVolume(); void syncVolume();
void setNativeMT32(bool b) { _nativeMT32 = b; } void setNativeMT32(bool b) { _nativeMT32 = b; }
bool hasNativeMT32() { return _nativeMT32; } bool hasNativeMT32() const { return _nativeMT32; }
void pause(); void pause();
void resume(); void resume();
void setLoop(bool loop) { _looping = loop; } void setLoop(bool loop) { _looping = loop; }
void setPassThrough(bool b) { _passThrough = b; }
void setGM(bool isGM) { _isGM = isGM; } void setGM(bool isGM) { _isGM = isGM; }
@ -88,7 +87,6 @@ private:
byte _channelVolume[16]; byte _channelVolume[16];
bool _nativeMT32; bool _nativeMT32;
bool _isGM; bool _isGM;
bool _passThrough;
bool _isPlaying; bool _isPlaying;
bool _looping; bool _looping;

View file

@ -45,7 +45,6 @@ MidiPlayer::MidiPlayer() {
// between songs. // between songs.
_driver = 0; _driver = 0;
_map_mt32_to_gm = false; _map_mt32_to_gm = false;
_passThrough = false;
_enable_sfx = true; _enable_sfx = true;
_current = 0; _current = 0;
@ -108,11 +107,6 @@ void MidiPlayer::send(uint32 b) {
if (!_current) if (!_current)
return; return;
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F); byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) { if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master music and master sfx volume. // Adjust volume changes by master music and master sfx volume.
@ -306,13 +300,6 @@ void MidiPlayer::setVolume(int musicVol, int sfxVol) {
} }
} }
void MidiPlayer::setDriver(MidiDriver *md) {
// Don't try to set this more than once.
if (_driver)
return;
_driver = md;
}
void MidiPlayer::setLoop(bool loop) { void MidiPlayer::setLoop(bool loop) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);

View file

@ -60,7 +60,6 @@ protected:
Common::Mutex _mutex; Common::Mutex _mutex;
MidiDriver *_driver; MidiDriver *_driver;
bool _map_mt32_to_gm; bool _map_mt32_to_gm;
bool _passThrough;
bool _nativeMT32; bool _nativeMT32;
MusicInfo _music; MusicInfo _music;
@ -106,14 +105,12 @@ public:
void stop(); void stop();
void pause(bool b); void pause(bool b);
int getMusicVolume() { return _musicVolume; } int getMusicVolume() const { return _musicVolume; }
int getSFXVolume() { return _sfxVolume; } int getSFXVolume() const { return _sfxVolume; }
void setVolume(int musicVol, int sfxVol); void setVolume(int musicVol, int sfxVol);
void setDriver(MidiDriver *md);
public: public:
int open(int gameType); int open(int gameType);
void setPassThrough(bool b) { _passThrough = b; }
// MidiDriver_BASE interface implementation // MidiDriver_BASE interface implementation
virtual void send(uint32 b); virtual void send(uint32 b);

View file

@ -36,7 +36,7 @@
namespace Draci { namespace Draci {
MusicPlayer::MusicPlayer(const char *pathMask) : _parser(0), _driver(0), _pathMask(pathMask), _looping(false), _isPlaying(false), _passThrough(false), _isGM(false), _track(-1) { MusicPlayer::MusicPlayer(const char *pathMask) : _parser(0), _driver(0), _pathMask(pathMask), _looping(false), _isPlaying(false), _isGM(false), _track(-1) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
_nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32")); _nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
@ -104,11 +104,6 @@ void MusicPlayer::setVolume(int volume) {
} }
void MusicPlayer::send(uint32 b) { void MusicPlayer::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F); byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) { if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume // Adjust volume changes by master volume

View file

@ -41,20 +41,19 @@ public:
MusicPlayer(const char *pathMask); MusicPlayer(const char *pathMask);
~MusicPlayer(); ~MusicPlayer();
bool isPlaying() { return _isPlaying; } bool isPlaying() const { return _isPlaying; }
void setPlaying(bool playing) { _isPlaying = playing; } void setPlaying(bool playing) { _isPlaying = playing; }
void setVolume(int volume); void setVolume(int volume);
int getVolume() { return _masterVolume; } int getVolume() const { return _masterVolume; }
void syncVolume(); void syncVolume();
bool hasNativeMT32() { return _nativeMT32; } bool hasNativeMT32() const { return _nativeMT32; }
void playSMF(int track, bool loop); void playSMF(int track, bool loop);
void stop(); void stop();
void pause(); void pause();
void resume(); void resume();
void setLoop(bool loop) { _looping = loop; } void setLoop(bool loop) { _looping = loop; }
void setPassThrough(bool b) { _passThrough = b; }
void setGM(bool isGM) { _isGM = isGM; } void setGM(bool isGM) { _isGM = isGM; }
@ -77,7 +76,6 @@ protected:
byte _channelVolume[16]; byte _channelVolume[16];
bool _nativeMT32; bool _nativeMT32;
bool _isGM; bool _isGM;
bool _passThrough;
bool _isPlaying; bool _isPlaying;
bool _looping; bool _looping;

View file

@ -615,8 +615,6 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
else else
setVolume(Sound.sfxVolume()); setVolume(Sound.sfxVolume());
_passThrough = false;
_parser = MidiParser::createParser_SMF(); _parser = MidiParser::createParser_SMF();
_parser->setMidiDriver(this); _parser->setMidiDriver(this);
_parser->setTimerRate(_driver->getBaseTempo()); _parser->setTimerRate(_driver->getBaseTempo());
@ -685,11 +683,6 @@ void MidiMusic::playMusic() {
} }
void MidiMusic::send(uint32 b) { void MidiMusic::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
#ifdef SOUND_CROP_CHANNELS #ifdef SOUND_CROP_CHANNELS
if ((b & 0xF) >= _numChannels) return; if ((b & 0xF) >= _numChannels) return;
byte channel = _channelNumber + (byte)(b & 0x0F); byte channel = _channelNumber + (byte)(b & 0x0F);

View file

@ -66,14 +66,12 @@ private:
uint32 songOffset(uint16 songNum) const; uint32 songOffset(uint16 songNum) const;
uint32 songLength(uint16 songNum) const; uint32 songLength(uint16 songNum) const;
bool _passThrough;
public: public:
MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS], MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
uint8 channelNum, uint8 soundNum, bool isMus, uint8 numChannels, void *soundData, uint32 size); uint8 channelNum, uint8 soundNum, bool isMus, uint8 numChannels, void *soundData, uint32 size);
~MidiMusic(); ~MidiMusic();
void setVolume(int volume); void setVolume(int volume);
int getVolume() { return _volume; } int getVolume() const { return _volume; }
void playSong(uint16 songNum); void playSong(uint16 songNum);
void stopSong() { stopMusic(); } void stopSong() { stopMusic(); }
@ -81,7 +79,6 @@ public:
void stopMusic(); void stopMusic();
void queueTuneList(int16 tuneList); void queueTuneList(int16 tuneList);
bool queueSong(uint16 songNum); bool queueSong(uint16 songNum);
void setPassThrough(bool b) { _passThrough = b; }
void toggleVChange(); void toggleVChange();
// MidiDriver_BASE interface implementation // MidiDriver_BASE interface implementation
@ -90,10 +87,10 @@ public:
void onTimer(); void onTimer();
uint8 channelNumber() { return _channelNumber; } uint8 channelNumber() const { return _channelNumber; }
uint8 soundNumber() { return _soundNumber; } uint8 soundNumber() const { return _soundNumber; }
bool isPlaying() { return _isPlaying; } bool isPlaying() const { return _isPlaying; }
bool isMusic() {return _isMusic; } bool isMusic() const { return _isMusic; }
}; };
class SoundManager : public Common::Singleton<SoundManager> { class SoundManager : public Common::Singleton<SoundManager> {

View file

@ -32,7 +32,7 @@
namespace M4 { namespace M4 {
MidiPlayer::MidiPlayer(MadsM4Engine *vm, MidiDriver *driver) : _vm(vm), _midiData(NULL), _driver(driver), _isPlaying(false), _passThrough(false), _isGM(false) { MidiPlayer::MidiPlayer(MadsM4Engine *vm, MidiDriver *driver) : _vm(vm), _midiData(NULL), _driver(driver), _isPlaying(false), _isGM(false) {
assert(_driver); assert(_driver);
memset(_channel, 0, sizeof(_channel)); memset(_channel, 0, sizeof(_channel));
_masterVolume = 0; _masterVolume = 0;
@ -79,11 +79,6 @@ void MidiPlayer::setVolume(int volume) {
} }
void MidiPlayer::send(uint32 b) { void MidiPlayer::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F); byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) { if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume // Adjust volume changes by master volume

View file

@ -39,16 +39,15 @@ public:
MidiPlayer(MadsM4Engine *vm, MidiDriver *driver); MidiPlayer(MadsM4Engine *vm, MidiDriver *driver);
~MidiPlayer(); ~MidiPlayer();
bool isPlaying() { return _isPlaying; } bool isPlaying() const { return _isPlaying; }
void setVolume(int volume); void setVolume(int volume);
int getVolume() { return _masterVolume; } int getVolume() const { return _masterVolume; }
void setNativeMT32(bool b) { _nativeMT32 = b; } void setNativeMT32(bool b) { _nativeMT32 = b; }
bool hasNativeMT32() { return _nativeMT32; } bool hasNativeMT32() const{ return _nativeMT32; }
void playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene); void playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene);
void stopMusic(); void stopMusic();
void setPassThrough(bool b) { _passThrough = b; }
void setGM(bool isGM) { _isGM = isGM; } void setGM(bool isGM) { _isGM = isGM; }
@ -68,7 +67,6 @@ protected:
byte _channelVolume[16]; byte _channelVolume[16];
bool _nativeMT32; bool _nativeMT32;
bool _isGM; bool _isGM;
bool _passThrough;
bool _isPlaying; bool _isPlaying;
bool _randomLoop; bool _randomLoop;

View file

@ -37,7 +37,7 @@
namespace Made { namespace Made {
MusicPlayer::MusicPlayer() : _parser(0), _driver(0), _looping(false), _isPlaying(false), _passThrough(false), _isGM(false) { MusicPlayer::MusicPlayer() : _parser(0), _driver(0), _looping(false), _isPlaying(false), _isGM(false) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
_nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32")); _nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
//bool adlib = (MidiDriver::getMusicType(dev) == MT_ADLIB); //bool adlib = (MidiDriver::getMusicType(dev) == MT_ADLIB);
@ -95,11 +95,6 @@ void MusicPlayer::setVolume(int volume) {
} }
void MusicPlayer::send(uint32 b) { void MusicPlayer::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F); byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) { if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume // Adjust volume changes by master volume

View file

@ -46,11 +46,11 @@ public:
MusicPlayer(); MusicPlayer();
~MusicPlayer(); ~MusicPlayer();
bool isPlaying() { return _isPlaying; } bool isPlaying() const { return _isPlaying; }
void setPlaying(bool playing) { _isPlaying = playing; } void setPlaying(bool playing) { _isPlaying = playing; }
void setVolume(int volume); void setVolume(int volume);
int getVolume() { return _masterVolume; } int getVolume() const { return _masterVolume; }
bool hasNativeMT32() const { return _nativeMT32; } bool hasNativeMT32() const { return _nativeMT32; }
void playXMIDI(GenericResource *midiResource, MusicFlags flags = MUSIC_NORMAL); void playXMIDI(GenericResource *midiResource, MusicFlags flags = MUSIC_NORMAL);
@ -59,7 +59,6 @@ public:
void pause(); void pause();
void resume(); void resume();
void setLoop(bool loop) { _looping = loop; } void setLoop(bool loop) { _looping = loop; }
void setPassThrough(bool b) { _passThrough = b; }
void setGM(bool isGM) { _isGM = isGM; } void setGM(bool isGM) { _isGM = isGM; }
@ -80,7 +79,6 @@ protected:
byte _channelVolume[16]; byte _channelVolume[16];
bool _nativeMT32; bool _nativeMT32;
bool _isGM; bool _isGM;
bool _passThrough;
bool _isPlaying; bool _isPlaying;
bool _looping; bool _looping;