ScummVM API documentation
audio_player.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 #ifndef VCRUISE_AUDIO_PLAYER_H
23 #define VCRUISE_AUDIO_PLAYER_H
24 
25 #include "common/mutex.h"
26 
27 #include "audio/audiostream.h"
28 #include "audio/mixer.h"
29 
30 namespace VCruise {
31 
32 struct AudioMetadata;
33 class CachedAudio;
34 
36 public:
38  ~AudioPlayer();
39 
40  int readBuffer(int16 *buffer, const int numSamples) override;
41  bool isStereo() const override;
42  int getRate() const override;
43  bool endOfData() const override;
44 
45  void play(byte volume, int8 balance);
46  void stop();
47 
48  void setVolume(byte volume);
49  void setBalance(int8 balance);
50  void setVolumeAndBalance(byte volume, int8 balance);
51 
52 private:
53  Common::Mutex _mutex;
54 
55  Audio::SoundHandle _handle;
56  //bool _isLooping;
57  bool _isPlaying;
58  bool _exhausted;
59  Audio::Mixer *_mixer;
61 
62  Audio::Mixer::SoundType _soundType;
63 };
64 
65 } // End of namespace VCruise
66 
67 #endif
int getRate() const override
Definition: mixer.h:49
bool isStereo() const override
int readBuffer(int16 *buffer, const int numSamples) override
SoundType
Definition: mixer.h:62
Definition: mixer.h:59
Definition: ad2044_items.h:27
Definition: mutex.h:67
Definition: audiostream.h:50
bool endOfData() const override
Definition: audio_player.h:35