// (Use SM_SetSoundMode() to set)\r
// MusicMode - What device is used for music\r
// (Use SM_SetMusicMode() to set)\r
+// DigiMode - What device is used for digitized sound effects\r
+// (Use SM_SetDigiDevice() to set)\r
+//\r
// For Cache Mgr:\r
// NeedsDigitized - load digitized sounds?\r
// NeedsMusic - load music?\r
\r
#include <dos.h>\r
\r
-//#ifdef _MUSE_ // Will be defined in ID_Types.h\r
+#ifndef _MUSE_ // Will be defined in ID_Types.h\r
#include "src/lib/id_sd.h"\r
-//#else\r
-//#include "ID_HEADS.H"\r
-//#endif\r
+#else\r
+#include "src/lib/16_head.h"\r
+#endif\r
#pragma hdrstop\r
#pragma warn -pia\r
\r
// Internal variables\r
static boolean SD_Started;\r
boolean nextsoundpos;\r
+ word/*boolean_+*/ TimerDone;\r
+ word TimerVal,TimerDelay10,TimerDelay25,TimerDelay100;\r
dword TimerDivisor,TimerCount;\r
static char *ParmStrings[] =\r
{\r
static memptr DigiNextAddr;\r
static word DigiNextLen;\r
\r
+#if 0\r
// SoundBlaster variables\r
static boolean sbNoCheck,sbNoProCheck;\r
static volatile boolean sbSamplePlaying;\r
byte ssOn,ssOff;\r
volatile byte far *ssSample;\r
volatile dword ssLengthLeft;\r
+#endif\r
\r
// PC Sound variables\r
volatile byte pcLastSample,far *pcSound;\r
// Sequencer variables\r
boolean sqActive;\r
static word alFXReg;\r
-static ActiveTrack *tracks[sqMaxTracks],\r
- mytracks[sqMaxTracks];\r
+static ActiveTrack *tracks[sqMaxTracks];//,\r
+//-- mytracks[sqMaxTracks];\r
static word sqMode,sqFadeStep;\r
word far *sqHack,far *sqHackPtr,sqHackLen,sqHackSeqLen;\r
long sqHackTime;\r
}\r
}\r
\r
-\r
-\r
-// Sound Source Code\r
-\r
///////////////////////////////////////////////////////////////////////////\r
//\r
-// SDL_SSStopSample() - Stops a sample playing on the Sound Source\r
+// SDL_TimingService() - Used by SDL_InitDelay() to determine a timing\r
+// value for the current system that we're running on\r
//\r
///////////////////////////////////////////////////////////////////////////\r
-#ifdef _MUSE_\r
-void\r
-#else\r
-static void\r
-#endif\r
-SDL_SSStopSample(void)\r
+//static void interrupt\r
+void interrupt\r
+SDL_TimingService(void)\r
{\r
-asm pushf\r
-asm cli\r
-\r
- /*(long)*/ssSample = 0;\r
+ //TimerVal = _CX;\r
+ __asm {\r
+ mov TimerVal,cx\r
+ }\r
+ TimerDone = 1;\r
\r
-asm popf\r
+ outportb(0x20,0x20); // Ack interrupt\r
}\r
\r
///////////////////////////////////////////////////////////////////////////\r
//\r
-// SDL_SSService() - Handles playing the next sample on the Sound Source\r
+// SDL_InitDelay() - Sets up TimerDelay's for SDL_Delay()\r
//\r
///////////////////////////////////////////////////////////////////////////\r
static void\r
-SDL_SSService(void)\r
+SDL_InitDelay(void)\r
{\r
- //boolean gotit;\r
- boolean doneflag=false;\r
- byte v;\r
+ int i;\r
+ word timer;\r
\r
- while (ssSample)\r
+ setvect(8,SDL_TimingService); // Set to my timer 0 ISR\r
+\r
+ SDL_SetIntsPerSec(1000); // Time 1ms\r
+\r
+ for (i = 0,timer = 0;i < 10;i++) // Do timing test 10 times\r
{\r
- __asm {\r
- mov dx,[ssStatus] // Check to see if FIFO is currently empty\r
- in al,dx\r
- test al,0x40\r
- jnz done // Nope - don't push any more data out\r
- jmp end\r
+ __asm {\r
+ xor dx,dx // Zero DX\r
+ mov cx,0xffff // Put starting value in CX\r
+ mov [TimerDone],cx // TimerDone = false - 1\r
#ifdef __BORLANDC__\r
- }\r
+ }\r
#endif\r
- done:\r
+startloop:\r
#ifdef __BORLANDC__\r
- __asm {\r
+ __asm {\r
#endif\r
- mov doneflag,1\r
+ or [TimerDone],0\r
+ jnz startloop // Make sure we're at the start\r
#ifdef __BORLANDC__\r
- }\r
+ }\r
#endif\r
- end:\r
-#ifdef __WATCOMC__\r
- }\r
+loop_:\r
+#ifdef __BORLANDC__\r
+ __asm {\r
#endif\r
- if(!doneflag)\r
- {\r
- v = *ssSample++;\r
- if (!(--ssLengthLeft))\r
- {\r
- /*(long)*/ssSample = 0;\r
- SDL_DigitizedDone();\r
- }\r
-\r
- __asm {\r
- mov dx,[ssData] // Pump the value out\r
- mov al,[v]\r
- out dx,al\r
-\r
- mov dx,[ssControl] // Pulse printer select\r
- mov al,[ssOff]\r
- out dx,al\r
- push ax\r
- pop ax\r
- mov al,[ssOn]\r
- out dx,al\r
-\r
- push ax // Delay a short while\r
- pop ax\r
- push ax\r
- pop ax\r
-done:;\r
- }\r
+ test [TimerDone],1 // See if TimerDone flag got hit\r
+ jnz done // Yep - drop out of the loop\r
+ loop loop_\r
+#ifdef __BORLANDC__\r
}\r
+#endif\r
+done:\r
+#ifdef __WATCOMC__\r
}\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-// SDL_SSPlaySample() - Plays the specified sample on the Sound Source\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-#ifdef _MUSE_\r
-void\r
-#else\r
-static void\r
#endif\r
-SDL_SSPlaySample(byte huge *data,dword len)\r
-{\r
-asm pushf\r
-asm cli\r
-\r
- ssLengthLeft = len;\r
- ssSample = (volatile byte far *)data;\r
\r
-asm popf\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-// SDL_StartSS() - Sets up for and turns on the Sound Source\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-SDL_StartSS(void)\r
-{\r
- if (ssPort == 3)\r
- ssControl = 0x27a; // If using LPT3\r
- else if (ssPort == 2)\r
- ssControl = 0x37a; // If using LPT2\r
- else\r
- ssControl = 0x3be; // If using LPT1\r
- ssStatus = ssControl - 1;\r
- ssData = ssStatus - 1;\r
+ if (0xffff - TimerVal > timer)\r
+ timer = 0xffff - TimerVal;\r
+ }\r
+ timer += timer / 2; // Use some slop\r
+ TimerDelay10 = timer / (1000 / 10);\r
+ TimerDelay25 = timer / (1000 / 25);\r
+ TimerDelay100 = timer / (1000 / 100);\r
\r
- ssOn = 0x04;\r
- if (ssIsTandy)\r
- ssOff = 0x0e; // Tandy wierdness\r
- else\r
- ssOff = 0x0c; // For normal machines\r
+ SDL_SetTimer0(0); // Reset timer 0\r
\r
- outportb(ssControl,ssOn); // Enable SS\r
+ setvect(8,t0OldService); // Set back to old ISR\r
}\r
\r
///////////////////////////////////////////////////////////////////////////\r
//\r
-// SDL_ShutSS() - Turns off the Sound Source\r
+// SDL_Delay() - Delays the specified amount of time\r
//\r
///////////////////////////////////////////////////////////////////////////\r
static void\r
-SDL_ShutSS(void)\r
+SDL_Delay(word delay)\r
{\r
- outportb(ssControl,ssOff);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-// SDL_CheckSS() - Checks to see if a Sound Source is present at the\r
-// location specified by the sound source variables\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static boolean\r
-SDL_CheckSS(void)\r
-{\r
- boolean present = false, chkdone=0;\r
- dword lasttime;\r
-\r
- // Turn the Sound Source on and wait awhile (4 ticks)\r
- SDL_StartSS();\r
-\r
- lasttime = TimeCount;\r
- while (TimeCount < lasttime + 4)\r
- {}\r
-\r
- __asm {\r
- mov dx,[ssStatus] // Check to see if FIFO is currently empty\r
- in al,dx\r
- test al,0x40\r
- jnz checkdone // Nope - Sound Source not here\r
+ if (!delay)\r
+ return;\r
\r
- mov cx,32 // Force FIFO overflow (FIFO is 16 bytes)\r
-#ifdef __BORLANDC__\r
- }\r
-#endif\r
-outloop:\r
-#ifdef __BORLANDC__\r
__asm {\r
-#endif\r
- mov dx,[ssData] // Pump a neutral value out\r
- mov al,0x80\r
- out dx,al\r
-\r
- mov dx,[ssControl] // Pulse printer select\r
- mov al,[ssOff]\r
- out dx,al\r
- push ax\r
- pop ax\r
- mov al,[ssOn]\r
- out dx,al\r
-\r
- push ax // Delay a short while before we do this again\r
- pop ax\r
- push ax\r
- pop ax\r
-\r
- loop outloop\r
-\r
- mov dx,[ssStatus] // Is FIFO overflowed now?\r
- in al,dx\r
- test al,0x40\r
- jz checkdone // Nope, still not - Sound Source not here\r
- jmp end\r
+ mov cx,[delay]\r
#ifdef __BORLANDC__\r
}\r
#endif\r
-checkdone:\r
+loop_:\r
#ifdef __BORLANDC__\r
__asm {\r
#endif\r
- mov chkdone,1\r
+ test [TimerDone],0 // Useless code - just for timing equivilency\r
+ jnz done\r
+ loop loop_\r
#ifdef __BORLANDC__\r
}\r
#endif\r
- end:\r
+done:\r
#ifdef __WATCOMC__\r
}\r
#endif\r
-\r
- if(!chkdone) present = true; // Yes - it's here!\r
-\r
-//checkdone:\r
- SDL_ShutSS();\r
- return(present);\r
-}\r
-\r
-static boolean\r
-SDL_DetectSoundSource(void)\r
-{\r
- for (ssPort = 1;ssPort <= 3;ssPort++)\r
- if (SDL_CheckSS())\r
- return(true);\r
- return(false);\r
}\r
\r
//\r
case sds_PC:\r
SDL_PCPlaySample(addr,len);\r
break;\r
- case sds_SoundSource:\r
- SDL_SSPlaySample(addr,len);\r
- break;\r
- case sds_SoundBlaster:\r
- SDL_SBPlaySample(addr,len);\r
- break;\r
+//SS case sds_SoundSource:\r
+//SS SDL_SSPlaySample(addr,len);\r
+//SS break;\r
+//SB case sds_SoundBlaster:\r
+//SB SDL_SBPlaySample(addr,len);\r
+//SB break;\r
}\r
}\r
\r
case sds_PC:\r
SDL_PCStopSample();\r
break;\r
- case sds_SoundSource:\r
- SDL_SSStopSample();\r
- break;\r
- case sds_SoundBlaster:\r
- SDL_SBStopSample();\r
- break;\r
+//SS case sds_SoundSource:\r
+//SS SDL_SSStopSample();\r
+//SS break;\r
+//SB case sds_SoundBlaster:\r
+//SB SDL_SBStopSample();\r
+//SB break;\r
}\r
\r
asm popf\r
}\r
\r
void\r
-SD_Poll(void)\r
+SD_Poll(global_game_variables_t *gvar)\r
{\r
if (DigiLeft && !DigiNextAddr)\r
{\r
DigiLeft -= DigiNextLen;\r
if (!DigiLeft)\r
DigiLastSegment = true;\r
- DigiNextAddr = SDL_LoadDigiSegment(DigiPage++);\r
+ DigiNextAddr = SDL_LoadDigiSegment(DigiPage++, gvar);\r
}\r
if (DigiMissed && DigiNextAddr)\r
{\r
\r
switch (DigiMode)\r
{\r
- case sds_SoundBlaster:\r
- SDL_PositionSBP(leftpos,rightpos);\r
- break;\r
+//SB case sds_SoundBlaster:\r
+//SB SDL_PositionSBP(leftpos,rightpos);\r
+//SB break;\r
}\r
}\r
\r
if (!DigiMode)\r
return;\r
\r
- SD_StopDigitized();\r
+ SD_StopDigitized(gvar);\r
if (which >= NumDigi)\r
Quit(gvar, "SD_PlayDigitized: bad sound number");\r
\r
- SD_SetPosition(leftpos,rightpos);\r
+ SD_SetPosition(leftpos,rightpos, gvar);\r
\r
DigiPage = DigiList[(which * 2) + 0];\r
DigiLeft = DigiList[(which * 2) + 1];\r
DigiLastEnd = DigiPage + ((DigiLeft + (PMPageSize - 1)) / PMPageSize);\r
\r
len = (DigiLeft >= PMPageSize)? PMPageSize : (DigiLeft % PMPageSize);\r
- addr = SDL_LoadDigiSegment(DigiPage++);\r
+ addr = SDL_LoadDigiSegment(DigiPage++, gvar);\r
\r
DigiPlaying = true;\r
DigiLastSegment = false;\r
if (!DigiLeft)\r
DigiLastSegment = true;\r
\r
- SD_Poll();\r
+ SD_Poll(gvar);\r
}\r
\r
void\r
}\r
\r
void\r
-SD_SetDigiDevice(SDSMode mode)\r
+SD_SetDigiDevice(SDSMode mode, global_game_variables_t *gvar)\r
{\r
boolean devicenotpresent;\r
\r
if (mode == DigiMode)\r
return;\r
\r
- SD_StopDigitized();\r
+ SD_StopDigitized(gvar);\r
\r
devicenotpresent = false;\r
switch (mode)\r
\r
if (!devicenotpresent)\r
{\r
- if (DigiMode == sds_SoundSource)\r
- SDL_ShutSS();\r
+//SS if (DigiMode == sds_SoundSource)\r
+//SS SDL_ShutSS();\r
\r
DigiMode = mode;\r
\r
- if (mode == sds_SoundSource)\r
- SDL_StartSS();\r
+//SS if (mode == sds_SoundSource)\r
+//SS SDL_StartSS();\r
\r
SDL_SetTimerSpeed();\r
}\r
PM_UnlockMainMem(gvar);\r
MM_GetPtr(&list,PMPageSize, gvar);\r
PM_CheckMainMem(gvar);\r
- p = (word far *)MK_FP(PM_GetPage(gvar->pm.fi.ChunksInFile - 1),0,gvar);\r
+ p = (word far *)MK_FP(PM_GetPage(gvar->pm.fi.ChunksInFile - 1, gvar),0);\r
_fmemcpy((void far *)list,(void far *)p,PMPageSize);\r
pg = gvar->pm.fi.PMSoundStart;\r
for (i = 0;i < PMPageSize / (sizeof(word) * 2);i++,p += 2)\r
{\r
- if (pg >= ChunksInFile - 1)\r
+ if (pg >= gvar->pm.fi.ChunksInFile - 1)\r
break;\r
pg += (p[1] + (PMPageSize - 1)) / PMPageSize;\r
}\r
- PM_UnlockMainMem();\r
- MM_GetPtr((memptr *)&DigiList,i * sizeof(word) * 2);\r
+ PM_UnlockMainMem(gvar);\r
+ MM_GetPtr(MEMPTRCONV DigiList,i * sizeof(word) * 2, gvar);\r
_fmemcpy((void far *)DigiList,(void far *)list,i * sizeof(word) * 2);\r
- MM_FreePtr(&list);\r
+ MM_FreePtr(&list, gvar);\r
NumDigi = i;\r
\r
for (i = 0;i < LASTSOUND;i++)\r
asm pushf\r
asm cli\r
\r
-asm mov dx,0x388\r
-asm mov al,[n]\r
-asm out dx,al\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm inc dx\r
-asm mov al,[b]\r
-asm out dx,al\r
-\r
-asm popf\r
-\r
-asm dec dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
+asm mov dx,0x388\r
+asm mov al,[n]\r
+asm out dx,al\r
+#if 0\r
+ SDL_Delay(TimerDelay10);\r
+#else\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+#endif\r
\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
+asm mov dx,0x389\r
+asm mov al,[b]\r
+asm out dx,al\r
\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
+asm popf\r
\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
-asm in al,dx\r
+#if 0\r
+ SDL_Delay(TimerDelay25);\r
+#else\r
+asm mov dx,0x388\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+asm in al, dx\r
+#endif\r
}\r
\r
-#if 0\r
+//#if 0\r
///////////////////////////////////////////////////////////////////////////\r
//\r
// SDL_SetInstrument() - Puts an instrument into a generator\r
\r
alOut(which + alFeedCon,inst->nConn); // DEBUG - I think this is right\r
}\r
-#endif\r
+//#endif\r
\r
///////////////////////////////////////////////////////////////////////////\r
//\r
#endif\r
SDL_ALPlaySound(AdLibSound far *sound, global_game_variables_t *gvar)\r
{\r
- Instrument far *inst;\r
+ Instrument __far *inst;\r
byte huge *data;\r
\r
SDL_ALStopSound();\r
asm popf\r
}\r
\r
-#if 0\r
+//#if 0\r
///////////////////////////////////////////////////////////////////////////\r
//\r
// SDL_ALSoundService() - Plays the next sample out through the AdLib card\r
\r
if (!(--alLengthLeft))\r
{\r
- (long)alSound = 0;\r
+ /*(long)*/alSound = 0;\r
alOut(alFreqH + 0,0);\r
SDL_SoundFinished();\r
}\r
}\r
}\r
-#endif\r
+//#endif\r
\r
#if 0\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+// SDL_SelectMeasure() - sets up sequencing variables for a given track\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SDL_SelectMeasure(ActiveTrack *track)\r
+{\r
+ track->seq = track->moods[track->mood];\r
+ track->nextevent = 0;\r
+}\r
+#endif\r
+\r
+//#if 0\r
void\r
SDL_ALService(void)\r
{\r
byte a,v;\r
word w;\r
\r
+ a=v=0;\r
+\r
if (!sqActive)\r
return;\r
\r
alTimeCount = sqHackTime = 0;\r
}\r
}\r
-#endif\r
+//#endif\r
\r
///////////////////////////////////////////////////////////////////////////\r
//\r
//\r
///////////////////////////////////////////////////////////////////////////\r
boolean\r
-SD_SetSoundMode(SDMode mode)\r
+SD_SetSoundMode(SDMode mode, global_game_variables_t *gvar)\r
{\r
boolean result = false;\r
word tableoffset;\r
\r
- SD_StopSound();\r
+ SD_StopSound(gvar);\r
\r
#ifndef _MUSE_\r
if ((mode == sdm_AdLib) && !AdLibPresent)\r
SDL_ShutDevice();\r
SoundMode = mode;\r
#ifndef _MUSE_\r
- SoundTable = (word *)(&audiosegs[tableoffset]);\r
+ SoundTable = (word *)(&gvar->ca.audiosegs[tableoffset]);\r
#endif\r
SDL_StartDevice();\r
}\r
SDL_SetDS();\r
\r
ssIsTandy = false;\r
- ssNoCheck = false;\r
+//SS ssNoCheck = false;\r
alNoCheck = false;\r
- sbNoCheck = false;\r
- sbNoProCheck = false;\r
+//SB sbNoCheck = false;\r
+//SB sbNoProCheck = false;\r
#ifndef _MUSE_\r
for (i = 1;i < _argc;i++)\r
{\r
case 0: // No AdLib detection\r
alNoCheck = true;\r
break;\r
- case 1: // No SoundBlaster detection\r
- sbNoCheck = true;\r
- break;\r
- case 2: // No SoundBlaster Pro detection\r
- sbNoProCheck = true;\r
- break;\r
- case 3:\r
- ssNoCheck = true; // No Sound Source detection\r
- break;\r
+//SB case 1: // No SoundBlaster detection\r
+//SB sbNoCheck = true;\r
+//SB break;\r
+//SB case 2: // No SoundBlaster Pro detection\r
+//SB sbNoProCheck = true;\r
+//SB break;\r
+//SS case 3:\r
+//SS ssNoCheck = true; // No Sound Source detection\r
+//SS break;\r
case 4: // Tandy Sound Source handling\r
ssIsTandy = true;\r
break;\r
- case 5: // Sound Source present at LPT1\r
- ssPort = 1;\r
- ssNoCheck = SoundSourcePresent = true;\r
- break;\r
- case 6: // Sound Source present at LPT2\r
- ssPort = 2;\r
- ssNoCheck = SoundSourcePresent = true;\r
- break;\r
- case 7: // Sound Source present at LPT3\r
- ssPort = 3;\r
- ssNoCheck = SoundSourcePresent = true;\r
- break;\r
+//SS case 5: // Sound Source present at LPT1\r
+//SS ssPort = 1;\r
+//SS ssNoCheck = SoundSourcePresent = true;\r
+//SS break;\r
+//SS case 6: // Sound Source present at LPT2\r
+//SS ssPort = 2;\r
+//SS ssNoCheck = SoundSourcePresent = true;\r
+//SS break;\r
+//SS case 7: // Sound Source present at LPT3\r
+//SS ssPort = 3;\r
+//SS ssNoCheck = SoundSourcePresent = true;\r
+//SS break;\r
}\r
}\r
#endif\r
\r
LocalTime = TimeCount = alTimeCount = 0;\r
\r
- SD_SetSoundMode(sdm_Off);\r
+ SD_SetSoundMode(sdm_Off, gvar);\r
SD_SetMusicMode(smm_Off);\r
\r
- if (!ssNoCheck)\r
- SoundSourcePresent = SDL_DetectSoundSource();\r
+//SS if (!ssNoCheck)\r
+//SS SoundSourcePresent = SDL_DetectSoundSource();\r
\r
if (!alNoCheck)\r
{\r
AdLibPresent = SDL_DetectAdLib();\r
- if (AdLibPresent && !sbNoCheck)\r
- {\r
- int port = -1;\r
- char *env = getenv("BLASTER");\r
- if (env)\r
- {\r
- long temp;\r
- while (*env)\r
- {\r
- while (isspace(*env))\r
- env++;\r
-\r
- switch (toupper(*env))\r
- {\r
- case 'A':\r
- temp = strtol(env + 1,&env,16);\r
- if\r
- (\r
- (temp >= 0x210)\r
- && (temp <= 0x260)\r
- && (!(temp & 0x00f))\r
- )\r
- port = (temp - 0x200) >> 4;\r
- else\r
- Quit(gvar, "SD_Startup: Unsupported address value in BLASTER");\r
- break;\r
- case 'I':\r
- temp = strtol(env + 1,&env,10);\r
- if\r
- (\r
- (temp >= 0)\r
- && (temp <= 10)\r
- && (sbIntVectors[temp] != -1)\r
- )\r
- {\r
- sbInterrupt = temp;\r
- sbIntVec = sbIntVectors[sbInterrupt];\r
- }\r
- else\r
- Quit(gvar, "SD_Startup: Unsupported interrupt value in BLASTER");\r
- break;\r
- case 'D':\r
- temp = strtol(env + 1,&env,10);\r
- if ((temp == 0) || (temp == 1) || (temp == 3))\r
- SDL_SBSetDMA(temp);\r
- else\r
- Quit(gvar, "SD_Startup: Unsupported DMA value in BLASTER");\r
- break;\r
- default:\r
- while (isspace(*env))\r
- env++;\r
- while (*env && !isspace(*env))\r
- env++;\r
- break;\r
- }\r
- }\r
- }\r
- SoundBlasterPresent = SDL_DetectSoundBlaster(port);\r
- }\r
+//SB if (AdLibPresent) && !sbNoCheck)\r
+//SB {\r
+//SB int port = -1;\r
+//SB char *env = getenv("BLASTER");\r
+//SB if (env)\r
+//SB {\r
+//SB long temp;\r
+//SB while (*env)\r
+//SB {\r
+//SB while (isspace(*env))\r
+//SB env++;\r
+//SB\r
+//SB switch (toupper(*env))\r
+//SB {\r
+//SB case 'A':\r
+//SB temp = strtol(env + 1,&env,16);\r
+//SB if\r
+//SB (\r
+//SB (temp >= 0x210)\r
+//SB && (temp <= 0x260)\r
+//SB && (!(temp & 0x00f))\r
+//SB )\r
+//SB port = (temp - 0x200) >> 4;\r
+//SB else\r
+//SB Quit(gvar, "SD_Startup: Unsupported address value in BLASTER");\r
+//SB break;\r
+//SB case 'I':\r
+//SB temp = strtol(env + 1,&env,10);\r
+//SB if\r
+//SB (\r
+//SB (temp >= 0)\r
+//SB && (temp <= 10)\r
+//SB && (sbIntVectors[temp] != -1)\r
+//SB )\r
+//SB {\r
+//SB sbInterrupt = temp;\r
+//SB sbIntVec = sbIntVectors[sbInterrupt];\r
+//SB }\r
+//SB else\r
+//SB Quit(gvar, "SD_Startup: Unsupported interrupt value in BLASTER");\r
+//SB break;\r
+//SB case 'D':\r
+//SB temp = strtol(env + 1,&env,10);\r
+//SB if ((temp == 0) || (temp == 1) || (temp == 3))\r
+//SB SDL_SBSetDMA(temp);\r
+//SB else\r
+//SB Quit(gvar, "SD_Startup: Unsupported DMA value in BLASTER");\r
+//SB break;\r
+//SB default:\r
+//SB while (isspace(*env))\r
+//SB env++;\r
+//SB while (*env && !isspace(*env))\r
+//SB env++;\r
+//SB break;\r
+//SB }\r
+//SB }\r
+//SB }\r
+//SB SoundBlasterPresent = SDL_DetectSoundBlaster(port);\r
+//SB }\r
}\r
\r
for (i = 0;i < 255;i++)\r
pcSoundLookup[i] = i * 60;\r
\r
- if (SoundBlasterPresent)\r
- SDL_StartSB();\r
+//SB if (SoundBlasterPresent)\r
+//SB SDL_StartSB();\r
\r
- SDL_SetupDigi();\r
+ SDL_SetupDigi(gvar);\r
\r
SD_Started = true;\r
}\r
//\r
///////////////////////////////////////////////////////////////////////////\r
void\r
-SD_Default(boolean gotit,SDMode sd,SMMode sm)\r
+SD_Default(boolean gotit,SDMode sd,SMMode sm, global_game_variables_t *gvar)\r
{\r
boolean gotsd,gotsm;\r
\r
sd = sdm_PC;\r
}\r
if (sd != SoundMode)\r
- SD_SetSoundMode(sd);\r
+ SD_SetSoundMode(sd, gvar);\r
\r
\r
if (gotsm) // Make sure requested music hardware is available\r
//\r
///////////////////////////////////////////////////////////////////////////\r
void\r
-SD_Shutdown(void)\r
+SD_Shutdown(global_game_variables_t *gvar)\r
{\r
if (!SD_Started)\r
return;\r
\r
SD_MusicOff();\r
- SD_StopSound();\r
+ SD_StopSound(gvar);\r
SDL_ShutDevice();\r
SDL_CleanDevice();\r
\r
- if (SoundBlasterPresent)\r
- SDL_ShutSB();\r
+//SB if (SoundBlasterPresent)\r
+//SB SDL_ShutSB();\r
\r
- if (SoundSourcePresent)\r
- SDL_ShutSS();\r
+//SS if (SoundSourcePresent)\r
+//SS SDL_ShutSS();\r
\r
asm pushf\r
asm cli\r
\r
SDL_PCStopSound();\r
\r
- SD_PlayDigitized(DigiMap[sound],lp,rp);\r
+ SD_PlayDigitized(DigiMap[sound],lp,rp, gvar);\r
SoundPositioned = ispos;\r
SoundNumber = sound;\r
SoundPriority = s->priority;\r
if (s->priority < DigiPriority)\r
return(false);\r
\r
- SD_PlayDigitized(DigiMap[sound],lp,rp);\r
+ SD_PlayDigitized(DigiMap[sound],lp,rp, gvar);\r
SoundPositioned = ispos;\r
DigiNumber = sound;\r
DigiPriority = s->priority;\r
SDL_PCPlaySound((void far *)s);\r
break;\r
case sdm_AdLib:\r
- SDL_ALPlaySound((void far *)s);\r
+ SDL_ALPlaySound((void far *)s, gvar);\r
break;\r
}\r
\r
//\r
///////////////////////////////////////////////////////////////////////////\r
void\r
-SD_StopSound(void)\r
+SD_StopSound(global_game_variables_t *gvar)\r
{\r
if (DigiPlaying)\r
- SD_StopDigitized();\r
+ SD_StopDigitized(gvar);\r
\r
switch (SoundMode)\r
{\r
return(result);\r
}\r
\r
+#if 0\r
// SD ASS!\r
void SDL_SetDS()\r
{\r
in al,dx\r
}\r
}\r
-\r
+#endif\r