ScummVM API documentation
adlib_ctmidi.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AUDIO_ADLIB_CTMIDI_H
23 #define AUDIO_ADLIB_CTMIDI_H
24 
25 #include "audio/adlib_ms.h"
26 
31 public:
32  // Instrument bank from CTMIDI.DRV. Transpose is stored separately.
33  static const AdLibIbkInstrumentDefinition CTMIDI_INSTRUMENT_BANK[128];
34  // Instrument transpose parameter values
35  static const int8 INSTRUMENT_TRANSPOSE[128];
36 
37  // Rhythm bank from CTMIDI.DRV. OPL note is stored separately.
38  static const AdLibIbkInstrumentDefinition CTMIDI_RHYTHM_BANK[47];
39  // Mapping from MIDI note value to rhythm instrument
40  static const uint8 RHYTHM_NOTE_INSTRUMENT_MAP[47];
41  // The OPL note to play for each rhythm instrument
42  static const uint8 RHYTHM_NOTES[47];
43 
44  // F-num lookup table from CTMIDI.DRV
45  static const uint16 CTMIDI_NOTE_FREQUENCIES[768];
46  // Volume modifier lookup table
47  static const int8 NOTE_VOLUME_MODIFIER_VALUES[18];
48 
51 
52  int open() override;
53  void deinitSource(uint8 source) override;
54 
55 protected:
56  // Instrument bank after conversion
57  OplInstrumentDefinition _ctmidiInstrumentBank[128];
58  // Rhythm bank after conversion
59  OplInstrumentDefinition _ctmidiRhythmBank[47];
60 
65  void initRhythmDefaults();
66  void programChange(uint8 channel, uint8 program, uint8 source) override;
67  uint8 allocateOplChannel(uint8 channel, uint8 source, InstrumentInfo &instrumentInfo) override;
68  void writeFrequency(uint8 oplChannel, OplInstrumentRhythmType rhythmType) override;
69  uint16 calculateFrequency(uint8 channel, uint8 source, uint8 note) override;
70  uint8 calculateUnscaledVolume(uint8 channel, uint8 source, uint8 velocity, const OplInstrumentDefinition &instrumentDef, uint8 operatorNum) override;
71 };
72 
73 #endif
uint8 allocateOplChannel(uint8 channel, uint8 source, InstrumentInfo &instrumentInfo) override
Definition: adlib_ms.h:295
void programChange(uint8 channel, uint8 program, uint8 source) override
uint16 calculateFrequency(uint8 channel, uint8 source, uint8 note) override
OplType
Definition: fmopl.h:58
Definition: adlib_ms.h:226
Definition: adlib_ctmidi.h:30
uint8 calculateUnscaledVolume(uint8 channel, uint8 source, uint8 velocity, const OplInstrumentDefinition &instrumentDef, uint8 operatorNum) override
Definition: adlib_ms.h:79
void writeFrequency(uint8 oplChannel, OplInstrumentRhythmType rhythmType) override
void deinitSource(uint8 source) override