[Plib-cvs] plib/src/sl sl.h,1.21,1.22 slDSP.cxx,1.19,1.20
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2003-01-04 02:55:58
|
Update of /cvsroot/plib/plib/src/sl In directory sc8-pr-cvs1:/tmp/cvs-serv3590/plib/src/sl Modified Files: sl.h slDSP.cxx Log Message: Committed numerous patches from 3rd parties: Added JS support for Mac OS-X. Removed JS support for HPUX. Fixes for IRIX sound support. Compile problems fixed in ul.h. Load/Save FLT fixed to include byte-swapping. Several fixes to MDL loader. Fixed 'frozen particle' bug in ssgaParticleSystem. Index: sl.h =================================================================== RCS file: /cvsroot/plib/plib/src/sl/sl.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- sl.h 17 Dec 2002 16:43:19 -0000 1.21 +++ sl.h 4 Jan 2003 02:55:55 -0000 1.22 @@ -37,6 +37,8 @@ #define SLDSP_DEFAULT_DEVICE "dsp" // dummy ... #elif defined(UL_SOLARIS) #define SLDSP_DEFAULT_DEVICE "/dev/audio" +#elif defined(UL_HPUX) +#define SLDSP_DEFAULT_DEVICE "/dev/audio" #elif defined(UL_MACINTOSH) || defined(UL_MAC_OSX) #define SLDSP_DEFAULT_DEVICE "dsp" // dummy #else Index: slDSP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sl/slDSP.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- slDSP.cxx 30 Nov 2002 00:41:49 -0000 1.19 +++ slDSP.cxx 4 Jan 2003 02:55:55 -0000 1.20 @@ -636,13 +636,13 @@ return; } - init_bytes = 1024 * 16; + init_bytes = 1024 * 4 ; config = ALnewconfig(); ALsetchannels ( config, _stereo ? AL_STEREO : AL_MONO ); ALsetwidth ( config, _bps == 8 ? AL_SAMPLE_8 : AL_SAMPLE_16 ); - ALsetqueuesize( config, init_bytes ); + ALsetqueuesize( config, init_bytes * 2 ); port = ALopenport( device, "w", config ); @@ -690,7 +690,7 @@ if ( error ) return 0 ; - return ALgetqueuesize( config ); + return ALgetqueuesize( config ) / 2 ; } void slDSP::getBufferInfo () @@ -700,8 +700,6 @@ } -#define swap_half(a) ( ((a & 0xff) << 8) | ((unsigned short)(a) >> 8) ) - void slDSP::write ( void *buffer, size_t length ) { char *buf = (char *)buffer; @@ -709,15 +707,10 @@ if ( error || (int)length <= 0 ) return ; - // Steve: is this a problem ?? - - for ( int i = 0; i < (int)length; i++ ) { + for ( int i = 0; i < (int)length; i++ ) buf[i] = buf[i] >> 1; - if (bps == 16) - buf[i] = swap_half( buf[i] ); - } - ALwritesamps(port, (void *)buf, length/2 ); + ALwritesamps(port, (void *)buf, length ); } @@ -728,10 +721,7 @@ if ( error ) return 0.0f ; - samples_remain = ALgetfillable(port); - - if ( stereo ) samples_remain /= 2 ; - if ( bps == 16 ) samples_remain /= 2 ; + samples_remain = ALgetfillable(port) / 2 ; return (float) samples_remain / (float) rate ; } @@ -744,10 +734,7 @@ if ( error ) return 0.0f ; - samples_used = ALgetfilled(port); - - if ( stereo ) samples_used /= 2 ; - if ( bps == 16 ) samples_used /= 2 ; + samples_used = ALgetfilled(port) * 2 ; return (float) samples_used / (float) rate ; } |