/*--------------------------------------------------------- Function: Description: Initialize sound system. ---------------------------------------------------------*/ void initsound() { if(Mix_OpenAudio(8000, AUDIO_S16SYS, 2, 512) == -1) { error("Unable to open audio device: ", Mix_GetError()); } if(!Mix_Init(MIX_INIT_MOD)) { printf("Unable to support MOD files: %s\n", Mix_GetError()); } #ifndef NO_SOUND if (initialized) return; // Initialize several more or less cool variables. mf = 0; // No MOD loaded. mod_play = 0; // No MOD has been loaded so don't play it. // initialize soundcard if (sound_Init(128, 8, 100, 1)) { error("Sound Error: ", Mix_GetError()); } else { initialized = 1; } #endif }
//* // ======================================================================================================================= // ======================================================================================================================= // BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback ) { // init audio system g_sPreviousSample.iTrack = NO_SAMPLE; g_sPreviousSample.x = SAMPLE_COORD_INVALID; g_sPreviousSample.y = SAMPLE_COORD_INVALID; g_sPreviousSample.z = SAMPLE_COORD_INVALID; g_bAudioEnabled = sound_Init(); if (g_bAudioEnabled) { sound_SetStoppedCallback( pStopTrackCallback ); } return g_bAudioEnabled; }
int kernel_Init_Audio(void) { if(flag_Check(&kernel_Main.SDL_Init_Flags, SDL_INIT_AUDIO) == 0) { file_Log(ker_Log(), 1, "No sound device loaded.\n"); /*Initialise sound manager with it not accepting any sounds*/ sound_Init(0, 0, 0, 0); return 0; } printf("Opening audio device\n\n"); if(Mix_OpenAudio(kernel_Main.sound_Frequency, kernel_Main.sound_Format, kernel_Main.sound_Channels, kernel_Main.sound_Chunksize) == -1) { return -1; } printf("Initalising sound manager\n"); sound_Init(16, 32, 50, 1); ker_ReportAudio(); return 0; }