aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio/audioengine_fmod.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llaudio/audioengine_fmod.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llaudio/audioengine_fmod.h')
-rw-r--r--linden/indra/llaudio/audioengine_fmod.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/linden/indra/llaudio/audioengine_fmod.h b/linden/indra/llaudio/audioengine_fmod.h
new file mode 100644
index 0000000..9274b1b
--- /dev/null
+++ b/linden/indra/llaudio/audioengine_fmod.h
@@ -0,0 +1,158 @@
1/**
2 * @file audioengine_fmod.h
3 * @brief Definition of LLAudioEngine class abstracting the audio
4 * support as a FMOD 3D implementation
5 *
6 * Copyright (c) 2002-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#ifndef LL_AUDIOENGINE_FMOD_H
30#define LL_AUDIOENGINE_FMOD_H
31
32#include "audioengine.h"
33
34#if LL_FMOD
35
36#include "listener_fmod.h"
37
38#include "fmod.h"
39
40class LLAudioStreamFMOD;
41
42class LLAudioEngine_FMOD : public LLAudioEngine
43{
44public:
45 LLAudioEngine_FMOD();
46 virtual ~LLAudioEngine_FMOD();
47
48 // initialization/startup/shutdown
49 virtual BOOL init(const S32 num_channels, void *user_data);
50 virtual void allocateListener();
51
52 virtual void shutdown();
53
54 virtual void idle(F32 max_decode_time = 0.f);
55
56 // Internet stream methods
57 virtual void initInternetStream();
58 virtual void startInternetStream(const char* url);
59 virtual void updateInternetStream();
60 virtual void stopInternetStream();
61 virtual void pauseInternetStream(int pause);
62 virtual int isInternetStreamPlaying();
63 virtual void getInternetStreamInfo(char* artist, char* title);
64 virtual void setInternetStreamGain(F32 vol);
65 virtual const char* getInternetStreamURL();
66
67 /*virtual*/ void initWind();
68 /*virtual*/ void cleanupWind();
69
70 /*virtual*/void updateWind(LLVector3 direction, F32 camera_height_above_water);
71
72protected:
73 /*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to.
74 /*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel.
75
76 /*virtual*/ void setInternalGain(F32 gain);
77protected:
78 static signed char F_CALLBACKAPI callbackMetaData(char* name, char* value, void* userdata);
79
80 LLAudioStreamFMOD *mCurrentInternetStreamp;
81 char mInternetStreamURL[1024]; /*Flawfinder: ignore*/
82 int mInternetStreamChannel;
83
84 std::list<LLAudioStreamFMOD *> mDeadStreams;
85
86 //F32 mMinDistance[MAX_BUFFERS];
87 //F32 mMaxDistance[MAX_BUFFERS];
88
89 S32 mFadeIn;
90 BOOL mInited;
91
92 // On Windows, userdata is the HWND of the application window.
93 void* mUserData;
94
95};
96
97
98class LLAudioChannelFMOD : public LLAudioChannel
99{
100public:
101 LLAudioChannelFMOD();
102 virtual ~LLAudioChannelFMOD();
103
104protected:
105 /*virtual*/ void play();
106 /*virtual*/ void playSynced(LLAudioChannel *channelp);
107 /*virtual*/ void cleanup();
108 /*virtual*/ BOOL isPlaying();
109
110 /*virtual*/ BOOL updateBuffer();
111 /*virtual*/ void update3DPosition();
112 /*virtual*/ void updateLoop();
113
114protected:
115 int mChannelID;
116 S32 mLastSamplePos;
117};
118
119
120class LLAudioBufferFMOD : public LLAudioBuffer
121{
122public:
123 LLAudioBufferFMOD();
124 virtual ~LLAudioBufferFMOD();
125
126 /*virtual*/ BOOL loadWAV(const char *filename);
127 /*virtual*/ U32 getLength();
128 friend class LLAudioChannelFMOD;
129
130 void set3DMode(BOOL use3d);
131protected:
132 FSOUND_SAMPLE *getSample() { return mSamplep; }
133protected:
134 FSOUND_SAMPLE *mSamplep;
135};
136
137class LLAudioStreamFMOD
138{
139public:
140 LLAudioStreamFMOD(const char *url);
141 int startStream();
142 BOOL stopStream(); // Returns true if the stream was successfully stopped.
143 BOOL ready();
144
145 char *getURL() { return mInternetStreamURL; }
146
147 int getOpenState();
148protected:
149 FSOUND_STREAM* mInternetStream;
150 BOOL mReady;
151
152 char mInternetStreamURL[1024]; /*Flawfinder: ignore*/
153};
154
155#endif
156
157#endif
158