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  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /* Sound engine */
23 #ifndef SCI_SOUND_AUDIO_H
24 #define SCI_SOUND_AUDIO_H
25 
26 #include "sci/engine/vm_types.h"
27 #include "audio/mixer.h"
28 
29 namespace Audio {
30 class RewindableAudioStream;
31 } // End of namespace Audio
32 
33 namespace Sci {
34 
35 enum AudioCommands {
36  kSciAudioWPlay = 1, /* Loads an audio stream */
37  kSciAudioPlay = 2, /* Plays an audio stream */
38  kSciAudioStop = 3, /* Stops an audio stream */
39  kSciAudioPause = 4, /* Pauses an audio stream */
40  kSciAudioResume = 5, /* Resumes an audio stream */
41  kSciAudioPosition = 6, /* Return current position in audio stream */
42  kSciAudioRate = 7, /* Return audio rate */
43  kSciAudioVolume = 8, /* Return audio volume */
44  kSciAudioLanguage = 9, /* Return audio language */
45  kSciAudioCD = 10 /* Plays SCI1.1 CD audio */
46 };
47 
48 #define AUDIO_VOLUME_MAX 127
49 
50 class Resource;
51 class ResourceId;
52 class ResourceManager;
53 class SegManager;
54 
55 class AudioPlayer {
56 public:
58  ~AudioPlayer();
59 
60  void setAudioRate(uint16 rate) { _audioRate = rate; }
61  Audio::SoundHandle *getAudioHandle() { return &_audioHandle; }
62  Audio::RewindableAudioStream *getAudioStream(uint32 number, uint32 volume, int *sampleLen);
63  int getAudioPosition();
64  int startAudio(uint16 module, uint32 tuple);
65  int wPlayAudio(uint16 module, uint32 tuple);
66  void stopAudio();
67  void pauseAudio();
68  void resumeAudio();
69 
70  void handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan);
71 
72  int audioCdPlay(int track, int start, int duration);
73  void audioCdStop();
74  void audioCdUpdate();
75  int audioCdPosition();
76 
77  void stopAllAudio();
78 
79  void incrementPlayCounter();
80  uint16 getPlayCounter();
81 
82 private:
83  ResourceManager *_resMan;
84  uint16 _audioRate;
85  Audio::SoundHandle _audioHandle;
86  Audio::Mixer *_mixer;
87  uint32 _audioCdStart;
88  bool _wPlayFlag;
89  bool _initCD;
90  uint16 _playCounter;
91 };
92 
93 } // End of namespace Sci
94 
95 #endif // SCI_SOUND_AUDIO_H
Definition: mixer.h:49
Definition: resource.h:327
Definition: mixer.h:59
Definition: audio.h:55
Definition: console.h:28
Definition: seg_manager.h:48
Definition: audiostream.h:109
Definition: vm_types.h:39
Definition: system.h:38