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)); } }
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 ) { Error(EXIT_FAILURE, FX_ErrorString( FX_Error )); } status = FX_SetCallBack( TestCallBack ); if ( status != FX_Ok ) { Error(EXIT_FAILURE, FX_ErrorString( FX_Error )); } }
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; }
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; }
void S_SoundShutdown(void) { if (MusicVoice >= 0) S_MusicShutdown(); if (FX_Shutdown() != FX_Ok) { Bsprintf(tempbuf, "S_SoundShutdown(): error: %s", FX_ErrorString(FX_Error)); G_GameExit(tempbuf); } }
void SoundShutdown( void ) { int32 status; // if they chose None lets return if (FXDevice == NumSoundCards) { return; } status = FX_Shutdown(); if ( status != FX_Ok ) { Error(EXIT_FAILURE, FX_ErrorString( FX_Error )); } }
char *FX_ErrorString(int ErrorNumber) { char *ErrorString; switch( ErrorNumber ) { case FX_Warning : case FX_Error : ErrorString = FX_ErrorString( FX_ErrorCode ); break; case FX_Ok : ErrorString = "Fx ok\n"; break; case FX_ASSVersion : ErrorString = "Apogee Sound System Version " ASS_VERSION_STRING " " "Programmed by Jim Dose\n" "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; break; case FX_SoundCardError : ErrorString = DSL_ErrorString( DSL_Error ); break; case FX_InvalidCard : ErrorString = "Invalid Sound Fx device.\n"; break; case FX_MultiVocError : ErrorString = MV_ErrorString( MV_Error ); break; case FX_DPMI_Error : ErrorString = "DPMI Error in FX_MAN.\n"; break; default : ErrorString = "Unknown Fx error code.\n"; break; } return( ErrorString ); }
void SoundShutdown( void ) { int32 status; // if they chose None lets return if (FXDevice < 0) return; if (MusicVoice >= 0) { MusicShutdown(); } status = FX_Shutdown(); if ( status != FX_Ok ) { sprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString( FX_Error )); gameexit(tempbuf); } }
void SoundShutdown(void) { int32_t status; // if they chose None lets return if (FXDevice < 0) { return; } if (!FxInitialized) return; status = FX_Shutdown(); if (status != FX_Ok) { buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error)); } }
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); }
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); }
char *FX_ErrorString ( int ErrorNumber ) { char *ErrorString; switch( ErrorNumber ) { case FX_Warning : case FX_Error : ErrorString = FX_ErrorString( FX_ErrorCode ); break; case FX_Ok : ErrorString = "Fx ok."; break; case FX_ASSVersion : ErrorString = "Apogee Sound System Version " ASS_VERSION_STRING " " "Programmed by Jim Dose\n" "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; break; #ifdef PLAT_DOS case FX_BlasterError : ErrorString = BLASTER_ErrorString( BLASTER_Error ); break; #endif case FX_SoundCardError : #ifdef PLAT_DOS switch( FX_SoundDevice ) { case SoundBlaster : case Awe32 : ErrorString = BLASTER_ErrorString( BLASTER_Error ); break; case ProAudioSpectrum : case SoundMan16 : ErrorString = PAS_ErrorString( PAS_Error ); break; case SoundScape : ErrorString = SOUNDSCAPE_ErrorString( SOUNDSCAPE_Error ); break; case UltraSound : ErrorString = GUSWAVE_ErrorString( GUSWAVE_Error ); break; case SoundSource : case TandySoundSource : ErrorString = SS_ErrorString( SS_Error ); break; } #else ErrorString = DSL_ErrorString( DSL_Error ); #endif break; case FX_InvalidCard : ErrorString = "Invalid Sound Fx device."; break; case FX_MultiVocError : ErrorString = MV_ErrorString( MV_Error ); break; case FX_DPMI_Error : ErrorString = "DPMI Error in FX_MAN."; break; default : ErrorString = "Unknown Fx error code."; break; } return( ErrorString ); }