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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef SCUMM_PLAYERS_PLAYER_V1_H 24 #define SCUMM_PLAYERS_PLAYER_V1_H 25 26 #include "scumm/players/player_v2.h" 27 28 namespace Scumm { 29 30 /** 31 * Scumm V1 PC-Speaker player. 32 */ 33 class Player_V1 : public Player_V2 { 34 public: 35 Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr); 36 ~Player_V1() override; 37 38 void startSound(int sound) override; 39 void stopSound(int sound) override; 40 void stopAllSounds() override; 41 int getMusicTimer() override; 42 43 protected: 44 void nextTick() override; 45 void clear_channel(int i) override; 46 void chainSound(int nr, byte *data) override; 47 48 void generateSpkSamples(int16 *data, uint len) override; 49 void generatePCjrSamples(int16 *data, uint len) override; 50 51 void restartSound(); 52 53 void set_mplex(uint mplex); 54 void parseSpeakerChunk(); 55 void nextSpeakerCmd(); 56 void parsePCjrChunk(); 57 void nextPCjrCmd(); 58 59 private: 60 struct channel_data_v1 { 61 uint freq; 62 uint volume; 63 byte *cmd_ptr; 64 uint notelen; 65 uint hull_counter; 66 uint attack; 67 uint decay; 68 uint level; 69 uint sustain_1; 70 uint sustain_2; 71 int sustctr; 72 }; 73 74 channel_data_v1 _channels[4]; 75 76 byte *_next_chunk; 77 byte *_repeat_chunk; 78 uint _chunk_type; 79 uint _mplex_step; 80 uint _mplex; 81 uint _repeat_ctr; 82 uint _freq_current; 83 int _forced_level; 84 uint16 _random_lsr; 85 uint *_value_ptr; 86 uint _time_left; 87 uint _start; 88 uint _end; 89 int _delta; 90 uint *_value_ptr_2; 91 uint _time_left_2; 92 uint _start_2; 93 int _delta_2; 94 }; 95 96 } // End of namespace Scumm 97 98 #endif 99