ScummVM API documentation
music_manager.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  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_MUSICMANAGER_H_INCLUDED_
28 #define ICB_MUSICMANAGER_H_INCLUDED_
29 
30 #include "engines/icb/common/px_common.h"
31 #include "engines/icb/sound/direct_sound.h"
32 
33 #include "common/stream.h"
34 
35 #include "audio/audiostream.h"
36 #include "audio/mixer.h"
37 
38 namespace ICB {
39 
40 class MusicManager {
41 private:
42  Audio::AudioStream *_audioStream;
43  Audio::SoundHandle _handle;
44 
45  uint32 m_bufferLength; // Stores the length of the sound buffers in bytes
46  int32 m_musicVol; // The volume the each stream was started at
47 
48  uint32 m_wavByteOffsetInCluster;
49  uint32 m_wavDataSize;
50 
51  bool8 m_paused;
52  int32 m_lengthInCycles; // Assumes 12 frames per second
53 
54  int32 m_fading;
55  int32 m_adjustFadeVol;
56 
57  uint32 m_identifier; // Handle if you like of loaded music
58 
59 public:
60  MusicManager();
61  ~MusicManager();
62 
63  bool8 UpdateMusic();
64 
65  bool8 LoadMusic(const char *clusterName, uint32 byteOffsetToWav, int32 vol = 128);
66  bool8 StartMusic(const char *clusterName, uint32 byteOffsetToWav, int32 vol = 128);
67  bool8 PlayMusic();
68  void StopMusic();
69  void SetMusicPausedStatus(bool8 p = TRUE8);
70  void SetMusicVolume(int32 volume);
71 
72  bool8 IsPlaying();
73  bool8 IsPaused() { return m_paused; }
74  int32 GetLength() { return m_lengthInCycles; }
75 
76 private:
77  bool8 OpenMusic(Common::SeekableReadStream *stream);
78  void KillBuffer();
79  void SetVolume(int32 volume);
80  void AdjustVolume(int32 amount);
81 };
82 
83 extern MusicManager *g_theMusicManager;
84 
85 } // End of namespace ICB
86 
87 #endif
Definition: actor.h:32
Definition: stream.h:745
Definition: mixer.h:49
Definition: music_manager.h:40
Definition: audiostream.h:50