ScummVM API documentation
towns_pc98_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 TOWNS_PC98_AUDIODRIVER_H
23 #define TOWNS_PC98_AUDIODRIVER_H
24 
25 #include "audio/softsynth/fmtowns_pc98/pc98_audio.h"
26 
27 class TownsPC98_MusicChannel;
28 class TownsPC98_MusicChannelSSG;
29 class TownsPC98_SfxChannel;
30 #ifndef DISABLE_PC98_RHYTHM_CHANNEL
31 class TownsPC98_MusicChannelPCM;
32 #endif
33 
35 friend class TownsPC98_MusicChannel;
36 friend class TownsPC98_MusicChannelSSG;
37 friend class TownsPC98_SfxChannel;
38 #ifndef DISABLE_PC98_RHYTHM_CHANNEL
39 friend class TownsPC98_MusicChannelPCM;
40 #endif
41 public:
42  TownsPC98_AudioDriver(Audio::Mixer *mixer, EmuType type);
44 
45  void loadMusicData(uint8 *data, bool loadPaused = false);
46  void loadSoundEffectData(uint8 *data, uint8 trackNum);
47  bool init();
48  void reset();
49 
50  void fadeStep();
51 
52  void pause();
53  void cont();
54 
55  bool looping() const;
56  bool musicPlaying() const;
57 
58  void setMusicVolume(int volume);
59  void setSoundEffectVolume(int volume);
60 
61 private:
62  uint8 readReg(uint8 part, uint8 reg);
63  void writeReg(uint8 part, uint8 reg, uint8 val);
64  void preventRegisterWrite(bool prevent);
65 
66  void timerCallbackA();
67  void timerCallbackB();
68 
69  void startSoundEffect();
70 
71  void setMusicTempo(uint8 tempo);
72  void setSfxTempo(uint16 tempo);
73 
74  TownsPC98_MusicChannel **_channels;
75  TownsPC98_MusicChannelSSG **_ssgChannels;
76  TownsPC98_SfxChannel **_sfxChannels;
77 #ifndef DISABLE_PC98_RHYTHM_CHANNEL
78  TownsPC98_MusicChannelPCM *_rhythmChannel;
79 #endif
80 
81  uint8 *_musicBuffer;
82  uint8 *_sfxBuffer;
83  const uint8 *_patchData;
84 
85  uint8 _updateChannelsFlag;
86  uint8 _updateSSGFlag;
87  uint8 _updateRhythmFlag;
88  uint8 _updateSfxFlag;
89  uint8 _finishedChannelsFlag;
90  uint8 _finishedSSGFlag;
91  uint8 _finishedRhythmFlag;
92  uint8 _finishedSfxFlag;
93 
94  bool _musicPlaying;
95  bool _sfxPlaying;
96  uint8 _fading;
97  uint8 _looping;
98  uint32 _musicTickCounter;
99 
100  int _sfxOffs;
101  uint8 *_sfxData;
102  uint16 _sfxOffsets[2];
103 
104  uint8 *_trackPtr;
105  bool _regWriteProtect;
106 
107  PC98AudioCore *_pc98a;
108 
109  const int _numChanFM;
110  const int _numChanSSG;
111  const int _numChanRHY;
112 
113  static const uint8 _channelPreset[36];
114  static const uint8 _levelPresetFMTOWNS[24];
115  static const uint8 _levelPresetPC98[24];
116  const uint8 *_levelPresets;
117 
118  bool _ready;
119 };
120 
121 #endif
Definition: pc98_audio.h:45
Definition: pc98_audio.h:32
Definition: mixer.h:59
Definition: towns_pc98_driver.h:34