ScummVM API documentation
player_v1.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_V1_H
23 #define SCUMM_PLAYERS_PLAYER_V1_H
24 
25 #include "scumm/players/player_v2.h"
26 
27 namespace Scumm {
28 
32 class Player_V1 : public Player_V2 {
33 public:
34  Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr);
35  ~Player_V1() override;
36 
37  void startSound(int sound) override;
38  void stopSound(int sound) override;
39  void stopAllSounds() override;
40  int getMusicTimer() override;
41 
42 protected:
43  void nextTick() override;
44  void clear_channel(int i) override;
45  void chainSound(int nr, byte *data) override;
46 
47  void generateSpkSamples(int16 *data, uint len) override;
48  void generatePCjrSamples(int16 *data, uint len) override;
49 
50  void set_mplex(uint mplex);
51  void parseSpeakerChunk();
52  void nextSpeakerCmd();
53  void parsePCjrChunk();
54  void nextPCjrCmd();
55 
56 private:
57  struct channel_data_v1 {
58  uint freq;
59  uint volume;
60  byte *cmd_ptr;
61  uint notelen;
62  uint hull_counter;
63  uint attack;
64  uint decay;
65  uint level;
66  uint sustain_1;
67  uint sustain_2;
68  int sustctr;
69  };
70 
71  channel_data_v1 _channels[4];
72 
73  byte *_next_chunk;
74  byte *_repeat_chunk;
75  uint _chunk_type;
76  uint _mplex_step;
77  uint _mplex;
78  uint _repeat_ctr;
79  uint _freq_current;
80  int _forced_level;
81  uint16 _random_lsr;
82  uint *_value_ptr;
83  uint _time_left;
84  uint _start;
85  uint _end;
86  int _delta;
87  uint *_value_ptr_2;
88  uint _time_left_2;
89  uint _start_2;
90  int _delta_2;
91 };
92 
93 } // End of namespace Scumm
94 
95 #endif
void stopAllSounds() override
Definition: player_v1.h:32
Definition: scumm.h:518
Definition: mixer.h:59
Definition: player_v2.h:36
void stopSound(int sound) override
int getMusicTimer() override
Definition: actor.h:30
void startSound(int sound) override