summaryrefslogtreecommitdiff
path: root/indra/llaudio
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llaudio')
-rwxr-xr-xindra/llaudio/llaudiodecodemgr.cpp84
-rw-r--r--indra/llaudio/llaudiodecodemgr.h2
-rwxr-xr-xindra/llaudio/llaudioengine.h2
-rw-r--r--indra/llaudio/llaudioengine_openal.cpp13
-rw-r--r--indra/llaudio/llaudioengine_openal.h4
-rw-r--r--indra/llaudio/lllistener_openal.h1
-rw-r--r--indra/llaudio/llvorbisencode.cpp4
7 files changed, 60 insertions, 50 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index ba4939f595..a46f9acc63 100755
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -70,22 +70,22 @@ public:
LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename);
- BOOL initDecode();
- BOOL decodeSection(); // Return TRUE if done.
- BOOL finishDecode();
+ bool initDecode();
+ bool decodeSection(); // Return true if done.
+ bool finishDecode();
void flushBadFile();
void ioComplete(S32 bytes) { mBytesRead = bytes; }
- BOOL isValid() const { return mValid; }
- BOOL isDone() const { return mDone; }
+ bool isValid() const { return mValid; }
+ bool isDone() const { return mDone; }
const LLUUID &getUUID() const { return mUUID; }
protected:
virtual ~LLVorbisDecodeState();
- BOOL mValid;
- BOOL mDone;
+ bool mValid;
+ bool mDone;
LLAtomicS32 mBytesRead;
LLUUID mUUID;
@@ -164,8 +164,8 @@ long cache_tell (void *datasource)
LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename)
{
- mDone = FALSE;
- mValid = FALSE;
+ mDone = false;
+ mValid = false;
mBytesRead = -1;
mUUID = uuid;
mInFilep = NULL;
@@ -188,7 +188,7 @@ LLVorbisDecodeState::~LLVorbisDecodeState()
}
-BOOL LLVorbisDecodeState::initDecode()
+bool LLVorbisDecodeState::initDecode()
{
ov_callbacks cache_callbacks;
cache_callbacks.read_func = cache_read;
@@ -204,14 +204,14 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "unable to open vorbis source vfile for reading" << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, cache_callbacks);
if(r < 0)
{
LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL;
- return(FALSE);
+ return(false);
}
S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
@@ -260,7 +260,7 @@ BOOL LLVorbisDecodeState::initDecode()
}
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
try
@@ -273,7 +273,7 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
{
@@ -360,31 +360,31 @@ BOOL LLVorbisDecodeState::initDecode()
// fprintf(stderr,"\nDecoded length: %ld samples\n", (long)ov_pcm_total(&vf,-1));
// fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
//}
- return TRUE;
+ return true;
}
-BOOL LLVorbisDecodeState::decodeSection()
+bool LLVorbisDecodeState::decodeSection()
{
if (!mInFilep)
{
LL_WARNS("AudioEngine") << "No cache file to decode in vorbis!" << LL_ENDL;
- return TRUE;
+ return true;
}
if (mDone)
{
// LL_WARNS("AudioEngine") << "Already done with decode, aborting!" << LL_ENDL;
- return TRUE;
+ return true;
}
char pcmout[4096]; /*Flawfinder: ignore*/
- BOOL eof = FALSE;
+ bool eof = false;
long ret=ov_read(&mVF, pcmout, sizeof(pcmout), 0, 2, 1, &mCurrentSection);
if (ret == 0)
{
/* EOF */
- eof = TRUE;
- mDone = TRUE;
- mValid = TRUE;
+ eof = true;
+ mDone = true;
+ mValid = true;
// LL_INFOS("AudioEngine") << "Vorbis EOF" << LL_ENDL;
}
else if (ret < 0)
@@ -394,10 +394,10 @@ BOOL LLVorbisDecodeState::decodeSection()
LL_WARNS("AudioEngine") << "BAD vorbis decode in decodeSection." << LL_ENDL;
- mValid = FALSE;
- mDone = TRUE;
- // We're done, return TRUE.
- return TRUE;
+ mValid = false;
+ mDone = true;
+ // We're done, return true.
+ return true;
}
else
{
@@ -409,12 +409,12 @@ BOOL LLVorbisDecodeState::decodeSection()
return eof;
}
-BOOL LLVorbisDecodeState::finishDecode()
+bool LLVorbisDecodeState::finishDecode()
{
if (!isValid())
{
LL_WARNS("AudioEngine") << "Bogus vorbis decode state for " << getUUID() << ", aborting!" << LL_ENDL;
- return TRUE; // We've finished
+ return true; // We've finished
}
if (mFileHandle == LLLFSThread::nullHandle())
@@ -422,7 +422,7 @@ BOOL LLVorbisDecodeState::finishDecode()
ov_clear(&mVF);
// write "data" chunk length, in little-endian format
- S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE;
+ S32 data_length = static_cast<S32>(mWAVBuffer.size()) - WAV_HEADER_SIZE;
mWAVBuffer[40] = (data_length) & 0x000000FF;
mWAVBuffer[41] = (data_length >> 8) & 0x000000FF;
mWAVBuffer[42] = (data_length >> 16) & 0x000000FF;
@@ -463,7 +463,7 @@ BOOL LLVorbisDecodeState::finishDecode()
{
memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/
}
- S32 near_end = mWAVBuffer.size() - (2 * fade_length);
+ S32 near_end = static_cast<S32>(mWAVBuffer.size()) - (2 * fade_length);
if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
{
memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/
@@ -487,11 +487,11 @@ BOOL LLVorbisDecodeState::finishDecode()
if (36 == data_length)
{
LL_WARNS("AudioEngine") << "BAD Vorbis decode in finishDecode!" << LL_ENDL;
- mValid = FALSE;
- return TRUE; // we've finished
+ mValid = false;
+ return true; // we've finished
}
mBytesRead = -1;
- mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(),
+ mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, static_cast<S32>(mWAVBuffer.size()),
new WriteResponder(this));
}
@@ -502,21 +502,21 @@ BOOL LLVorbisDecodeState::finishDecode()
if (mBytesRead == 0)
{
LL_WARNS("AudioEngine") << "Unable to write file in LLVorbisDecodeState::finishDecode" << LL_ENDL;
- mValid = FALSE;
- return TRUE; // we've finished
+ mValid = false;
+ return true; // we've finished
}
}
else
{
- return FALSE; // not done
+ return false; // not done
}
}
- mDone = TRUE;
+ mDone = true;
LL_DEBUGS("AudioEngine") << "Finished decode for " << getUUID() << LL_ENDL;
- return TRUE;
+ return true;
}
void LLVorbisDecodeState::flushBadFile()
@@ -779,13 +779,13 @@ void LLAudioDecodeMgr::processQueue()
mImpl->processQueue();
}
-BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
+bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
{
if (gAudiop && gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL;
- return TRUE;
+ return true;
}
if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND))
@@ -793,9 +793,9 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
// Just put it on the decode queue.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL;
mImpl->mDecodeQueue.push_back(uuid);
- return TRUE;
+ return true;
}
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " no file available" << LL_ENDL;
- return FALSE;
+ return false;
}
diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h
index 02d5c67587..79f8b8e92e 100644
--- a/indra/llaudio/llaudiodecodemgr.h
+++ b/indra/llaudio/llaudiodecodemgr.h
@@ -43,7 +43,7 @@ class LLAudioDecodeMgr : public LLSingleton<LLAudioDecodeMgr>
~LLAudioDecodeMgr();
public:
void processQueue();
- BOOL addDecodeRequest(const LLUUID &uuid);
+ bool addDecodeRequest(const LLUUID &uuid);
void addAudioRequest(const LLUUID &uuid);
protected:
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index 2a16050c5b..a9a229c0a5 100755
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -265,7 +265,7 @@ public:
void preload(const LLUUID &audio_id); // Only used for preloading UI sounds, now.
- void addAudioData(LLAudioData *adp, bool set_current = TRUE);
+ void addAudioData(LLAudioData *adp, bool set_current = true);
void setForcedPriority(const bool ambient) { mForcedPriority = ambient; }
bool isForcedPriority() const { return mForcedPriority; }
diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp
index 1c4c67e6f6..18d682b554 100644
--- a/indra/llaudio/llaudioengine_openal.cpp
+++ b/indra/llaudio/llaudioengine_openal.cpp
@@ -135,10 +135,19 @@ void LLAudioEngine_OpenAL::shutdown()
LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL;
LLAudioEngine::shutdown();
+ // If a subsequent error occurs while there is still an error recorded
+ // internally, the second error will simply be ignored.
+ // Clear previous error to make sure we will captuare a valid failure reason
+ ALenum error = alutGetError();
+ if (error != ALUT_ERROR_NO_ERROR)
+ {
+ LL_WARNS() << "Uncleared error state prior to shutdown: "
+ << alutGetErrorString(error) << LL_ENDL;
+ }
+
LL_INFOS() << "About to alutExit()" << LL_ENDL;
if(!alutExit())
{
- LL_WARNS() << "Nuts." << LL_ENDL;
LL_WARNS() << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL;
}
@@ -518,7 +527,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
}
alBufferData(buffer,
- AL_FORMAT_STEREO16,
+ AL_FORMAT_STEREO_FLOAT32,
mWindGen->windGenerate(mWindBuf,
mWindBufSamples),
mWindBufBytes,
diff --git a/indra/llaudio/llaudioengine_openal.h b/indra/llaudio/llaudioengine_openal.h
index 9aadc84ddf..574bec416d 100644
--- a/indra/llaudio/llaudioengine_openal.h
+++ b/indra/llaudio/llaudioengine_openal.h
@@ -57,9 +57,9 @@ class LLAudioEngine_OpenAL : public LLAudioEngine
/*virtual*/ void updateWind(LLVector3 direction, F32 camera_altitude);
private:
- typedef S16 WIND_SAMPLE_T;
+ typedef F32 WIND_SAMPLE_T;
LLWindGen<WIND_SAMPLE_T> *mWindGen;
- S16 *mWindBuf;
+ F32 *mWindBuf;
U32 mWindBufFreq;
U32 mWindBufSamples;
U32 mWindBufBytes;
diff --git a/indra/llaudio/lllistener_openal.h b/indra/llaudio/lllistener_openal.h
index a877270201..f1b69ddcef 100644
--- a/indra/llaudio/lllistener_openal.h
+++ b/indra/llaudio/lllistener_openal.h
@@ -32,6 +32,7 @@
#include "AL/al.h"
#include "AL/alut.h"
+#include "AL/alext.h"
class LLListener_OpenAL : public LLListener
{
diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp
index 573c947764..83e7fad92f 100644
--- a/indra/llaudio/llvorbisencode.cpp
+++ b/indra/llaudio/llvorbisencode.cpp
@@ -75,7 +75,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
U32 chunk_length = 0;
U32 raw_data_length = 0;
U32 bytes_per_sec = 0;
- BOOL uncompressed_pcm = FALSE;
+ bool uncompressed_pcm = false;
unsigned char wav_header[44]; /*Flawfinder: ignore*/
@@ -133,7 +133,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
{
if ((wav_header[8] == 0x01) && (wav_header[9] == 0x00))
{
- uncompressed_pcm = TRUE;
+ uncompressed_pcm = true;
}
num_channels = ((U16) wav_header[11] << 8) + wav_header[10];
sample_rate = ((U32) wav_header[15] << 24)