// $Id$
-#define MICHAEL_JOHNSON_EXPERIMENTAL_ENGINE_AUDIO
+#define USE_NEW_ENGINE_CODE
+#undef MICHAEL_JOHNSON_EXPERIMENTAL_ENGINE_AUDIO
#ifdef HAVE_CONFIG_H
#include <simgear/constants.h> // for VERSION
#include <simgear/debug/logstream.hxx>
-#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/fg_random.h>
#include <simgear/misc/fgpath.hxx>
// -dw- use custom sioux settings so I can see output window
-#ifdef MACOS
+#ifdef macintosh
# ifndef FG_NDEBUG
# include <sioux.h> // settings for output window
# endif
static int idle_state = 0;
static int global_multi_loop;
+// attempt to avoid a large bounce at startup
+static bool initial_freeze = true;
+
// Another hack
int use_signals = 0;
multi_loop = 1;
}
- if ( !globals->get_freeze() ) {
+ if ( !globals->get_freeze() && !initial_freeze ) {
// run Autopilot system
current_autopilot->run();
// fdm_state, 0, remainder );
cur_fdm_state->update( 0 );
FGSteam::update( 0 );
+
+ if ( global_tile_mgr.queue_size() == 0 ) {
+ initial_freeze = false;
+ }
}
fdm_list.push_back( *cur_fdm_state );
}
}
-#if ! defined( MACOS )
+#if ! defined( macintosh )
// Do any I/O channel work that might need to be done
fgIOProcess();
#endif
#ifdef ENABLE_AUDIO_SUPPORT
if ( current_options.get_sound() && !audio_sched->not_working() ) {
-# ifdef MICHAEL_JOHNSON_EXPERIMENTAL_ENGINE_AUDIO
+# if defined(MICHAEL_JOHNSON_EXPERIMENTAL_ENGINE_AUDIO)
static double kts_to_fts = NM_TO_METER * METER_TO_FEET / 3600.0;
double pitch = log((controls.get_throttle(0) * 14.0) + 1.0);
//fprintf(stderr, "pitch1: %f ", pitch);
- // if (controls.get_throttle(0) > 0.0 ||
+ // if (controls.get_throttle(0) > 0.0 ||
// cur_fdm_state->get_V_calibrated_kts() > 40.0) {
//fprintf(stderr, "rel_wind: %f ", cur_fdm_state->get_V_calibrated_kts());
// }
// fprintf(stderr, "pitch4: %f\n", pitch);
- double volume = controls.get_throttle(0) * 1.15 + 0.3 +
+ double volume = controls.get_throttle(0) * 0.1 + 0.3 +
log(cur_fdm_state->get_V_calibrated_kts() * kts_to_fts + 1.0)/14.0;
+ if ( volume > 1.0 ) { volume = 1.0; }
+
// fprintf(stderr, "volume: %f\n", volume);
pitch_envelope.setStep ( 0, 0.01, pitch );
volume_envelope.setStep ( 0, 0.01, volume );
+# elif defined(USE_NEW_ENGINE_CODE)
+
+ // pitch corresponds to rpm
+ // volume corresponds to manifold pressure
+
+ double rpm_factor = cur_fdm_state->get_engine(0)->get_RPM() / 2500.0;
+ cout << "rpm = " << cur_fdm_state->get_engine(0)->get_RPM() << endl;
+
+ double pitch = 0.3 + rpm_factor * 3.0;
+
+ // don't run at absurdly slow rates -- not realistic
+ // and sounds bad to boot. :-)
+ if (pitch < 0.7) { pitch = 0.7; }
+ if (pitch > 5.0) { pitch = 5.0; }
+ cout << "pitch = " << pitch << endl;
+
+ double mp_factor =
+ cur_fdm_state->get_engine(0)->get_Manifold_Pressure() / 28;
+ cout << "mp = " << cur_fdm_state->get_engine(0)->get_Manifold_Pressure()
+ << endl;
+
+ double volume = mp_factor;
+
+ if ( volume < 0.3 ) { volume = 0.3; }
+ if ( volume > 2.0 ) { volume = 2.0; }
+ cout << "volume = " << volume << endl;
+
+ pitch_envelope.setStep ( 0, 0.01, pitch );
+ volume_envelope.setStep ( 0, 0.01, volume );
+
# else
double param = controls.get_throttle( 0 ) * 2.0 + 1.0;
// Initialize GLUT and define a main window
int fgGlutInit( int *argc, char **argv ) {
-#if !defined( MACOS )
+#if !defined( macintosh )
// GLUT will extract all glut specific options so later on we only
// need wory about our own.
glutInit(argc, argv);
general.set_glVendor( (char *)glGetString ( GL_VENDOR ) );
general.set_glRenderer( (char *)glGetString ( GL_RENDERER ) );
general.set_glVersion( (char *)glGetString ( GL_VERSION ) );
-
+ int tmp;
+ glGetIntegerv( GL_MAX_TEXTURE_SIZE, &tmp );
+ general.set_glMaxTexSize( tmp );
FG_LOG ( FG_GENERAL, FG_INFO, general.get_glRenderer() );
+ FG_LOG ( FG_GENERAL, FG_INFO, "Max texture size = " << tmp );
#if 0
// try to determine if we should adjust the initial default
// Main ...
int main( int argc, char **argv ) {
-#if defined( MACOS )
+#if defined( macintosh )
freopen ("stdout.txt", "w", stdout );
freopen ("stderr.txt", "w", stderr );
argc = ccommand( &argv );
// seed the random number generater
fg_srandom();
- aircraft_dir = ""; // Initialize the Aircraft directory to "" (UIUC)
+ // Read global preferences from $FG_ROOT/preferences.xml
+ // FIXME: this will *not* work with an --fg_root option because
+ // we have not read the command-line yet. Suggestions?
+
+ FGPath props_path(current_options.get_fg_root());
+ props_path.append("preferences.xml");
+ FG_LOG(FG_INPUT, FG_INFO, "Reading global preferences");
+ if (!readPropertyList(props_path.str(), ¤t_properties)) {
+ FG_LOG(FG_INPUT, FG_ALERT, "Failed to read global preferences from "
+ << props_path.str());
+ } else {
+ FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
+ }
+
+ // Initialize the Aircraft directory to "" (UIUC)
+ aircraft_dir = "";
// needs to happen before we parse command line options
globals = new FGGlobals;