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

void QECutEvent::start ( void   )  [virtual]

Start processing

Reimplemented from QEBlockingEvent.

Definition at line 52 of file qecutevent.cpp.

References QEEvent::blocking_start(), QEEvent::init(), QEEvent::set_default_audio_format(), QEEvent::set_input(), QEEvent::set_input_position(), QEEvent::set_length(), QEEvent::set_output(), QEEvent::set_output_position(), and QEEvent::status_info().

                           {
  // copy cut-area to clipboard
  status_info("Copying selected area to clipboard...");
  blocking_start(); 

  TEMPORARY_FILE_DIRECTORY tempfile_dir_rep;
  string tmpdir ("ecawave-");
  char* tmp_p = getenv("USER");
  if (tmp_p != NULL) {
    tmpdir += string(tmp_p);
    tempfile_dir_rep.reserve_directory(tmpdir);
  }
  if (tempfile_dir_rep.is_valid() != true) {
    status_info("Cut failed...");
    return;
  }

  // copy before-cut to temporary file
  string tmpfile = tempfile_dir_rep.create_filename("cut-tmp", ".wav");
  if (start_pos_rep != 0) {
    init("cutevent-phase2", "default");
    set_input(input_rep);
    set_input_position(0);
    set_default_audio_format(input_rep);
    ectrl->set_chainsetup_output_mode(AUDIO_IO::io_write);
    set_output(tmpfile);
    set_length(start_pos_rep);
    status_info("Copying begin to a temporary file...");
    blocking_start();
  }

  // copy after-cut to temporary file
  init("cutevent-phase3", "default");
  set_input(input_rep);
  set_input_position(start_pos_rep + length_rep);
  set_default_audio_format(input_rep);
  set_length(0);
  ectrl->set_chainsetup_output_mode(AUDIO_IO::io_readwrite);  
  set_output(tmpfile);
  set_output_position(start_pos_rep);
  status_info("Copying end to the temporary file...");
  blocking_start();

  // copy temporary over the input file  
  init("cutevent-phase4", "default");
  ectrl->set_chainsetup_output_mode(AUDIO_IO::io_write);
  set_input(tmpfile);
  set_default_audio_format(tmpfile);
  set_output(input_rep);
  set_length(0);
  status_info("Copying from the temporary file...");
  blocking_start();
  
  // remove the tempfile
  ::remove(tmpfile.c_str());
}


Generated by  Doxygen 1.6.0   Back to index