Merge branch 'attenuation' into navaids-radio
This commit is contained in:
commit
d8e4f8035d
18 changed files with 185 additions and 216 deletions
|
@ -80,8 +80,11 @@ IF(APPLE)
|
|||
list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY})
|
||||
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# disabled while DBus / HAL / udev issues are decided
|
||||
#set(EVENT_INPUT_DEFAULT 1)
|
||||
find_package(UDev)
|
||||
|
||||
if(UDEV_FOUND)
|
||||
set(EVENT_INPUT_DEFAULT 1)
|
||||
endif(UDEV_FOUND)
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
|
@ -164,15 +167,19 @@ if(EVENT_INPUT)
|
|||
IF(APPLE)
|
||||
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
find_package(DBus)
|
||||
if(NOT DBUS_FOUND)
|
||||
message(WARNING "DBus not found, event input will be disabled")
|
||||
if(NOT UDEV_FOUND)
|
||||
message(WARNING "UDev not found, event input is disabled!")
|
||||
set(EVENT_INPUT 0)
|
||||
else()
|
||||
set(EVENT_INPUT_LIBRARIES ${UDEV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(WARNING "event input is not supported on this platform yet")
|
||||
endif()
|
||||
|
||||
# Keep PLIB INPUT enabled as long as EventInput does not replace current joystick configurations.
|
||||
set(ENABLE_PLIB_JOYSTICK 1)
|
||||
else(EVENT_INPUT)
|
||||
set(ENABLE_PLIB_JOYSTICK 1)
|
||||
endif(EVENT_INPUT)
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
# - Try to find the low-level D-Bus library
|
||||
# Once done this will define
|
||||
#
|
||||
# DBUS_FOUND - system has D-Bus
|
||||
# DBUS_INCLUDE_DIR - the D-Bus include directory
|
||||
# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
|
||||
# DBUS_LIBRARIES - the libraries needed to use D-Bus
|
||||
|
||||
# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
|
||||
# modeled after FindLibArt.cmake:
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
|
||||
|
||||
# in cache already
|
||||
SET(DBUS_FOUND TRUE)
|
||||
|
||||
else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
|
||||
|
||||
IF (NOT WIN32)
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
IF (PKG_CONFIG_FOUND)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
pkg_check_modules(_DBUS_PC QUIET dbus-1)
|
||||
ENDIF (PKG_CONFIG_FOUND)
|
||||
ENDIF (NOT WIN32)
|
||||
|
||||
FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
|
||||
${_DBUS_PC_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/include/dbus-1.0
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
|
||||
${_DBUS_PC_INCLUDE_DIRS}
|
||||
/usr/lib${LIB_SUFFIX}/include
|
||||
/usr/lib${LIB_SUFFIX}/dbus-1.0/include
|
||||
/usr/lib64/include
|
||||
/usr/lib64/dbus-1.0/include
|
||||
/usr/lib/include
|
||||
/usr/lib/dbus-1.0/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
|
||||
PATHS
|
||||
${_DBUS_PC_LIBDIR}
|
||||
)
|
||||
|
||||
|
||||
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
|
||||
set(DBUS_FOUND TRUE)
|
||||
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
|
||||
|
||||
|
||||
if (DBUS_FOUND)
|
||||
if (NOT DBus_FIND_QUIETLY)
|
||||
message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
|
||||
endif (NOT DBus_FIND_QUIETLY)
|
||||
else (DBUS_FOUND)
|
||||
if (DBus_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find D-Bus")
|
||||
endif (DBus_FIND_REQUIRED)
|
||||
endif (DBUS_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
|
||||
|
||||
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
|
53
CMakeModules/FindUDev.cmake
Normal file
53
CMakeModules/FindUDev.cmake
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Configure libudev environment
|
||||
#
|
||||
# UDEV_FOUND - system has a libudev
|
||||
# UDEV_INCLUDE_DIR - where to find header files
|
||||
# UDEV_LIBRARIES - the libraries to link against udev
|
||||
# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
|
||||
#
|
||||
# copyright (c) 2011 Petr Vanek <petr@scribus.info>
|
||||
# Redistribution and use of this file is allowed according to the terms of the BSD license.
|
||||
#
|
||||
|
||||
FIND_PATH(
|
||||
UDEV_INCLUDE_DIR
|
||||
libudev.h
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
${UDEV_PATH_INCLUDES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
UDEV_LIBRARIES
|
||||
NAMES udev libudev
|
||||
PATHS
|
||||
/usr/${CMAKE_INSTALL_LIBDIR}
|
||||
/usr/local/${CMAKE_INSTALL_LIBDIR}
|
||||
${UDEV_PATH_LIB}
|
||||
)
|
||||
|
||||
IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
|
||||
SET(UDEV_FOUND "YES")
|
||||
execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE)
|
||||
# retvale is 0 of the condition is "true" so we need to negate the value...
|
||||
if (UDEV_STABLE)
|
||||
set(UDEV_STABLE 0)
|
||||
else (UDEV_STABLE)
|
||||
set(UDEV_STABLE 1)
|
||||
endif (UDEV_STABLE)
|
||||
message(STATUS "libudev stable: ${UDEV_STABLE}")
|
||||
ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
|
||||
|
||||
IF (UDEV_FOUND)
|
||||
MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}")
|
||||
MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}")
|
||||
ELSE (UDEV_FOUND)
|
||||
MESSAGE(STATUS "UDev not found.")
|
||||
MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include")
|
||||
MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib")
|
||||
MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}")
|
||||
IF (UDev_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find UDev library")
|
||||
ENDIF (UDev_FIND_REQUIRED)
|
||||
ENDIF (UDEV_FOUND)
|
|
@ -147,7 +147,10 @@ FGAIBase::~FGAIBase() {
|
|||
|
||||
if (_refID != 0 && _refID != 1) {
|
||||
SGSoundMgr *smgr = globals->get_soundmgr();
|
||||
smgr->remove("aifx:"+_refID);
|
||||
stringstream name;
|
||||
name << "aifx:";
|
||||
name << _refID;
|
||||
smgr->remove(name.str());
|
||||
}
|
||||
|
||||
delete fp;
|
||||
|
@ -221,10 +224,11 @@ void FGAIBase::update(double dt) {
|
|||
_fx->set_orientation( orient );
|
||||
|
||||
SGVec3d velocity;
|
||||
velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec, pitch*speed );
|
||||
velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec,
|
||||
pitch*speed );
|
||||
_fx->set_velocity( velocity );
|
||||
}
|
||||
else if (_aimodel)
|
||||
else if ((_aimodel)&&(fgGetBool("/sim/sound/aimodels/enabled",false)))
|
||||
{
|
||||
string fxpath = _aimodel->get_sound_path();
|
||||
if (fxpath != "")
|
||||
|
@ -234,7 +238,10 @@ void FGAIBase::update(double dt) {
|
|||
|
||||
// initialize the sound configuration
|
||||
SGSoundMgr *smgr = globals->get_soundmgr();
|
||||
_fx = new FGFX(smgr, "aifx:"+_refID, props);
|
||||
stringstream name;
|
||||
name << "aifx:";
|
||||
name << _refID;
|
||||
_fx = new FGFX(smgr, name.str(), props);
|
||||
_fx->init();
|
||||
}
|
||||
}
|
||||
|
@ -485,6 +492,8 @@ void FGAIBase::unbind() {
|
|||
|
||||
props->setBoolValue("/sim/controls/radar/", true);
|
||||
|
||||
// drop reference to sound effects now
|
||||
_fx = 0;
|
||||
}
|
||||
|
||||
double FGAIBase::UpdateRadar(FGAIManager* manager) {
|
||||
|
|
|
@ -101,6 +101,7 @@ void FGAIShip::readFromScenario(SGPropertyNode* scFileNode) {
|
|||
setFixedTurnRadius(scFileNode->getDoubleValue("fixed-turn-radius-ft", 500));
|
||||
setSpeedConstant(scFileNode->getDoubleValue("speed-constant", 0.5));
|
||||
setSMPath(scFileNode->getStringValue("submodel-path", ""));
|
||||
setRollFactor(scFileNode->getDoubleValue("roll-factor", 1));
|
||||
|
||||
if (!flightplan.empty()) {
|
||||
SG_LOG(SG_AI, SG_ALERT, "getting flightplan: " << _name );
|
||||
|
@ -560,6 +561,10 @@ void FGAIShip::setFixedTurnRadius(double ftr) {
|
|||
_fixed_turn_radius = ftr;
|
||||
}
|
||||
|
||||
void FGAIShip::setRollFactor(double rf) {
|
||||
_roll_factor = rf * -0.0083335;
|
||||
}
|
||||
|
||||
void FGAIShip::setInitialTunnel(bool t) {
|
||||
_initial_tunnel = t;
|
||||
setTunnel(_initial_tunnel);
|
||||
|
|
|
@ -61,11 +61,14 @@ public:
|
|||
void setRudderConstant(double rc);
|
||||
void setSpeedConstant(double sc);
|
||||
void setFixedTurnRadius(double ft);
|
||||
void setRollFactor(double rf);
|
||||
|
||||
void setTunnel(bool t);
|
||||
void setInitialTunnel(bool t);
|
||||
|
||||
void setWPNames();
|
||||
void setWPPos();
|
||||
|
||||
double sign(double x);
|
||||
|
||||
bool _hdg_lock;
|
||||
|
|
|
@ -100,7 +100,7 @@ void FGATCManager::init() {
|
|||
|
||||
|
||||
FGAirport *apt = FGAirport::findByIdent(airport);
|
||||
if (apt && onGround && !runway.empty()) {
|
||||
if (apt && onGround) {// && !runway.empty()) {
|
||||
FGAirportDynamics* dcs = apt->getDynamics();
|
||||
int park_index = dcs->getNrOfParkings() - 1;
|
||||
//cerr << "found information: " << runway << " " << airport << ": parking = " << parking << endl;
|
||||
|
@ -111,7 +111,9 @@ void FGATCManager::init() {
|
|||
"Failed to find parking position " << parking <<
|
||||
" at airport " << airport << " at " << SG_ORIGIN);
|
||||
}
|
||||
// No valid parking location, so either at the runway or at a random location.
|
||||
if (parking.empty() || (park_index < 0)) {
|
||||
if (!runway.empty()) {
|
||||
controller = apt->getDynamics()->getTowerController();
|
||||
int stationFreq = apt->getDynamics()->getTowerFrequency(2);
|
||||
//cerr << "Setting radio frequency to in airfrequency: " << stationFreq << endl;
|
||||
|
@ -121,6 +123,9 @@ void FGATCManager::init() {
|
|||
fp->setRunway(runway);
|
||||
fp->createTakeOff(&ai_ac, false, apt, 0, fltType);
|
||||
ai_ac.setTakeOffStatus(2);
|
||||
} else {
|
||||
// We're on the ground somewhere. Handle this case later.
|
||||
}
|
||||
} else {
|
||||
controller = apt->getDynamics()->getStartupController();
|
||||
int stationFreq = apt->getDynamics()->getGroundFrequency(1);
|
||||
|
|
|
@ -36,7 +36,8 @@ set(HEADERS
|
|||
if(EVENT_INPUT)
|
||||
list(APPEND SOURCES ${EVENT_INPUT_SOURCES})
|
||||
list(APPEND SOURCES ${EVENT_INPUT_HEADERS})
|
||||
include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
|
||||
include_directories(${UDEV_INCLUDE_DIR})
|
||||
add_definitions(-DWITH_EVENTINPUT)
|
||||
endif()
|
||||
|
||||
set(FGJS_SOURCES
|
||||
|
|
|
@ -25,15 +25,11 @@
|
|||
#include <cstring>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <poll.h>
|
||||
#include <linux/input.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <fcntl.h>
|
||||
#include "FGLinuxEventInput.hxx"
|
||||
|
||||
#include <libudev.h>
|
||||
#include <poll.h>
|
||||
#include <linux/input.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <string.h>
|
||||
|
@ -445,92 +441,42 @@ void FGLinuxInputDevice::SetDevname( std::string name )
|
|||
this->devname = name;
|
||||
}
|
||||
|
||||
FGLinuxEventInput::FGLinuxEventInput() :
|
||||
halcontext(NULL)
|
||||
FGLinuxEventInput::FGLinuxEventInput()
|
||||
{
|
||||
}
|
||||
|
||||
FGLinuxEventInput::~FGLinuxEventInput()
|
||||
{
|
||||
if( halcontext != NULL ) {
|
||||
libhal_ctx_shutdown( halcontext, NULL);
|
||||
libhal_ctx_free( halcontext );
|
||||
halcontext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
//TODO: enable hotplug support
|
||||
static void DeviceAddedCallback (LibHalContext *ctx, const char *udi)
|
||||
{
|
||||
FGLinuxEventInput * linuxEventInput = (FGLinuxEventInput*)libhal_ctx_get_user_data (ctx);
|
||||
linuxEventInput->AddHalDevice( udi );
|
||||
}
|
||||
|
||||
static void DeviceRemovedCallback (LibHalContext *ctx, const char *udi)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void FGLinuxEventInput::postinit()
|
||||
{
|
||||
FGEventInput::postinit();
|
||||
|
||||
DBusConnection * connection;
|
||||
DBusError dbus_error;
|
||||
struct udev * udev = udev_new();
|
||||
|
||||
dbus_error_init(&dbus_error);
|
||||
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
|
||||
if (dbus_error_is_set(&dbus_error)) {
|
||||
SG_LOG( SG_INPUT, SG_ALERT, "Can't connect to system bus " << dbus_error.message);
|
||||
dbus_error_free (&dbus_error);
|
||||
return;
|
||||
struct udev_enumerate *enumerate = udev_enumerate_new(udev);
|
||||
udev_enumerate_add_match_subsystem(enumerate, "input");
|
||||
udev_enumerate_scan_devices(enumerate);
|
||||
struct udev_list_entry *devices = udev_enumerate_get_list_entry(enumerate);
|
||||
struct udev_list_entry *dev_list_entry;
|
||||
|
||||
udev_list_entry_foreach(dev_list_entry, devices) {
|
||||
const char * path = udev_list_entry_get_name(dev_list_entry);
|
||||
struct udev_device *dev = udev_device_new_from_syspath(udev, path);
|
||||
const char * node = udev_device_get_devnode(dev);
|
||||
|
||||
dev = udev_device_get_parent( dev );
|
||||
const char * name = udev_device_get_sysattr_value(dev,"name");
|
||||
|
||||
SG_LOG(SG_INPUT,SG_ALERT, "name=" << (name?name:"<null>") << ", node=" << (node?node:"<null>"));
|
||||
if( name && node )
|
||||
AddDevice( new FGLinuxInputDevice(name, node) );
|
||||
|
||||
udev_device_unref(dev);
|
||||
}
|
||||
|
||||
halcontext = libhal_ctx_new();
|
||||
|
||||
libhal_ctx_set_dbus_connection (halcontext, connection );
|
||||
dbus_error_init (&dbus_error);
|
||||
|
||||
if( libhal_ctx_init( halcontext, &dbus_error )) {
|
||||
|
||||
int num_devices = 0;
|
||||
char ** devices = libhal_find_device_by_capability(halcontext, "input", &num_devices, NULL);
|
||||
|
||||
for ( int i = 0; i < num_devices; i++)
|
||||
AddHalDevice( devices[i] );
|
||||
|
||||
libhal_free_string_array (devices);
|
||||
|
||||
//TODO: enable hotplug support
|
||||
// libhal_ctx_set_user_data( halcontext, this );
|
||||
// libhal_ctx_set_device_added( halcontext, DeviceAddedCallback );
|
||||
// libhal_ctx_set_device_removed( halcontext, DeviceRemovedCallback );
|
||||
} else {
|
||||
if(dbus_error_is_set (&dbus_error) ) {
|
||||
SG_LOG( SG_INPUT, SG_ALERT, "Can't connect to hald: " << dbus_error.message);
|
||||
dbus_error_free (&dbus_error);
|
||||
} else {
|
||||
SG_LOG( SG_INPUT, SG_ALERT, "Can't connect to hald." );
|
||||
}
|
||||
|
||||
libhal_ctx_free (halcontext);
|
||||
halcontext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void FGLinuxEventInput::AddHalDevice( const char * udi )
|
||||
{
|
||||
char * device = libhal_device_get_property_string( halcontext, udi, "input.device", NULL);
|
||||
char * product = libhal_device_get_property_string( halcontext, udi, "input.product", NULL);
|
||||
|
||||
if( product != NULL && device != NULL )
|
||||
AddDevice( new FGLinuxInputDevice(product, device) );
|
||||
else
|
||||
SG_LOG( SG_INPUT, SG_ALERT, "Can't get device or product property of " << udi );
|
||||
|
||||
if( device != NULL ) libhal_free_string( device );
|
||||
if( product != NULL ) libhal_free_string( product );
|
||||
udev_unref(udev);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "FGEventInput.hxx"
|
||||
#include <linux/input.h>
|
||||
#include <hal/libhal.h>
|
||||
|
||||
struct FGLinuxEventData : public FGEventData {
|
||||
FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
|
||||
|
@ -71,10 +70,7 @@ public:
|
|||
virtual void update (double dt);
|
||||
virtual void postinit();
|
||||
|
||||
void AddHalDevice( const char * udi );
|
||||
protected:
|
||||
LibHalContext *halcontext;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -77,6 +77,7 @@ target_link_libraries(fgfs
|
|||
${PLIB_LIBRARIES}
|
||||
${JPEG_LIBRARY}
|
||||
${HLA_LIBRARIES}
|
||||
${EVENT_INPUT_LIBRARIES}
|
||||
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
|
||||
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
|
||||
${PLATFORM_LIBS}
|
||||
|
|
|
@ -171,6 +171,7 @@ FGGlobals::~FGGlobals()
|
|||
ai->unbind();
|
||||
delete ai;
|
||||
}
|
||||
SGSubsystem* sound = subsystem_mgr->remove("sound");
|
||||
|
||||
subsystem_mgr->shutdown();
|
||||
subsystem_mgr->unbind();
|
||||
|
@ -205,6 +206,7 @@ FGGlobals::~FGGlobals()
|
|||
delete tacanlist;
|
||||
delete carrierlist;
|
||||
delete channellist;
|
||||
delete sound;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,6 +91,9 @@ FGAircraftModel::reinit()
|
|||
void
|
||||
FGAircraftModel::deinit()
|
||||
{
|
||||
// drop reference
|
||||
_fx = 0;
|
||||
|
||||
if (!_aircraft) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
const float THIRD = (1.0/3.0);
|
||||
const float f_0 = 47.7; // 47.7 MHz from [Alg 1.1], to convert frequency into wavenumber and vica versa
|
||||
const double THIRD = (1.0/3.0);
|
||||
const double f_0 = 47.7; // 47.7 MHz from [Alg 1.1], to convert frequency into wavenumber and vica versa
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -376,14 +376,14 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
eps_dielect, sgm_conductivity, eno, frq_mhz, radio_climate,
|
||||
pol, conf, rel, dbloss, strmode, p_mode, horizons, errnum);
|
||||
if( _root_node->getBoolValue( "use-clutter-attenuation", false ) )
|
||||
clutterLoss(frq_mhz, distance_m, itm_elev, materials, receiver_height, transmitter_height, p_mode, horizons, clutter_loss);
|
||||
clutterLoss(frq_mhz, itm_elev, materials, receiver_height, transmitter_height, p_mode, horizons, clutter_loss);
|
||||
}
|
||||
else {
|
||||
point_to_point(itm_elev, transmitter_height, receiver_height,
|
||||
eps_dielect, sgm_conductivity, eno, frq_mhz, radio_climate,
|
||||
pol, conf, rel, dbloss, strmode, p_mode, horizons, errnum);
|
||||
if( _root_node->getBoolValue( "use-clutter-attenuation", false ) )
|
||||
clutterLoss(frq_mhz, distance_m, itm_elev, materials, transmitter_height, receiver_height, p_mode, horizons, clutter_loss);
|
||||
clutterLoss(frq_mhz, itm_elev, materials, transmitter_height, receiver_height, p_mode, horizons, clutter_loss);
|
||||
}
|
||||
|
||||
double pol_loss = 0.0;
|
||||
|
@ -434,11 +434,11 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
* We are only worried about clutter loss, terrain influence
|
||||
* on the first Fresnel zone is calculated in the ITM functions
|
||||
***/
|
||||
void FGRadioTransmission::clutterLoss(double freq, double distance_m, double itm_elev[], deque<string> materials,
|
||||
void FGRadioTransmission::clutterLoss(double freq, double itm_elev[], deque<string> materials,
|
||||
double transmitter_height, double receiver_height, int p_mode,
|
||||
double horizons[], double &clutter_loss) {
|
||||
|
||||
distance_m = itm_elev[0] * itm_elev[1]; // only consider elevation points
|
||||
double distance_m = itm_elev[0] * itm_elev[1]; // only consider elevation points
|
||||
|
||||
if (p_mode == 0) { // LOS: take each point and see how clutter height affects first Fresnel zone
|
||||
int mat = 0;
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
double polarization_loss();
|
||||
double ITM_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
||||
double LOS_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
||||
void clutterLoss(double freq, double distance_m, double itm_elev[], std::deque<string> materials,
|
||||
void clutterLoss(double freq, double itm_elev[], std::deque<string> materials,
|
||||
double transmitter_height, double receiver_height, int p_mode,
|
||||
double horizons[], double &clutter_loss);
|
||||
void get_material_properties(string mat_name, double &height, double &density);
|
||||
|
|
|
@ -40,11 +40,21 @@
|
|||
#include <simgear/sound/xmlsound.hxx>
|
||||
|
||||
FGFX::FGFX ( SGSoundMgr *smgr, const string &refname, SGPropertyNode *props ) :
|
||||
_props( props ),
|
||||
_enabled( fgGetNode("/sim/sound/effects/enabled", true) ),
|
||||
_volume( fgGetNode("/sim/sound/effects/volume", true) )
|
||||
_props( props )
|
||||
{
|
||||
if (!props) _props = globals->get_props();
|
||||
if (!props) {
|
||||
_is_aimodel = false;
|
||||
_props = globals->get_props();
|
||||
_enabled = fgGetNode("/sim/sound/effects/enabled", true);
|
||||
_volume = fgGetNode("/sim/sound/effects/volume", true);
|
||||
} else {
|
||||
_is_aimodel = true;
|
||||
_enabled = _props->getNode("/sim/sound/aimodels/enabled", true);
|
||||
_enabled->setBoolValue(fgGetBool("/sim/sound/effects/enabled"));
|
||||
_volume = _props->getNode("/sim/sound/aimodels/volume", true);
|
||||
_volume->setFloatValue(fgGetFloat("/sim/sound/effects/volume"));
|
||||
_volume->setFloatValue(0.1f);
|
||||
}
|
||||
|
||||
_avionics_enabled = _props->getNode("sim/sound/avionics/enabled", true);
|
||||
_avionics_volume = _props->getNode("sim/sound/avionics/volume", true);
|
||||
|
@ -97,18 +107,17 @@ FGFX::init()
|
|||
}
|
||||
|
||||
node = root.getNode("fx");
|
||||
if(node) {
|
||||
if(node && !_is_aimodel) {
|
||||
for (int i = 0; i < node->nChildren(); ++i) {
|
||||
SGXmlSound *sound = new SGXmlSound();
|
||||
SGXmlSound *soundfx = new SGXmlSound();
|
||||
|
||||
try {
|
||||
sound->init(globals->get_props(), node->getChild(i), this,
|
||||
_avionics, path.dir());
|
||||
|
||||
_sound.push_back(sound);
|
||||
soundfx->init( _props, node->getChild(i), this, _avionics,
|
||||
path.dir() );
|
||||
_sound.push_back( soundfx );
|
||||
} catch ( sg_exception &e ) {
|
||||
SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
|
||||
delete sound;
|
||||
delete soundfx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
bool _is_aimodel;
|
||||
SGSharedPtr<SGSampleGroup> _avionics;
|
||||
std::vector<SGXmlSound *> _sound;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue