ScummVM API documentation
LowLevelSound.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  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_LOWLEVELSOUND_H
29 #define HPL_LOWLEVELSOUND_H
30 
31 #include "hpl1/engine/math/MathTypes.h"
32 #include "hpl1/engine/system/SystemTypes.h"
33 
34 #include "hpl1/engine/system/low_level_system.h"
35 
36 namespace hpl {
37 
38 class iSoundData;
39 class iSoundEnvironment;
40 // class iSoundFilter;
41 
42 typedef Common::List<iSoundEnvironment *> tSoundEnvList;
43 typedef tSoundEnvList::iterator tSoundEnvListIt;
44 
46 public:
48  virtual ~iLowLevelSound();
49 
54  virtual void GetSupportedFormats(tStringList &alstFormats) = 0;
55 
56  virtual iSoundData *LoadSoundData(const tString &asName, const tString &asFilePath,
57  const tString &asType, bool abStream, bool abLoopStream) = 0;
58 
59  virtual void UpdateSound(float afTimeStep) = 0;
60 
61  virtual void SetListenerAttributes(const cVector3f &avPos, const cVector3f &avVel,
62  const cVector3f &avForward, const cVector3f &avUp) = 0;
63  virtual void SetListenerPosition(const cVector3f &avPos) = 0;
64  const cMatrixf &GetListenerMatrix() { return m_mtxListener; }
65 
66  virtual void SetListenerAttenuation(bool abEnabled) = 0;
67 
68  virtual void SetSetRolloffFactor(float afFactor) = 0;
69 
70  virtual void SetVolume(float afVolume) = 0;
71 
72  cVector3f &GetListenerPosition() { return mvListenerPosition; }
73  cVector3f &GetListenerVelocity() { return mvListenerVelocity; }
74  cVector3f &GetListenerForward() { return mvListenerForward; }
75  cVector3f &GetListenerUp() { return mvListenerUp; }
76  bool GetListenerAttenuation() { return mbListenerAttenuation; }
77 
78  float GetVolume() { return mfVolume; }
79 
80  // virtual void LogSoundStatus() {}
81  virtual void Init(bool abUseHardware, bool abForceGeneric, bool abUseEnvAudio, int alMaxChannels,
82  int alStreamUpdateFreq, bool abUseThreading, bool abUseVoiceManagement,
83  int alMaxMonoSourceHint, int alMaxStereoSourceHint,
84  int alStreamingBufferSize, int alStreamingBufferCount, bool abEnableLowLevelLog, tString asDeviceName) = 0;
85 
86  bool IsHardwareAccelerated() { return mbHardwareAcc; }
87  bool IsEnvAudioAvailable() { return mbEnvAudioEnabled; }
88 
89  virtual void SetEnvVolume(float afVolume) = 0;
90  float GetEnvVolume() { return mfEnvVolume; }
91 
92  virtual iSoundEnvironment *LoadSoundEnvironment(const tString &asFilePath) = 0;
93 
94  virtual void SetSoundEnvironment(iSoundEnvironment *apSoundEnv) = 0;
95  virtual void FadeSoundEnvironment(iSoundEnvironment *apSourceSoundEnv, iSoundEnvironment *apDestSoundEnv, float afT) = 0;
96 
97  iSoundEnvironment *GetSoundEnvironmentFromFileName(const tString &asName);
98  // void DestroySoundEnvironment( iSoundEnvironment* apSoundEnv);
99 
100 protected:
101  float mfVolume;
102  float mfEnvVolume;
103  bool mbListenerAttenuation;
104 
105  bool mbHardwareAcc;
106  bool mbEnvAudioEnabled;
107 
108  cVector3f mvListenerUp;
109  cVector3f mvListenerForward;
110  cVector3f mvListenerRight;
111  cVector3f mvListenerPosition;
112  cVector3f mvListenerVelocity;
113 
114  cMatrixf m_mtxListener;
115 
116  tSoundEnvList mlstSoundEnv;
117 };
118 
119 } // namespace hpl
120 
121 #endif // HPL_LOWLEVELSOUND_H
Definition: AI.h:36
Definition: str.h:59
Definition: SoundEnvironment.h:36
ListInternal::Iterator< t_T > iterator
Definition: list.h:52
Definition: SoundData.h:39
virtual void GetSupportedFormats(tStringList &alstFormats)=0
Definition: LowLevelSound.h:45