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 BaseFile;
44 class BaseSoundBuffer : public BaseClass {
45 public:
46 
47  BaseSoundBuffer(BaseGame *inGame);
48  ~BaseSoundBuffer() override;
49 
50  bool pause();
51  bool play(bool looping = false, uint32 startSample = 0);
52  bool resume();
53  bool stop();
54  bool isPlaying();
55 
56  void setLooping(bool looping);
57 
58  uint32 getPosition();
59  bool setPosition(uint32 pos);
60  uint32 getLength();
61 
62  bool setLoopStart(uint32 pos);
63  uint32 getLoopStart() const {
64  return _loopStart;
65  }
66 
67  bool setPan(float pan);
68  bool setPrivateVolume(int colume);
69  bool setVolume(int colume);
70  void updateVolume();
71 
72  void setType(Audio::Mixer::SoundType Type);
73  Audio::Mixer::SoundType getType() const;
74 
75  bool loadFromFile(const Common::String &filename, bool forceReload = false);
76  void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0);
77  bool applyFX(TSFXType type, float param1, float param2, float param3, float param4);
78  int32 getPrivateVolume() const;
79  void setFreezePaused(bool freezePaused);
80  bool isFreezePaused() const;
81  bool isLooping() const;
82  //HSTREAM _stream;
83  //HSYNC _sync;
84 
85 private:
88  Audio::SoundHandle *_handle;
89  bool _freezePaused;
90  bool _looping;
91  int32 _privateVolume;
92  uint32 _loopStart;
93  uint32 _startPos;
94  Common::String _filename;
95  bool _streamed;
97  int32 _volume;
98  int8 _pan;
99 };
100 
101 } // End of namespace Wintermute
102 
103 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: stream.h:745
Definition: audiostream.h:212
Type
Definition: log.h:33
Definition: mixer.h:49
SoundType
Definition: mixer.h:62
Definition: base_sound_buffer.h:44
Definition: base.h:43
Definition: system.h:38
Definition: achievements_tables.h:27