1
0
Fork 0

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:
curt 1998-06-03 00:47:11 +00:00
parent a8d69d9d3c
commit 476d5e73b2
6 changed files with 77 additions and 36 deletions

View file

@ -50,7 +50,12 @@
#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.

View 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

View 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

View file

@ -34,13 +34,8 @@
#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.

View 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.

View file

@ -73,7 +73,7 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
// 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;
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;
@ -81,7 +81,7 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
// 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;
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.
//