void Controller::tick() {
	while (running) {
		process_input(getch());

		if (should_fetch_song()) {
			bool reload_playlist = finished_song();
			if (finished_song()) {
				timer.stop();
			}
			play_current_song(playlist.name, reload_playlist);
		}

		post_song();
		try {
		requests.tick();
		}
		catch (happyhttp::Wobbly &exception) {
			add_message("happyhttp exception %s", exception.what());
		}
		
		player_tick();
		try_cache_next_song();
		draw();
		std::this_thread::sleep_for(std::chrono::milliseconds(3));
	}

	player.stop_processing();
}
Beispiel #2
0
void heal_t::tick( dot_t* d )
{
  if ( sim -> debug )
    log_t::output( sim, "%s ticks (%d of %d)", name(), d -> current_tick, d -> num_ticks );

  result = RESULT_HIT;

  player_tick();

  target_debuff( heal_target[0], HEAL_OVER_TIME );

  if ( tick_may_crit )
  {
    if ( rng[ RESULT_CRIT ] -> roll( crit_chance( 0 ) ) )
    {
      result = RESULT_CRIT;
    }
  }

  tick_dmg = calculate_tick_damage();

  assess_damage( heal_target[0], tick_dmg, HEAL_OVER_TIME, result );

  if ( callbacks ) action_callback_t::trigger( player -> tick_callbacks[ result ], this );

  stats -> add_tick( d -> time_to_tick );
}
Beispiel #3
0
int Gate_Manager::tick(void) {
	Time_Value now(Time_Value::gettimeofday());
	tick_time_ = now;

	close_list_tick(now);
	player_tick(now);
	server_info_tick(now);
	object_pool_tick(now);
	//LOG->show_msg_time(now);
	return 0;
}
Beispiel #4
0
int main(int argc, char** argv) {
    int d,x;
    char *samps;
    
    //initialise AO
    ao_device *ao;
    ao_sample_format form;
    
    ao_initialize();
    d=ao_default_driver_id();
    form.bits=8;
    form.rate=DDS_FREQ;
    form.channels=1;
    form.byte_format=AO_FMT_NATIVE;
#ifdef TO_FILE
    ao=ao_open_file(ao_driver_id("wav"),"music.wav",1,&form,NULL);
#else
    ao=ao_open_live(d,&form,NULL);
    if (ao==NULL) {
	printf("Error opening device %d\n");
	exit(0);
    }    
#endif
    //Libao is opened and initialised now.

    //allocate sample buffer
    samps=malloc(AO_BUFF);
    d=0;
    //reset player
    player_reset();
    while(1) {
	//generate AO_BUFF samples, advance the player 60 times per second
	for (x=0; x<AO_BUFF; x++) {
	    d++;
	    if (d>(DDS_FREQ/PLAYER_FREQ)) {
		d=0;
		player_tick();
	    }
	    samps[x]=dds_get_next_sample()<<5;
	}
	//let libao play the samples
	ao_play(ao,samps,AO_BUFF);
    }
    //never happens because the while() above
    ao_close(ao);
    ao_shutdown();
}