//--------------------------------------------------------------------------
bool LLAlertHandler::processNotification(const LLNotificationPtr& notification)
{
	if(mChannel.isDead())
	{
		return false;
	}

	// arrange a channel on a screen
	if(!mChannel.get()->getVisible())
	{
		initChannel();
	}

	if (notification->canLogToIM() && notification->hasFormElements())
	{
		const std::string name = LLHandlerUtil::getSubstitutionName(notification);

		LLUUID from_id = notification->getPayload()["from_id"];

// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9)
		// Don't spawn an IM session for non-chat related events:
		//   - LLHandlerUtil::logToIMP2P() below will still be called with to_file_only == false
		//   - LLHandlerUtil::logToIM() will eventually be called as a result and without an open IM session it will log the
		//     same message as it would for an open session whereas to_file_only == true would take a different code path
		if ( (RlvActions::hasOpenP2PSession(from_id)) || (RlvActions::canStartIM(from_id)) )
		{
// [/RLVa:KB]
			// firstly create session...
			LLHandlerUtil::spawnIMSession(name, from_id);
// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9)
		}
// [/RLVa:KB]

		// ...then log message to have IM Well notified about new message
		LLHandlerUtil::logToIMP2P(notification);
	}

	LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
	LLToast::Params p;
	p.notif_id = notification->getID();
	p.notification = notification;
	p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
	p.enable_hide_btn = false;
	p.can_fade = false;
	p.is_modal = mIsModal;
	p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);

	// Show alert in middle of progress view (during teleport) (EXT-1093)
	LLProgressView* progress = gViewerWindow->getProgressView();
	LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
	mChannel.get()->updatePositionAndSize(rc);

	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
	if(channel)
		channel->addToast(p);
	
	return false;
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------
bool LLAlertHandler::processNotification(const LLSD& notify)
{
	if(!mChannel)
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;

	// arrange a channel on a screen
	if(!mChannel->getVisible())
	{
		initChannel();
	}

	if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load")
	{
		if (LLHandlerUtil::canSpawnSessionAndLogToIM(notification))
		{
			const std::string name = LLHandlerUtil::getSubstitutionName(notification);

			LLUUID from_id = notification->getPayload()["from_id"];

			// firstly create session...
			LLHandlerUtil::spawnIMSession(name, from_id);

			// ...then log message to have IM Well notified about new message
			LLHandlerUtil::logToIMP2P(notification);
		}

		LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
		LLToast::Params p;
		p.notif_id = notification->getID();
		p.notification = notification;
		p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
		p.enable_hide_btn = false;
		p.can_fade = false;
		p.is_modal = mIsModal;
		p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);

		// Show alert in middle of progress view (during teleport) (EXT-1093)
		LLProgressView* progress = gViewerWindow->getProgressView();
		LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
		mChannel->updatePositionAndSize(rc);

		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
		if(channel)
			channel->addToast(p);
	}
	else if (notify["sigtype"].asString() == "change")
	{
		LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
		if(channel)
			channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
	}
	else
	{
		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
		if(channel)
			channel->killToastByNotificationID(notification->getID());
	}
	return false;
}
void audio_update_volume(bool force_update)
{
	F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
	BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");

	LLProgressView* progress = gViewerWindow->getProgressView();
	BOOL progress_view_visible = FALSE;

	if (progress)
	{
		progress_view_visible = progress->getVisible();
	}

	if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized"))
	{
		mute_audio = TRUE;
	}
	F32 mute_volume = mute_audio ? 0.0f : 1.0f;

	// Sound Effects
	if (gAudiop) 
	{
		gAudiop->setMasterGain ( master_volume );

		gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
		gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
		gAudiop->setMuted(mute_audio || progress_view_visible);
		
		if (force_update)
		{
			audio_update_wind(true);
		}

		// handle secondary gains
		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX,
		//						  gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"));
		//gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI,
		//						  gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"));
		//gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
		//						  gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"));

		static LLCachedControl<bool> muteSounds(gSavedSettings, "MuteSounds");
		static LLCachedControl<bool> muteUI(gSavedSettings, "MuteUI");
		static LLCachedControl<bool> muteAmbient(gSavedSettings, "MuteAmbient");
		static LLCachedControl<F32> audioLevelSFX(gSavedSettings, "AudioLevelSFX");
		static LLCachedControl<F32> audioLevelUI(gSavedSettings, "AudioLevelUI");
		static LLCachedControl<F32> audioLevelAmbient(gSavedSettings, "AudioLevelAmbient");

		gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX,
								  muteSounds ? 0.f : (F32)audioLevelSFX);
		gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI,
								  muteUI ? 0.f : (F32)audioLevelUI);
		gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
								  muteAmbient ? 0.f : (F32)audioLevelAmbient);

		// <FS:Ansariel>
	}

	// Streaming Music
	if (gAudiop) 
	{
		if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade())
		{
			LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
			LLViewerAudio::getInstance()->setForcedTeleportFade(false);
		}

		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
		//BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");

		static LLCachedControl<F32> audioLevelMusic(gSavedSettings, "AudioLevelMusic");
		static LLCachedControl<bool> muteMusic(gSavedSettings, "MuteMusic");
		F32 music_volume = (F32)audioLevelMusic;
		BOOL music_muted = (BOOL)muteMusic;
		// </FS:Ansariel>
		F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();

		music_volume = mute_volume * master_volume * music_volume * fade_volume;
		gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume);
	}

	// Streaming Media
	// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
	//F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
	//BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");

	static LLCachedControl<F32> audioLevelMedia(gSavedSettings, "AudioLevelMedia");
	static LLCachedControl<bool> muteMedia(gSavedSettings, "MuteMedia");
	F32 media_volume = (F32)audioLevelMedia;
	BOOL media_muted = (BOOL)muteMedia;
	// </FS:Ansariel>
	media_volume = mute_volume * master_volume * media_volume;
	LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );

	// Voice
	if (LLVoiceClient::getInstance())
	{
		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
		static LLCachedControl<F32> audioLevelVoice(gSavedSettings, "AudioLevelVoice");
		F32 voice_volume = (F32)audioLevelVoice;
		// </FS:Ansariel>
		voice_volume = mute_volume * master_volume * voice_volume;
		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
		static LLCachedControl<bool> muteVoice(gSavedSettings, "MuteVoice");
		BOOL voice_mute = (BOOL)muteVoice;
		// </FS:Ansariel>
		LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
		static LLCachedControl<F32> audioLevelMic(gSavedSettings, "AudioLevelMic");
		LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : (F32)audioLevelMic);
		// </FS:Ansariel>

		// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
		//if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
		static LLCachedControl<bool> muteWhenMinimized(gSavedSettings, "MuteWhenMinimized");
		if (!gViewerWindow->getActive() && muteWhenMinimized)
		// </FS:Ansariel>
		{
			LLVoiceClient::getInstance()->setMuteMic(true);
		}
		else
		{
			LLVoiceClient::getInstance()->setMuteMic(false);
		}
	}
}
Ejemplo n.º 4
0
void audio_update_volume(bool force_update)
{
    F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
    BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");

    LLProgressView* progress = gViewerWindow->getProgressView();
    BOOL progress_view_visible = FALSE;

    if (progress)
    {
        progress_view_visible = progress->getVisible();
    }

    if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized"))
    {
        mute_audio = TRUE;
    }
    F32 mute_volume = mute_audio ? 0.0f : 1.0f;

    // Sound Effects
    if (gAudiop)
    {
        gAudiop->setMasterGain ( master_volume );

        gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
        gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
        gAudiop->setMuted(mute_audio || progress_view_visible);

        if (force_update)
        {
            audio_update_wind(true);
        }

        // handle secondary gains
        gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX,
                                  gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"));
        gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI,
                                  gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"));
        gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
                                  gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"));
    }

    // Streaming Music
    if (gAudiop)
    {
        if (progress_view_visible  && !LLViewerAudio::getInstance()->getForcedTeleportFade())
        {
            LLViewerAudio::getInstance()->setForcedTeleportFade(true);
            LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
            LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null);
        }

        if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade() == true)
        {
            LLViewerAudio::getInstance()->setForcedTeleportFade(false);
        }

        F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
        BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
        F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();

        music_volume = mute_volume * master_volume * music_volume * fade_volume;
        gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume);
    }

    // Streaming Media
    F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
    BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");
    media_volume = mute_volume * master_volume * media_volume;
    LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );

    // Voice
    if (LLVoiceClient::getInstance())
    {
        F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
        voice_volume = mute_volume * master_volume * voice_volume;
        BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
        LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
        LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));

        if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
        {
            LLVoiceClient::getInstance()->setMuteMic(true);
        }
        else
        {
            LLVoiceClient::getInstance()->setMuteMic(false);
        }
    }
}