Updated for new version of Steve's audio library.
STL includes don't use .h
Small view optimizations.
#include <Astro/sky.hxx>
#include <Astro/stars.hxx>
#include <Astro/sun.hxx>
-#include <Audio/sl.h>
+
+#ifdef HAVE_OSS_AUDIO
+# include <Audio/sl.h>
+# include <Audio/sm.h>
+#endif
+
#include <Cockpit/cockpit.hxx>
#include <Debug/fg_debug.h>
#include <Joystick/joystick.h>
int displayInstruments;
// Global structures for the Audio library
-slScheduler audio_sched ;
-slMixer audio_mixer ;
+#ifdef HAVE_OSS_AUDIO
+slScheduler audio_sched ( 8000 ) ;
+smMixer audio_mixer ;
slSample *s1;
slSample *s2;
+#endif
// The following defines flight gear options. Because glutlib will also
global_events.Process();
// Run audio scheduler
+#ifdef HAVE_OSS_AUDIO
audio_sched.update();
+#endif
// redraw display
fgRenderFrame();
"GLUT event handler initialization failed ...\n" );
}
- // Audio support
+ // Initialize audio support
+#ifdef HAVE_OSS_AUDIO
audio_mixer . setMasterVolume ( 30 ) ; /* 50% of max volume. */
- audio_sched . setRate ( 8000 ) ; /* 8KHz sample rate. */
- // audio_sched . setSafetyMargin ( 0.128 ) ;
- audio_sched . stereo ( SL_FALSE ) ; /* Monophonic. */
- audio_sched . setBps ( 8 ) ; /* 8 bit samples. */
- s1 = new slSample ( "/dos/X-System-HSR/sounds/xp_recip.wav" );
- s2 = new slSample ( "/dos/X-System-HSR/sounds/wind.wav" );
+ audio_sched . setSafetyMargin ( 1.0 ) ;
+ s1 = new slSample ( "/dos/X-System-HSR/sounds/xp_recip.wav", &audio_sched );
+ s2 = new slSample ( "/dos/X-System-HSR/sounds/wind.wav", &audio_sched );
s2 -> adjustVolume(0.5);
audio_sched . loopSample ( s1 );
audio_sched . loopSample ( s2 );
+#endif
// pass control off to the master GLUT event handler
glutMainLoop();
// $Log$
+// Revision 1.20 1998/06/03 00:47:11 curt
+// Updated to compile in audio support if OSS available.
+// Updated for new version of Steve's audio library.
+// STL includes don't use .h
+// Small view optimizations.
+//
// Revision 1.19 1998/06/01 17:54:40 curt
// Added Linux audio support.
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
+if HAVE_OSS_AUDIO
+AUDIO_DEFS = -DHAVE_OSS_AUDIO
+AUDIO_LIBS = $(top_builddir)/Lib/Audio/libAudio.la
+else
+AUDIO_DEFS =
+AUDIO_LIBS =
+endif
+
EXTRA_DIST = runfg.in runfg.bat.in
bin_PROGRAMS = fg
$(top_builddir)/Simulator/Time/libTime.la \
$(top_builddir)/Simulator/Weather/libWeather.la \
$(top_builddir)/Simulator/Joystick/libJoystick.la \
- $(top_builddir)/Lib/Audio/libAudio.la \
+ $(AUDIO_LIBS) \
$(top_builddir)/Lib/Math/libMath.la \
$(top_builddir)/Lib/Bucket/libBucket.la \
$(top_builddir)/Lib/Debug/libDebug.la \
$(top_builddir)/Lib/zlib/libz.la
+DEFS += $(AUDIO_DEFS)
+
INCLUDES += \
- -DGLUT \
-I$(top_builddir) \
-I$(top_builddir)/Lib \
-I$(top_builddir)/Simulator
// (Log is kept at end of this file)
-#include <string.h>
+#include <string>
#include <Debug/fg_debug.h>
#include <Include/fg_zlib.h>
// $Log$
+// Revision 1.6 1998/06/03 00:47:13 curt
+// Updated to compile in audio support if OSS available.
+// Updated for new version of Steve's audio library.
+// STL includes don't use .h
+// Small view optimizations.
+//
// Revision 1.5 1998/05/29 20:37:22 curt
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
// Read airport list into a "map" STL for dynamic list sizing and fast tree
#endif
-#include <map.h> // STL associative "array"
-
-#if defined(WIN32)
-# include <string> // Standard C++ string library
-#else
-# include <std/string.h> // Standard C++ string library
-#endif
+#include <map> // STL associative "array"
+#include <string> // Standard C++ string library
typedef struct {
// $Log$
+// Revision 1.4 1998/06/03 00:47:14 curt
+// Updated to compile in audio support if OSS available.
+// Updated for new version of Steve's audio library.
+// STL includes don't use .h
+// Small view optimizations.
+//
// Revision 1.3 1998/06/01 17:54:42 curt
// Added Linux audio support.
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
#include <Astro/sky.hxx>
#include <Astro/stars.hxx>
#include <Astro/sun.hxx>
-#include <Audio/sl.h>
#include <Autopilot/autopilot.h>
#include <Cockpit/cockpit.hxx>
#include <Debug/fg_debug.h>
// $Log$
+// Revision 1.18 1998/06/03 00:47:14 curt
+// Updated to compile in audio support if OSS available.
+// Updated for new version of Steve's audio library.
+// STL includes don't use .h
+// Small view optimizations.
+//
// Revision 1.17 1998/06/01 17:54:42 curt
// Added Linux audio support.
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
double theta_x, theta_y;
- // printf("win_ratio = %.2f\n", win_ratio);
- // calculate sin() and cos() of fov / 2 in X direction;
- theta_x = (o->fov * win_ratio * DEG_TO_RAD) / 2.0;
- // printf("theta_x = %.2f\n", theta_x);
- sin_fov_x = sin(theta_x);
- cos_fov_x = cos(theta_x);
- slope_x = sin_fov_x / cos_fov_x;
- // printf("slope_x = %.2f\n", slope_x);
-
- // calculate sin() and cos() of fov / 2 in Y direction;
- theta_y = (o->fov * DEG_TO_RAD) / 2.0;
- // printf("theta_y = %.2f\n", theta_y);
- sin_fov_y = sin(theta_y);
- cos_fov_y = cos(theta_y);
- slope_y = sin_fov_y / cos_fov_y;
- // printf("slope_y = %.2f\n", slope_y);
+ // printf("win_ratio = %.2f\n", win_ratio);
+ // calculate sin() and cos() of fov / 2 in X direction;
+ theta_x = (o->fov * win_ratio * DEG_TO_RAD) / 2.0;
+ // printf("theta_x = %.2f\n", theta_x);
+ sin_fov_x = sin(theta_x);
+ cos_fov_x = cos(theta_x);
+ slope_x = - cos_fov_x / sin_fov_x;
+ // printf("slope_x = %.2f\n", slope_x);
+
+ // calculate sin() and cos() of fov / 2 in Y direction;
+ theta_y = (o->fov * DEG_TO_RAD) / 2.0;
+ // printf("theta_y = %.2f\n", theta_y);
+ sin_fov_y = sin(theta_y);
+ cos_fov_y = cos(theta_y);
+ slope_y = cos_fov_y / sin_fov_y;
+ // printf("slope_y = %.2f\n", slope_y);
}
// $Log$
+// Revision 1.12 1998/06/03 00:47:15 curt
+// Updated to compile in audio support if OSS available.
+// Updated for new version of Steve's audio library.
+// STL includes don't use .h
+// Small view optimizations.
+//
// Revision 1.11 1998/05/27 02:24:05 curt
// View optimizations by Norman Vine.
//