Example #1
0
void BACKUP_call_very_often(void){
  static bool has_inited = false;
  if (has_inited==false){
    RT_BACKUP_reset_timer();
    has_inited=true;
  }

  static bool is_playing = false;
  
  Player_State player_state = ATOMIC_GET(pc->player_state);
  
  if (!is_playing && player_state==PLAYER_STATE_PLAYING){
    is_playing = true;
    g_curr_playing_start_time = TIME_get_ms();
  }

  if (is_playing && player_state==PLAYER_STATE_STOPPED){
    is_playing = false;
    double added_playing_duration = TIME_get_ms() - g_curr_playing_start_time;
    g_curr_playing_duration += added_playing_duration;
  }

  if (is_playing)
    return;
  
  //printf("duration: %f\n",get_unbackuped_duration() / 1000.0);
  
  if (get_unbackuped_duration()  > get_backup_interval_ms()){
    make_backup();
    RT_BACKUP_reset_timer();
  }
}
Example #2
0
void BACKUP_call_very_often(void){
  if (MIXER_is_saving())
    return;

  if (g_radium_runs_custom_exec)
    return;
  
  static bool has_inited = false;
  if (has_inited==false){
    RT_BACKUP_reset_timer();
    has_inited=true;
  }

  if (!editor_has_keyboard_focus()) // If showing popup menu, editing text widgets, etc. we don't want to disturb the user.
    return;

  if (QApplication::mouseButtons() != Qt::NoButton) // Wait until user doesn't use the mouse.
    return;
  
  static bool is_playing = false;
  
  Player_State player_state = ATOMIC_GET(pc->player_state);
  
  if (!is_playing && player_state==PLAYER_STATE_PLAYING){
    is_playing = true;
    g_curr_playing_start_time = TIME_get_ms();
  }

  if (is_playing && player_state==PLAYER_STATE_STOPPED){
    is_playing = false;
    double added_playing_duration = TIME_get_ms() - g_curr_playing_start_time;
    g_curr_playing_duration += added_playing_duration;
  }

  if (!doSaveBackupWhilePlaying())
    if (is_playing)
      return;
  
  //printf("duration: %f\n",get_unbackuped_duration() / 1000.0);

  if (SampleRecorder_Get_Num_Instances() > 0)
    return;
  
  if (get_unbackuped_duration()  > get_backup_interval_ms()){
    make_backup();
    RT_BACKUP_reset_timer();
  }
}