shithub: rott

Download patch

ref: aeaca7503c31ad10559594ec92f3786778f46894
parent: 61a235463c4e2fe2eaff6395cb7e4eca8011c7db
author: Jacob Moody <moody@posixcafe.org>
date: Sat Feb 11 13:32:51 EST 2023

make this audiolib work instead of hacking in the duke one

--- a/src/audiolib/_multivc.h
+++ b/src/audiolib/_multivc.h
@@ -69,7 +69,10 @@
 #define NumberOfBuffers   16
 #define TotalBufferSize   ( MixBufferSize * NumberOfBuffers )
 
+#ifdef __plan9__
+#undef PI
 #define PI                3.1415926536
+#endif
 
 typedef enum
    {
--- /dev/null
+++ b/src/audiolib/mkfile
@@ -1,0 +1,21 @@
+</$objtype/mkfile
+
+CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL -DSHAREWARE=0
+
+LIB=libaudio.a
+
+OFILES=\
+	fx_man.$O\
+	dsl.$O\
+	ll_man.$O\
+	multivoc.$O\
+	mv_mix.$O\
+	mvreverb.$O\
+	nodpmi.$O\
+	pitch.$O\
+	user.$O\
+	usrhooks.$O\
+
+
+</sys/src/cmd/mksyslib
+
--- a/src/audiolib/multivoc.c
+++ b/src/audiolib/multivoc.c
@@ -556,7 +556,7 @@
 
    Interperate the information of a VOC format sound file.
 ---------------------------------------------------------------------*/
-static __inline unsigned int get_le32(void *p0)
+static unsigned int get_le32(void *p0)
 {
 	//unsigned char *p = p0;
 	//return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
@@ -564,7 +564,7 @@
 	return(BUILDSWAP_INTEL32(val));
 }
 
-static __inline unsigned int get_le16(void *p0)
+static unsigned int get_le16(void *p0)
 {
 	//unsigned char *p = p0;
 	//return p[0] | (p[1]<<8);
@@ -720,7 +720,7 @@
             if ( voice->LoopEnd == NULL )
                {
                voice->LoopCount = get_le16(ptr);
-               voice->LoopStart = ptr + blocklength;
+               voice->LoopStart = (char*)ptr + blocklength;
                }
             ptr += blocklength;
             break;
@@ -736,7 +736,7 @@
                {
                if ( ( voice->LoopCount > 0 ) && ( voice->LoopStart != NULL ) )
                   {
-                  ptr = voice->LoopStart;
+                  ptr = (uchar*)voice->LoopStart;
                   if ( voice->LoopCount < 0xffff )
                      {
                      voice->LoopCount--;
@@ -799,8 +799,8 @@
 
    if ( voice->Playing )
       {
-      voice->NextBlock    = ptr + blocklength;
-      voice->sound        = ptr;
+      voice->NextBlock    = (char*)ptr + blocklength;
+      voice->sound        = (char*)ptr;
 
       voice->SamplingRate = samplespeed;
       voice->RateScale    = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
@@ -2279,7 +2279,7 @@
       return( MV_Error );
       }
 
-   if ( strncmp( data->DATA, "data", 4 ) != 0 )
+   if ( strncmp( (char*)data->DATA, "data", 4 ) != 0 )
       {
       MV_SetErrorCode( MV_InvalidWAVFile );
       return( MV_Error );
--- a/src/mkfile
+++ b/src/mkfile
@@ -1,11 +1,9 @@
 </$objtype/mkfile
 
-CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL
+CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL -DSHAREWARE=0
 TARG=games/rott
 
-LIB=\
-	../../duke3d/Game/src/audiolib/libaudio.a\
-
+LIB=audiolib/libaudio.a
 
 OFILES=\
 	HashTable.$O \