mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 13:52:40 +02:00
adding sound to login screen
This commit is contained in:
parent
d12655ed7b
commit
51f5942a7f
4 changed files with 30 additions and 4 deletions
|
@ -1033,8 +1033,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||
_lastFaceTrackerUpdate(0),
|
||||
_snapshotSound(nullptr),
|
||||
_sampleSound(nullptr)
|
||||
|
||||
_sampleSound(nullptr),
|
||||
_loginStateSound(nullptr)
|
||||
{
|
||||
|
||||
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
||||
|
@ -2286,6 +2286,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
});
|
||||
|
||||
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/snapshot/snap.wav"));
|
||||
_loginStateSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/crystals_and_voices.mp3"));
|
||||
|
||||
// Monitor model assets (e.g., from Clara.io) added to the world that may need resizing.
|
||||
static const int ADD_ASSET_TO_WORLD_TIMER_INTERVAL_MS = 1000;
|
||||
|
@ -2634,6 +2635,10 @@ void Application::cleanupBeforeQuit() {
|
|||
_snapshotSoundInjector->stop();
|
||||
}
|
||||
|
||||
if (_loginStateSoundInjector != nullptr) {
|
||||
_loginStateSoundInjector->stop();
|
||||
}
|
||||
|
||||
// destroy Audio so it and its threads have a chance to go down safely
|
||||
// this must happen after QML, as there are unexplained audio crashes originating in qtwebengine
|
||||
DependencyManager::destroy<AudioClient>();
|
||||
|
@ -2945,6 +2950,12 @@ static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, in
|
|||
void Application::showLoginScreen() {
|
||||
auto accountManager = DependencyManager::get<AccountManager>();
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
if (!_loginStateSound->isReady()) {
|
||||
connect(_loginStateSound.data(), &Sound::ready, this, &Application::showLoginScreen);
|
||||
return;
|
||||
} else {
|
||||
disconnect(_loginStateSound.data(), &Sound::ready, this, &Application::showLoginScreen);
|
||||
}
|
||||
if (!accountManager->isLoggedIn()) {
|
||||
if (!isHMDMode()) {
|
||||
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
|
@ -2956,6 +2967,15 @@ void Application::showLoginScreen() {
|
|||
loginData["action"] = "login dialog shown";
|
||||
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
|
||||
_window->setWindowTitle("High Fidelity Interface");
|
||||
if (!_loginStateSoundInjector) {
|
||||
AudioInjectorOptions options;
|
||||
options.localOnly = true;
|
||||
options.position = getMyAvatar()->getHeadPosition();
|
||||
options.loop = true;
|
||||
options.volume = 0.4f;
|
||||
options.stereo = true;
|
||||
_loginStateSoundInjector = AudioInjector::playSound(_loginStateSound, options);
|
||||
}
|
||||
} else {
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
}
|
||||
|
@ -5298,6 +5318,7 @@ void Application::pauseUntilLoginDetermined() {
|
|||
|
||||
// disconnect domain handler.
|
||||
nodeList->getDomainHandler().disconnect();
|
||||
|
||||
}
|
||||
|
||||
void Application::resumeAfterLoginDialogActionTaken() {
|
||||
|
@ -8670,7 +8691,7 @@ void Application::updateLoginDialogOverlayPosition() {
|
|||
auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f);
|
||||
auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
|
||||
|
||||
if (pointAngle > 30.0f) {
|
||||
if (pointAngle > 40.0f) {
|
||||
QVariantMap properties {
|
||||
{"position", vec3toVariant(newOverlayPositionVec)},
|
||||
{"orientation", quatToVariant(newOverlayOrientation)}
|
||||
|
@ -8695,6 +8716,9 @@ void Application::onDismissedLoginDialog() {
|
|||
_loginDialogOverlayID = OverlayID();
|
||||
_loginStateManager.tearDown();
|
||||
}
|
||||
if (_loginStateSoundInjector != nullptr) {
|
||||
_loginStateSoundInjector->stop();
|
||||
}
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
}
|
||||
|
||||
|
|
|
@ -794,6 +794,8 @@ private:
|
|||
AudioInjectorPointer _snapshotSoundInjector;
|
||||
SharedSoundPointer _snapshotSound;
|
||||
SharedSoundPointer _sampleSound;
|
||||
AudioInjectorPointer _loginStateSoundInjector;
|
||||
SharedSoundPointer _loginStateSound;
|
||||
|
||||
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
||||
QString _autoSwitchDisplayModeSupportedHMDPluginName;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
var TEXTURE_EPSILON = 0.01;
|
||||
var isVisible = false;
|
||||
var VOLUME = 0.4;
|
||||
var tune = SoundCache.getSound(Script.resolvePath("/~/system/assets/sounds/crystals_and_voices.mp3"));
|
||||
var tune = SoundCache.getSound(Script.resourcesPath() + "sounds/crystals_and_voices.mp3");
|
||||
var sample = null;
|
||||
var MAX_LEFT_MARGIN = 1.9;
|
||||
var INNER_CIRCLE_WIDTH = 4.7;
|
||||
|
|
Loading…
Reference in a new issue