Import some changes from internal
This commit is contained in:
@@ -38,6 +38,8 @@
|
|||||||
#include "lllistener_openal.h"
|
#include "lllistener_openal.h"
|
||||||
|
|
||||||
|
|
||||||
|
const float LLAudioEngine_OpenAL::WIND_BUFFER_SIZE_SEC = 0.05f;
|
||||||
|
|
||||||
LLAudioEngine_OpenAL::LLAudioEngine_OpenAL()
|
LLAudioEngine_OpenAL::LLAudioEngine_OpenAL()
|
||||||
:
|
:
|
||||||
mWindGen(NULL),
|
mWindGen(NULL),
|
||||||
@@ -185,6 +187,8 @@ LLAudioChannelOpenAL::~LLAudioChannelOpenAL()
|
|||||||
void LLAudioChannelOpenAL::cleanup()
|
void LLAudioChannelOpenAL::cleanup()
|
||||||
{
|
{
|
||||||
alSourceStop(mALSource);
|
alSourceStop(mALSource);
|
||||||
|
alSourcei(mALSource, AL_BUFFER, AL_NONE);
|
||||||
|
|
||||||
mCurrentBufferp = NULL;
|
mCurrentBufferp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +328,14 @@ void LLAudioBufferOpenAL::cleanup()
|
|||||||
{
|
{
|
||||||
if(mALBuffer != AL_NONE)
|
if(mALBuffer != AL_NONE)
|
||||||
{
|
{
|
||||||
|
alGetError(); // clear error
|
||||||
alDeleteBuffers(1, &mALBuffer);
|
alDeleteBuffers(1, &mALBuffer);
|
||||||
|
|
||||||
|
ALenum error = alutGetError();
|
||||||
|
if(ALC_NO_ERROR != error)
|
||||||
|
{
|
||||||
|
LL_WARNS("OpenAL") << "Error: " << alutGetErrorString( error ) << " when cleaning up a buffer" << LL_ENDL;
|
||||||
|
}
|
||||||
mALBuffer = AL_NONE;
|
mALBuffer = AL_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -441,6 +452,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
|
|||||||
F64 pitch;
|
F64 pitch;
|
||||||
F64 center_freq;
|
F64 center_freq;
|
||||||
ALenum error;
|
ALenum error;
|
||||||
|
ALuint *buffers = NULL;
|
||||||
|
|
||||||
if (!mEnableWind)
|
if (!mEnableWind)
|
||||||
return;
|
return;
|
||||||
@@ -485,12 +497,10 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
|
|||||||
|
|
||||||
//llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl;
|
//llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl;
|
||||||
|
|
||||||
while(processed--) // unqueue old buffers
|
//delete the old wind buffers
|
||||||
{
|
buffers = new ALuint[processed];
|
||||||
ALuint buffer;
|
|
||||||
ALenum error;
|
|
||||||
alGetError(); /* clear error */
|
alGetError(); /* clear error */
|
||||||
alSourceUnqueueBuffers(mWindSource, 1, &buffer);
|
alSourceUnqueueBuffers(mWindSource, processed, &buffers[0]);
|
||||||
error = alGetError();
|
error = alGetError();
|
||||||
if(error != AL_NO_ERROR)
|
if(error != AL_NO_ERROR)
|
||||||
{
|
{
|
||||||
@@ -498,23 +508,28 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alDeleteBuffers(1, &buffer);
|
alDeleteBuffers(processed, &buffers[0]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// We dont need to keep track of the buffers' id now.
|
||||||
|
delete[] buffers;
|
||||||
|
buffers = NULL;
|
||||||
|
|
||||||
|
//create the buffers for the empty wind buffers
|
||||||
unprocessed += mNumEmptyWindALBuffers;
|
unprocessed += mNumEmptyWindALBuffers;
|
||||||
while (mNumEmptyWindALBuffers > 0) // fill+queue new buffers
|
buffers = new ALuint[mNumEmptyWindALBuffers];
|
||||||
{
|
|
||||||
ALuint buffer;
|
|
||||||
alGetError(); /* clear error */
|
alGetError(); /* clear error */
|
||||||
alGenBuffers(1,&buffer);
|
alGenBuffers(mNumEmptyWindALBuffers,&buffers[0]);
|
||||||
if((error=alGetError()) != AL_NO_ERROR)
|
if((error=alGetError()) != AL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << llendl;
|
llwarns << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << llendl;
|
||||||
break;
|
//break;
|
||||||
}
|
}
|
||||||
|
|
||||||
alBufferData(buffer,
|
//fill the buffers with generated wind.
|
||||||
|
int errors = 0;
|
||||||
|
for(int i = 0; i < mNumEmptyWindALBuffers; i++)
|
||||||
|
{
|
||||||
|
alBufferData(buffers[i],
|
||||||
AL_FORMAT_STEREO16,
|
AL_FORMAT_STEREO16,
|
||||||
mWindGen->windGenerate(mWindBuf,
|
mWindGen->windGenerate(mWindBuf,
|
||||||
mWindBufSamples),
|
mWindBufSamples),
|
||||||
@@ -524,18 +539,25 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
|
|||||||
if(error != AL_NO_ERROR)
|
if(error != AL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl;
|
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl;
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alSourceQueueBuffers(mWindSource, 1, &buffer);
|
//queue the buffers
|
||||||
|
alSourceQueueBuffers(mWindSource, mNumEmptyWindALBuffers, &buffers[0]);
|
||||||
error = alGetError();
|
error = alGetError();
|
||||||
if(error != AL_NO_ERROR)
|
if(error != AL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl;
|
llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
--mNumEmptyWindALBuffers;
|
mNumEmptyWindALBuffers = errors;
|
||||||
}
|
// We dont need to keep track of the buffers' id now.
|
||||||
|
delete[] buffers;
|
||||||
|
buffers = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
//restart playing if not playing
|
||||||
ALint playing;
|
ALint playing;
|
||||||
alGetSourcei(mWindSource, AL_SOURCE_STATE, &playing);
|
alGetSourcei(mWindSource, AL_SOURCE_STATE, &playing);
|
||||||
if(playing != AL_PLAYING)
|
if(playing != AL_PLAYING)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class LLAudioEngine_OpenAL : public LLAudioEngine
|
|||||||
int mNumEmptyWindALBuffers;
|
int mNumEmptyWindALBuffers;
|
||||||
|
|
||||||
static const int MAX_NUM_WIND_BUFFERS = 80;
|
static const int MAX_NUM_WIND_BUFFERS = 80;
|
||||||
static const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec
|
static const float WIND_BUFFER_SIZE_SEC; // 1/20th sec
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLAudioChannelOpenAL : public LLAudioChannel
|
class LLAudioChannelOpenAL : public LLAudioChannel
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
// Locally used constants
|
// Locally used constants
|
||||||
//
|
//
|
||||||
const U32 SEC_PER_DAY = 86400;
|
const U32 SEC_PER_DAY = 86400;
|
||||||
const F64 SEC_TO_MICROSEC = 1000000.f;
|
const F64 SEC_TO_MICROSEC = 1000000.0;
|
||||||
const U64 SEC_TO_MICROSEC_U64 = 1000000;
|
const U64 SEC_TO_MICROSEC_U64 = 1000000;
|
||||||
const F64 USEC_TO_SEC_F64 = 0.000001;
|
const F64 USEC_TO_SEC_F64 = 0.000001;
|
||||||
|
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* LLCalcParser.cpp
|
|
||||||
* SecondLife
|
|
||||||
*
|
|
||||||
* Created by Aimee Walton on 28/09/2008.
|
|
||||||
* Copyright 2008 Aimee Walton.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
|
||||||
|
|
||||||
#include "llcalcparser.h"
|
|
||||||
using namespace boost::spirit::classic;
|
|
||||||
|
|
||||||
F32 LLCalcParser::lookup(const std::string::iterator& start, const std::string::iterator& end) const
|
|
||||||
{
|
|
||||||
LLCalc::calc_map_t::iterator iter;
|
|
||||||
|
|
||||||
std::string name(start, end);
|
|
||||||
|
|
||||||
if (mConstants)
|
|
||||||
{
|
|
||||||
iter = mConstants->find(name);
|
|
||||||
if (iter != mConstants->end())
|
|
||||||
{
|
|
||||||
return (*iter).second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This should never happen!
|
|
||||||
throw_(end, std::string("Missing constants table"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mVariables)
|
|
||||||
{
|
|
||||||
iter = mVariables->find(name);
|
|
||||||
if (iter != mVariables->end())
|
|
||||||
{
|
|
||||||
return (*iter).second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw_(end, std::string("Unknown symbol " + name));
|
|
||||||
return 0.f;
|
|
||||||
}
|
|
||||||
@@ -484,8 +484,8 @@ void LLFastTimerView::draw()
|
|||||||
sTimerColors[&LLFastTimer::NamedTimer::getRootNamedTimer()] = LLColor4::grey;
|
sTimerColors[&LLFastTimer::NamedTimer::getRootNamedTimer()] = LLColor4::grey;
|
||||||
|
|
||||||
F32 hue = 0.f;
|
F32 hue = 0.f;
|
||||||
|
// <ALCH:LL> Move color generation down to be in the next loop.
|
||||||
for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
|
/*for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
|
||||||
it != timer_tree_iterator_t();
|
it != timer_tree_iterator_t();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
@@ -502,7 +502,8 @@ void LLFastTimerView::draw()
|
|||||||
child_color.setHSL(hue, saturation, lightness);
|
child_color.setHSL(hue, saturation, lightness);
|
||||||
|
|
||||||
sTimerColors[idp] = child_color;
|
sTimerColors[idp] = child_color;
|
||||||
}
|
}*/
|
||||||
|
// </ALCH:LL>
|
||||||
|
|
||||||
const S32 LEGEND_WIDTH = 220;
|
const S32 LEGEND_WIDTH = 220;
|
||||||
{
|
{
|
||||||
@@ -516,6 +517,20 @@ void LLFastTimerView::draw()
|
|||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
LLFastTimer::NamedTimer* idp = (*it);
|
LLFastTimer::NamedTimer* idp = (*it);
|
||||||
|
// <ALCH:LL> Move color generation down to be in the next loop.
|
||||||
|
const F32 HUE_INCREMENT = 0.23f;
|
||||||
|
hue = fmodf(hue + HUE_INCREMENT, 1.f);
|
||||||
|
// saturation increases with depth
|
||||||
|
F32 saturation = clamp_rescale((F32)idp->getDepth(), 0.f, 3.f, 0.f, 1.f);
|
||||||
|
// lightness alternates with depth
|
||||||
|
F32 lightness = idp->getDepth() % 2 ? 0.5f : 0.6f;
|
||||||
|
|
||||||
|
LLColor4 child_color;
|
||||||
|
child_color.setHSL(hue, saturation, lightness);
|
||||||
|
|
||||||
|
sTimerColors[idp] = child_color;
|
||||||
|
// </ALCH:LL>
|
||||||
|
|
||||||
// <FS:LO> Making the ledgend part of fast timers scrollable
|
// <FS:LO> Making the ledgend part of fast timers scrollable
|
||||||
if(mScrollOffset_tmp)
|
if(mScrollOffset_tmp)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user