ScummVM API documentation
audio.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  * aint32 with this program; if not, write to the Free Software
19  *
20  *
21  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_AUDIO_H
27 #define SAGA2_AUDIO_H
28 
29 #include "audio/mixer.h"
30 
31 namespace Saga2 {
32 
33 class Music;
34 class hResContext;
35 
36 #define Here Point32(0,0)
37 
38 enum VolumeTarget {
39  kVolSfx,
40  kVolVoice,
41  kVolMusic
42 };
43 
44 struct SoundInstance {
45  uint32 seg;
46  bool loop;
47  Point32 loc;
48 };
49 
51 private:
52  enum {
53  kClickSounds = 3
54  };
55 
56  SoundInstance _currentSpeech;
57  SoundInstance _currentLoop;
58  SoundInstance _currentMusic;
59 
60 public:
61  Audio::SoundHandle _speechSoundHandle;
62  Audio::SoundHandle _sfxSoundHandle;
63  Audio::SoundHandle _bgmSoundHandle;
64  Audio::SoundHandle _clickSoundHandle;
65  Audio::SoundHandle _loopSoundHandle;
66 
67  Common::List<SoundInstance> _speechQueue;
69 
70  Audio::Mixer *_mixer;
71  Music *_music;
72 
73  int32 _clickSizes[kClickSounds];
74  uint8 *_clickData[kClickSounds];
75 
76 public:
77  // ctor, dtor, initialization
79  ~AudioInterface();
80 
81  // init, cleanup
82  void initAudioInterface(hResContext *musicContext);
83 
84  // event loop calls
85  bool playFlag();
86  void playMe();
87 
88  // music calls
89  void playMusic(uint32 s, int16 loopFactor = 1, Point32 where = Here);
90  void stopMusic();
91 
92  // sound calls
93  void queueSound(uint32 s, int16 loopFactor = 1, Point32 where = Here);
94 
95  // loop calls
96  void playLoop(uint32 s, int16 loopFactor = 0, Point32 where = Here);
97  void stopLoop();
98  void setLoopPosition(Point32 newLoc);
99  uint32 currentLoop() {
100  return _currentLoop.seg;
101  }
102 
103  // voice calls
104  void queueVoice(uint32 s, Point32 where = Here);
105  void queueVoice(uint32 s[], Point32 where = Here);
106  void stopVoice();
107  bool talking();
108  bool saying(uint32 s);
109 
110  byte getVolume(VolumeTarget src);
111  void suspend();
112  void resume();
113 };
114 
115 } // end of namespace Saga2
116 
117 #endif
Definition: rect.h:184
Definition: audio.h:44
Definition: actor.h:32
Definition: list.h:44
Definition: music.h:39
Definition: queue.h:42
Definition: hresmgr.h:98
Definition: mixer.h:49
Definition: mixer.h:59
Definition: audio.h:50