diff options
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r-- | linden/indra/llaudio/CMakeLists.txt | 3 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 94 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine.h | 5 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine_fmod.h | 2 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine_openal.cpp | 30 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine_openal.h | 1 | ||||
-rw-r--r-- | linden/indra/llaudio/listener_openal.cpp | 1 | ||||
-rw-r--r-- | linden/indra/llaudio/listener_openal.h | 3 | ||||
-rw-r--r-- | linden/indra/llaudio/llaudiodecodemgr.cpp | 23 |
9 files changed, 119 insertions, 43 deletions
diff --git a/linden/indra/llaudio/CMakeLists.txt b/linden/indra/llaudio/CMakeLists.txt index 235248e..70041e7 100644 --- a/linden/indra/llaudio/CMakeLists.txt +++ b/linden/indra/llaudio/CMakeLists.txt | |||
@@ -4,6 +4,7 @@ project(llaudio) | |||
4 | 4 | ||
5 | include(00-Common) | 5 | include(00-Common) |
6 | include(Audio) | 6 | include(Audio) |
7 | include(OPENAL) | ||
7 | include(FMOD) | 8 | include(FMOD) |
8 | include(OPENAL) | 9 | include(OPENAL) |
9 | include(LLCommon) | 10 | include(LLCommon) |
@@ -25,6 +26,7 @@ include_directories( | |||
25 | ${OPENAL_LIB_INCLUDE_DIRS} | 26 | ${OPENAL_LIB_INCLUDE_DIRS} |
26 | ${FREEAULT_LIB_INCLUDE_DIRS} | 27 | ${FREEAULT_LIB_INCLUDE_DIRS} |
27 | ${LLMEDIA_INCLUDE_DIRS} | 28 | ${LLMEDIA_INCLUDE_DIRS} |
29 | ${GSTREAMER_INCLUDE_DIRS} | ||
28 | ) | 30 | ) |
29 | 31 | ||
30 | set(llaudio_SOURCE_FILES | 32 | set(llaudio_SOURCE_FILES |
@@ -83,6 +85,7 @@ set_source_files_properties(${llaudio_HEADER_FILES} | |||
83 | list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) | 85 | list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) |
84 | 86 | ||
85 | add_library (llaudio ${llaudio_SOURCE_FILES}) | 87 | add_library (llaudio ${llaudio_SOURCE_FILES}) |
88 | |||
86 | target_link_libraries( | 89 | target_link_libraries( |
87 | llaudio | 90 | llaudio |
88 | ${VORBISENC_LIBRARIES} | 91 | ${VORBISENC_LIBRARIES} |
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index c5bc367..dd0ffff 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp | |||
@@ -45,6 +45,8 @@ | |||
45 | #include "llassetstorage.h" | 45 | #include "llassetstorage.h" |
46 | 46 | ||
47 | #include "llmediamanager.h" | 47 | #include "llmediamanager.h" |
48 | #include "llmediabase.h" | ||
49 | #include "llmediaimplcommon.h" | ||
48 | 50 | ||
49 | // necessary for grabbing sounds from sim (implemented in viewer) | 51 | // necessary for grabbing sounds from sim (implemented in viewer) |
50 | extern void request_sound(const LLUUID &sound_guid); | 52 | extern void request_sound(const LLUUID &sound_guid); |
@@ -101,6 +103,8 @@ void LLAudioEngine::setDefaults() | |||
101 | 103 | ||
102 | mInternetStreamMedia = NULL; | 104 | mInternetStreamMedia = NULL; |
103 | mInternetStreamURL.clear(); | 105 | mInternetStreamURL.clear(); |
106 | |||
107 | mStatus = LLMediaBase::STATUS_UNKNOWN; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
@@ -168,6 +172,14 @@ void LLAudioEngine::shutdown() | |||
168 | } | 172 | } |
169 | 173 | ||
170 | 174 | ||
175 | //////////////////////////////////////////////////////////////////////////////// | ||
176 | // virtual (derives from LLMediaBase) | ||
177 | LLMediaBase::EStatus LLAudioEngine::getStatus() | ||
178 | { | ||
179 | return mStatus; | ||
180 | } | ||
181 | |||
182 | |||
171 | // virtual | 183 | // virtual |
172 | void LLAudioEngine::startInternetStream(const std::string& url) | 184 | void LLAudioEngine::startInternetStream(const std::string& url) |
173 | { | 185 | { |
@@ -184,31 +196,51 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
184 | } | 196 | } |
185 | 197 | ||
186 | if(!mInternetStreamMedia) | 198 | if(!mInternetStreamMedia) |
199 | { | ||
187 | return; | 200 | return; |
188 | 201 | } | |
189 | if (!url.empty()) { | 202 | // Check for a dead stream from gstreamer, just in case |
190 | llinfos << "Starting internet stream: " << url << llendl; | 203 | else if(getStatus() == LLMediaBase::STATUS_DEAD) |
191 | mInternetStreamURL = url; | 204 | { |
192 | mInternetStreamMedia->navigateTo ( url ); | 205 | llinfos << "don't play dead stream urls"<< llendl; |
193 | llinfos << "Playing....." << llendl; | 206 | mInternetStreamURL.clear(); |
194 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | 207 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
195 | mInternetStreamMedia->updateMedia(); | 208 | mInternetStreamMedia->updateMedia(); |
196 | } else { | 209 | stopInternetStream(); |
197 | llinfos << "setting stream to NULL"<< llendl; | 210 | } |
211 | else if (url.empty()) | ||
212 | { | ||
213 | llinfos << "url is emptly. Setting stream to NULL"<< llendl; | ||
198 | mInternetStreamURL.clear(); | 214 | mInternetStreamURL.clear(); |
199 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 215 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
200 | mInternetStreamMedia->updateMedia(); | 216 | mInternetStreamMedia->updateMedia(); |
201 | } | 217 | } |
218 | // Stream appears to be good, attempting to play | ||
219 | else | ||
220 | { | ||
221 | // stop any other stream first | ||
222 | stopInternetStream(); | ||
223 | |||
224 | llinfos << "Starting internet stream: " << url << llendl; | ||
225 | mInternetStreamURL = url; | ||
226 | mInternetStreamMedia->navigateTo(url); | ||
227 | //llinfos << "Playing....." << llendl; | ||
228 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | ||
229 | mInternetStreamMedia->updateMedia(); | ||
230 | mStatus = LLMediaBase::STATUS_STARTED; | ||
231 | } | ||
202 | } | 232 | } |
203 | 233 | ||
204 | // virtual | 234 | // virtual |
205 | void LLAudioEngine::stopInternetStream() | 235 | void LLAudioEngine::stopInternetStream() |
206 | { | 236 | { |
207 | llinfos << "entered stopInternetStream()" << llendl; | 237 | llinfos << "entered stopInternetStream()" << llendl; |
208 | 238 | mInternetStreamURL.clear(); | |
209 | if(mInternetStreamMedia) | 239 | |
240 | if(mInternetStreamMedia) | ||
210 | { | 241 | { |
211 | if( ! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)){ | 242 | if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) |
243 | { | ||
212 | llinfos << "attempting to stop stream failed!" << llendl; | 244 | llinfos << "attempting to stop stream failed!" << llendl; |
213 | } | 245 | } |
214 | mInternetStreamMedia->updateMedia(); | 246 | mInternetStreamMedia->updateMedia(); |
@@ -300,6 +332,13 @@ void LLAudioEngine::updateChannels() | |||
300 | { | 332 | { |
301 | if (mChannels[i]) | 333 | if (mChannels[i]) |
302 | { | 334 | { |
335 | // set secondary gain if type is available | ||
336 | LLAudioSource* source = mChannels[i]->getSource(); | ||
337 | if (source) | ||
338 | { | ||
339 | mChannels[i]->setSecondaryGain(mSecondaryGain[source->getType()]); | ||
340 | } | ||
341 | |||
303 | mChannels[i]->updateBuffer(); | 342 | mChannels[i]->updateBuffer(); |
304 | mChannels[i]->update3DPosition(); | 343 | mChannels[i]->update3DPosition(); |
305 | mChannels[i]->updateLoop(); | 344 | mChannels[i]->updateLoop(); |
@@ -378,7 +417,7 @@ void LLAudioEngine::idle(F32 max_decode_time) | |||
378 | LLAudioChannel *channelp = getFreeChannel(max_priority); | 417 | LLAudioChannel *channelp = getFreeChannel(max_priority); |
379 | if (channelp) | 418 | if (channelp) |
380 | { | 419 | { |
381 | //llinfos << "Replacing source in channel due to priority!" << llendl; | 420 | //LL_INFOS("AudioEngine") << "Replacing source in channel due to priority!" << llendl; |
382 | max_sourcep->setChannel(channelp); | 421 | max_sourcep->setChannel(channelp); |
383 | channelp->setSource(max_sourcep); | 422 | channelp->setSource(max_sourcep); |
384 | if (max_sourcep->isSyncSlave()) | 423 | if (max_sourcep->isSyncSlave()) |
@@ -545,7 +584,7 @@ void LLAudioEngine::idle(F32 max_decode_time) | |||
545 | { | 584 | { |
546 | if (!mBuffers[i]->mInUse && mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > 30.f) | 585 | if (!mBuffers[i]->mInUse && mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > 30.f) |
547 | { | 586 | { |
548 | //llinfos << "Flushing unused buffer!" << llendl; | 587 | //LL_INFOS("AudioEngine") << "Flushing unused buffer!" << llendl; |
549 | mBuffers[i]->mAudioDatap->mBufferp = NULL; | 588 | mBuffers[i]->mAudioDatap->mBufferp = NULL; |
550 | delete mBuffers[i]; | 589 | delete mBuffers[i]; |
551 | mBuffers[i] = NULL; | 590 | mBuffers[i] = NULL; |
@@ -658,8 +697,8 @@ LLAudioBuffer *LLAudioEngine::getFreeBuffer() | |||
658 | 697 | ||
659 | if (buffer_id >= 0) | 698 | if (buffer_id >= 0) |
660 | { | 699 | { |
661 | llinfos << "Taking over unused buffer " << buffer_id << llendl; | 700 | LL_INFOS("AudioEngine") << "Taking over unused buffer " << buffer_id << llendl; |
662 | //llinfos << "Flushing unused buffer!" << llendl; | 701 | //LL_INFOS("AudioEngine") << "Flushing unused buffer!" << llendl; |
663 | mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; | 702 | mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; |
664 | delete mBuffers[buffer_id]; | 703 | delete mBuffers[buffer_id]; |
665 | mBuffers[buffer_id] = createBuffer(); | 704 | mBuffers[buffer_id] = createBuffer(); |
@@ -871,9 +910,10 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i | |||
871 | const S32 type, const LLVector3d &pos_global) | 910 | const S32 type, const LLVector3d &pos_global) |
872 | { | 911 | { |
873 | // Create a new source (since this can't be associated with an existing source. | 912 | // Create a new source (since this can't be associated with an existing source. |
874 | //llinfos << "Localized: " << audio_uuid << llendl; | 913 | //LL_INFOS("AudioEngine") << "Localized: " << audio_uuid << llendl; |
875 | 914 | ||
876 | if (mMuted) | 915 | //If we cannot hear it, dont even try to load the sound. |
916 | if (mMuted || gain == 0.0) | ||
877 | { | 917 | { |
878 | return; | 918 | return; |
879 | } | 919 | } |
@@ -1093,10 +1133,10 @@ bool LLAudioEngine::hasLocalFile(const LLUUID &uuid) | |||
1093 | 1133 | ||
1094 | void LLAudioEngine::startNextTransfer() | 1134 | void LLAudioEngine::startNextTransfer() |
1095 | { | 1135 | { |
1096 | //llinfos << "LLAudioEngine::startNextTransfer()" << llendl; | 1136 | //LL_INFOS("AudioEngine") << "LLAudioEngine::startNextTransfer()" << llendl; |
1097 | if (mCurrentTransfer.notNull() || getMuted()) | 1137 | if (mCurrentTransfer.notNull() || getMuted()) |
1098 | { | 1138 | { |
1099 | //llinfos << "Transfer in progress, aborting" << llendl; | 1139 | //LL_INFOS("AudioEngine") << "Transfer in progress, aborting" << llendl; |
1100 | return; | 1140 | return; |
1101 | } | 1141 | } |
1102 | 1142 | ||
@@ -1277,7 +1317,7 @@ void LLAudioEngine::startNextTransfer() | |||
1277 | 1317 | ||
1278 | if (asset_id.notNull()) | 1318 | if (asset_id.notNull()) |
1279 | { | 1319 | { |
1280 | llinfos << "Getting asset data for: " << asset_id << llendl; | 1320 | LL_INFOS("AudioEngine") << "Getting asset data for: " << asset_id << llendl; |
1281 | gAudiop->mCurrentTransfer = asset_id; | 1321 | gAudiop->mCurrentTransfer = asset_id; |
1282 | gAudiop->mCurrentTransferTimer.reset(); | 1322 | gAudiop->mCurrentTransferTimer.reset(); |
1283 | gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, | 1323 | gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, |
@@ -1285,7 +1325,7 @@ void LLAudioEngine::startNextTransfer() | |||
1285 | } | 1325 | } |
1286 | else | 1326 | else |
1287 | { | 1327 | { |
1288 | //llinfos << "No pending transfers?" << llendl; | 1328 | //LL_INFOS("AudioEngine") << "No pending transfers?" << llendl; |
1289 | } | 1329 | } |
1290 | } | 1330 | } |
1291 | 1331 | ||
@@ -1295,7 +1335,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E | |||
1295 | { | 1335 | { |
1296 | if (result_code) | 1336 | if (result_code) |
1297 | { | 1337 | { |
1298 | llinfos << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << llendl; | 1338 | LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << llendl; |
1299 | // Need to mark data as bad to avoid constant rerequests. | 1339 | // Need to mark data as bad to avoid constant rerequests. |
1300 | LLAudioData *adp = gAudiop->getAudioData(uuid); | 1340 | LLAudioData *adp = gAudiop->getAudioData(uuid); |
1301 | if (adp) | 1341 | if (adp) |
@@ -1676,7 +1716,7 @@ LLAudioChannel::LLAudioChannel() : | |||
1676 | LLAudioChannel::~LLAudioChannel() | 1716 | LLAudioChannel::~LLAudioChannel() |
1677 | { | 1717 | { |
1678 | // Need to disconnect any sources which are using this channel. | 1718 | // Need to disconnect any sources which are using this channel. |
1679 | //llinfos << "Cleaning up audio channel" << llendl; | 1719 | //LL_INFOS("AudioEngine") << "Cleaning up audio channel" << llendl; |
1680 | if (mCurrentSourcep) | 1720 | if (mCurrentSourcep) |
1681 | { | 1721 | { |
1682 | mCurrentSourcep->setChannel(NULL); | 1722 | mCurrentSourcep->setChannel(NULL); |
@@ -1687,12 +1727,12 @@ LLAudioChannel::~LLAudioChannel() | |||
1687 | 1727 | ||
1688 | void LLAudioChannel::setSource(LLAudioSource *sourcep) | 1728 | void LLAudioChannel::setSource(LLAudioSource *sourcep) |
1689 | { | 1729 | { |
1690 | //llinfos << this << ": setSource(" << sourcep << ")" << llendl; | 1730 | //LL_INFOS("AudioEngine") << this << ": setSource(" << sourcep << ")" << llendl; |
1691 | 1731 | ||
1692 | if (!sourcep) | 1732 | if (!sourcep) |
1693 | { | 1733 | { |
1694 | // Clearing the source for this channel, don't need to do anything. | 1734 | // Clearing the source for this channel, don't need to do anything. |
1695 | //llinfos << "Clearing source for channel" << llendl; | 1735 | //LL_INFOS("AudioEngine") << "Clearing source for channel" << llendl; |
1696 | cleanup(); | 1736 | cleanup(); |
1697 | mCurrentSourcep = NULL; | 1737 | mCurrentSourcep = NULL; |
1698 | mWaiting = false; | 1738 | mWaiting = false; |
@@ -1702,7 +1742,7 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep) | |||
1702 | if (sourcep == mCurrentSourcep) | 1742 | if (sourcep == mCurrentSourcep) |
1703 | { | 1743 | { |
1704 | // Don't reallocate the channel, this will make FMOD goofy. | 1744 | // Don't reallocate the channel, this will make FMOD goofy. |
1705 | //llinfos << "Calling setSource with same source!" << llendl; | 1745 | //LL_INFOS("AudioEngine") << "Calling setSource with same source!" << llendl; |
1706 | } | 1746 | } |
1707 | 1747 | ||
1708 | mCurrentSourcep = sourcep; | 1748 | mCurrentSourcep = sourcep; |
diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index b582f14..d289ba5 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h | |||
@@ -45,6 +45,8 @@ | |||
45 | #include "llframetimer.h" | 45 | #include "llframetimer.h" |
46 | #include "llassettype.h" | 46 | #include "llassettype.h" |
47 | 47 | ||
48 | #include "llmediabase.h" | ||
49 | |||
48 | class LLMediaBase; | 50 | class LLMediaBase; |
49 | 51 | ||
50 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; | 52 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; |
@@ -160,6 +162,7 @@ public: | |||
160 | // use a value from 0.0 to 1.0, inclusive | 162 | // use a value from 0.0 to 1.0, inclusive |
161 | virtual void setInternetStreamGain(F32 vol); | 163 | virtual void setInternetStreamGain(F32 vol); |
162 | virtual const std::string& getInternetStreamURL(); | 164 | virtual const std::string& getInternetStreamURL(); |
165 | virtual LLMediaBase::EStatus getStatus(); | ||
163 | 166 | ||
164 | // For debugging usage | 167 | // For debugging usage |
165 | virtual LLVector3 getListenerPos(); | 168 | virtual LLVector3 getListenerPos(); |
@@ -246,6 +249,8 @@ protected: | |||
246 | 249 | ||
247 | LLFrameTimer mWindUpdateTimer; | 250 | LLFrameTimer mWindUpdateTimer; |
248 | 251 | ||
252 | LLMediaBase::EStatus mStatus; | ||
253 | |||
249 | private: | 254 | private: |
250 | void setDefaults(); | 255 | void setDefaults(); |
251 | LLMediaBase *mInternetStreamMedia; | 256 | LLMediaBase *mInternetStreamMedia; |
diff --git a/linden/indra/llaudio/audioengine_fmod.h b/linden/indra/llaudio/audioengine_fmod.h index 4d2cbce..60f75b9 100644 --- a/linden/indra/llaudio/audioengine_fmod.h +++ b/linden/indra/llaudio/audioengine_fmod.h | |||
@@ -49,7 +49,7 @@ public: | |||
49 | 49 | ||
50 | // initialization/startup/shutdown | 50 | // initialization/startup/shutdown |
51 | virtual bool init(const S32 num_channels, void *user_data); | 51 | virtual bool init(const S32 num_channels, void *user_data); |
52 | virtual std::string getDriverName(bool verbose); | 52 | virtual std::string getDriverName(bool verbose); |
53 | virtual void allocateListener(); | 53 | virtual void allocateListener(); |
54 | 54 | ||
55 | virtual void shutdown(); | 55 | virtual void shutdown(); |
diff --git a/linden/indra/llaudio/audioengine_openal.cpp b/linden/indra/llaudio/audioengine_openal.cpp index b33e0b0..a14b725 100644 --- a/linden/indra/llaudio/audioengine_openal.cpp +++ b/linden/indra/llaudio/audioengine_openal.cpp | |||
@@ -54,15 +54,41 @@ LLAudioEngine_OpenAL::~LLAudioEngine_OpenAL() | |||
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | static ALboolean alutInitHelp(const char **errorstring) | ||
58 | { | ||
59 | ALboolean result = AL_FALSE; | ||
60 | ALenum err = AL_NO_ERROR; | ||
61 | #if LL_WINDOWS | ||
62 | __try { | ||
63 | result = alutInit(NULL, NULL); | ||
64 | err = alutGetError(); | ||
65 | alGetError(); // hit loading of wrap_oal.dll | ||
66 | if(!result) *errorstring = alutGetErrorString(err); | ||
67 | } __except( EXCEPTION_EXECUTE_HANDLER ) { | ||
68 | *errorstring = "[Exception]"; | ||
69 | result = AL_FALSE; | ||
70 | } | ||
71 | return result; | ||
72 | #else | ||
73 | result = alutInit(NULL, NULL); | ||
74 | if(!result) { | ||
75 | err = alutGetError(); | ||
76 | *errorstring = alutGetErrorString(err); | ||
77 | } | ||
78 | return result; | ||
79 | #endif | ||
80 | } | ||
81 | |||
57 | // virtual | 82 | // virtual |
58 | bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) | 83 | bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) |
59 | { | 84 | { |
85 | const char *errorstring = "(null)"; | ||
60 | mWindGen = NULL; | 86 | mWindGen = NULL; |
61 | LLAudioEngine::init(num_channels, userdata); | 87 | LLAudioEngine::init(num_channels, userdata); |
62 | 88 | ||
63 | if(!alutInit(NULL, NULL)) | 89 | if(!alutInitHelp(&errorstring)) |
64 | { | 90 | { |
65 | llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << llendl; | 91 | llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << errorstring << llendl; |
66 | return false; | 92 | return false; |
67 | } | 93 | } |
68 | 94 | ||
diff --git a/linden/indra/llaudio/audioengine_openal.h b/linden/indra/llaudio/audioengine_openal.h index 54b60e6..5ccdcb7 100644 --- a/linden/indra/llaudio/audioengine_openal.h +++ b/linden/indra/llaudio/audioengine_openal.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "listener_openal.h" | 39 | #include "listener_openal.h" |
40 | #include "windgen.h" | 40 | #include "windgen.h" |
41 | 41 | ||
42 | |||
42 | class LLAudioEngine_OpenAL : public LLAudioEngine | 43 | class LLAudioEngine_OpenAL : public LLAudioEngine |
43 | { | 44 | { |
44 | public: | 45 | public: |
diff --git a/linden/indra/llaudio/listener_openal.cpp b/linden/indra/llaudio/listener_openal.cpp index 718de63..a164242 100644 --- a/linden/indra/llaudio/listener_openal.cpp +++ b/linden/indra/llaudio/listener_openal.cpp | |||
@@ -122,4 +122,3 @@ F32 LLListener_OpenAL::getDistanceFactor() | |||
122 | { | 122 | { |
123 | return mDistanceFactor; | 123 | return mDistanceFactor; |
124 | } | 124 | } |
125 | |||
diff --git a/linden/indra/llaudio/listener_openal.h b/linden/indra/llaudio/listener_openal.h index 3e4353f..6f71a02 100644 --- a/linden/indra/llaudio/listener_openal.h +++ b/linden/indra/llaudio/listener_openal.h | |||
@@ -35,7 +35,8 @@ | |||
35 | 35 | ||
36 | #include "listener.h" | 36 | #include "listener.h" |
37 | 37 | ||
38 | #include "AL/al.h" | 38 | |
39 | //#include "AL/al.h" | ||
39 | #include "AL/alut.h" | 40 | #include "AL/alut.h" |
40 | 41 | ||
41 | class LLListener_OpenAL : public LLListener | 42 | class LLListener_OpenAL : public LLListener |
diff --git a/linden/indra/llaudio/llaudiodecodemgr.cpp b/linden/indra/llaudio/llaudiodecodemgr.cpp index 0515648..c984e1f 100644 --- a/linden/indra/llaudio/llaudiodecodemgr.cpp +++ b/linden/indra/llaudio/llaudiodecodemgr.cpp | |||
@@ -374,16 +374,16 @@ BOOL LLVorbisDecodeState::finishDecode() | |||
374 | 374 | ||
375 | // write "data" chunk length, in little-endian format | 375 | // write "data" chunk length, in little-endian format |
376 | S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE; | 376 | S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE; |
377 | mWAVBuffer[40] = (data_length) & 0x000000FF; | 377 | mWAVBuffer[40] = (data_length - 8) & 0x000000FF; |
378 | mWAVBuffer[41] = (data_length >> 8) & 0x000000FF; | 378 | mWAVBuffer[41] = ((data_length - 8)>> 8) & 0x000000FF; |
379 | mWAVBuffer[42] = (data_length >> 16) & 0x000000FF; | 379 | mWAVBuffer[42] = ((data_length - 8)>> 16) & 0x000000FF; |
380 | mWAVBuffer[43] = (data_length >> 24) & 0x000000FF; | 380 | mWAVBuffer[43] = ((data_length - 8)>> 24) & 0x000000FF; |
381 | |||
381 | // write overall "RIFF" length, in little-endian format | 382 | // write overall "RIFF" length, in little-endian format |
382 | data_length += 36; | 383 | mWAVBuffer[4] = (data_length + 28) & 0x000000FF; |
383 | mWAVBuffer[4] = (data_length) & 0x000000FF; | 384 | mWAVBuffer[5] = ((data_length + 28) >> 8) & 0x000000FF; |
384 | mWAVBuffer[5] = (data_length >> 8) & 0x000000FF; | 385 | mWAVBuffer[6] = ((data_length + 28) >> 16) & 0x000000FF; |
385 | mWAVBuffer[6] = (data_length >> 16) & 0x000000FF; | 386 | mWAVBuffer[7] = ((data_length + 28) >> 24) & 0x000000FF; |
386 | mWAVBuffer[7] = (data_length >> 24) & 0x000000FF; | ||
387 | 387 | ||
388 | // | 388 | // |
389 | // FUDGECAKES!!! Vorbis encode/decode messes up loop point transitions (pop) | 389 | // FUDGECAKES!!! Vorbis encode/decode messes up loop point transitions (pop) |
@@ -395,7 +395,8 @@ BOOL LLVorbisDecodeState::finishDecode() | |||
395 | S32 fade_length; | 395 | S32 fade_length; |
396 | char pcmout[4096]; /*Flawfinder: ignore*/ | 396 | char pcmout[4096]; /*Flawfinder: ignore*/ |
397 | 397 | ||
398 | fade_length = llmin((S32)128,(S32)(data_length-36)/8); | 398 | fade_length = llmin((S32)128,(S32)(data_length)/8); |
399 | |||
399 | if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length)) | 400 | if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length)) |
400 | { | 401 | { |
401 | memcpy(pcmout, &mWAVBuffer[WAV_HEADER_SIZE], (2 * fade_length)); /*Flawfinder: ignore*/ | 402 | memcpy(pcmout, &mWAVBuffer[WAV_HEADER_SIZE], (2 * fade_length)); /*Flawfinder: ignore*/ |
@@ -435,7 +436,7 @@ BOOL LLVorbisDecodeState::finishDecode() | |||
435 | } | 436 | } |
436 | } | 437 | } |
437 | 438 | ||
438 | if (36 == data_length) | 439 | if (0 == data_length) |
439 | { | 440 | { |
440 | llwarns << "BAD Vorbis decode in finishDecode!" << llendl; | 441 | llwarns << "BAD Vorbis decode in finishDecode!" << llendl; |
441 | mValid = FALSE; | 442 | mValid = FALSE; |