ScummVM API documentation
player_v2base.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 SCUMM_PLAYERS_PLAYER_V2BASE_H
23 #define SCUMM_PLAYERS_PLAYER_V2BASE_H
24 
25 #include "common/scummsys.h"
26 #include "common/mutex.h"
27 #include "scumm/music.h"
28 
29 namespace Scumm {
30 
31 class ScummEngine;
32 
33 
34 #include "common/pack-start.h" // START STRUCT PACKING
35 
36 struct channel_data {
37  uint16 time_left; // 00
38  uint16 next_cmd; // 02
39  uint16 base_freq; // 04
40  uint16 freq_delta; // 06
41  uint16 freq; // 08
42  uint16 volume; // 10
43  uint16 volume_delta; // 12
44  uint16 tempo; // 14
45  uint16 inter_note_pause; // 16
46  uint16 transpose; // 18
47  uint16 note_length; // 20
48  uint16 hull_curve; // 22
49  uint16 hull_offset; // 24
50  uint16 hull_counter; // 26
51  uint16 freqmod_table; // 28
52  uint16 freqmod_offset; // 30
53  uint16 freqmod_incr; // 32
54  uint16 freqmod_multiplier; // 34
55  uint16 freqmod_modulo; // 36
56  uint16 unknown[4]; // 38 - 44
57  uint16 music_timer; // 46
58  uint16 music_script_nr; // 48
59 } PACKED_STRUCT;
60 
61 #include "common/pack-end.h" // END STRUCT PACKING
62 
66 class Player_V2Base : public MusicEngine {
67 public:
68  Player_V2Base(ScummEngine *scumm, bool pcjr);
69  ~Player_V2Base() override;
70 
71  // MusicEngine API
72 // virtual void setMusicVolume(int vol);
73 // virtual void startSound(int sound);
74 // virtual void stopSound(int sound);
75 // virtual void stopAllSounds();
76  int getMusicTimer() override;
77 // virtual int getSoundStatus(int sound) const;
78 
79 protected:
80  bool _isV3Game;
81  ScummEngine *_vm;
82 
83  bool _pcjr;
84  int _header_len;
85 
86  int _current_nr;
87  byte *_current_data;
88  int _next_nr;
89  byte *_next_data;
90  byte *_retaddr;
91 
92  union ChannelInfo {
93  channel_data d;
94  uint16 array[sizeof(channel_data)/2];
95  };
96 
97  ChannelInfo _channels[5];
98 
99 private:
100  int _music_timer;
101  int _music_timer_ctr;
102  int _ticks_per_music_timer;
103 
104  const uint16 *_freqs_table;
105 
106 protected:
107  virtual void nextTick();
108  virtual void clear_channel(int i);
109  virtual void chainSound(int nr, byte *data);
110  virtual void chainNextSound();
111 
112  void execute_cmd(ChannelInfo *channel);
113  void next_freqs(ChannelInfo *channel);
114 };
115 
116 
117 } // End of namespace Scumm
118 
119 #endif
Definition: music.h:40
Definition: scumm.h:518
Definition: player_v2base.h:66
Definition: player_v2base.h:92
Definition: actor.h:30
Definition: player_v2base.h:36