ScummVM API documentation
music.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 // Music class
23 
24 #ifndef SAGA2_MUSIC_H
25 #define SAGA2_MUSIC_H
26 
27 #include "audio/mididrv.h"
28 #include "audio/mididrv_ms.h"
29 #include "audio/midiparser.h"
30 #include "audio/mixer.h"
31 
32 namespace Saga2 {
33 
34 enum MusicFlags {
35  MUSIC_NORMAL = 0,
36  MUSIC_LOOP = 0x0001
37 };
38 
39 class Music {
40 public:
41 
42  Music(hResContext *musicRes);
43  ~Music();
44  bool isPlaying();
45 
46  void play(uint32 resourceId, MusicFlags flags = MUSIC_NORMAL);
47  void pause();
48  void resume();
49  void stop();
50 
51  void setVolume(int volume);
52  int getVolume() { return _currentVolume; }
53 
54  bool isAdlib() const { return _driverType == MT_ADLIB; }
55 
56  void syncSoundSettings();
57 
58 private:
59  MidiParser *_parser;
60  MidiDriver_Multisource *_driver;
61  Audio::SoundHandle _musicHandle;
62  uint32 _trackNumber;
63 
64  int _currentVolume;
65  MusicType _musicType;
66  MusicType _driverType;
67 
68  hResContext *_musicContext;
69 
70  byte *_currentMusicBuffer;
71 
72  static void timerCallback(void *refCon);
73  void onTimer();
74 };
75 
76 } // End of namespace Saga2
77 
78 #endif
Definition: actor.h:32
Definition: mididrv_ms.h:86
MusicType
Definition: mididrv.h:44
Definition: music.h:39
Definition: hresmgr.h:98
Definition: mixer.h:49
Definition: midiparser.h:289