aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio/audioengine_openal.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llaudio/audioengine_openal.h')
-rw-r--r--linden/indra/llaudio/audioengine_openal.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/linden/indra/llaudio/audioengine_openal.h b/linden/indra/llaudio/audioengine_openal.h
new file mode 100644
index 0000000..6289f99
--- /dev/null
+++ b/linden/indra/llaudio/audioengine_openal.h
@@ -0,0 +1,100 @@
1/**
2 * @file audioengine_openal.cpp
3 * @brief implementation of audio engine using OpenAL
4 * support as a OpenAL 3D implementation
5 *
6 * Copyright (c) 2002-2008, Linden Research, Inc.
7 *
8 * $LicenseInfo:firstyear=2002&license=viewergpl$
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlife.com/developers/opensource/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlife.com/developers/opensource/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33
34#ifndef LL_AUDIOENGINE_OpenAL_H
35#define LL_AUDIOENGINE_OpenAL_H
36
37#include "audioengine.h"
38#include "listener_openal.h"
39#include "windgen.h"
40
41class LLAudioEngine_OpenAL : public LLAudioEngine
42{
43 public:
44 LLAudioEngine_OpenAL();
45 virtual ~LLAudioEngine_OpenAL();
46
47 virtual bool init(const S32 num_channels, void *user_data);
48 virtual void allocateListener();
49
50 virtual void shutdown();
51
52 void setInternalGain(F32 gain);
53
54 LLAudioBuffer* createBuffer();
55 LLAudioChannel* createChannel();
56
57 /*virtual*/ void initWind();
58 /*virtual*/ void cleanupWind();
59 /*virtual*/ void updateWind(LLVector3 direction, F32 camera_altitude);
60
61 private:
62 void * windDSP(void *newbuffer, int length);
63 LLWindGen<S16> *mWindGen;
64};
65
66class LLAudioChannelOpenAL : public LLAudioChannel
67{
68 public:
69 LLAudioChannelOpenAL();
70 virtual ~LLAudioChannelOpenAL();
71 protected:
72 void play();
73 void playSynced(LLAudioChannel *channelp);
74 void cleanup();
75 bool isPlaying();
76
77 bool updateBuffer();
78 void update3DPosition();
79 void updateLoop(){};
80
81 ALuint mALSource;
82};
83
84class LLAudioBufferOpenAL : public LLAudioBuffer{
85 public:
86 LLAudioBufferOpenAL();
87 virtual ~LLAudioBufferOpenAL();
88
89 bool loadWAV(const std::string& filename);
90 U32 getLength();
91
92 friend class LLAudioChannelOpenAL;
93 protected:
94 void cleanup();
95 ALuint getBuffer() {return mALBuffer;}
96
97 ALuint mALBuffer;
98};
99
100#endif