From adefd71cb8a3e70da10523e4eb97e442a655a6cd Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 15 Sep 2017 12:38:59 -0500 Subject: [PATCH] no idea how to get sdtest to play music. i got math homework and work work to do 1st --- src/lib/16_sd.c | 6 ++--- src/lib/16_sd.h | 3 ++- src/lib/16_t.h | 2 ++ src/lib/16_tail.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ src/lib/16_tail.h | 3 +++ src/lib/16_tdef.h | 2 +- src/paltest.c | 2 +- src/sdtest.c | 19 ++++++++++++-- 8 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index f0902838..e77fb92a 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -70,8 +70,6 @@ #define writereg(n) outportb(alFMData,n) #define readstat() inportb(alFMStatus) -//#define SD_USECATA3DSETTIMERSPEED - // Imports from ID_SD_A.ASM /*extern*/ void SDL_SetDS(void); /*extern*/ void interrupt SDL_t0ExtremeAsmService(void);//, @@ -461,7 +459,7 @@ SDL_InitDelay(void) int i; word timer; - setvect(8,SDL_TimingService); // Set to my timer 0 ISR +//++++ setvect(8,SDL_TimingService); // Set to my timer 0 ISR SDL_SetIntsPerSec(1000); // Time 1ms @@ -1709,7 +1707,7 @@ SD_Startup(global_game_variables_t *gvar) t0OldService = getvect(8); // Get old timer 0 ISR #ifdef SD_USECATA3DSETTIMERSPEED -//++++ SDL_InitDelay(); // SDL_InitDelay() uses t0OldService + SDL_InitDelay(); // SDL_InitDelay() uses t0OldService setvect(8,SDL_t0Service); // Set to my timer 0 ISR #endif diff --git a/src/lib/16_sd.h b/src/lib/16_sd.h index 12558e66..53beec8c 100755 --- a/src/lib/16_sd.h +++ b/src/lib/16_sd.h @@ -34,6 +34,8 @@ #include "src/lib/16_head.h" #include "src/lib/16_pm.h" +//#define SD_USECATA3DSETTIMERSPEED + void alOut(byte n,byte b); #ifdef __DEBUG__ @@ -260,4 +262,3 @@ extern void SDL_PCPlaySound(PCSound far *sound, global_game_variables_t *gvar), #endif #endif - diff --git a/src/lib/16_t.h b/src/lib/16_t.h index de709bdf..a935d8cd 100755 --- a/src/lib/16_t.h +++ b/src/lib/16_t.h @@ -133,4 +133,6 @@ inline void gotoxy(int x,int y) } #endif +#define PFDT printf("."); + #endif/*_TYPE_H_*/ diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index 11c5765e..4d6040cb 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -409,6 +409,69 @@ noxor: //=========================================================================== +/* +============================================================================= + + MUSIC STUFF + +============================================================================= +*/ + + +/* +================= += += StopMusic += +================= +*/ + +void TL_StopMusic(global_game_variables_t *gvar) +{ + int i; + + SD_MusicOff(); + for (i = 0;i < LASTMUSIC;i++) + if (gvar->ca.audiosegs[STARTMUSIC + i]) + { + MM_SetPurge(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],3, gvar); + MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],false, gvar); + } +} + +//========================================================================== + + +/* +================= += += StartMusic += +================= +*/ + +void TL_StartMusic(global_game_variables_t *gvar) +{ + musicnames chunk; + + SD_MusicOff(); + chunk = 0;//++++songs[gamestate.mapon+gamestate.episode*10]; + +// if ((chunk == -1) || (MusicMode != smm_AdLib)) +//DEBUG control panel return; + +//++++ MM_BombOnError (false,gvar); +//++++ CA_CacheAudioChunk(STARTMUSIC + chunk, gvar); +//++++ MM_BombOnError (true,gvar); +//++++ if (gvar->mm.mmerror) +//++++ gvar->mm.mmerror = false; +//++++ else +//++++ { + MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + chunk],true, gvar); + SD_StartMusic((MusicGroup far *)gvar->ca.audiosegs[STARTMUSIC + chunk]); +//++++ } +} + /* ================== = diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 4f8ed486..1a8e48a4 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -29,6 +29,7 @@ #include "src/lib/16_mm.h" #include "src/lib/16_ca.h" #include "src/lib/16_in.h" +#include "src/lib/16_sd.h" #include "src/lib/16_dbg.h" #include "src/lib/16_vl.h" #include "src/lib/testpatt.h" @@ -134,6 +135,8 @@ void Shutdown16(global_game_variables_t *gvar), void TL_DosLibStartup(global_game_variables_t *gvar); void TL_VidInit(global_game_variables_t *gvar); boolean FizzleFade (unsigned source, unsigned dest, unsigned width, unsigned height, unsigned frames, boolean abortable, global_game_variables_t *gvar); +void TL_StartMusic(global_game_variables_t *gvar); +void TL_StopMusic(global_game_variables_t *gvar); void DebugMemory_(global_game_variables_t *gvar, boolean q); void ClearMemory (global_game_variables_t *gvar); void Quit (global_game_variables_t *gvar, char *error); diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 90222526..f6b3e68c 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -678,7 +678,7 @@ typedef enum { #define STARTPCSOUNDS 0 #define STARTADLIBSOUNDS 87 #define STARTDIGISOUNDS 174 -#define STARTMUSIC 261 +#define STARTMUSIC 0//++++261 // // Music names & indexes diff --git a/src/paltest.c b/src/paltest.c index dff2f9a0..21f6a811 100755 --- a/src/paltest.c +++ b/src/paltest.c @@ -47,7 +47,7 @@ void copyboxesmodex(page_t *page, boolean pn) void main(int argc, char *argv[]) { static word paloffset=0; - static global_game_variables_t gvar; + global_game_variables_t gvar; // map_view_t mv[4]; map_t map; diff --git a/src/sdtest.c b/src/sdtest.c index 8511cac9..4e11d113 100755 --- a/src/sdtest.c +++ b/src/sdtest.c @@ -21,12 +21,27 @@ */ #include "src/lib/16_sd.h" +#include "src/lib/16_tail.h" -void main() +void main(int argc,char **argv) { - /*static */global_game_variables_t gvar; + ScanCode scancode; + static global_game_variables_t gvar; + StartupCAMMPM(&gvar); + if(!CA_LoadFile(argv[1], MEMPTRCONV gvar.ca.audiosegs[0], &gvar)) + { + printf("Failed to load IMF Music\n"); + ShutdownCAMMPM(&gvar); + return; + } + IN_Startup(&gvar); printf("start\n"); SD_Startup(&gvar); + TL_StartMusic (&gvar); + while (!(scancode = gvar.in.inst->LastScan)){} printf("shutdown\n"); + TL_StopMusic(&gvar); SD_Shutdown(&gvar); + IN_Shutdown(&gvar); + ShutdownCAMMPM(&gvar); } -- 2.39.2