void SD_SetDigiDevice(SDSMode mode) { bool devicenotpresent; if (mode == DigiMode) return; SD_StopDigitized(); devicenotpresent = false; switch (mode) { default: break; case sds_SoundBlaster: if (!SoundBlasterPresent) devicenotpresent = true; break; } if (!devicenotpresent) { DigiMode = mode; #ifdef NOTYET SDL_SetTimerSpeed(); #endif } }
/////////////////////////////////////////////////////////////////////////// // // SDL_PCPlaySound() - Plays the specified sound on the PC speaker // /////////////////////////////////////////////////////////////////////////// static void _SDL_PCPlaySound(PCSound *sound) { // We must stop the digitized sound because we're just faking the digitized PC Speaker playback if(DigiMode == sds_PC) SD_StopDigitized(); SDL_LockMutex(audioMutex); pcPhaseTick = 0; pcLastSample = 0; // Must be a value that cannot be played, so the PC Speaker is forced to reset (-1 wraps to 255 so it cannot be used here) pcLengthLeft = LittleLong(sound->common.length); pcSound = sound->data; SDL_UnlockMutex(audioMutex); }
void SD_SetDigiDevice(SDSMode mode) { boolean devicenotpresent; if (mode == DigiMode) return; SD_StopDigitized(); devicenotpresent = false; switch (mode) { case SDS_SOUNDBLASTER: if (!SoundBlasterPresent) devicenotpresent = true; break; } if (!devicenotpresent) DigiMode = mode; }
/////////////////////////////////////////////////////////////////////////// // // SD_StopSound() - if a sound is playing, stops it // /////////////////////////////////////////////////////////////////////////// void SD_StopSound(void) { if (DigiPlaying) SD_StopDigitized(); switch (SoundMode) { default: break; case sdm_PC: SDL_PCStopSound(); break; case sdm_AdLib: SDL_ALStopSound(); break; } SoundPositioned = false; SDL_SoundFinished(); }
/////////////////////////////////////////////////////////////////////////// // // SD_StopSound() - if a sound is playing, stops it // /////////////////////////////////////////////////////////////////////////// void SD_StopSound(void) { if (DigiPlaying) SD_StopDigitized(); switch (SoundMode) { case SDM_PC: #if 0 SD_PCStopSound(); #endif break; case SDM_ADLIB: SD_ALStopSound(); break; } SoundPositioned = false; SD_SoundFinished(); }
void ClearMemory (void) { PM_UnlockMainMem(); SD_StopDigitized(); MM_SortMem (); }
/* ================ = = ShapeTest = ================ */ void ShapeTest (void) { //TODO #if NOTYET extern word NumDigi; extern word *DigiList; extern int postx; extern int postwidth; extern byte *postsource; static char buf[10]; boolean done; ScanCode scan; int i,j,k,x; longword l; byte *addr; soundnames sound; // PageListStruct far *page; CenterWindow(20,16); VW_UpdateScreen(); for (i = 0,done = false; !done;) { US_ClearWindow(); sound = (soundnames) -1; // page = &PMPages[i]; US_Print(" Page #"); US_PrintUnsigned(i); if (i < PMSpriteStart) US_Print(" (Wall)"); else if (i < PMSoundStart) US_Print(" (Sprite)"); else if (i == ChunksInFile - 1) US_Print(" (Sound Info)"); else US_Print(" (Sound)"); /* US_Print("\n XMS: "); if (page->xmsPage != -1) US_PrintUnsigned(page->xmsPage); else US_Print("No"); US_Print("\n Main: "); if (page->mainPage != -1) US_PrintUnsigned(page->mainPage); else if (page->emsPage != -1) { US_Print("EMS "); US_PrintUnsigned(page->emsPage); } else US_Print("No"); US_Print("\n Last hit: "); US_PrintUnsigned(page->lastHit);*/ US_Print("\n Address: "); addr = (byte *) PM_GetPage(i); sprintf(buf,"0x%08X",(int32_t) addr); US_Print(buf); if (addr) { if (i < PMSpriteStart) { // // draw the wall // vbuf += 32*SCREENWIDTH; postx = 128; postwidth = 1; postsource = addr; for (x=0;x<64;x++,postx++,postsource+=64) { wallheight[postx] = 256; ScalePost (); } vbuf -= 32*SCREENWIDTH; } else if (i < PMSoundStart) { // // draw the sprite // vbuf += 32*SCREENWIDTH; SimpleScaleShape (160, i-PMSpriteStart, 64); vbuf -= 32*SCREENWIDTH; } else if (i == ChunksInFile - 1) { US_Print("\n\n Number of sounds: "); US_PrintUnsigned(NumDigi); for (l = j = k = 0;j < NumDigi;j++) { l += DigiList[(j * 2) + 1]; k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; } US_Print("\n Total bytes: "); US_PrintUnsigned(l); US_Print("\n Total pages: "); US_PrintUnsigned(k); } else { byte *dp = addr; for (j = 0;j < NumDigi;j++) { k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; if ((i >= PMSoundStart + DigiList[j * 2]) && (i < PMSoundStart + DigiList[j * 2] + k)) break; } if (j < NumDigi) { sound = (soundnames) j; US_Print("\n Sound #"); US_PrintUnsigned(j); US_Print("\n Segment #"); US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]); } for (j = 0;j < PageLengths[i];j += 32) { byte v = dp[j]; int v2 = (unsigned)v; v2 -= 128; v2 /= 4; if (v2 < 0) VWB_Vlin(WindowY + WindowH - 32 + v2, WindowY + WindowH - 32, WindowX + 8 + (j / 32),BLACK); else VWB_Vlin(WindowY + WindowH - 32, WindowY + WindowH - 32 + v2, WindowX + 8 + (j / 32),BLACK); } } } VW_UpdateScreen(); IN_Ack(); scan = LastScan; IN_ClearKey(scan); switch (scan) { case sc_LeftArrow: if (i) i--; break; case sc_RightArrow: if (++i >= ChunksInFile) i--; break; case sc_W: // Walls i = 0; break; case sc_S: // Sprites i = PMSpriteStart; break; case sc_D: // Digitized i = PMSoundStart; break; case sc_I: // Digitized info i = ChunksInFile - 1; break; /* case sc_L: // Load all pages for (j = 0;j < ChunksInFile;j++) PM_GetPage(j); break;*/ case sc_P: if (sound != -1) SD_PlayDigitized(sound,8,8); break; case sc_Escape: done = true; break; /* case sc_Enter: PM_GetPage(i); break;*/ } } SD_StopDigitized(); #endif }