Пример #1
0
void Pause(bool pause)
{
	if(pause)
	{
		game_state=3;
		console_print("paused");
		SOUND_stop( water_sound );
		SOUND_stop( lava_sound );
		SOUND_stop( toxic_sound );
		SOUND_stop( background_sound );


	}
	else
	{
		game_state=0;
		console_print("unpaused");
		SOUND_play( water_sound, 1 );
		SOUND_play( lava_sound, 1 );
		SOUND_play( toxic_sound, 1 );
		MEMORY *memory;
		memory = mopen( ( char * )"background.ogg", 1 );

		background_soundbuffer = SOUNDBUFFER_load_stream( ( char * )"background", memory );

		background_sound = SOUND_add( ( char * )"background", background_soundbuffer );

		SOUND_set_volume( background_sound, 0.5f );

		SOUND_play( background_sound, 1 );


	}

}
Пример #2
0
/** Initializes the sound subsystem **/
void SOUND_initialize()
{
	//Load paddle left
	load_audio( paddle_left, ARRAY_SIZE(paddle_left) );

	//Load paddle right
	load_audio( paddle_right, ARRAY_SIZE(paddle_right) );

	//Load paddle miss
	load_audio( paddle_fail, ARRAY_SIZE(paddle_fail) );

	//Load victory song
	load_audio( victory_song, ARRAY_SIZE(victory_song) );
	
	//Load intro song
	load_audio( pong_song, ARRAY_SIZE(pong_song) );

	//Finish up
	SOUND_stop();

	//so that amplitude is calculated
	volume = 5;
	SOUND_change_volume( 0 );
}
Пример #3
0
/** This function progresses a song to the next note **/
void SOUND_progress_tracker()
{
	BITFIELD bits;
	Audio *paudio = &audio_list[current_song];		

	//Progress to next note
	paudio->offset += 2;

	//end of audio?
	if( paudio->offset >= paudio->length-1 )
	{
		SOUND_stop();
		LED_set_enabled( 0 );
		return;
	}

	//Set the duration of this note
	RTC_set_top( (int) *(paudio->array_start + paudio->offset + 1) );

	//get next note
	current_note = (Note) *(paudio->array_start + paudio->offset);
	
	//Display LED for which note we are playing
	switch( current_note )
	{
		case C: bits = 1; break;
		case D: bits = 2; break;
		case E: bits = 4; break;
		case F: bits = 8; break;
		case G: bits = 16; break;
		case A: bits = 32; break;
		case B: bits = 64; break;
		default: bits = 0; break;
	}
	LED_set_enabled( bits );
}