shithub: rott

Download patch

ref: 3e27f1b2d0d8f020e9d3509934736ee9055b8c31
parent: a3828d459c7f9fd188e2a2bfb7663622d3ae1755
author: Jacob Moody <moody@posixcafe.org>
date: Sun Feb 12 02:42:24 EST 2023

use native audio and various audio issues

--- a/src/audiolib/mkfile
+++ b/src/audiolib/mkfile
@@ -3,6 +3,7 @@
 CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL -DSHAREWARE=0
 
 LIB=libaudio.a
+CLEANFILES=libaudio.a
 
 OFILES=\
 	fx_man.$O\
--- a/src/dukemusc.c
+++ b/src/dukemusc.c
@@ -398,10 +398,10 @@
     music_songdata = song;
 
     // finally, we can load it with SDL_mixer
-   // music_musicchunk = Mix_LoadMUS(filename);
-    //if (music_musicchunk == NULL) {
+   music_musicchunk = Mix_LoadMUS(filename);
+   if (music_musicchunk == NULL) {
         return MUSIC_Error;
-    //}
+    }
 
     Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
 
--- a/src/mkfile
+++ b/src/mkfile
@@ -1,8 +1,11 @@
 </$objtype/mkfile
 
 CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL -DSHAREWARE=0
-TARG=games/rott
+BIN=/$objtype/bin/games
+TARG=rott
 
+DIRS=audiolib
+
 LIB=audiolib/libaudio.a
 
 OFILES=\
@@ -159,3 +162,11 @@
 
 </sys/src/cmd/mkone
 
+audiolib/libaudio.a:
+	@{ cd audiolib && mk }
+
+clean:V:
+	rm -f *.[$OS] [$OS].out y.tab.? lex.yy.c y.debug y.output $TARG $CLEANFILES
+	for(i in $DIRS)@{
+		cd $i && mk clean
+	}
--- a/src/rt_cfg.c
+++ b/src/rt_cfg.c
@@ -102,8 +102,8 @@
 int     mouseadjustment  = 5;
 int     threshold        = 1;
 int     NumVoices        = 4;
-int     NumChannels      = 1;
-int     NumBits          = 8;
+int     NumChannels      = 2;
+int     NumBits          = 16;
 boolean AutoDetailOn     = true;
 int     DoubleClickSpeed = 20;
 boolean BobbinOn         = true;
--- a/src/rt_main.c
+++ b/src/rt_main.c
@@ -164,6 +164,8 @@
     _argc = argc;
     _argv = argv;
 
+    Mix_Init(1);
+
 #if defined(PLATFORM_MACOSX)
     {
         /* OS X will give us a path in the form '/Applications/Rise of the Triad.app/Contents/MacOS/Rise of the Triad'.
@@ -1632,7 +1634,7 @@
         while (GetTicCount()==time) {}
     }
     
-    
+    Mix_HaltMusic();
     PrintMapStats();
     PrintTileStats();
     SetTextMode();
--- a/src/rt_sound.c
+++ b/src/rt_sound.c
@@ -220,7 +220,7 @@
         bits     = 8;
     }
 
-    status=FX_Init( card, voices, channels, bits, 11025 );
+    status=FX_Init( card, voices, channels, bits, 44100 );
     
     if (status != FX_Ok)
     {