shithub: duke3d

Download patch

ref: fb65145deb14daa6c0226b693d74fd274ebf166b
parent: 61afb65d1e3cf0733b9fc1e1d185c269cc07ebc9
author: Jacob Moody <moody@posixcafe.org>
date: Sun Feb 5 22:44:24 EST 2023

build subdirs

--- a/Game/src/audiolib/_multivc.h
+++ b/Game/src/audiolib/_multivc.h
@@ -71,6 +71,9 @@
 #define NumberOfBuffers   16
 #define TotalBufferSize   ( MixBufferSize * NumberOfBuffers )
 
+#ifdef __plan9__
+#undef PI
+#endif
 #define PI                3.1415926536
 
 typedef enum
--- /dev/null
+++ b/Game/src/audiolib/mkfile
@@ -1,0 +1,31 @@
+</$objtype/mkfile
+
+CFLAGS=-Fpw -I ../../../Engine/src -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__
+LIB=libaudio.a
+
+OFILES=\
+	dpmi.$O \
+	dsl.$O \
+	fx_man.$O \
+	ll_man.$O \
+	multivoc.$O \
+	mv_mix.$O \
+	mvreverb.$O \
+	pitch.$O \
+	usrhooks.$O \
+
+HFILES=\
+	_multivc.h \
+	dpmi.h \
+	dsl.h \
+	fx_man.h \
+	ll_man.h \
+	linklist.h \
+	multivoc.h \
+	sndcards.h \
+	music.h \
+	pitch.h \
+	usrhooks.h \
+	util.h \
+
+</sys/src/cmd/mksyslib
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -447,11 +447,11 @@
 		count = MV_BufferSize / MV_SampleSize * MV_Channels;
 		if ( MV_Bits == 16 )
 		{
-			MV_16BitDownmix(dest, count);
+			MV_16BitDownmix((uchar*)dest, count);
 		}
 		else
 		{
-			MV_8BitDownmix(dest, count);
+			MV_8BitDownmix((uchar*)dest, count);
 		}
 			
 	}
@@ -706,7 +706,7 @@
             }
          else
             {
-            voice->LoopEnd = ( char * )blocklength;
+            voice->LoopEnd = ( uchar * )blocklength;
             }
 
          voice->LoopStart = voice->sound + ( unsigned long )voice->LoopStart;
@@ -1706,9 +1706,9 @@
 
    riff = ( riff_header * )ptr;
 
-   if ( ( strncmp( riff->RIFF, "RIFF", 4 ) != 0 ) ||
-      ( strncmp( riff->WAVE, "WAVE", 4 ) != 0 ) ||
-      ( strncmp( riff->fmt, "fmt ", 4) != 0 ) )
+   if ( ( strncmp( (char*)riff->RIFF, "RIFF", 4 ) != 0 ) ||
+      ( strncmp( (char*)riff->WAVE, "WAVE", 4 ) != 0 ) ||
+      ( strncmp( (char*)riff->fmt, "fmt ", 4) != 0 ) )
       {
       MV_SetErrorCode( MV_InvalidWAVFile );
       return( MV_Error );
@@ -1737,7 +1737,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 );
@@ -1776,7 +1776,7 @@
    voice->position    = 0;
    voice->length      = 0;
    voice->BlockLength = absloopend;
-   voice->NextBlock   = ( char * )( data + 1 );
+   voice->NextBlock   = ( uchar * )( data + 1 );
    voice->next        = NULL;
    voice->prev        = NULL;
    voice->priority    = priority;
@@ -2304,7 +2304,7 @@
 	   return( MV_Error);
    }
 
-   MV_FooBuffer = ptr;
+   MV_FooBuffer = (double*)ptr;
 
 // Start the playback engine
    status = MV_StartPlayback();
--- a/Game/src/audiolib/multivoc.h
+++ b/Game/src/audiolib/multivoc.h
@@ -34,6 +34,8 @@
 //#include <windows.h>
 #include <SDL2/SDL.h>
 
+#include <inttypes.h>
+
 // forward declare
 //struct SDL_mutex;
 
--- /dev/null
+++ b/Game/src/midi/mkfile
@@ -1,0 +1,9 @@
+</$objtype/mkfile
+
+CFLAGS=-Fpw -I ../../../Engine/src -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__
+LIB=libmidi.a
+
+OFILES=\
+	sdl_midi.$O
+
+</sys/src/cmd/mksyslib
--- a/Game/src/midi/sdl_midi.c
+++ b/Game/src/midi/sdl_midi.c
@@ -8,6 +8,7 @@
 
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_mixer.h>
+#include <SDL2/SDL_rwops.h>
 #include <stdio.h>
 
 #include "../audiolib/music.h"
--- a/Game/src/mkfile
+++ b/Game/src/mkfile
@@ -5,8 +5,13 @@
 
 LIB=\
 	../../Engine/src/libbuild.a \
+	audiolib/libaudio.a \
+	midi/libmidi.a \
 
+CLEANFILES=\
+	$LIB \
 
+
 OFILES=\
 	actors.$O \
 	animlib.$O \
@@ -56,3 +61,12 @@
 	util_lib.h \
 
 </sys/src/cmd/mkone
+
+../../Engine/src/libbuild.a:
+	@{cd ../../Engine/src/ && mk }
+
+audiolib/libaudio.a:
+	@{cd audiolib && mk }
+
+midi/libmidi.a:
+	@{cd midi && mk }
--- a/Game/src/sounddebugdefs.h
+++ b/Game/src/sounddebugdefs.h
@@ -5,4 +5,4 @@
 extern uint32_t sounddebugAllocateSoundCalls;
 extern uint32_t sounddebugDeallocateSoundCalls;
 
-#endif
\ No newline at end of file
+#endif