From fa666a29a4c2bbf5725cefc1022b8da106329109 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 1 Aug 2018 01:50:45 +0200 Subject: [PATCH 1/6] Add back fix for FIRE-11266 / BUG-3549 / MAINT-2983 (Changing audio device now requires relog to restore sounds) to FMOD Studio --- indra/llaudio/llaudioengine_fmodstudio.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index e55485bb02..b51a76e3ac 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -49,6 +49,43 @@ const U32 EXTRA_SOUND_CHANNELS = 10; FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); +// FIRE-11266 / BUG-3549 / MAINT-2983: Changing audio device now requires relog to restore sounds +#if LL_WINDOWS +FMOD_RESULT F_CALLBACK systemCallback(FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void *commanddata2, void* userdata) +{ + FMOD::System *sys = (FMOD::System *)system; + FMOD_RESULT result; + switch (type) + { + case FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED: + { + int drivers; + sys->getNumDrivers(&drivers); + + if (drivers <= 0) + { + break; + } + + for (int i = 0; i < drivers; ++i) + { + result = sys->setDriver(i); + if (result == FMOD_OK) + { + break; + } + } + break; + } + + default: + break; + } + return FMOD_OK; +} +#endif +// + FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; LLAudioEngine_FMODSTUDIO::LLAudioEngine_FMODSTUDIO(bool enable_profiler, U32 resample_method) @@ -110,6 +147,13 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata) result = mSystem->setSoftwareChannels(num_channels + EXTRA_SOUND_CHANNELS); Check_FMOD_Error(result,"FMOD::System::setSoftwareChannels"); + // FIRE-11266 / BUG-3549 / MAINT-2983: Changing audio device now requires relog to restore sounds +#if LL_WINDOWS + result = mSystem->setCallback(systemCallback); + Check_FMOD_Error(result, "FMOD::System::setCallback"); +#endif + // + FMOD_ADVANCEDSETTINGS adv_settings = { }; adv_settings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS); switch (mResampleMethod) From 54d84229371dfda8a8d535f6f2c0a69a891d6440 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 1 Aug 2018 16:06:23 +0200 Subject: [PATCH 2/6] FIRE-22851: Show texture "Save as" file picker subsequently instead all at once --- indra/newview/llinventoryfunctions.cpp | 6 ++++ indra/newview/llpreviewtexture.cpp | 49 ++++++++++++++++++++++---- indra/newview/llpreviewtexture.h | 11 ++++-- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 914b2bd18d..17c315dcf7 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2677,6 +2677,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root { LLAppearanceMgr::instance().removeItemsFromAvatar(ids); } + // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once + else if (action == "save_as") // "save_as" is only available for textures as of 01/08/2018 + { + LLPreviewTexture::saveMultiple(ids); + } + // else { std::set::iterator set_iter; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 08cba5c71c..07c1bcdb9b 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -383,21 +383,32 @@ BOOL LLPreviewTexture::canSaveAs() const // virtual void LLPreviewTexture::saveAs() { - // Allow to use user-defined default save format for textures + // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once // saveAs(LLPreviewTexture::FORMAT_TGA); + saveAs(uuid_vec_t()); + // +} + +// FIRE-22851: Show texture "Save as" file picker subsequently instead all at once +void LLPreviewTexture::saveAs(uuid_vec_t remaining_ids) +{ + // Allow to use user-defined default save format for textures if (!gSavedSettings.getBOOL("FSTextureDefaultSaveAsFormat")) { - saveAs(LLPreviewTexture::FORMAT_TGA); + saveAs(LLPreviewTexture::FORMAT_TGA, remaining_ids); } else { - saveAs(LLPreviewTexture::FORMAT_PNG); + saveAs(LLPreviewTexture::FORMAT_PNG, remaining_ids); } // - } +// -void LLPreviewTexture::saveAs(EFileformatType format) +// FIRE-22851: Show texture "Save as" file picker subsequently instead all at once +//void LLPreviewTexture::saveAs(EFileformatType format) +void LLPreviewTexture::saveAs(EFileformatType format, uuid_vec_t remaining_ids) +// { if (mLoadingFullImage) return; @@ -422,13 +433,13 @@ void LLPreviewTexture::saveAs(EFileformatType format) //std::string filename = getItem() ? LLDir::getScrubbedFileName(getItem()->getName()) : LLStringUtil::null; //(new LLFilePickerReplyThread(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1), LLFilePicker::FFSAVE_TGAPNG, filename))->getFile(); std::string filename = getItem() ? checkFileExtension(LLDir::getScrubbedFileName(getItem()->getName()), format) : LLStringUtil::null; - (new LLFilePickerReplyThread(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1, format, callback), saveFilter, filename))->getFile(); + (new LLFilePickerReplyThread(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1, format, callback, remaining_ids), saveFilter, filename))->getFile(); // } // Undo MAINT-2897 and use our own texture format selection //void LLPreviewTexture::saveTextureToFile(const std::vector& filenames) -void LLPreviewTexture::saveTextureToFile(const std::vector& filenames, EFileformatType format, loaded_callback_func callback) +void LLPreviewTexture::saveTextureToFile(const std::vector& filenames, EFileformatType format, loaded_callback_func callback, uuid_vec_t remaining_ids) // { const LLInventoryItem* item = getItem(); @@ -452,6 +463,9 @@ void LLPreviewTexture::saveTextureToFile(const std::vector& filenam mImage->setLoadedCallback(callback, // 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList); + + // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once + saveMultiple(remaining_ids); } // virtual @@ -1137,3 +1151,24 @@ void LLPreviewTexture::onButtonRefresh() destroy_texture(mImageID); } // + +// FIRE-22851: Show texture "Save as" file picker subsequently instead all at once +//static +void LLPreviewTexture::saveMultiple(uuid_vec_t ids) +{ + if (ids.empty()) + { + return; + } + + LLUUID next_id = ids.front(); + ids.erase(ids.begin()); + + LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance("preview_texture", next_id); + if (preview_texture) + { + preview_texture->openToSave(); + preview_texture->saveAs(ids); + } +} +// diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 2c8341f322..4b24690a32 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -55,7 +55,11 @@ public: virtual BOOL canSaveAs() const; virtual void saveAs(); - void saveAs(EFileformatType format); + // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once + //void saveAs(EFileformatType format); + virtual void saveAs(uuid_vec_t remaining_ids); + void saveAs(EFileformatType format, uuid_vec_t remaining_ids = uuid_vec_t()); + // Undo MAINT-2897 and use our own texture format selection //void saveTextureToFile(const std::vector& filenames); - void saveTextureToFile(const std::vector& filenames, EFileformatType format, loaded_callback_func callback); + void saveTextureToFile(const std::vector& filenames, EFileformatType format, loaded_callback_func callback, uuid_vec_t remaining_ids = uuid_vec_t()); // static void onSaveAsBtn(LLUICtrl* ctrl, void* data); @@ -103,6 +107,9 @@ public: // FIRE-20150: Add refresh button to texture preview void onButtonRefresh(); + // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once + static void saveMultiple(uuid_vec_t ids); + protected: void init(); void populateRatioList(); From 83f9586525f43d77d6ad5856f0a6557aceb6f1cd Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 1 Aug 2018 16:21:11 +0200 Subject: [PATCH 3/6] Remove unneeded virtual modifier --- indra/newview/llpreviewtexture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 4b24690a32..5b612bec89 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -57,7 +57,7 @@ public: virtual void saveAs(); // FIRE-22851: Show texture "Save as" file picker subsequently instead all at once //void saveAs(EFileformatType format); - virtual void saveAs(uuid_vec_t remaining_ids); + void saveAs(uuid_vec_t remaining_ids); void saveAs(EFileformatType format, uuid_vec_t remaining_ids = uuid_vec_t()); // Date: Wed, 1 Aug 2018 16:35:20 +0200 Subject: [PATCH 4/6] Backed out changeset f230e265d4bf (Fix for FIRE-11266): In contrast to FMOD Ex, device ejection/insertion is now automatically handled in FMOD Studio and manually handling isn't needed. That is what the comments in fmod_common.h claims and can actually observed in reality. In this case, we should resort to automatic handling by FMOD Studio. --- indra/llaudio/llaudioengine_fmodstudio.cpp | 44 ---------------------- 1 file changed, 44 deletions(-) diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index b51a76e3ac..e55485bb02 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -49,43 +49,6 @@ const U32 EXTRA_SOUND_CHANNELS = 10; FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); -// FIRE-11266 / BUG-3549 / MAINT-2983: Changing audio device now requires relog to restore sounds -#if LL_WINDOWS -FMOD_RESULT F_CALLBACK systemCallback(FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void *commanddata2, void* userdata) -{ - FMOD::System *sys = (FMOD::System *)system; - FMOD_RESULT result; - switch (type) - { - case FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED: - { - int drivers; - sys->getNumDrivers(&drivers); - - if (drivers <= 0) - { - break; - } - - for (int i = 0; i < drivers; ++i) - { - result = sys->setDriver(i); - if (result == FMOD_OK) - { - break; - } - } - break; - } - - default: - break; - } - return FMOD_OK; -} -#endif -// - FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; LLAudioEngine_FMODSTUDIO::LLAudioEngine_FMODSTUDIO(bool enable_profiler, U32 resample_method) @@ -147,13 +110,6 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata) result = mSystem->setSoftwareChannels(num_channels + EXTRA_SOUND_CHANNELS); Check_FMOD_Error(result,"FMOD::System::setSoftwareChannels"); - // FIRE-11266 / BUG-3549 / MAINT-2983: Changing audio device now requires relog to restore sounds -#if LL_WINDOWS - result = mSystem->setCallback(systemCallback); - Check_FMOD_Error(result, "FMOD::System::setCallback"); -#endif - // - FMOD_ADVANCEDSETTINGS adv_settings = { }; adv_settings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS); switch (mResampleMethod) From 708f3388af52c607aef0f1667c68a98bff04c5f2 Mon Sep 17 00:00:00 2001 From: Liny Date: Thu, 2 Aug 2018 04:48:25 -0700 Subject: [PATCH 5/6] FIRE-22853 Make snapshots to disk not remember path and filename if the user doesnt want them to. --- .../app_settings/settings_per_account.xml | 11 ++++++++++ indra/newview/llstartup.cpp | 8 ++++++++ .../default/xui/en/panel_snapshot_local.xml | 20 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index df36dfc407..7c897bc670 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -1202,5 +1202,16 @@ Value 0 + FSRememberSnapshotPathSessions + + Comment + If enabled, remember the path and filename of snapshots between sessions. Default (true) + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 66b186604f..0c372e448d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1468,6 +1468,14 @@ bool idle_startup() gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir()); } // + + // FIRE-22853 Make snapshots to disk not remember path and filename if the user doesnt want them to. + if (!gSavedPerAccountSettings.getBOOL("FSRememberSnapshotPathSessions")) + { + gSavedPerAccountSettings.setString("SnapshotBaseDir", gSavedPerAccountSettings.getControl("SnapshotBaseDir")->getDefault().asString()); + gSavedPerAccountSettings.setString("SnapshotBaseName", gSavedPerAccountSettings.getControl("SnapshotBaseName")->getDefault().asString()); + } + // // Seperate user directories per grid on OS build #ifdef OPENSIM gDirUtilp->setPerAccountChatLogsDir(userid, gridlabel); diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml index 8853d40556..b1e9f1c078 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml @@ -165,6 +165,26 @@ name="image_quality_slider" top_pad="6" width="203" /> + + + Save location and filename between sessions +