ScummVM API documentation
adlplayer.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_SOUND_ADLPLAYER_H
29 #define GOB_SOUND_ADLPLAYER_H
30 
31 #include "common/array.h"
32 
33 #include "gob/sound/adlib.h"
34 
35 namespace Common {
36  class SeekableReadStream;
37 }
38 
39 namespace Gob {
40 
42 class ADLPlayer : public AdLib {
43 public:
44  ADLPlayer();
45  ~ADLPlayer() override;
46 
47  bool load(Common::SeekableReadStream &adl);
48  bool load(const byte *data, uint32 dataSize, int index = -1);
49  void unload();
50 
51  int getIndex() const;
52 
53 protected:
54  // AdLib interface
55  uint32 pollMusic(bool first) override;
56  void rewind() override;
57 
58 private:
59  struct Timbre {
60  uint16 startParams[kOperatorsPerVoice * kParamCount];
61  uint16 params[kOperatorsPerVoice * kParamCount];
62  };
63 
64  uint8 _soundMode;
65 
66  Common::Array<Timbre> _timbres;
67 
68  byte *_songData;
69  uint32 _songDataSize;
70 
71  const byte *_playPos;
72 
73  int _index;
74 
75  uint8 _modifyInstrument;
76  uint16 _currentInstruments[kMaxVoiceCount];
77 
78 
79  void setInstrument(int voice, int instrument);
80 
81  bool readHeader (Common::SeekableReadStream &adl, int &timbreCount);
82  bool readTimbres (Common::SeekableReadStream &adl, int timbreCount);
83  bool readSongData(Common::SeekableReadStream &adl);
84 };
85 
86 } // End of namespace Gob
87 
88 #endif // GOB_SOUND_ADLPLAYER_H
Definition: stream.h:745
Definition: adlplayer.h:42
Definition: anifile.h:40
Definition: algorithm.h:29
Definition: adlib.h:42