ScummVM API documentation
musicbase.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 SKY_MUSIC_MUSICBASE_H
23#define SKY_MUSIC_MUSICBASE_H
24
25
26#include "common/scummsys.h"
27#include "common/mutex.h"
28
29#include "audio/mixer.h"
30
31namespace Audio {
32class SeekableAudioStream;
33}
34
35namespace Sky {
36
37class Disk;
38
39#define FILES_PER_SECTION 4
40
41typedef struct {
42 uint8 musicToProcess;
44} Actions;
45
47public:
48 virtual ~ChannelBase() {}
49 virtual uint8 process(uint16 aktTime) = 0;
50 virtual void updateVolume(uint16 pVolume) = 0;
51 virtual bool isActive() = 0;
52private:
53};
54
55class MusicBase {
56public:
57 MusicBase(Audio::Mixer *pMixer, Disk *pDisk);
58 virtual ~MusicBase();
59 void loadSection(uint8 pSection);
60 void startMusic(uint16 param);
61 void stopMusic();
62 bool musicIsPlaying();
63 uint8 giveVolume();
64 uint8 giveCurrentMusic();
65 virtual void setVolume(uint16 param) = 0;
66
67protected:
68
69 Audio::Mixer *_mixer;
70 Disk *_skyDisk;
71 uint8 *_musicData;
72
73 uint16 _musicDataLoc;
74 uint16 _driverFileBase;
75
76 uint16 _musicVolume, _numberOfChannels;
77 uint8 _currentMusic, _currentSection;
78 uint8 _musicTempo0; // can be changed by music stream
79 uint8 _musicTempo1; // given once per music
80 uint32 _tempo; // calculated from musicTempo0 and musicTempo1
81 uint32 _aktTime;
82 Actions _onNextPoll;
83 ChannelBase *_channels[10];
84 Common::Mutex _mutex;
85 Audio::SoundHandle _musicHandle;
86
87 virtual void setupPointers() = 0;
88 virtual void setupChannels(uint8 *channelData) = 0;
89 virtual void startDriver() = 0;
90
91 void updateTempo();
92 void loadNewMusic();
93 void pollMusic();
94
95 void stopMusicInternal();
96};
97
98} // End of namespace Sky
99
100#endif //MUSICBASE_H
Definition: mixer.h:70
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: mutex.h:67
Definition: musicbase.h:46
Definition: disk.h:59
Definition: musicbase.h:55
Definition: system.h:39
Definition: autoroute.h:28
Definition: musicbase.h:41