]> git.mxchange.org Git - flightgear.git/commitdiff
Updated to compile in audio support if OSS available.
authorcurt <curt>
Wed, 3 Jun 1998 00:47:11 +0000 (00:47 +0000)
committercurt <curt>
Wed, 3 Jun 1998 00:47:11 +0000 (00:47 +0000)
Updated for new version of Steve's audio library.
STL includes don't use .h
Small view optimizations.

Main/GLUTmain.cxx
Main/Makefile.am
Main/airports.cxx
Main/airports.hxx
Main/fg_init.cxx
Main/views.cxx

index 0c764368f9e6d1459ebdaeea7b8525cb39709c33..e5aab2f37e1fba1c2751bce0bc0e01c4e57d965e 100644 (file)
 #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>
@@ -81,10 +86,12 @@ int use_signals = 0;
 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
@@ -547,7 +554,9 @@ static void fgMainLoop( void ) {
     global_events.Process();
 
     // Run audio scheduler
+#ifdef HAVE_OSS_AUDIO
     audio_sched.update();
+#endif
 
     // redraw display
     fgRenderFrame();
@@ -695,17 +704,16 @@ int main( int argc, char **argv ) {
                  "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();
@@ -724,6 +732,12 @@ extern "C" {
 
 
 // $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.
index 33e4f0c4598625bf7c5a8e0960af25053c71b167..32f57745bc76e9428801fc5157a665fbc8daa7f1 100644 (file)
@@ -1,3 +1,11 @@
+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
@@ -26,14 +34,15 @@ fg_LDADD = \
        $(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
index b9222dcfe901bf870a191ae7e012796f8dc585d5..d3a4ca1373195597f970f9b0b4520442b05be275 100644 (file)
@@ -25,7 +25,7 @@
 // (Log is kept at end of this file)
 
 
-#include <string.h>
+#include <string>
 
 #include <Debug/fg_debug.h>
 #include <Include/fg_zlib.h>
@@ -104,6 +104,12 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
 
 
 // $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
index 3718d223fce4e2a068f122aabb12e384d25f3ea6..9402930283a223dcbb9c0315550187e3fa9bbee6 100644 (file)
 #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 {
@@ -75,6 +70,12 @@ public:
 
 
 // $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.
index e95c8224e31f1e020759b14fd24595fd6383166d..79a97cf839421cf42260a6996b5ae5eea3cffc8f 100644 (file)
@@ -40,7 +40,6 @@
 #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>
@@ -387,6 +386,12 @@ int fgInitSubsystems( void ) {
 
 
 // $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.
index 88bc02c3f4695bd88b843faebe794add1608e3ca..5ab8e9425f579427142eb78318af2ad76f5fbcf1 100644 (file)
@@ -67,22 +67,22 @@ void fgVIEW::Init( void ) {
 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);
 }
 
 
@@ -376,6 +376,12 @@ fgVIEW::~fgVIEW( void ) {
 
 
 // $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.
 //