ScummVM API documentation
OpenALSoundChannel.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_OPENAL_SOUND_CHANNEL_H
29 #define HPL_OPENAL_SOUND_CHANNEL_H
30 
31 #include "audio/audiostream.h"
32 #include "audio/mixer.h"
33 #include "common/file.h"
34 #include "common/str.h"
35 #include "hpl1/engine/impl/OpenALSoundData.h"
36 #include "hpl1/engine/sound/SoundChannel.h"
37 #include "hpl1/engine/sound/SoundData.h"
38 
39 //#include "OALWrapper/OAL_Funcs.h"
40 
41 namespace hpl {
42 
43 class cLowLevelSoundOpenAL;
44 
46  friend class cLowLevelSoundOpenAL;
47 
48 public:
49  cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream *audioStream, cSoundManager *apSoundManger, cLowLevelSoundOpenAL *lowLevelSound, int priority);
51 
52  void Play();
53  void Stop();
54 
55  void SetPaused(bool abX);
56  void SetSpeed(float afSpeed);
57  void SetVolume(float afVolume);
58  void SetLooping(bool abLoop);
59  void SetPan(float afPan);
60  void Set3D(bool ab3D);
61 
62  void SetPriority(int alX);
63  int GetPriority();
64 
65  void SetPositionRelative(bool abRelative);
66  void SetPosition(const cVector3f &avPos);
67  void SetVelocity(const cVector3f &avVel);
68 
69  void SetMinDistance(float fMin);
70  void SetMaxDistance(float fMax);
71 
72  bool IsPlaying();
73 
74  bool IsBufferUnderrun() { return false; }
75  double GetElapsedTime() { return g_system->getMixer()->getElapsedTime(_handle).secs(); }
76  double GetTotalTime() { return _audioStream->getLength().secs(); }
77 
78  void SetAffectedByEnv(bool abAffected);
79  void SetFiltering(bool abEnabled, int alFlags);
80  void SetFilterGain(float afGain);
81  void SetFilterGainHF(float afGainHF);
82 
83 private:
84  void restart();
85 
86  Audio::SoundHandle _handle;
87  Audio::SeekableAudioStream *_audioStream;
88  cLowLevelSoundOpenAL *_lowLevelSound;
89  int _priority;
90  // int mlDefaultFreq;
91 
92  // float mfPosition[3];
93  // float mfVelocity[3];
94 };
95 
96 } // namespace hpl
97 
98 #endif // HPL_OPENAL_CHANNEL_H
int secs() const
Definition: timestamp.h:198
Definition: AI.h:36
virtual Audio::Mixer * getMixer()=0
virtual Timestamp getLength() const =0
Definition: audiostream.h:212
OSystem * g_system
Definition: mixer.h:49
Definition: OpenALSoundChannel.h:45
virtual Timestamp getElapsedTime(SoundHandle handle)=0
Definition: SoundManager.h:39
Definition: OpenALSoundData.h:42
Definition: SoundChannel.h:46
Definition: LowLevelSoundOpenAL.h:43