diff options
author | Willem Jan Palenstijn | 2015-07-22 22:37:40 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-07-22 22:43:42 +0200 |
commit | 6ec9c81b575f13b2c4b30aeac592ebf2557b5890 (patch) | |
tree | 503d50902bad2d800165593039d08d5ccf0c98ab /engines/queen/midiadlib.h | |
parent | 5ec05f6b647c5ea41418be7ed19ad381f97cabd8 (diff) | |
parent | 4e5c8d35f7e133e2e72a846fdbd54900c91eeb73 (diff) | |
download | scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.tar.gz scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.tar.bz2 scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.zip |
Merge branch 'master' into mm
Conflicts:
engines/access/access.cpp
engines/access/asurface.h
engines/access/bubble_box.cpp
engines/access/bubble_box.h
engines/access/martian/martian_game.cpp
engines/access/player.cpp
engines/access/player.h
engines/access/resources.cpp
engines/access/screen.cpp
engines/access/screen.h
engines/access/sound.cpp
engines/access/sound.h
Diffstat (limited to 'engines/queen/midiadlib.h')
-rw-r--r-- | engines/queen/midiadlib.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/engines/queen/midiadlib.h b/engines/queen/midiadlib.h new file mode 100644 index 0000000000..8692e51840 --- /dev/null +++ b/engines/queen/midiadlib.h @@ -0,0 +1,128 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "audio/fmopl.h" +#include "audio/mididrv.h" + +namespace Queen { + +class AdLibMidiDriver : public MidiDriver { +public: + + AdLibMidiDriver() { + _adlibWaveformSelect = 0; + _isOpen = false; + } + + ~AdLibMidiDriver() {} + + // MidiDriver + int open(); + void close(); + void send(uint32 b); + void metaEvent(byte type, byte *data, uint16 length); + MidiChannel *allocateChannel() { return 0; } + MidiChannel *getPercussionChannel() { return 0; } + void setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc); + bool isOpen() const { return _isOpen; } + uint32 getBaseTempo() { return 1000000 / OPL::OPL::kDefaultCallbackFrequency; } + + void setVolume(uint32 volume); + +private: + + void handleMidiEvent0x90_NoteOn(int channel, int param1, int param2); + void handleSequencerSpecificMetaEvent1(int channel, const uint8 *data); + void handleSequencerSpecificMetaEvent2(uint8 value); + void handleSequencerSpecificMetaEvent3(uint8 value); + + void adlibWrite(uint8 port, uint8 value); + void adlibSetupCard(); + void adlibSetupChannels(int fl); + void adlibResetAmpVibratoRhythm(int am, int vib, int kso); + void adlibResetChannels(); + void adlibSetAmpVibratoRhythm(); + void adlibSetCSMKeyboardSplit(); + void adlibSetNoteMul(int mul); + void adlibSetWaveformSelect(int fl); + void adlibSetPitchBend(int channel, int range); + void adlibPlayNote(int channel); + uint8 adlibPlayNoteHelper(int channel, int note1, int note2, int oct); + void adlibTurnNoteOff(int channel); + void adlibTurnNoteOn(int channel, int note); + void adlibSetupChannelFromSequence(int channel, const uint8 *src, int fl); + void adlibSetupChannel(int channel, const uint16 *src, int fl); + void adlibSetNoteVolume(int channel, int volume); + void adlibSetChannelVolume(int channel, uint8 volume); + void adlibSetupChannelHelper(int channel); + void adlibSetChannel0x40(int channel); + void adlibSetChannel0xC0(int channel); + void adlibSetChannel0x60(int channel); + void adlibSetChannel0x80(int channel); + void adlibSetChannel0x20(int channel); + void adlibSetChannel0xE0(int channel); + + void onTimer(); + + OPL::OPL *_opl; + int _midiNumberOfChannels; + int _adlibNoteMul; + int _adlibWaveformSelect; + int _adlibAMDepthEq48; + int _adlibVibratoDepthEq14; + int _adlibRhythmEnabled; + int _adlibKeyboardSplitOn; + int _adlibVibratoRhythm; + uint8 _midiChannelsFreqTable[9]; + uint8 _adlibChannelsLevelKeyScalingTable[11]; + uint8 _adlibSetupChannelSequence1[14 * 18]; + uint16 _adlibSetupChannelSequence2[14]; + int16 _midiChannelsNote2Table[9]; + uint8 _midiChannelsNote1Table[9]; + uint8 _midiChannelsOctTable[9]; + uint16 _adlibChannelsVolume[11]; + uint16 _adlibMetaSequenceData[28]; + uint8 _adlibChannelsVolumeTable[11]; + + bool _isOpen; + Common::TimerManager::TimerProc _adlibTimerProc; + void *_adlibTimerParam; + + static const uint8 _adlibChannelsMappingTable1[]; + static const uint8 _adlibChannelsNoFeedback[]; + static const uint8 _adlibChannelsMappingTable2[]; + static const uint8 _adlibChannelsMappingTable3[]; + static const uint8 _adlibChannelsKeyScalingTable1[]; + static const uint8 _adlibChannelsKeyScalingTable2[]; + static const uint8 _adlibInitSequenceData1[]; + static const uint8 _adlibInitSequenceData2[]; + static const uint8 _adlibInitSequenceData3[]; + static const uint8 _adlibInitSequenceData4[]; + static const uint8 _adlibInitSequenceData5[]; + static const uint8 _adlibInitSequenceData6[]; + static const uint8 _adlibInitSequenceData7[]; + static const uint8 _adlibInitSequenceData8[]; + static const int16 _midiChannelsNoteTable[]; + static const int16 _midiNoteFreqTable[]; +}; + +} // End of namespace Queen |