示例#1
0
void SoundStartup( void )
   {
   int32 status;

   // if they chose None lets return
   if (FXDevice == NumSoundCards) return;

   // Do special Sound Blaster, AWE32 stuff
   if (
         ( FXDevice == SoundBlaster ) ||
         ( FXDevice == Awe32 )
      )
      {
      int MaxVoices;
      int MaxBits;
      int MaxChannels;

      status = FX_SetupSoundBlaster
                  (
                  BlasterConfig, (int *)&MaxVoices, (int *)&MaxBits, (int *)&MaxChannels
                  );
      }
   else
      {
      status = FX_Ok;
      }

   if ( status == FX_Ok )
      {
      if ( eightytwofifty && numplayers > 1)
         {
         status = FX_Init( FXDevice, min( NumVoices,4 ), 1, 8, 8000 );
         }
      else
         {
         status = FX_Init( FXDevice, NumVoices, NumChannels, NumBits, MixRate );
         }
      if ( status == FX_Ok )
         {

         FX_SetVolume( FXVolume );
         if (ReverseStereo == 1)
            FX_SetReverseStereo(!FX_GetReverseStereo());
         }
      }
   if ( status != FX_Ok )
        soundexit("Error initializing sound.");

   status = FX_SetCallBack( TestCallBack );

   if ( status != FX_Ok )
        soundexit("Error initializing sound.");
   }
示例#2
0
void SoundStartup( void )
{
   int32 status;
    int fxdevicetype;
    void * initdata = 0;

   // if they chose None lets return
    if (FXDevice < 0) {
        return;
    } else if (FXDevice == 0) {
        fxdevicetype = ASS_AutoDetect;
    } else {
        fxdevicetype = FXDevice - 1;
    }
    
//    #ifdef _WIN32
//    initdata = (void *) win_gethwnd();
//    #endif

   status = FX_Init( fxdevicetype, NumVoices, &NumChannels, &NumBits, &MixRate, initdata );
   if ( status == FX_Ok ) {
      FX_SetVolume( FXVolume );
      FX_SetReverseStereo(ReverseStereo);
	  status = FX_SetCallBack( testcallback );
  }

   if ( status != FX_Ok ) {
	  sprintf(tempbuf, "Sound startup error: %s", FX_ErrorString( FX_Error ));
	  gameexit(tempbuf);
   }
	
	FXDevice = 0;
}
示例#3
0
int main(int argc, char ** argv)
{
   int status = 0;
   int NumVoices = 8;
   int NumChannels = 2;
   int NumBits = 16;
   unsigned MixRate = 32000;
   void * initdata = 0;
   int voice = FX_Error;
   const char * song = "test.ogg";
   
   if (argc > 1) {
      song = argv[1];
   }
   
#ifdef _WIN32
   initdata = win_gethwnd();
#endif
   
   status = FX_Init( ASS_AutoDetect, NumVoices, &NumChannels, &NumBits, &MixRate, initdata );
   if (status != FX_Ok) {
      fprintf(stderr, "FX_Init error %s\n", FX_ErrorString(status));
      return 1;
   }
   
   fprintf(stdout, "Format is %dHz %d-bit %d-channel\n", MixRate, NumBits, NumChannels);
   
   playsong(song);
   
   FX_Shutdown();
   
   return 0;
}
示例#4
0
void
SoundStartup(void)
{
    int32_t status;
    void *initdata = 0;
    int fxdevicetype;

    // if they chose None lets return
    if (FXDevice < 0)
    {
        gs.FxOn = FALSE;
        return;
    }
    else if (FXDevice == 0)
    {
        fxdevicetype = ASS_AutoDetect;
    }
    else
    {
        fxdevicetype = FXDevice - 1;
    }

#ifdef MIXERTYPEWIN
    initdata = (void *) win_gethwnd();
#endif

    //gs.FxOn = TRUE;

    status = FX_Init(fxdevicetype, NumVoices, NumChannels, NumBits, MixRate, initdata);
    if (status == FX_Ok)
    {
        FxInitialized = TRUE;
        FX_SetVolume(gs.SoundVolume);

        if (gs.FlipStereo)
            FX_SetReverseStereo(!FX_GetReverseStereo());
    }
    if (status != FX_Ok)
    {
        buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error));
    }

    status = FX_SetCallBack(SoundCallBack);

    if (status != FX_Ok)
    {
        buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error));
    }

}
示例#5
0
void S_SoundStartup(void)
{
    void *initdata = NULL;

#ifdef MIXERTYPEWIN
    initdata = (void *) win_gethwnd(); // used for DirectSound
#endif

    initprintf("Initializing sound... ");

    if (FX_Init(ASS_AutoDetect, ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata) != FX_Ok)
    {
        initprintf("failed! %s\n", FX_ErrorString(FX_Error));
        return;
    }

    initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels,
        ud.config.NumBits, ud.config.MixRate);

    for (int i=0; i<g_maxSoundPos; ++i)
    {
        for (int j = 0; j<MAXSOUNDINSTANCES; ++j)
        {
            g_sounds[i].num = 0;
            g_sounds[i].SoundOwner[j].voice = 0;
            g_sounds[i].SoundOwner[j].ow = -1;
            g_sounds[i].SoundOwner[j].sndist = UINT32_MAX;
            g_sounds[i].SoundOwner[j].clock = 0;
        }

        g_soundlocks[i] = 199;
    }

    FX_SetVolume(ud.config.MasterVolume);
    S_MusicVolume(MASTER_VOLUME(ud.config.MusicVolume));

    FX_SetReverseStereo(ud.config.ReverseStereo);
    FX_SetCallBack(S_Callback);
    FX_SetPrintf(initprintf);
    mutex_init(&s_mutex);
}
示例#6
0
int SD_Startup ( bool bombonerror )
{
   int status;
   int card;
   int voices;
   int channels;
   int bits;
   int i;
   extern bool IS8250;

   if (SD_Started==true)
      SD_Shutdown();

   if ( ( FXMode < 0 ) || ( FXMode >= 11 ) )
      {
      return( 0 );
      }
   card = fxnums[ FXMode ];
   if (card==-1) // Check if it is off
      return (0);

   switch (card)
      {
      case SoundScape:
         soundstart=W_GetNumForName("digistrt")+1;
         soundtype=fx_digital;
         break;
      default:
         Error("FX: Unsupported Card number %d",FXMode);
         break;
      }

   if ( soundtype == fx_digital )
      {
      if ( SoundsRemapped == false )
         {
         for( i = 0; i < SD_LASTSOUND; i++ )
            {
            int snd;

            snd = sounds[ i ].snds[ fx_digital ];
            if ( snd >= 0)
               {
               sounds[ i ].snds[ fx_digital ] = W_GetNumForName(
                  W_GetNameForNum( snd + soundstart ) );
               }
            }
         SoundsRemapped = true;
         }
      soundstart = 0;
      }

   voices   = NumVoices;
   channels = NumChannels;
   bits     = NumBits;

   if ( IS8250 )
      {
      voices   = max( voices, 4 );
      channels = 1;
      bits     = 8;
      }

   status=FX_Init( card, voices, channels, bits, 11025 );

   if (status != FX_Ok)
      {
      if (bombonerror)
         {
         DeleteSoundFile ();
         Error( "%s\n", FX_ErrorString( status ) );
         }

      return (status);
      }

   if (stereoreversed == true)
      {
      FX_SetReverseStereo(!FX_GetReverseStereo());
      }

   FX_SetCallBack( SD_MakeCacheable );

   remotestart=W_GetNumForName("remostrt")+1;

   SD_Started=true;

   FX_SetVolume (FXvolume);

   return (0);
}
示例#7
0
int FX_InitSystem( void )
{
	return FX_Init();
}
示例#8
0
int FX_InitSystem( refdef_t* refdef )
{
	return FX_Init( refdef );
}