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; }
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 ); }
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 )); } }
void SoundShutdown( void ) { int32 status; // if they chose None lets return if (FXDevice == NumSoundCards) return; status = FX_Shutdown(); if ( status != FX_Ok ) { puts("Error initializing sound."); gameexit(""); } }
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)); } }
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 ); }