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.
This commit is contained in:
parent
a8d69d9d3c
commit
476d5e73b2
6 changed files with 77 additions and 36 deletions
|
@ -50,7 +50,12 @@
|
||||||
#include <Astro/sky.hxx>
|
#include <Astro/sky.hxx>
|
||||||
#include <Astro/stars.hxx>
|
#include <Astro/stars.hxx>
|
||||||
#include <Astro/sun.hxx>
|
#include <Astro/sun.hxx>
|
||||||
|
|
||||||
|
#ifdef HAVE_OSS_AUDIO
|
||||||
# include <Audio/sl.h>
|
# include <Audio/sl.h>
|
||||||
|
# include <Audio/sm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Cockpit/cockpit.hxx>
|
#include <Cockpit/cockpit.hxx>
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
#include <Joystick/joystick.h>
|
#include <Joystick/joystick.h>
|
||||||
|
@ -81,10 +86,12 @@ int use_signals = 0;
|
||||||
int displayInstruments;
|
int displayInstruments;
|
||||||
|
|
||||||
// Global structures for the Audio library
|
// Global structures for the Audio library
|
||||||
slScheduler audio_sched ;
|
#ifdef HAVE_OSS_AUDIO
|
||||||
slMixer audio_mixer ;
|
slScheduler audio_sched ( 8000 ) ;
|
||||||
|
smMixer audio_mixer ;
|
||||||
slSample *s1;
|
slSample *s1;
|
||||||
slSample *s2;
|
slSample *s2;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// The following defines flight gear options. Because glutlib will also
|
// The following defines flight gear options. Because glutlib will also
|
||||||
|
@ -547,7 +554,9 @@ static void fgMainLoop( void ) {
|
||||||
global_events.Process();
|
global_events.Process();
|
||||||
|
|
||||||
// Run audio scheduler
|
// Run audio scheduler
|
||||||
|
#ifdef HAVE_OSS_AUDIO
|
||||||
audio_sched.update();
|
audio_sched.update();
|
||||||
|
#endif
|
||||||
|
|
||||||
// redraw display
|
// redraw display
|
||||||
fgRenderFrame();
|
fgRenderFrame();
|
||||||
|
@ -695,17 +704,16 @@ int main( int argc, char **argv ) {
|
||||||
"GLUT event handler initialization failed ...\n" );
|
"GLUT event handler initialization failed ...\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio support
|
// Initialize audio support
|
||||||
|
#ifdef HAVE_OSS_AUDIO
|
||||||
audio_mixer . setMasterVolume ( 30 ) ; /* 50% of max volume. */
|
audio_mixer . setMasterVolume ( 30 ) ; /* 50% of max volume. */
|
||||||
audio_sched . setRate ( 8000 ) ; /* 8KHz sample rate. */
|
audio_sched . setSafetyMargin ( 1.0 ) ;
|
||||||
// audio_sched . setSafetyMargin ( 0.128 ) ;
|
s1 = new slSample ( "/dos/X-System-HSR/sounds/xp_recip.wav", &audio_sched );
|
||||||
audio_sched . stereo ( SL_FALSE ) ; /* Monophonic. */
|
s2 = new slSample ( "/dos/X-System-HSR/sounds/wind.wav", &audio_sched );
|
||||||
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" );
|
|
||||||
s2 -> adjustVolume(0.5);
|
s2 -> adjustVolume(0.5);
|
||||||
audio_sched . loopSample ( s1 );
|
audio_sched . loopSample ( s1 );
|
||||||
audio_sched . loopSample ( s2 );
|
audio_sched . loopSample ( s2 );
|
||||||
|
#endif
|
||||||
|
|
||||||
// pass control off to the master GLUT event handler
|
// pass control off to the master GLUT event handler
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
|
@ -724,6 +732,12 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.19 1998/06/01 17:54:40 curt
|
||||||
// Added Linux audio support.
|
// Added Linux audio support.
|
||||||
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
||||||
|
|
|
@ -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
|
EXTRA_DIST = runfg.in runfg.bat.in
|
||||||
|
|
||||||
bin_PROGRAMS = fg
|
bin_PROGRAMS = fg
|
||||||
|
@ -26,14 +34,15 @@ fg_LDADD = \
|
||||||
$(top_builddir)/Simulator/Time/libTime.la \
|
$(top_builddir)/Simulator/Time/libTime.la \
|
||||||
$(top_builddir)/Simulator/Weather/libWeather.la \
|
$(top_builddir)/Simulator/Weather/libWeather.la \
|
||||||
$(top_builddir)/Simulator/Joystick/libJoystick.la \
|
$(top_builddir)/Simulator/Joystick/libJoystick.la \
|
||||||
$(top_builddir)/Lib/Audio/libAudio.la \
|
$(AUDIO_LIBS) \
|
||||||
$(top_builddir)/Lib/Math/libMath.la \
|
$(top_builddir)/Lib/Math/libMath.la \
|
||||||
$(top_builddir)/Lib/Bucket/libBucket.la \
|
$(top_builddir)/Lib/Bucket/libBucket.la \
|
||||||
$(top_builddir)/Lib/Debug/libDebug.la \
|
$(top_builddir)/Lib/Debug/libDebug.la \
|
||||||
$(top_builddir)/Lib/zlib/libz.la
|
$(top_builddir)/Lib/zlib/libz.la
|
||||||
|
|
||||||
|
DEFS += $(AUDIO_DEFS)
|
||||||
|
|
||||||
INCLUDES += \
|
INCLUDES += \
|
||||||
-DGLUT \
|
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
-I$(top_builddir)/Lib \
|
-I$(top_builddir)/Lib \
|
||||||
-I$(top_builddir)/Simulator
|
-I$(top_builddir)/Simulator
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// (Log is kept at end of this file)
|
// (Log is kept at end of this file)
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string>
|
||||||
|
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
#include <Include/fg_zlib.h>
|
#include <Include/fg_zlib.h>
|
||||||
|
@ -104,6 +104,12 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.5 1998/05/29 20:37:22 curt
|
||||||
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
// Tweaked material properties & lighting a bit in GLUTmain.cxx.
|
||||||
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
// Read airport list into a "map" STL for dynamic list sizing and fast tree
|
||||||
|
|
|
@ -34,13 +34,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <map.h> // STL associative "array"
|
#include <map> // STL associative "array"
|
||||||
|
|
||||||
#if defined(WIN32)
|
|
||||||
#include <string> // Standard C++ string library
|
#include <string> // Standard C++ string library
|
||||||
#else
|
|
||||||
# include <std/string.h> // Standard C++ string library
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -75,6 +70,12 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.3 1998/06/01 17:54:42 curt
|
||||||
// Added Linux audio support.
|
// Added Linux audio support.
|
||||||
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <Astro/sky.hxx>
|
#include <Astro/sky.hxx>
|
||||||
#include <Astro/stars.hxx>
|
#include <Astro/stars.hxx>
|
||||||
#include <Astro/sun.hxx>
|
#include <Astro/sun.hxx>
|
||||||
#include <Audio/sl.h>
|
|
||||||
#include <Autopilot/autopilot.h>
|
#include <Autopilot/autopilot.h>
|
||||||
#include <Cockpit/cockpit.hxx>
|
#include <Cockpit/cockpit.hxx>
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
|
@ -387,6 +386,12 @@ int fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.17 1998/06/01 17:54:42 curt
|
||||||
// Added Linux audio support.
|
// Added Linux audio support.
|
||||||
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
// avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
|
||||||
|
|
|
@ -73,7 +73,7 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
||||||
// printf("theta_x = %.2f\n", theta_x);
|
// printf("theta_x = %.2f\n", theta_x);
|
||||||
sin_fov_x = sin(theta_x);
|
sin_fov_x = sin(theta_x);
|
||||||
cos_fov_x = cos(theta_x);
|
cos_fov_x = cos(theta_x);
|
||||||
slope_x = sin_fov_x / cos_fov_x;
|
slope_x = - cos_fov_x / sin_fov_x;
|
||||||
// printf("slope_x = %.2f\n", slope_x);
|
// printf("slope_x = %.2f\n", slope_x);
|
||||||
|
|
||||||
// calculate sin() and cos() of fov / 2 in Y direction;
|
// calculate sin() and cos() of fov / 2 in Y direction;
|
||||||
|
@ -81,7 +81,7 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
|
||||||
// printf("theta_y = %.2f\n", theta_y);
|
// printf("theta_y = %.2f\n", theta_y);
|
||||||
sin_fov_y = sin(theta_y);
|
sin_fov_y = sin(theta_y);
|
||||||
cos_fov_y = cos(theta_y);
|
cos_fov_y = cos(theta_y);
|
||||||
slope_y = sin_fov_y / cos_fov_y;
|
slope_y = cos_fov_y / sin_fov_y;
|
||||||
// printf("slope_y = %.2f\n", slope_y);
|
// printf("slope_y = %.2f\n", slope_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,6 +376,12 @@ fgVIEW::~fgVIEW( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.11 1998/05/27 02:24:05 curt
|
||||||
// View optimizations by Norman Vine.
|
// View optimizations by Norman Vine.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue