shithub: rott

Download patch

ref: 3ea197db2f364626ab5cc27955d01074e70d0bbe
parent: 87c8e97e45a7e1d398273fe9c502bae8c28e6d8c
author: Marc-Alexandre Espiaut <marcalexandre@member.fsf.org>
date: Mon Jun 4 14:13:44 EDT 2018

Removing DOS code audiolib/multivoc.c

--- a/rott/audiolib/multivoc.c
+++ b/rott/audiolib/multivoc.c
@@ -34,11 +34,6 @@
 #include <string.h>
 #include <time.h>
 
-#ifdef PLAT_DOS
-#include <dos.h>
-#include <conio.h>
-#endif
-
 #include "util.h"
 #include "dpmi.h"
 #include "usrhooks.h"
@@ -47,15 +42,7 @@
 #include "linklist.h"
 #include "sndcards.h"
 
-#ifdef PLAT_DOS
-#include "blaster.h"
-#include "sndscape.h"
-#include "sndsrc.h"
-#include "pas16.h"
-#include "guswave.h"
-#else
 #include "dsl.h"
-#endif
 
 #include "pitch.h"
 #include "multivoc.h"
@@ -186,26 +173,6 @@
          ErrorString = "No voice with matching handle found.";
          break;
 
-#ifdef PLAT_DOS
-      case MV_BlasterError :
-         ErrorString = BLASTER_ErrorString( BLASTER_Error );
-         break;
-
-      case MV_PasError :
-         ErrorString = PAS_ErrorString( PAS_Error );
-         break;
-
-      case MV_SoundScapeError :
-         ErrorString = SOUNDSCAPE_ErrorString( SOUNDSCAPE_Error );
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case MV_SoundSourceError :
-         ErrorString = SS_ErrorString( SS_Error );
-         break;
-      #endif
-#endif
-
       case MV_DPMI_Error :
          ErrorString = "DPMI Error in Multivoc.";
          break;
@@ -419,16 +386,6 @@
    VoiceNode *voice;
    VoiceNode *next;
 
-#ifdef PLAT_DOS
-   if ( MV_DMAChannel >= 0 )
-      {
-      // Get the currently playing buffer
-      buffer = ( char * )DMA_GetCurrentPos( MV_DMAChannel );
-      MV_MixPage   = ( unsigned )( buffer - MV_MixBuffer[ 0 ] );
-      MV_MixPage >>= MV_BuffShift;
-      }
-#endif
-
    // Toggle which buffer we'll mix next
    MV_MixPage++;
    if ( MV_MixPage >= MV_NumberOfBuffers )
@@ -1859,37 +1816,7 @@
       mode |= SIXTEEN_BIT;
       }
 
-#ifdef PLAT_DOS
-   switch( MV_SoundCard )
-      {
-      case UltraSound :
-         MV_MixMode = mode;
-         break;
-
-      case SoundBlaster :
-      case Awe32 :
-         MV_MixMode = BLASTER_SetMixMode( mode );
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         MV_MixMode = PAS_SetMixMode( mode );
-         break;
-
-      case SoundScape :
-         MV_MixMode = SOUNDSCAPE_SetMixMode( mode );
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case SoundSource :
-      case TandySoundSource :
-         MV_MixMode = SS_SetMixMode( mode );
-         break;
-      #endif
-      }
-#else
    MV_MixMode = mode;
-#endif
 
    MV_Channels = 1;
    if ( MV_MixMode & STEREO )
@@ -1966,95 +1893,6 @@
 //   return( MV_Ok );
 
    // Start playback
-#ifdef PLAT_DOS
-   switch( MV_SoundCard )
-      {
-      case SoundBlaster :
-      case Awe32 :
-         status = BLASTER_BeginBufferedPlayback( MV_MixBuffer[ 0 ],
-            TotalBufferSize, MV_NumberOfBuffers,
-            MV_RequestedMixRate, MV_MixMode, MV_ServiceVoc );
-
-         if ( status != BLASTER_Ok )
-            {
-            MV_SetErrorCode( MV_BlasterError );
-            return( MV_Error );
-            }
-
-         MV_MixRate = BLASTER_GetPlaybackRate();
-         MV_DMAChannel = BLASTER_DMAChannel;
-         break;
-
-      case UltraSound :
-
-         status = GUSWAVE_StartDemandFeedPlayback( MV_ServiceGus, 1,
-            MV_Bits, MV_RequestedMixRate, 0, ( MV_Channels == 1 ) ?
-            0 : 24, 255, 0xffff, 0 );
-         if ( status < GUSWAVE_Ok )
-            {
-            MV_SetErrorCode( MV_BlasterError );
-            return( MV_Error );
-            }
-
-         if ( MV_Channels == 2 )
-            {
-            status = GUSWAVE_StartDemandFeedPlayback( MV_ServiceRightGus, 1,
-               MV_Bits, MV_RequestedMixRate, 0, 8, 255, 0xffff, 0 );
-            if ( status < GUSWAVE_Ok )
-               {
-               GUSWAVE_KillAllVoices();
-               MV_SetErrorCode( MV_BlasterError );
-               return( MV_Error );
-               }
-            }
-
-         MV_MixRate = MV_RequestedMixRate;
-         MV_DMAChannel = -1;
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         status = PAS_BeginBufferedPlayback( MV_MixBuffer[ 0 ],
-            TotalBufferSize, MV_NumberOfBuffers,
-            MV_RequestedMixRate, MV_MixMode, MV_ServiceVoc );
-
-         if ( status != PAS_Ok )
-            {
-            MV_SetErrorCode( MV_PasError );
-            return( MV_Error );
-            }
-
-         MV_MixRate = PAS_GetPlaybackRate();
-         MV_DMAChannel = PAS_DMAChannel;
-         break;
-
-      case SoundScape :
-         status = SOUNDSCAPE_BeginBufferedPlayback( MV_MixBuffer[ 0 ],
-            TotalBufferSize, MV_NumberOfBuffers, MV_RequestedMixRate,
-            MV_MixMode, MV_ServiceVoc );
-
-         if ( status != SOUNDSCAPE_Ok )
-            {
-            MV_SetErrorCode( MV_SoundScapeError );
-            return( MV_Error );
-            }
-
-         MV_MixRate = SOUNDSCAPE_GetPlaybackRate();
-         MV_DMAChannel = SOUNDSCAPE_DMAChannel;
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case SoundSource :
-      case TandySoundSource :
-         SS_BeginBufferedPlayback( MV_MixBuffer[ 0 ],
-            TotalBufferSize, MV_NumberOfBuffers,
-            MV_ServiceVoc );
-         MV_MixRate = SS_SampleRate;
-         MV_DMAChannel = -1;
-         break;
-      #endif
-      }
-#else
     status = DSL_BeginBufferedPlayback( MV_MixBuffer[ 0 ],
             TotalBufferSize, MV_NumberOfBuffers,
             MV_RequestedMixRate, MV_MixMode, MV_ServiceVoc );
@@ -2066,7 +1904,6 @@
        }
 
     MV_MixRate = DSL_GetPlaybackRate();
-#endif
 
    return( MV_Ok );
    }
@@ -2088,38 +1925,7 @@
    VoiceNode   *next;
    unsigned    flags;
 
-#ifdef PLAT_DOS
-   // Stop sound playback
-   switch( MV_SoundCard )
-      {
-      case SoundBlaster :
-      case Awe32 :
-         BLASTER_StopPlayback();
-         break;
-
-      case UltraSound :
-         GUSWAVE_KillAllVoices();
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         PAS_StopPlayback();
-         break;
-
-      case SoundScape :
-         SOUNDSCAPE_StopPlayback();
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case SoundSource :
-      case TandySoundSource :
-         SS_StopPlayback();
-         break;
-      #endif
-      }
-#else
    DSL_StopPlayback();
-#endif
 
    // Make sure all callbacks are done.
    flags = DisableInterrupts();
@@ -2153,75 +1959,8 @@
    )
 
    {
-#ifdef PLAT_DOS
-   int status;
-
-   switch( MV_SoundCard )
-      {
-      case SoundBlaster :
-      case Awe32 :
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         break;
-
-      default :
-         MV_SetErrorCode( MV_UnsupportedCard );
-         return( MV_Error );
-         break;
-      }
-
-   if ( function == NULL )
-      {
-      MV_SetErrorCode( MV_NullRecordFunction );
-      return( MV_Error );
-      }
-
-   MV_StopPlayback();
-
-   // Initialize the buffers
-   ClearBuffer_DW( MV_MixBuffer[ 0 ], SILENCE_8BIT, TotalBufferSize >> 2 );
-
-   // Set the mix buffer variables
-   MV_MixPage  = 0;
-
-   MV_RecordFunc = function;
-
-   // Start playback
-   switch( MV_SoundCard )
-      {
-      case SoundBlaster :
-      case Awe32 :
-         status = BLASTER_BeginBufferedRecord( MV_MixBuffer[ 0 ],
-            TotalBufferSize, NumberOfBuffers, MixRate, MONO_8BIT,
-            MV_ServiceRecord );
-
-         if ( status != BLASTER_Ok )
-            {
-            MV_SetErrorCode( MV_BlasterError );
-            return( MV_Error );
-            }
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         status = PAS_BeginBufferedRecord( MV_MixBuffer[ 0 ],
-            TotalBufferSize, NumberOfBuffers, MixRate, MONO_8BIT,
-            MV_ServiceRecord );
-
-         if ( status != PAS_Ok )
-            {
-            MV_SetErrorCode( MV_PasError );
-            return( MV_Error );
-            }
-         break;
-      }
-
-   MV_Recording = TRUE;
-   return( MV_Ok );
-#else
    MV_SetErrorCode( MV_UnsupportedCard );
    return( MV_Error );
-#endif
    }
 
 
@@ -2237,24 +1976,6 @@
    )
 
    {
-#ifdef PLAT_DOS
-   // Stop sound playback
-   switch( MV_SoundCard )
-      {
-      case SoundBlaster :
-      case Awe32 :
-         BLASTER_StopPlayback();
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         PAS_StopPlayback();
-         break;
-      }
-
-   MV_Recording = FALSE;
-   MV_StartPlayback();
-#endif
    }
 
 
@@ -3017,91 +2738,7 @@
    )
 
    {
-#ifdef PLAT_DOS
-   unsigned flags;
-   long time;
-   int  start;
-   int  status;
-   int  pos;
-
-   if ( MV_SoundCard == UltraSound )
-      {
-      return( MV_Ok );
-      }
-
-   flags = DisableInterrupts();
-   _enable();
-
-   status = MV_Error;
-   start  = MV_MixPage;
-   time   = clock() + CLOCKS_PER_SEC * 2;
-
-   while( clock() < time )
-      {
-      if ( MV_MixPage != start )
-         {
-         status = MV_Ok;
-         }
-      }
-
-   RestoreInterrupts( flags );
-
-   if ( status != MV_Ok )
-      {
-      // Just in case an error doesn't get reported
-      MV_SetErrorCode( MV_DMAFailure );
-
-      switch( MV_SoundCard )
-         {
-         case SoundBlaster :
-         case Awe32 :
-            pos = BLASTER_GetCurrentPos();
-            break;
-
-         case ProAudioSpectrum :
-         case SoundMan16 :
-            pos = PAS_GetCurrentPos();
-            break;
-
-         case SoundScape :
-            pos = SOUNDSCAPE_GetCurrentPos();
-            break;
-
-         #ifndef SOUNDSOURCE_OFF
-         case SoundSource :
-         case TandySoundSource :
-            MV_SetErrorCode( MV_SoundSourceFailure );
-            pos = -1;
-            break;
-         #endif
-
-         default :
-            MV_SetErrorCode( MV_UnsupportedCard );
-            pos = -2;
-            break;
-         }
-
-      if ( pos > 0 )
-         {
-         MV_SetErrorCode( MV_IrqFailure );
-         }
-      else if ( pos == 0 )
-         {
-         if ( MV_Bits == 16 )
-            {
-            MV_SetErrorCode( MV_DMA16Failure );
-            }
-         else
-            {
-            MV_SetErrorCode( MV_DMAFailure );
-            }
-         }
-      }
-
-   return( status );
-#else
    return MV_Ok;
-#endif
    }
 
 
@@ -3191,72 +2828,11 @@
    MV_SetReverseStereo( FALSE );
 
    // Initialize the sound card
-#ifdef PLAT_DOS
-   switch( soundcard )
-      {
-      case UltraSound :
-         status = GUSWAVE_Init( 2 );
-         if ( status != GUSWAVE_Ok )
-            {
-            //JIM
-            MV_SetErrorCode( MV_BlasterError );
-            }
-         break;
-
-      case SoundBlaster :
-      case Awe32 :
-         status = BLASTER_Init();
-         if ( status != BLASTER_Ok )
-            {
-            MV_SetErrorCode( MV_BlasterError );
-            }
-
-         if ( ( BLASTER_Config.Type == SBPro ) ||
-            ( BLASTER_Config.Type == SBPro2 ) )
-            {
-            MV_SetReverseStereo( TRUE );
-            }
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         status = PAS_Init();
-         if ( status != PAS_Ok )
-            {
-            MV_SetErrorCode( MV_PasError );
-            }
-         break;
-
-      case SoundScape :
-         status = SOUNDSCAPE_Init();
-         if ( status != SOUNDSCAPE_Ok )
-            {
-            MV_SetErrorCode( MV_SoundScapeError );
-            }
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case SoundSource :
-      case TandySoundSource :
-         status = SS_Init( soundcard );
-         if ( status != SS_Ok )
-            {
-            MV_SetErrorCode( MV_SoundSourceError );
-            }
-         break;
-      #endif
-
-      default :
-         MV_SetErrorCode( MV_UnsupportedCard );
-         break;
-      }
-#else
    status = DSL_Init();
    if ( status != DSL_Ok )
       {
       MV_SetErrorCode( MV_BlasterError );
       }
-#endif
 
    if ( MV_ErrorCode != MV_Ok )
       {
@@ -3289,14 +2865,6 @@
    MV_SetMixMode( numchannels, samplebits );
    MV_ReverbDelay = MV_BufferSize * 3;
 
-#ifdef PLAT_DOS
-   // Make sure we don't cross a physical page
-   if ( ( ( unsigned long )ptr & 0xffff ) + TotalBufferSize > 0x10000 )
-      {
-      ptr = ( char * )( ( ( unsigned long )ptr & 0xff0000 ) + 0x10000 );
-      }
-#endif
-
    MV_MixBuffer[ MV_NumberOfBuffers ] = ptr;
    for( buffer = 0; buffer < MV_NumberOfBuffers; buffer++ )
       {
@@ -3368,37 +2936,7 @@
    MV_StopPlayback();
 
    // Shutdown the sound card
-#ifdef PLAT_DOS
-   switch( MV_SoundCard )
-      {
-      case UltraSound :
-         GUSWAVE_Shutdown();
-         break;
-
-      case SoundBlaster :
-      case Awe32 :
-         BLASTER_Shutdown();
-         break;
-
-      case ProAudioSpectrum :
-      case SoundMan16 :
-         PAS_Shutdown();
-         break;
-
-      case SoundScape :
-         SOUNDSCAPE_Shutdown();
-         break;
-
-      #ifndef SOUNDSOURCE_OFF
-      case SoundSource :
-      case TandySoundSource :
-         SS_Shutdown();
-         break;
-      #endif
-      }
-#else
    DSL_Shutdown();
-#endif
 
    RestoreInterrupts( flags );
 
@@ -3550,7 +3088,6 @@
    return( MV_Ok );
    }
 
-#ifndef PLAT_DOS
 void ClearBuffer_DW( void *ptr, unsigned data, int length )
 {
 	unsigned *d = (unsigned *)ptr;
@@ -3561,4 +3098,3 @@
 		d++;
 	}
 }
-#endif