Exemplo n.º 1
0
// Use this function if it is important that we don't return too early.
void OS_WaitAtLeast(int milliseconds) {
    double start_time = TIME_get_ms();

    OS_WaitForAShortTime(milliseconds);

    while( (TIME_get_ms()-start_time) < milliseconds)
        OS_WaitForAShortTime(10);
}
Exemplo n.º 2
0
static void PlayStopReally(bool doit){ 
	pc->isplaying=false;
	pc->initplaying=false;
        pc->playertask_has_been_called = false;
        pc->is_playing_range = false;
        
        printf("PlayStopReally called: %s\n",doit==true?"true":"false");

        if (PLAYER_current_thread_has_lock()){
          RError("Potential deadlock detected: Calling PlayStopReally while holding player lock.");
          return;
        }

        if (PLAYER_is_running())
          while(pc->peq!=NULL) OS_WaitForAShortTime(20);

	StopAllInstruments();

#if !USE_OPENGL
	if(doit) (*Ptask2MtaskCallBack)();
#endif

	pc->end_time=0;
        pc->end_time_f=0;

        pc->play_id++;

        struct Tracker_Windows *window = root->song->tracker_windows;
        struct WBlocks *wblock = window->wblock;

        ScrollEditorToRealLine(window,wblock,wblock->curr_realline);

#if !USE_OPENGL
        DrawWBlockSpesific(window,wblock,wblock->curr_realline,wblock->curr_realline); // clear cursor shade.
        UpdateAllWTracks(window,wblock,wblock->curr_realline,wblock->curr_realline); // same here.
#endif
        printf("[hb gakkgakk: %d\n",GC_dont_gc);
        PATCH_reset_time();

        //while(GC_is_disabled())
        while(GC_dont_gc>0)
          GC_enable();

        MIDI_insert_recorded_midi_events();
}
Exemplo n.º 3
0
// called very often
static void PlayHandleRangeLoop(void){

  struct Blocks *block = pc->block;
  
  if (pc->is_playing_range == false || block==NULL)
    return;

  //printf("duration: %d\nrealtime: %d\n\n", (int)duration, (int)pc->therealtime);

  
  STime start_therealtime = pc->therealtime;

  if (start_therealtime >= pc->range_duration/block->reltempo) {
    PlayRangeCurrPos(root->song->tracker_windows);
    int counter = 0;
    while (pc->therealtime == start_therealtime && counter < 50){ // Wait for the player to start up.
      OS_WaitForAShortTime(20);
      counter++;
    }
  }
}