if (player && player->get_output_driver_type() == MIDI_DRIVER_OGG)
if (player && player->get_ogg_enabled())
void Background_noise::handle_event	(	unsigned long curtime,	long udata	)	{	Main_actor *ava = gwin->get_main_actor();	unsigned long delay = 8000;	int currentstate = 0;#ifndef COLOURLESS_REALLY_HATES_THE_BG_SFX	int bghour = gwin->get_clock()->get_hour();	if(gwin->is_in_dungeon())		currentstate = 2;	else		if (bghour < 6 || bghour > 20)			currentstate = 3;	//Night time		else			currentstate = 1;	MyMidiPlayer *player = Audio::get_ptr()->get_midi();	if (player && player->get_output_driver_type() == MIDI_DRIVER_OGG)	{		delay = 1500;	//Quickly get back to this function check		//We've got OGG so play the background SFX tracks		int curr_track = player->get_current_track();		if(curr_track == 7 && currentstate == 3)		{			//Play the cricket sounds at night 			delay = 3000 + rand()%5000;			Audio::get_ptr()->play_sound_effect(61, MIX_MAX_VOLUME - 30);		}		if((curr_track == -1 || laststate != currentstate ) && Audio::get_ptr()->is_music_enabled())		{			if(curr_track == -1 || (curr_track >=4 && curr_track <=8) || curr_track == 52)		//Not already playing music			{				int tracknum=255;				//Get the relevant track number. SI tracks are converted back to BG ones later on				if(gwin->is_in_dungeon())				{					//Start the SFX music track then					if(Game::get_game_type() == BLACK_GATE)						tracknum = 52;					else						tracknum = 42;						laststate = 2;				}				else								{					if (bghour < 6 || bghour > 20)					{						if(Game::get_game_type() == BLACK_GATE)												tracknum = 7;						else							tracknum = 66;						laststate = 3;					}					else					{						//Start the SFX music track then						if(Game::get_game_type() == BLACK_GATE)							tracknum = 6;						else							tracknum = 67;						laststate = 1;					}				}				Audio::get_ptr()->start_music(tracknum,1);			}		}	}	else	{				//Tests to see if track is playing the SFX tracks, possible 		//when the game has been restored		//and the Audio option was changed from OGG to something else		if(player && player->get_current_track() >=4 && 		   player->get_current_track() <= 8)			player->stop_music();		//Not OGG so play the SFX sounds manually					// Only if outside.		if (ava && !gwin->is_main_actor_inside()  &&			// +++++SI SFX's don't sound right.			Game::get_game_type() == BLACK_GATE )		{			int sound;		// BG SFX #.			static unsigned char bgnight[] = {61, 61, 255},						 bgday[] = {82, 85, 85};			if (repeats > 0)	// Repeating?				sound = last_sound;			else			{				int hour = gwin->get_clock()->get_hour();				if (hour < 6 || hour > 20)					sound = bgnight[rand()%sizeof(bgnight)];				else					sound = bgday[rand()%sizeof(bgday)];						// Translate BG to SI #'s.				sound = Audio::game_sfx(sound);				last_sound = sound;			}			Audio::get_ptr()->play_sound_effect(sound);			repeats++;		// Count it.			if (rand()%(repeats + 1) == 0)						// Repeat.				delay = 500 + rand()%1000;			else			{				delay = 4000 + rand()%3000;				repeats = 0;			}		}	}#endif	gwin->get_tqueue()->add(curtime + delay, this, udata);}