ScummVM API documentation
origin_fx_adib_driver.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 NUVIE_SOUND_ORIGIN_FX_ADLIB_DRIVER_H
23 #define NUVIE_SOUND_ORIGIN_FX_ADLIB_DRIVER_H
24 
25 #include "ultima/nuvie/core/nuvie_defs.h"
26 #include "ultima/nuvie/conf/configuration.h"
27 
28 namespace Ultima {
29 namespace Nuvie {
30 
31 class Copl;
32 class Configuration;
33 
35 public:
36  OriginFXAdLibDriver(const Configuration *cfg, Copl *newopl);
38 
39 private:
40 
41  const Configuration *config;
42  Copl *opl;
43 
44  unsigned char num_tim_records;
45  unsigned char *adlib_tim_data;
46 
47  struct adlib_instrument {
48  sint8 channel;
49  sint8 note;
50  uint8 byte_68;
51  sint16 word_121;
52  uint8 byte_137;
53  sint16 word_cb;
54  sint16 word_3c;
55  unsigned char *tim_data;
56  };
57 
58  adlib_instrument adlib_ins[11];
59 
60  int adlib_num_active_channels; //either 6 or 9.
61  unsigned char *midi_chan_tim_ptr[32];
62  uint8 midi_chan_tim_off_10[32];
63  sint16 midi_chan_tim_off_11[32];
64  sint16 midi_chan_pitch[32];
65  sint16 midi_chan_volume[29];
66 
67  uint8 byte_73[13];
68  uint8 adlib_bd_status;
69 
70 public:
71  void init();
72  void play_note(uint8 channel, sint8 note, uint8 velocity);
73  void control_mode_change(uint8 channel, uint8 function, uint8 value);
74  void program_change(sint8 channel, uint8 program_number);
75  void pitch_bend(uint8 channel, uint8 pitch_lsb, uint8 pitch_msb);
76  void interrupt_vector();
77 
78 private:
79  sint16 read_sint16(unsigned char *buf);
80  void midi_write_adlib(unsigned int r, unsigned char v);
81 
82  void load_tim_file();
83  unsigned char *get_tim_data(uint8 program_number);
84 
85  uint8 adlib_voice_op(sint8 voice);
86  uint8 adlib_voice_op1(sint8 voice);
87  uint16 sub_60D(sint16 val);
88  uint16 sub_4BF(uint8 channel, uint8 note, uint8 velocity, unsigned char *cur_tim_ptr);
89  void sub_45E(sint16 voice);
90  void sub_48E(sint16 voice, uint8 val);
91  void write_adlib_instrument(sint8 voice, unsigned char *tim_data);
92 };
93 
94 } // End of namespace Nuvie
95 } // End of namespace Ultima
96 
97 #endif
Definition: origin_fx_adib_driver.h:34
Definition: configuration.h:61
Definition: opl.h:30
Definition: detection.h:27