ScummVM API documentation
soundcd.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_SOUNDCD_H
23#define SCUMM_SOUNDCD_H
24
25#include "backends/audiocd/audiocd.h"
26#include "common/scummsys.h"
27#include "common/serializer.h"
28
29namespace Scumm {
30
31// The number of "ticks" (1/10th of a second) into the Overture that the
32// LucasFilm logo should appear. This corresponds to a timer value of 204.
33// The default value is selected to work well with the Ozawa recording.
34
35#define DEFAULT_LOOM_OVERTURE_TRANSITION 1160
36
37class ScummEngine;
38class SoundSE;
39
40class SoundCD {
41private:
42 ScummEngine *_vm;
43 Audio::Mixer *_mixer;
44 SoundSE *_soundSE;
45
46 Audio::SoundHandle *_fileBasedCDAudioHandle;
47 bool _hasFileBasedCDAudio = false;
48 AudioCDManager::Status _fileBasedCDStatus;
49
50 int _musicTimer = 0;
51
52 bool _useReplacementAudioTracks = false;
53 int _loomOvertureTransition = 0;
54 uint32 _replacementTrackStartTime = 0;
55
56public:
57 int16 _currentCDSound = 0;
58 uint32 _cdMusicTimerMod = 0;
59 uint32 _cdMusicTimer = 0;
60 bool _soundsPaused = false;
61
62 SoundCD(ScummEngine *parent, Audio::Mixer *mixer, SoundSE *soundSE, bool useReplacementAudioTracks);
63 ~SoundCD();
64
65 bool triggerCDSound(int soundID);
66 void stopCDSound(int sound);
67 void stopAllCDSounds();
68 void pauseCDSounds(bool pause);
69
70 bool useReplacementAudio() const { return _useReplacementAudioTracks; }
71 void updateMusicTimer();
72 int getMusicTimer() const { return _musicTimer; }
73 int getCDMusicTimer() const { return _cdMusicTimer; }
74
75 void startCDTimer();
76 void stopCDTimer();
77
78 int playCDTrackFromSoundID(int soundId);
79 void playCDTrack(int track, int numLoops, int startFrame, int duration);
80 void stopCD();
81 int pollCD() const;
82 void updateCD();
83 AudioCDManager::Status getCDStatus();
84 int getCurrentCDSound() const { return _currentCDSound; }
85
86 int restoreAfterLoad();
87 void restoreCDAudioAfterLoad(AudioCDManager::Status &info);
88
89 bool isRolandLoom() const;
90
91private:
92 int getReplacementAudioTrack(int soundID);
93 void playCDTrackInternal(int track, int numLoops, int startFrame, int duration);
94 int getCDTrackIdFromSoundId(int soundId, int &loops, int &start, int &end);
95};
96
97} // End of namespace Scumm
98
99#endif
Definition: mixer.h:70
Definition: mixer.h:49
Definition: scumm.h:536
Definition: soundcd.h:40
Definition: soundse.h:72
Definition: actor.h:30
Definition: audiocd.h:40