diff options
Diffstat (limited to 'linden/indra/llaudio/llaudioengine_fmod.h')
-rw-r--r-- | linden/indra/llaudio/llaudioengine_fmod.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/linden/indra/llaudio/llaudioengine_fmod.h b/linden/indra/llaudio/llaudioengine_fmod.h new file mode 100644 index 0000000..3968657 --- /dev/null +++ b/linden/indra/llaudio/llaudioengine_fmod.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /** | ||
2 | * @file audioengine_fmod.h | ||
3 | * @brief Definition of LLAudioEngine class abstracting the audio | ||
4 | * support as a FMOD 3D implementation | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
7 | * | ||
8 | * Copyright (c) 2002-2009, Linden Research, Inc. | ||
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://secondlifegrid.net/programs/open_source/licensing/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 | ||
22 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
23 | * | ||
24 | * By copying, modifying or distributing this software, you acknowledge | ||
25 | * that you have read and understood your obligations described above, | ||
26 | * and agree to abide by those obligations. | ||
27 | * | ||
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
30 | * COMPLETENESS OR PERFORMANCE. | ||
31 | * $/LicenseInfo$ | ||
32 | */ | ||
33 | |||
34 | #ifndef LL_AUDIOENGINE_FMOD_H | ||
35 | #define LL_AUDIOENGINE_FMOD_H | ||
36 | |||
37 | #include "llaudioengine.h" | ||
38 | #include "lllistener_fmod.h" | ||
39 | #include "llwindgen.h" | ||
40 | |||
41 | #include "fmod.h" | ||
42 | |||
43 | class LLAudioStreamManagerFMOD; | ||
44 | |||
45 | class LLAudioEngine_FMOD : public LLAudioEngine | ||
46 | { | ||
47 | public: | ||
48 | LLAudioEngine_FMOD(); | ||
49 | virtual ~LLAudioEngine_FMOD(); | ||
50 | |||
51 | // initialization/startup/shutdown | ||
52 | virtual bool init(const S32 num_channels, void *user_data); | ||
53 | virtual std::string getDriverName(bool verbose); | ||
54 | virtual void allocateListener(); | ||
55 | |||
56 | virtual void shutdown(); | ||
57 | |||
58 | /*virtual*/ void initWind(); | ||
59 | /*virtual*/ void cleanupWind(); | ||
60 | |||
61 | /*virtual*/void updateWind(LLVector3 direction, F32 camera_height_above_water); | ||
62 | |||
63 | #if LL_DARWIN | ||
64 | typedef S32 MIXBUFFERFORMAT; | ||
65 | #else | ||
66 | typedef S16 MIXBUFFERFORMAT; | ||
67 | #endif | ||
68 | |||
69 | protected: | ||
70 | /*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to. | ||
71 | /*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel. | ||
72 | |||
73 | /*virtual*/ void setInternalGain(F32 gain); | ||
74 | protected: | ||
75 | static signed char F_CALLBACKAPI callbackMetaData(char* name, char* value, void* userdata); | ||
76 | |||
77 | //F32 mMinDistance[MAX_BUFFERS]; | ||
78 | //F32 mMaxDistance[MAX_BUFFERS]; | ||
79 | |||
80 | bool mInited; | ||
81 | |||
82 | // On Windows, userdata is the HWND of the application window. | ||
83 | void* mUserData; | ||
84 | |||
85 | LLWindGen<MIXBUFFERFORMAT> *mWindGen; | ||
86 | }; | ||
87 | |||
88 | |||
89 | class LLAudioChannelFMOD : public LLAudioChannel | ||
90 | { | ||
91 | public: | ||
92 | LLAudioChannelFMOD(); | ||
93 | virtual ~LLAudioChannelFMOD(); | ||
94 | |||
95 | protected: | ||
96 | /*virtual*/ void play(); | ||
97 | /*virtual*/ void playSynced(LLAudioChannel *channelp); | ||
98 | /*virtual*/ void cleanup(); | ||
99 | /*virtual*/ bool isPlaying(); | ||
100 | |||
101 | /*virtual*/ bool updateBuffer(); | ||
102 | /*virtual*/ void update3DPosition(); | ||
103 | /*virtual*/ void updateLoop(); | ||
104 | |||
105 | protected: | ||
106 | int mChannelID; | ||
107 | S32 mLastSamplePos; | ||
108 | }; | ||
109 | |||
110 | |||
111 | class LLAudioBufferFMOD : public LLAudioBuffer | ||
112 | { | ||
113 | public: | ||
114 | LLAudioBufferFMOD(); | ||
115 | virtual ~LLAudioBufferFMOD(); | ||
116 | |||
117 | /*virtual*/ bool loadWAV(const std::string& filename); | ||
118 | /*virtual*/ U32 getLength(); | ||
119 | friend class LLAudioChannelFMOD; | ||
120 | |||
121 | void set3DMode(bool use3d); | ||
122 | protected: | ||
123 | FSOUND_SAMPLE *getSample() { return mSamplep; } | ||
124 | protected: | ||
125 | FSOUND_SAMPLE *mSamplep; | ||
126 | }; | ||
127 | |||
128 | |||
129 | #endif // LL_AUDIOENGINE_FMOD_H | ||