Logo Search packages:      
Sourcecode: ecawave version File versions  Download package

void QEEvent::blocking_start ( void   )  [protected, inherited]

Starts processing. If processing takes long, a graphical progressbar is shown.

require: ectrl->is_valid() == true ectrl->is_selected() == true is_triggered() == false

ensure: is_triggered() == false

Definition at line 82 of file qeevent.cpp.

References QEEvent::is_triggered(), QEEvent::status_info(), QEEvent::toggle_result(), and QEEvent::toggle_triggered_state().

Referenced by QECutEvent::start(), and QEBlockingEvent::start().

                                 {
  // --------
  DBC_REQUIRE(ectrl->is_valid() == true);
  DBC_REQUIRE(ectrl->is_selected() == true);
  DBC_REQUIRE(is_triggered() == false);
  // --------

  try {
    ectrl->connect_chainsetup();
    if (ectrl->is_connected() != true) {
      QMessageBox* mbox = new QMessageBox(0, "mbox");
      mbox->information(0, "ecawave", QString("Error during operation!"), 0);
      toggle_result(false);
      return;
    }
    
    set_audio_object_params();

    ectrl->start();
    toggle_triggered_state(true);

    struct timespec sleepcount;
    sleepcount.tv_sec = 0;
    sleepcount.tv_nsec = 20000000;
    
    int progress_length = static_cast<int>(ectrl->length_in_seconds_exact() * 10.0);
    if (progress_length == 0 && input_object_repp != 0) 
      progress_length = static_cast<int>(input_object_repp->length_in_seconds_exact() * 10.0);
    if (progress_length == 0) progress_length = (1 << 23);
      
    double progress_start = ectrl->position_in_seconds_exact();

    QProgressDialog progress (status_info().c_str(), 0,
                        static_cast<int>(progress_length - progress_start * 10), 0, 0, true);

    progress.setProgress(0);
    progress.show();
    while(ectrl->is_finished() == false) {
      nanosleep(&sleepcount, NULL);
      progress.setProgress(static_cast<int>((ectrl->position_in_seconds_exact() - progress_start) * 10.0));
    }
    toggle_triggered_state(false);
    toggle_result(true);
  }
  catch(ECA_ERROR& e) {
    cerr << "---\nlibecasound error while processing event: [" << e.error_section() << "] : \"" << e.error_message() << "\"\n\n";
    toggle_result(false);
  }

  // --------
  DBC_ENSURE(is_triggered() == false);
  // --------
}


Generated by  Doxygen 1.6.0   Back to index