ScummVM API documentation
sound.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 #ifndef DRAGONS_SOUND_H
22 #define DRAGONS_SOUND_H
23 
24 #include "common/scummsys.h"
25 #include "audio/mixer.h"
26 #include "audio/audiostream.h"
27 #include "midimusicplayer.h"
28 
29 
30 namespace Dragons {
31 
32 class DragonsEngine;
33 class BigfileArchive;
34 class DragonRMS;
35 class VabSound;
36 struct SpeechLocation;
37 
38 typedef struct Voice {
39  int16 soundID;
40  Audio::SoundHandle handle;
41 
42  Voice() {
43  soundID = -1;
44  }
45 } Voice;
46 
47 #define NUM_VOICES 25
48 
49 class SoundManager {
50 public:
51  SoundManager(DragonsEngine *vm, BigfileArchive* bigFileArchive, DragonRMS *dragonRms);
52  ~SoundManager();
53 
54  void loadMsf(uint32 sceneId);
55  void playOrStopSound(uint16 soundId);
56 
57  void playMusic(int16 song);
58  void playSpeech(uint32 textIndex);
59  bool isSpeechPlaying();
60  void resumeMusic();
61  void syncSoundSettings();
62 
63 public:
64  uint16 _dat_8006bb60_sound_related;
65 
66 private:
67  DragonsEngine *_vm;
68  BigfileArchive *_bigFileArchive;
69  DragonRMS *_dragonRMS;
70 
71  uint8 _speechVolume;
72  uint8 _sfxVolume;
73  uint8 _musicVolume;
74 
75  uint8 _sfxVolumeTbl[0x780];
76 
77  VabSound* _vabMusx;
78  VabSound* _vabMsf;
79  VabSound* _vabGlob;
80 
81  Audio::SoundHandle _speechHandle;
82  MidiMusicPlayer *_midiPlayer;
83 
84  Voice _voice[NUM_VOICES];
85  int16 _currentSong;
86 
87 private:
88  void SomeInitSound_FUN_8003f64c();
89 
90  void initVabData();
91 
92  void playSound(uint16 soundId, uint16 i);
93 
94  void stopSound(uint16 id, uint16 i);
95 
96  uint16 getVabFromSoundId(uint16 id);
97 
98  VabSound * loadVab(const char *headerFilename, const char *bodyFilename);
99 
100  bool getSpeechLocation(uint32 talkId, struct SpeechLocation *location);
101  bool isVoicePlaying(uint16 soundID);
102  Audio::SoundHandle *getVoiceHandle(uint16 soundID);
103  void stopVoicePlaying(uint16 soundID);
104  void stopAllVoices();
105 
106 private:
107  class PSXAudioTrack {
108  private:
109  struct ADPCMStatus {
110  int16 sample[2];
111  } _adpcmStatus[2];
112 
113  public:
114  PSXAudioTrack();
115 
116  Audio::QueuingAudioStream *createNewAudioStream(Common::File *fd, uint16 sectorStart, int8 startOffset, uint16 sectorEnd);
117 
118  private:
119  void queueAudioFromSector(Audio::QueuingAudioStream *audStream, Common::SeekableReadStream *sector);
120  };
121 };
122 
123 } // End of namespace Dragons
124 
125 #endif //DRAGONS_SOUND_H
Definition: bigfile.h:42
Definition: midimusicplayer.h:30
Definition: vabsound.h:96
Definition: sound.h:49
Definition: stream.h:745
Definition: mixer.h:49
Definition: dragonrms.h:42
Definition: file.h:47
Definition: sound.h:38
Definition: actor.h:26
Definition: audiostream.h:370
Definition: dragons.h:167