Skip to content

Commit

Permalink
Merge pull request #254 from TwinFan/Next
Browse files Browse the repository at this point in the history
v3.4.1 Option Force FMOD Instance
  • Loading branch information
TwinFan authored May 28, 2023
2 parents 670e3d0 + 29ac176 commit 835f688
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else()
endif()

project(LiveTraffic
VERSION 3.4.0
VERSION 3.4.1
DESCRIPTION "LiveTraffic X-Plane plugin")

# Provide compile macros from the above project version definition
Expand Down
23 changes: 18 additions & 5 deletions Include/DataRefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ const int DEF_FD_REFRESH_INTVL = 20; ///< how often to fetch new flig
const int DEF_FD_LONG_REFR_INTVL= 60; ///< how often to fetch new flight data if flying high
const int DEF_FD_BUF_PERIOD = 90; ///< seconds to buffer before simulating aircraft
const int DEF_FD_REDUCE_HEIGHT = 10000; ///< height AGL considered "flying high"
const int DEF_CONTR_ALT_MIN = 25000; ///< [ft] Auto Contrails: Minimum altitude
const int DEF_CONTR_ALT_MAX = 45000; ///< [ft] Auto Contrails: Maximum altitude
const int DEF_CONTR_LIFETIME = 25; ///< [s] Contrail default time to live
const bool DEF_CONTR_MULTI = false; ///< Auto-create multiple or just a single contrail?
#if LIN // On Linux, there more reports of issues if using separate FMOD, so we keep it disabled by default:
const bool DEF_SND_FMOD_INST = false; ///< Enforce using our own FMOD instance instead of X-Plane's?
#else // There have been various CTD reports with complex aircraft if using X-Plane's FMOD, so we keep this enabled by default:
const bool DEF_SND_FMOD_INST = true; ///< Enforce using our own FMOD instance instead of X-Plane's?
#endif
const int DEF_SUI_TRANSP = 0; ///< Settings UI: transaprent background?
const int MIN_NETW_TIMEOUT = 5; ///< [s] minimum network request timeout
const int DEF_NETW_TIMEOUT = 90; ///< [s] of network request timeout

Expand Down Expand Up @@ -352,6 +362,7 @@ enum dataRefsLT {
DR_CFG_AIRCRAFT_DISPLAYED,
DR_CFG_AUTO_START,
DR_CFG_MASTER_VOLUME,
DR_CFG_SND_FORCE_FMOD_INSTANCE,
DR_CFG_AI_ON_REQUEST,
DR_CFG_AI_UNDER_CONTROL,
DR_CFG_AI_NOT_ON_GND,
Expand Down Expand Up @@ -655,6 +666,7 @@ class DataRefs
// generic config values
int bAutoStart = true; ///< shall display a/c right after startup?
int volMaster = 100; ///< Master Volume in Percent
int sndForceFmodInstance= DEF_SND_FMOD_INST; ///< Sound: Force using our own FMOD instance (instead of using XP's)
int bAIonRequest = false; ///< acquire multiplayer control for TCAS on request only, not automatically?
bool bAwaitingAIControl = false; ///< have in vain tried acquiring AI control and are waiting for callback now?
int bAINotOnGnd = false; ///< shall a/c on the ground be hidden from TCAS/AI?
Expand Down Expand Up @@ -683,10 +695,10 @@ class DataRefs
int hideInReplay = false; ///< Shall no planes been shown while in Replay mode (to avoid collisions)?
int hideStaticTwr = true; ///< filter out TWR objects from the channels
int cpyObjFiles = 1; ///< copy `.obj` files for replacing dataRefs and textures
int contrailAltMin_ft = 25000; ///< [ft] Auto Contrails: Minimum altitude
int contrailAltMax_ft = 45000; ///< [ft] Auto Contrails: Maximum altitude
int contrailLifeTime = 25; ///< [s] Contrail default time to live
bool contrailMulti = false; ///< Auto-create multiple or just a single contrail?
int contrailAltMin_ft = DEF_CONTR_ALT_MIN; ///< [ft] Auto Contrails: Minimum altitude
int contrailAltMax_ft = DEF_CONTR_ALT_MAX; ///< [ft] Auto Contrails: Maximum altitude
int contrailLifeTime = DEF_CONTR_LIFETIME; ///< [s] Contrail default time to live
bool contrailMulti = DEF_CONTR_MULTI; ///< Auto-create multiple or just a single contrail?
int remoteSupport = 0; ///< support XPMP2 Remote Client? (3-way: -1 off, 0 auto, 1 on)
int bUseExternalCamera = false; ///< Do not activate LiveTraffic's camera view when hitting the camera button (intended for a 3rd party camera plugin to activate instead based on reading livetraffic/camera/... dataRefs or using LTAPI)

Expand Down Expand Up @@ -757,7 +769,7 @@ class DataRefs

// Settings UI
WndRect SUIrect; ///< Settings UI Window position
int SUItransp = 0; ///< Settings UI: transaprent background?
int SUItransp = DEF_SUI_TRANSP; ///< Settings UI: transaprent background?

// A/C Info Window(s)
WndRect ACIrect; ///< A/C Info Window position
Expand Down Expand Up @@ -890,6 +902,7 @@ class DataRefs
// specific access
inline bool GetAutoStart() const { return bAutoStart != 0; }
int GetVolumeMaster() const { return volMaster; }
bool ShallForceFmodInstance() const { return sndForceFmodInstance != 0; }
inline bool IsAIonRequest() const { return bAIonRequest != 0; }
bool IsAINotOnGnd() const { return bAINotOnGnd != 0; }
static int HaveAIUnderControl(void* =NULL) { return XPMPHasControlOfAIAircraft(); }
Expand Down
2 changes: 1 addition & 1 deletion Lib/XPMP2
4 changes: 2 additions & 2 deletions LiveTraffic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@
LIVETRAFFIC_VERSION_BETA = 0;
LIVETRAFFIC_VER_MAJOR = 3;
LIVETRAFFIC_VER_MINOR = 4;
LIVETRAFFIC_VER_PATCH = 0;
LIVETRAFFIC_VER_PATCH = 1;
LLVM_LTO = NO;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 10.15;
Expand Down Expand Up @@ -896,7 +896,7 @@
LIVETRAFFIC_VERSION_BETA = 0;
LIVETRAFFIC_VER_MAJOR = 3;
LIVETRAFFIC_VER_MINOR = 4;
LIVETRAFFIC_VER_PATCH = 0;
LIVETRAFFIC_VER_PATCH = 1;
LLVM_LTO = YES;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 10.15;
Expand Down
9 changes: 9 additions & 0 deletions Src/DataRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ DataRefs::dataRefDefinitionT DATA_REFS_LT[CNT_DATAREFS_LT] = {
{"livetraffic/cfg/aircrafts_displayed", DataRefs::LTGetInt, DataRefs::LTSetAircraftDisplayed, GET_VAR, false },
{"livetraffic/cfg/auto_start", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/cfg/volume/master", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/cfg/sound/force_fmod_instance", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true, true },
{"livetraffic/cfg/ai_on_request", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/cfg/ai_controlled", DataRefs::HaveAIUnderControl, NULL, NULL, false },
{"livetraffic/cfg/ai_not_on_gnd", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
Expand Down Expand Up @@ -592,6 +593,7 @@ void* DataRefs::getVarAddr (dataRefsLT dr)
case DR_CFG_AIRCRAFT_DISPLAYED: return &bShowingAircraft;
case DR_CFG_AUTO_START: return &bAutoStart;
case DR_CFG_MASTER_VOLUME: return &volMaster;
case DR_CFG_SND_FORCE_FMOD_INSTANCE:return &sndForceFmodInstance;
case DR_CFG_AI_ON_REQUEST: return &bAIonRequest;
case DR_CFG_AI_NOT_ON_GND: return &bAINotOnGnd;
case DR_CFG_LABELS: return &labelCfg;
Expand Down Expand Up @@ -1775,6 +1777,13 @@ void DataRefs::ResetAdvCfgToDefaults ()
fdBufPeriod = DEF_FD_BUF_PERIOD;
fdReduceHeight = DEF_FD_REDUCE_HEIGHT;
netwTimeout = DEF_NETW_TIMEOUT;
contrailAltMin_ft = DEF_CONTR_ALT_MIN;
contrailAltMax_ft = DEF_CONTR_ALT_MAX;
contrailLifeTime = DEF_CONTR_LIFETIME;
contrailMulti = DEF_CONTR_MULTI;
sndForceFmodInstance= DEF_SND_FMOD_INST;
MsgRect.clear();
SUItransp = DEF_SUI_TRANSP;
UIFontScale = DEF_UI_FONT_SCALE;
UIopacity = DEF_UI_OPACITY;
}
Expand Down
10 changes: 5 additions & 5 deletions Src/LTMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,12 +898,12 @@ int MPIntPrefsFunc (const char*, const char* key, int iDefault)
if (!strcmp(key, XPMP_CFG_ITM_CONTR_LIFE)) return dataRefs.GetContrailLifeTime();
if (!strcmp(key, XPMP_CFG_ITM_CONTR_MULTI)) return dataRefs.GetContrailMulti();
// Support XPMP2 Remote Clinet?
if (!strcmp(key, XPMP_CFG_ITM_SUPPORT_REMOTE))
return dataRefs.GetRemoteSupport();
if (!strcmp(key, XPMP_CFG_ITM_SUPPORT_REMOTE)) return dataRefs.GetRemoteSupport();
// Sound if enabled
if (!strcmp(key, XPMP_CFG_ITM_ACTIVATE_SOUND))
return dataRefs.GetVolumeMaster() > 0;

if (!strcmp(key, XPMP_CFG_ITM_ACTIVATE_SOUND)) return dataRefs.GetVolumeMaster() > 0;
// Force own FMOD instance?
if (!strcmp(key, XPMP_CFG_ITM_FMOD_INSTANCE)) return dataRefs.ShallForceFmodInstance();

// dont' know/care about the option, return the default value
return iDefault;
}
Expand Down
9 changes: 9 additions & 0 deletions Src/SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,15 @@ void LTSettingsUI::buildInterface()
if (!*sFilter) ImGui::TreePop();
}

if (ImGui::TreeNodeHelp("Miscellaneous", nCol, nullptr, nullptr, sFilter, nOpCl,
ImGuiTreeNodeFlags_DefaultOpen | ImGuiTreeNodeFlags_SpanFullWidth))
{
ImGui::FilteredCfgCheckbox("Own FMOD Instance", sFilter, DR_CFG_SND_FORCE_FMOD_INSTANCE,
"Enforce using separate FMOD instance instead of X-Plane's.\n(Takes effect after restart only.)");

if (!*sFilter) ImGui::TreePop();
}

if (ImGui::TreeNodeHelp("Export", nCol, nullptr, nullptr, sFilter, nOpCl,
ImGuiTreeNodeFlags_SpanFullWidth))
{
Expand Down
20 changes: 19 additions & 1 deletion docs/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,31 @@ <h1 id="release-notes">Release Notes</h1>

<h2>v3</h2>

<h3>v3.4.0</h3>
<h3>v3.4.1</h3>

<P>
<b>Update:</b> In case of doubt you can always just copy all files from the archive
over the files of your existing installation.
</P>

<P>At least copy the following files, which have changed compared to v3.4.0:</P>
<ul>
<li><code>lin|mac|win_x64/LiveTraffic.xpl</code></li>
</ul>

<P>Change log:</P>

<ul>
<li>
Added Advanced configuration option to force a separate FMOD instance, avoids
<a href="https://forums.x-plane.org/index.php?/forums/topic/288846-live-traffic-ctd-x-plane-1205/">FMOD interference with other plugins/FlyWithLua</a>
that caused CTDs e.g. with Zibo B738 or Thranda C206.<br>
Windows, Mac: Enabled by default; Linux: Disabled by default
</li>
</ul>

<h3>v3.4.0</h3>

<P>At least copy the following files, which have changed compared to v3.3.2:</P>
<ul>
<li><code>lin|mac|win_x64/LiveTraffic.xpl</code></li>
Expand Down

0 comments on commit 835f688

Please sign in to comment.