ScummVM API documentation
base_sound_buffer.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 /*
23  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 
28 #ifndef WINTERMUTE_BASE_SOUNDBUFFER_H
29 #define WINTERMUTE_BASE_SOUNDBUFFER_H
30 
31 
32 #include "engines/wintermute/base/base.h"
33 #include "audio/mixer.h"
34 #include "common/stream.h"
35 
36 namespace Audio {
37 class SeekableAudioStream;
38 class SoundHandle;
39 }
40 
41 namespace Wintermute {
42 
43 class BaseSoundBuffer : public BaseClass {
44 public:
45 
46  BaseSoundBuffer(BaseGame *inGame);
47  ~BaseSoundBuffer() override;
48 
49  bool pause();
50  bool play(bool looping = false, uint32 startSample = 0);
51  bool resume();
52  bool stop();
53  bool isPlaying();
54 
55  void setLooping(bool looping);
56 
57  uint32 getPosition();
58  bool setPosition(uint32 pos);
59  uint32 getLength();
60 
61  bool setLoopStart(uint32 pos);
62  uint32 getLoopStart() const {
63  return _loopStart;
64  }
65 
66  bool setPan(float pan);
67  bool setPrivateVolume(int colume);
68  bool setVolume(int colume);
69  void updateVolume();
70 
71  void setType(Audio::Mixer::SoundType Type);
72  Audio::Mixer::SoundType getType() const;
73 
74  bool loadFromFile(const Common::String &filename, bool forceReload = false);
75  void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0);
76  bool applyFX(TSFXType type, float param1, float param2, float param3, float param4);
77  int32 getPrivateVolume() const;
78  void setFreezePaused(bool freezePaused);
79  bool isFreezePaused() const;
80  bool isLooping() const;
81  //HSTREAM _stream;
82  //HSYNC _sync;
83 
84 private:
87  Audio::SoundHandle *_handle;
88  bool _freezePaused;
89  bool _looping;
90  int32 _privateVolume;
91  uint32 _loopStart;
92  uint32 _startPos;
93  Common::String _filename;
94  bool _streamed;
95  int32 _volume;
96  int8 _pan;
97 };
98 
99 } // End of namespace Wintermute
100 
101 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: audiostream.h:212
Type
Definition: log.h:33
Definition: mixer.h:49
SoundType
Definition: mixer.h:73
Definition: base_sound_buffer.h:43
Definition: base.h:43
Definition: system.h:38
Definition: achievements_tables.h:27