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 restartSound();
51 
52  void set_mplex(uint mplex);
53  void parseSpeakerChunk();
54  void nextSpeakerCmd();
55  void parsePCjrChunk();
56  void nextPCjrCmd();
57 
58 private:
59  struct channel_data_v1 {
60  uint freq;
61  uint volume;
62  byte *cmd_ptr;
63  uint notelen;
64  uint hull_counter;
65  uint attack;
66  uint decay;
67  uint level;
68  uint sustain_1;
69  uint sustain_2;
70  int sustctr;
71  };
72 
73  channel_data_v1 _channels[4];
74 
75  byte *_next_chunk;
76  byte *_repeat_chunk;
77  uint _chunk_type;
78  uint _mplex_step;
79  uint _mplex;
80  uint _repeat_ctr;
81  uint _freq_current;
82  int _forced_level;
83  uint16 _random_lsr;
84  uint *_value_ptr;
85  uint _time_left;
86  uint _start;
87  uint _end;
88  int _delta;
89  uint *_value_ptr_2;
90  uint _time_left_2;
91  uint _start_2;
92  int _delta_2;
93 };
94 
95 } // End of namespace Scumm
96 
97 #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