diff options
author | Armin Weatherwax | 2011-01-04 00:25:35 +0100 |
---|---|---|
committer | Armin Weatherwax | 2011-01-04 00:36:19 +0100 |
commit | b4959214023db77c6048036cc924075c4271ba74 (patch) | |
tree | bfc899fae639c2187088d3802e2404a7d689ed88 /linden/indra/llaudio | |
parent | load unloaded-avatar-cloud particle system from LLSD file. (diff) | |
download | meta-impy-b4959214023db77c6048036cc924075c4271ba74.zip meta-impy-b4959214023db77c6048036cc924075c4271ba74.tar.gz meta-impy-b4959214023db77c6048036cc924075c4271ba74.tar.bz2 meta-impy-b4959214023db77c6048036cc924075c4271ba74.tar.xz |
move streaming audio out of gAudiop into its own class.
* might solve several issues with streaming audio, like:
streaming audio not working when the sound effects driver fails.
* breaks fmod. Sorry. If you want fmod go fix it, its probably not difficult.
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r-- | linden/indra/llaudio/llaudioengine.cpp | 79 | ||||
-rw-r--r-- | linden/indra/llaudio/llaudioengine.h | 21 | ||||
-rw-r--r-- | linden/indra/llaudio/llstreamingaudio.h | 3 |
3 files changed, 3 insertions, 100 deletions
diff --git a/linden/indra/llaudio/llaudioengine.cpp b/linden/indra/llaudio/llaudioengine.cpp index bed791a..6b0003a 100644 --- a/linden/indra/llaudio/llaudioengine.cpp +++ b/linden/indra/llaudio/llaudioengine.cpp | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "linden_common.h" | 36 | #include "linden_common.h" |
37 | 37 | ||
38 | #include "llaudioengine.h" | 38 | #include "llaudioengine.h" |
39 | #include "llstreamingaudio.h" | ||
40 | 39 | ||
41 | #include "llerror.h" | 40 | #include "llerror.h" |
42 | #include "llmath.h" | 41 | #include "llmath.h" |
@@ -48,7 +47,6 @@ | |||
48 | #include "llaudiodecodemgr.h" | 47 | #include "llaudiodecodemgr.h" |
49 | #include "llassetstorage.h" | 48 | #include "llassetstorage.h" |
50 | 49 | ||
51 | |||
52 | // necessary for grabbing sounds from sim (implemented in viewer) | 50 | // necessary for grabbing sounds from sim (implemented in viewer) |
53 | extern void request_sound(const LLUUID &sound_guid); | 51 | extern void request_sound(const LLUUID &sound_guid); |
54 | 52 | ||
@@ -70,16 +68,6 @@ LLAudioEngine::~LLAudioEngine() | |||
70 | { | 68 | { |
71 | } | 69 | } |
72 | 70 | ||
73 | LLStreamingAudioInterface* LLAudioEngine::getStreamingAudioImpl() | ||
74 | { | ||
75 | return mStreamingAudioImpl; | ||
76 | } | ||
77 | |||
78 | void LLAudioEngine::setStreamingAudioImpl(LLStreamingAudioInterface *impl) | ||
79 | { | ||
80 | mStreamingAudioImpl = impl; | ||
81 | } | ||
82 | |||
83 | void LLAudioEngine::setDefaults() | 71 | void LLAudioEngine::setDefaults() |
84 | { | 72 | { |
85 | mMaxWindGain = 1.f; | 73 | mMaxWindGain = 1.f; |
@@ -108,8 +96,6 @@ void LLAudioEngine::setDefaults() | |||
108 | mInternalGain = 0.f; | 96 | mInternalGain = 0.f; |
109 | mNextWindUpdate = 0.f; | 97 | mNextWindUpdate = 0.f; |
110 | 98 | ||
111 | mStreamingAudioImpl = NULL; | ||
112 | |||
113 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) | 99 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) |
114 | mSecondaryGain[i] = 1.0f; | 100 | mSecondaryGain[i] = 1.0f; |
115 | } | 101 | } |
@@ -174,62 +160,6 @@ void LLAudioEngine::shutdown() | |||
174 | } | 160 | } |
175 | } | 161 | } |
176 | 162 | ||
177 | |||
178 | // virtual | ||
179 | void LLAudioEngine::startInternetStream(const std::string& url) | ||
180 | { | ||
181 | if (mStreamingAudioImpl) | ||
182 | mStreamingAudioImpl->start(url); | ||
183 | } | ||
184 | |||
185 | |||
186 | // virtual | ||
187 | void LLAudioEngine::stopInternetStream() | ||
188 | { | ||
189 | if (mStreamingAudioImpl) | ||
190 | mStreamingAudioImpl->stop(); | ||
191 | } | ||
192 | |||
193 | // virtual | ||
194 | void LLAudioEngine::pauseInternetStream(int pause) | ||
195 | { | ||
196 | if (mStreamingAudioImpl) | ||
197 | mStreamingAudioImpl->pause(pause); | ||
198 | } | ||
199 | |||
200 | // virtual | ||
201 | void LLAudioEngine::updateInternetStream() | ||
202 | { | ||
203 | if (mStreamingAudioImpl) | ||
204 | mStreamingAudioImpl->update(); | ||
205 | } | ||
206 | |||
207 | // virtual | ||
208 | int LLAudioEngine::isInternetStreamPlaying() | ||
209 | { | ||
210 | if (mStreamingAudioImpl) | ||
211 | return mStreamingAudioImpl->isPlaying(); | ||
212 | |||
213 | return 0; // Stopped | ||
214 | } | ||
215 | |||
216 | |||
217 | // virtual | ||
218 | void LLAudioEngine::setInternetStreamGain(F32 vol) | ||
219 | { | ||
220 | if (mStreamingAudioImpl) | ||
221 | mStreamingAudioImpl->setGain(vol); | ||
222 | } | ||
223 | |||
224 | // virtual | ||
225 | std::string LLAudioEngine::getInternetStreamURL() | ||
226 | { | ||
227 | if (mStreamingAudioImpl) | ||
228 | return mStreamingAudioImpl->getURL(); | ||
229 | else return std::string(); | ||
230 | } | ||
231 | |||
232 | |||
233 | void LLAudioEngine::updateChannels() | 163 | void LLAudioEngine::updateChannels() |
234 | { | 164 | { |
235 | S32 i; | 165 | S32 i; |
@@ -512,7 +442,6 @@ void LLAudioEngine::idle(F32 max_decode_time) | |||
512 | // or request new data. | 442 | // or request new data. |
513 | startNextTransfer(); | 443 | startNextTransfer(); |
514 | 444 | ||
515 | updateInternetStream(); | ||
516 | } | 445 | } |
517 | 446 | ||
518 | 447 | ||
@@ -754,14 +683,6 @@ F32 LLAudioEngine::getSecondaryGain(S32 type) | |||
754 | return mSecondaryGain[type]; | 683 | return mSecondaryGain[type]; |
755 | } | 684 | } |
756 | 685 | ||
757 | F32 LLAudioEngine::getInternetStreamGain() | ||
758 | { | ||
759 | if (mStreamingAudioImpl) | ||
760 | return mStreamingAudioImpl->getGain(); | ||
761 | else | ||
762 | return 1.0f; | ||
763 | } | ||
764 | |||
765 | void LLAudioEngine::setMaxWindGain(F32 gain) | 686 | void LLAudioEngine::setMaxWindGain(F32 gain) |
766 | { | 687 | { |
767 | mMaxWindGain = gain; | 688 | mMaxWindGain = gain; |
diff --git a/linden/indra/llaudio/llaudioengine.h b/linden/indra/llaudio/llaudioengine.h index a1b240e..7237ce2 100644 --- a/linden/indra/llaudio/llaudioengine.h +++ b/linden/indra/llaudio/llaudioengine.h | |||
@@ -71,8 +71,6 @@ class LLAudioData; | |||
71 | class LLAudioChannel; | 71 | class LLAudioChannel; |
72 | class LLAudioChannelOpenAL; | 72 | class LLAudioChannelOpenAL; |
73 | class LLAudioBuffer; | 73 | class LLAudioBuffer; |
74 | class LLStreamingAudioInterface; | ||
75 | |||
76 | 74 | ||
77 | // | 75 | // |
78 | // LLAudioEngine definition | 76 | // LLAudioEngine definition |
@@ -119,16 +117,13 @@ public: | |||
119 | // stops playing new sounds. | 117 | // stops playing new sounds. |
120 | void setMuted(bool muted); | 118 | void setMuted(bool muted); |
121 | bool getMuted() const { return mMuted; } | 119 | bool getMuted() const { return mMuted; } |
122 | #ifdef USE_PLUGIN_MEDIA | 120 | |
123 | LLPluginClassMedia* initializeMedia(const std::string& media_type); | ||
124 | #endif | ||
125 | F32 getMasterGain(); | 121 | F32 getMasterGain(); |
126 | void setMasterGain(F32 gain); | 122 | void setMasterGain(F32 gain); |
127 | 123 | ||
128 | F32 getSecondaryGain(S32 type); | 124 | F32 getSecondaryGain(S32 type); |
129 | void setSecondaryGain(S32 type, F32 gain); | 125 | void setSecondaryGain(S32 type, F32 gain); |
130 | 126 | ||
131 | F32 getInternetStreamGain(); | ||
132 | 127 | ||
133 | virtual void setDopplerFactor(F32 factor); | 128 | virtual void setDopplerFactor(F32 factor); |
134 | virtual F32 getDopplerFactor(); | 129 | virtual F32 getDopplerFactor(); |
@@ -150,19 +145,6 @@ public: | |||
150 | LLAudioSource *findAudioSource(const LLUUID &source_id); | 145 | LLAudioSource *findAudioSource(const LLUUID &source_id); |
151 | LLAudioData *getAudioData(const LLUUID &audio_uuid); | 146 | LLAudioData *getAudioData(const LLUUID &audio_uuid); |
152 | 147 | ||
153 | // Internet stream implementation manipulation | ||
154 | LLStreamingAudioInterface *getStreamingAudioImpl(); | ||
155 | void setStreamingAudioImpl(LLStreamingAudioInterface *impl); | ||
156 | // Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists | ||
157 | void startInternetStream(const std::string& url); | ||
158 | void stopInternetStream(); | ||
159 | void pauseInternetStream(int pause); | ||
160 | void updateInternetStream(); // expected to be called often | ||
161 | int isInternetStreamPlaying(); | ||
162 | // use a value from 0.0 to 1.0, inclusive | ||
163 | void setInternetStreamGain(F32 vol); | ||
164 | std::string getInternetStreamURL(); | ||
165 | |||
166 | // For debugging usage | 148 | // For debugging usage |
167 | virtual LLVector3 getListenerPos(); | 149 | virtual LLVector3 getListenerPos(); |
168 | 150 | ||
@@ -247,7 +229,6 @@ protected: | |||
247 | 229 | ||
248 | private: | 230 | private: |
249 | void setDefaults(); | 231 | void setDefaults(); |
250 | LLStreamingAudioInterface *mStreamingAudioImpl; | ||
251 | }; | 232 | }; |
252 | 233 | ||
253 | 234 | ||
diff --git a/linden/indra/llaudio/llstreamingaudio.h b/linden/indra/llaudio/llstreamingaudio.h index aa89e6a..f5d5334 100644 --- a/linden/indra/llaudio/llstreamingaudio.h +++ b/linden/indra/llaudio/llstreamingaudio.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #include "stdtypes.h" // from llcommon | 37 | #include "stdtypes.h" // from llcommon |
38 | 38 | ||
39 | // Entirely abstract. Based exactly on the historic API. | 39 | // Entirely abstract. Based on the historic API. |
40 | class LLStreamingAudioInterface | 40 | class LLStreamingAudioInterface |
41 | { | 41 | { |
42 | public: | 42 | public: |
@@ -51,6 +51,7 @@ class LLStreamingAudioInterface | |||
51 | virtual void setGain(F32 vol) = 0; | 51 | virtual void setGain(F32 vol) = 0; |
52 | virtual F32 getGain() = 0; | 52 | virtual F32 getGain() = 0; |
53 | virtual std::string getURL() = 0; | 53 | virtual std::string getURL() = 0; |
54 | virtual std::string getVersion() = 0; | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | #endif // LL_STREAMINGAUDIO_H | 57 | #endif // LL_STREAMINGAUDIO_H |