Ejemplo n.º 1
0
int FX_GetBlasterSettings
   (
   fx_blaster_config *blaster
   )

   {
#ifdef PLAT_DOS
   int status;
   BLASTER_CONFIG Blaster;

   FX_SetErrorCode( FX_Ok );

   status = BLASTER_GetEnv( &Blaster );
   if ( status != BLASTER_Ok )
      {
      FX_SetErrorCode( FX_BlasterError );
      return( FX_Error );
      }

   blaster->Type      = Blaster.Type;
   blaster->Address   = Blaster.Address;
   blaster->Interrupt = Blaster.Interrupt;
   blaster->Dma8      = Blaster.Dma8;
   blaster->Dma16     = Blaster.Dma16;
   blaster->Midi      = Blaster.Midi;
   blaster->Emu       = Blaster.Emu;
#endif

   return( FX_Ok );
   }
Ejemplo n.º 2
0
int FX_StartRecording
   (
   int MixRate,
   void ( *function )( char *ptr, int length )
   )

   {
   int status;

   switch( FX_SoundDevice )
      {
      case SoundBlaster :
      case Awe32 :
      case ProAudioSpectrum :
      case SoundMan16 :
         status = MV_StartRecording( MixRate, function );
         if ( status != MV_Ok )
            {
            FX_SetErrorCode( FX_MultiVocError );
            status = FX_Warning;
            }
         else
            {
            status = FX_Ok;
            }
         break;

      default :
         FX_SetErrorCode( FX_InvalidCard );
         status = FX_Warning;
         break;
      }

   return( status );
   }
Ejemplo n.º 3
0
int FX_Init
(
    int SoundCard,
    int numvoices,
    int * numchannels,
    int * samplebits,
    int * mixrate,
    void * initdata
)

{
    int status;
    int devicestatus;

    if ( FX_Installed )
    {
        FX_Shutdown();
    }

    if (SoundCard == ASS_AutoDetect) {
#if 0 //defined __APPLE__
        SoundCard = ASS_CoreAudio;
#elif defined _WIN32
        SoundCard = ASS_DirectSound;
#elif defined HAVE_SDL
        SoundCard = ASS_SDL;
#else
        SoundCard = ASS_NoSound;
#endif
    }

    if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) {
        FX_SetErrorCode( FX_InvalidCard );
        status = FX_Error;
        return status;
    }

    if (SoundDriver_IsPCMSupported(SoundCard) == 0) {
        // unsupported cards fall back to no sound
        SoundCard = ASS_NoSound;
    }

    status = FX_Ok;
    devicestatus = MV_Init( SoundCard, mixrate, numvoices, numchannels, samplebits, initdata );
    if ( devicestatus != MV_Ok )
    {
        FX_SetErrorCode( FX_MultiVocError );
        status = FX_Error;
    }

    if ( status == FX_Ok )
    {
        FX_Installed = TRUE;
    }

    return( status );
}
Ejemplo n.º 4
0
int FX_StartDemandFeedPlayback
   (
   void ( *function )( char **ptr, unsigned long *length ),
   int rate,
   int pitchoffset,
   int vol,
   int left,
   int right,
   int priority,
   unsigned long callbackval
   )

   {
   int handle;

   handle = MV_StartDemandFeedPlayback( function, rate,
      pitchoffset, vol, left, right, priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 5
0
/*---------------------------------------------------------------------
   Function: FX_PlayLoopedAuto

   Play a looped sound, autodetecting the format.
---------------------------------------------------------------------*/
int FX_PlayLoopedAuto( char *ptr, unsigned int length, int loopstart, int loopend,
                       int pitchoffset, int vol, int left, int right, int priority,
                       unsigned int callbackval )
{
    int handle = -1;

    if (!memcmp("Creative Voice File\x1a", ptr, 20)) {
        handle = MV_PlayLoopedVOC(ptr, length, loopstart, loopend, pitchoffset,
                                  vol, left, right, priority, callbackval);
    } else if (!memcmp("RIFF", ptr, 4) && !memcmp("WAVE", ptr + 8, 4)) {
        handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset,
                                  vol, left, right, priority, callbackval);
#ifdef HAVE_VORBIS
    } else if (!memcmp("OggS", ptr, 4)) {
        handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset,
                                     vol, left, right, priority, callbackval);
#endif
    }

    if ( handle < MV_Ok )
    {
        FX_SetErrorCode( FX_MultiVocError );
        handle = FX_Warning;
    }

    return handle;
}
Ejemplo n.º 6
0
int FX_PlayLoopedRaw
   (
   uint8_t *ptr,
   uint32_t length,
   char *loopstart,
   char *loopend,
   uint32_t rate,
   int32_t pitchoffset,
   int32_t vol,
   int32_t left,
   int32_t right,
   int32_t priority,
   uint32_t callbackval
   )

   {
   int handle;

   handle = MV_PlayLoopedRaw( ptr, length, loopstart, loopend,
      rate, pitchoffset, vol, left, right, priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 7
0
int FX_SetCallBack
   (
   void ( *function )( unsigned long )
   )

   {
   int status;

   status = FX_Ok;

   switch( FX_SoundDevice )
      {
      case SoundBlaster :
      case Awe32 :
      case ProAudioSpectrum :
      case SoundMan16 :
      case SoundScape :
      case SoundSource :
      case TandySoundSource :
      case UltraSound :
         MV_SetCallBack( function );
         break;

      default :
         FX_SetErrorCode( FX_InvalidCard );
         status = FX_Error;
      }

   return( status );
   }
Ejemplo n.º 8
0
int FX_PlayRaw
   (
   char *ptr,
   unsigned long length,
   unsigned rate,
   int pitchoffset,
   int vol,
   int left,
   int right,
   int priority,
   unsigned long callbackval
   )

   {
   int handle;

   handle = MV_PlayRaw( ptr, length, rate, pitchoffset,
      vol, left, right, priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 9
0
int FX_PlayLoopedWAV
   (
   char *ptr,
   long loopstart,
   long loopend,
   int pitchoffset,
   int vol,
   int left,
   int right,
   int priority,
   unsigned long callbackval
   )

   {
   int handle;

   handle = MV_PlayLoopedWAV( ptr, loopstart, loopend,
      pitchoffset, vol, left, right, priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 10
0
int FX_Shutdown
   (
   void
   )

   {
   int status;

   if ( !FX_Installed )
      {
      return( FX_Ok );
      }

   status = FX_Ok;
   switch( FX_SoundDevice )
      {
      case SoundBlaster :
      case Awe32 :
      case ProAudioSpectrum :
      case SoundMan16 :
      case SoundScape :
      case SoundSource :
      case TandySoundSource :
      case UltraSound :
         status = MV_Shutdown();
         if ( status != MV_Ok )
            {
            FX_SetErrorCode( FX_MultiVocError );
            status = FX_Error;
            }
         break;

      default :
         FX_SetErrorCode( FX_InvalidCard );
         status = FX_Error;
      }

   FX_Installed = FALSE;
   LL_UnlockMemory();

   return( status );
   }
Ejemplo n.º 11
0
int FX_SetupSoundBlaster
   (
   fx_blaster_config blaster,
   int *MaxVoices,
   int *MaxSampleBits,
   int *MaxChannels
   )

   {
#ifdef PLAT_DOS
   int DeviceStatus;
   BLASTER_CONFIG Blaster;

   FX_SetErrorCode( FX_Ok );

   FX_SoundDevice = SoundBlaster;

   Blaster.Type      = blaster.Type;
   Blaster.Address   = blaster.Address;
   Blaster.Interrupt = blaster.Interrupt;
   Blaster.Dma8      = blaster.Dma8;
   Blaster.Dma16     = blaster.Dma16;
   Blaster.Midi      = blaster.Midi;
   Blaster.Emu       = blaster.Emu;

   BLASTER_SetCardSettings( Blaster );

   DeviceStatus = BLASTER_Init();
   if ( DeviceStatus != BLASTER_Ok )
      {
      FX_SetErrorCode( FX_SoundCardError );
      return( FX_Error );
      }

   *MaxVoices = 8;
   BLASTER_GetCardInfo( MaxSampleBits, MaxChannels );
#endif

   return( FX_Ok );
   }
Ejemplo n.º 12
0
int FX_SetupCard
   (
   int SoundCard,
   fx_device *device
   )

   {
   int status;
   int DeviceStatus;

   if ( USER_CheckParameter( "ASSVER" ) )
      {
      FX_SetErrorCode( FX_ASSVersion );
      return( FX_Error );
      }

   FX_SoundDevice = SoundCard;

   status = FX_Ok;
   FX_SetErrorCode( FX_Ok );


      DeviceStatus = DSL_Init();
      if ( DeviceStatus != DSL_Ok )
         {
         FX_SetErrorCode( FX_SoundCardError );
         status = FX_Error;
         }
         else
         {
         device->MaxVoices     = 32;
         device->MaxSampleBits = 0;
         device->MaxChannels   = 0;
         }


   return( status );
   }
Ejemplo n.º 13
0
int FX_StartRecording
(
    int MixRate,
    void ( *function )( char *ptr, int length )
)

{
    int status;

    FX_SetErrorCode( FX_InvalidCard );
    status = FX_Warning;

    return( status );
}
Ejemplo n.º 14
0
int FX_StopSound
   (
   int handle
   )

   {
   int status;

   status = MV_Kill( handle );
   if ( status != MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      return( FX_Warning );
      }

   return( FX_Ok );
   }
Ejemplo n.º 15
0
int FX_EndLooping
   (
   int handle
   )

   {
   int status;

   status = MV_EndLooping( handle );
   if ( status == MV_Error )
      {
      FX_SetErrorCode( FX_MultiVocError );
      status = FX_Warning;
      }

   return( status );
   }
Ejemplo n.º 16
0
int FX_StopAllSounds
   (
   void
   )

   {
   int status;

   status = MV_KillAllVoices();
   if ( status != MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      return( FX_Warning );
      }

   return( FX_Ok );
   }
Ejemplo n.º 17
0
int FX_SetFrequency
   (
   int handle,
   int frequency
   )

   {
   int status;

   status = MV_SetFrequency( handle, frequency );
   if ( status == MV_Error )
      {
      FX_SetErrorCode( FX_MultiVocError );
      status = FX_Warning;
      }

   return( status );
   }
Ejemplo n.º 18
0
int FX_SetPitch
   (
   int handle,
   int pitchoffset
   )

   {
   int status;

   status = MV_SetPitch( handle, pitchoffset );
   if ( status == MV_Error )
      {
      FX_SetErrorCode( FX_MultiVocError );
      status = FX_Warning;
      }

   return( status );
   }
Ejemplo n.º 19
0
int FX_PauseSound
(
    int handle,
    int pauseon
)

{
    int status;

    status = MV_PauseVoice( handle, pauseon );
    if ( status != MV_Ok )
    {
        FX_SetErrorCode( FX_MultiVocError );
        return( FX_Warning );
    }

    return( FX_Ok );
}
Ejemplo n.º 20
0
int FX_Pan3D
   (
   int handle,
   int angle,
   int distance
   )

   {
   int status;

   status = MV_Pan3D( handle, angle, distance );
   if ( status != MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      status = FX_Warning;
      }

   return( status );
   }
Ejemplo n.º 21
0
int FX_SetPan
   (
   int handle,
   int vol,
   int left,
   int right
   )

   {
   int status;

   status = MV_SetPan( handle, vol, left, right );
   if ( status == MV_Error )
      {
      FX_SetErrorCode( FX_MultiVocError );
      status = FX_Warning;
      }

   return( status );
   }
Ejemplo n.º 22
0
int FX_PlayWAV3D
   (
   uint8_t *ptr,
   int32_t pitchoffset,
   int32_t angle,
   int32_t distance,
   int32_t priority,
   uint32_t callbackval
   )

   {
   int handle;

   handle = MV_PlayWAV3D( ptr, pitchoffset, angle, distance,
      priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 23
0
/*---------------------------------------------------------------------
   Function: FX_PlayAuto3D

   Play a positioned sound, autodetecting the format.
---------------------------------------------------------------------*/
int FX_PlayAuto3D( char *ptr, unsigned int length, int pitchoffset, int angle,
                   int distance, int priority, unsigned int callbackval )
{
    int handle = -1;

    if (!memcmp("Creative Voice File\x1a", ptr, 20)) {
        handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
    } else if (!memcmp("RIFF", ptr, 4) && !memcmp("WAVE", ptr + 8, 4)) {
        handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
#ifdef HAVE_VORBIS
    } else if (!memcmp("OggS", ptr, 4)) {
        handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
#endif
    }

    if ( handle < MV_Ok )
    {
        FX_SetErrorCode( FX_MultiVocError );
        handle = FX_Warning;
    }

    return handle;
}
Ejemplo n.º 24
0
int FX_PlayWAV3D
   (
   char *ptr,
   int pitchoffset,
   int angle,
   int distance,
   int priority,
   unsigned long callbackval
   )

   {
   int handle;

   handle = MV_PlayWAV3D( ptr, pitchoffset, angle, distance,
      priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 25
0
int FX_Shutdown
(
    void
)

{
    int status;

    if ( !FX_Installed )
    {
        return( FX_Ok );
    }

    status = MV_Shutdown();
    if ( status != MV_Ok )
    {
        FX_SetErrorCode( FX_MultiVocError );
        status = FX_Error;
    }

    FX_Installed = FALSE;

    return( status );
}
Ejemplo n.º 26
0
int FX_PlayWAV
   (
   uint8_t *ptr,
   int32_t pitchoffset,
   int32_t vol,
   int32_t left,
   int32_t right,
   int32_t priority,
   uint32_t callbackval
   )

   {
   int handle;

   handle = MV_PlayWAV( ptr, pitchoffset, vol, left, right,
      priority, callbackval );
   if ( handle < MV_Ok )
      {
      FX_SetErrorCode( FX_MultiVocError );
      handle = FX_Warning;
      }

   return( handle );
   }
Ejemplo n.º 27
0
int FX_Init
   (
   int SoundCard,
   int numvoices,
   int numchannels,
   int samplebits,
   unsigned mixrate
   )

   {
   int status;
   int devicestatus;

   if ( FX_Installed )
      {
      FX_Shutdown();
      }

   if ( USER_CheckParameter( "ASSVER" ) )
      {
      FX_SetErrorCode( FX_ASSVersion );
      return( FX_Error );
      }

   status = LL_LockMemory();
   if ( status != LL_Ok )
      {
      FX_SetErrorCode( FX_DPMI_Error );
      return( FX_Error );
      }

   FX_MixRate = mixrate;

   status = FX_Ok;
   FX_SoundDevice = SoundCard;
   switch( SoundCard )
      {
      case SoundBlaster :
      case Awe32 :
      case ProAudioSpectrum :
      case SoundMan16 :
      case SoundScape :
      case SoundSource :
      case TandySoundSource :
      case UltraSound :
         devicestatus = MV_Init( SoundCard, FX_MixRate, numvoices,
            numchannels, samplebits );
         if ( devicestatus != MV_Ok )
            {
            FX_SetErrorCode( FX_MultiVocError );
            status = FX_Error;
            }
         break;

      default :
         FX_SetErrorCode( FX_InvalidCard );
         status = FX_Error;
      }

   if ( status != FX_Ok )
      {
      LL_UnlockMemory();
      }
   else
      {
      FX_Installed = TRUE;
      }

   return( status );
   }
Ejemplo n.º 28
0
int FX_SetupCard
   (
   int SoundCard,
   fx_device *device
   )

   {
   int status;
   int DeviceStatus;

   if ( USER_CheckParameter( "ASSVER" ) )
      {
      FX_SetErrorCode( FX_ASSVersion );
      return( FX_Error );
      }

   FX_SoundDevice = SoundCard;

   status = FX_Ok;
   FX_SetErrorCode( FX_Ok );

#ifdef PLAT_DOS
   switch( SoundCard )
      {
      case SoundBlaster :
      case Awe32 :
         DeviceStatus = BLASTER_Init();
         if ( DeviceStatus != BLASTER_Ok )
            {
            FX_SetErrorCode( FX_SoundCardError );
            status = FX_Error;
            break;
            }

         device->MaxVoices = 32;
         BLASTER_GetCardInfo( &device->MaxSampleBits, &device->MaxChannels );
         break;

      case ProAudioSpectrum :
      case SoundMan16 :
         DeviceStatus = PAS_Init();
         if ( DeviceStatus != PAS_Ok )
            {
            FX_SetErrorCode( FX_SoundCardError );
            status = FX_Error;
            break;
            }

         device->MaxVoices = 32;
         PAS_GetCardInfo( &device->MaxSampleBits, &device->MaxChannels );
         break;

      case GenMidi :
      case SoundCanvas :
      case WaveBlaster :
         device->MaxVoices     = 0;
         device->MaxSampleBits = 0;
         device->MaxChannels   = 0;
         break;

      case SoundScape :
         device->MaxVoices = 32;
         DeviceStatus = SOUNDSCAPE_GetCardInfo( &device->MaxSampleBits,
            &device->MaxChannels );
         if ( DeviceStatus != SOUNDSCAPE_Ok )
            {
            FX_SetErrorCode( FX_SoundCardError );
            status = FX_Error;
            }
         break;

      case UltraSound :
         if ( GUSWAVE_Init( 8 ) != GUSWAVE_Ok )
            {
            FX_SetErrorCode( FX_SoundCardError );
            status = FX_Error;
            break;
            }

         device->MaxVoices     = 8;
         device->MaxSampleBits = 0;
         device->MaxChannels   = 0;
         break;

      case SoundSource :
      case TandySoundSource :
         DeviceStatus = SS_Init( SoundCard );
         if ( DeviceStatus != SS_Ok )
            {
            FX_SetErrorCode( FX_SoundCardError );
            status = FX_Error;
            break;
            }
         SS_Shutdown();
         device->MaxVoices     = 32;
         device->MaxSampleBits = 8;
         device->MaxChannels   = 1;
         break;
      default :
         FX_SetErrorCode( FX_InvalidCard );
         status = FX_Error;
      }
#else
      DeviceStatus = DSL_Init();
      if ( DeviceStatus != DSL_Ok )
         {
         FX_SetErrorCode( FX_SoundCardError );
         status = FX_Error;
         }
         else
         {
         device->MaxVoices     = 32;
         device->MaxSampleBits = 0;
         device->MaxChannels   = 0;
         }
#endif

   return( status );
   }