CHUI-667: Post code review changes
parent
daa5084dd6
commit
4c5790d4bf
|
|
@ -839,6 +839,10 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
|
|||
asp->play(audio_uuid);
|
||||
}
|
||||
|
||||
void LLAudioEngine::triggerSound(SoundData& soundData)
|
||||
{
|
||||
triggerSound(soundData.audio_uuid, soundData.owner_id, soundData.gain, soundData.type, soundData.pos_global);
|
||||
}
|
||||
|
||||
void LLAudioEngine::setListenerPos(LLVector3 aVec)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class LLAudioChannel;
|
|||
class LLAudioChannelOpenAL;
|
||||
class LLAudioBuffer;
|
||||
class LLStreamingAudioInterface;
|
||||
struct SoundData;
|
||||
|
||||
|
||||
//
|
||||
|
|
@ -144,6 +145,8 @@ public:
|
|||
void triggerSound(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain,
|
||||
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
|
||||
const LLVector3d &pos_global = LLVector3d::zero);
|
||||
void triggerSound(SoundData& soundData);
|
||||
|
||||
bool preloadSound(const LLUUID &id);
|
||||
|
||||
void addAudioSource(LLAudioSource *asp);
|
||||
|
|
@ -456,6 +459,27 @@ protected:
|
|||
LLFrameTimer mLastUseTimer;
|
||||
};
|
||||
|
||||
struct SoundData
|
||||
{
|
||||
LLUUID audio_uuid;
|
||||
LLUUID owner_id;
|
||||
F32 gain;
|
||||
S32 type;
|
||||
LLVector3d pos_global;
|
||||
|
||||
SoundData(const LLUUID &audio_uuid,
|
||||
const LLUUID& owner_id,
|
||||
const F32 gain,
|
||||
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
|
||||
const LLVector3d &pos_global = LLVector3d::zero)
|
||||
{
|
||||
this->audio_uuid = audio_uuid;
|
||||
this->owner_id = owner_id;
|
||||
this->gain = gain;
|
||||
this->type = type;
|
||||
this->pos_global = pos_global;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
extern LLAudioEngine* gAudiop;
|
||||
|
|
|
|||
|
|
@ -221,8 +221,6 @@
|
|||
#include "llmachineid.h"
|
||||
#include "llmainlooprepeater.h"
|
||||
|
||||
#include <queue>
|
||||
|
||||
// *FIX: These extern globals should be cleaned up.
|
||||
// The globals either represent state/config/resource-storage of either
|
||||
// this app, or another 'component' of the viewer. App globals should be
|
||||
|
|
@ -458,11 +456,11 @@ void idle_afk_check()
|
|||
}
|
||||
|
||||
// A callback set in LLAppViewer::init()
|
||||
void ui_audio_callback(const LLUUID& uuid)
|
||||
static void ui_audio_callback(const LLUUID& uuid)
|
||||
{
|
||||
if (gAudiop)
|
||||
{
|
||||
gAudiop->triggerSound(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
|
||||
gAudiop->triggerSound(SoundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +469,7 @@ static void deferred_ui_audio_callback(const LLUUID& uuid)
|
|||
{
|
||||
if (gAudiop)
|
||||
{
|
||||
LLDeferredSounds::instance().deferSound(uuid);
|
||||
LLDeferredSounds::instance().deferSound(SoundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@
|
|||
|
||||
#include "lldeferredsounds.h"
|
||||
|
||||
void ui_audio_callback(const LLUUID& uuid);
|
||||
#include "llaudioengine.h"
|
||||
|
||||
void LLDeferredSounds::deferSound(LLUUID sound)
|
||||
void LLDeferredSounds::deferSound(SoundData& sound)
|
||||
{
|
||||
soundQueue.push(sound);
|
||||
soundVector.push_back(sound);
|
||||
}
|
||||
void LLDeferredSounds::playdeferredSounds()
|
||||
{
|
||||
while(soundQueue.size())
|
||||
while(soundVector.size())
|
||||
{
|
||||
ui_audio_callback(soundQueue.front());
|
||||
soundQueue.pop();
|
||||
gAudiop->triggerSound(soundVector.back());
|
||||
soundVector.pop_back();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,13 +29,15 @@
|
|||
|
||||
#include "llsingleton.h"
|
||||
|
||||
struct SoundData;
|
||||
|
||||
class LLDeferredSounds : public LLSingleton<LLDeferredSounds>
|
||||
{
|
||||
private:
|
||||
std::queue<LLUUID> soundQueue;
|
||||
std::vector<SoundData> soundVector;
|
||||
public:
|
||||
//Add sounds to be played once progress bar is hidden (such as after teleport or loading screen)
|
||||
void deferSound(LLUUID sound);
|
||||
void deferSound(SoundData& sound);
|
||||
|
||||
void playdeferredSounds();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue