~ubuntu-branches/ubuntu/edgy/muse/edgy

« back to all changes in this revision

Viewing changes to muse/waveedit/waveview.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2006-01-03 20:18:47 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060103201847-r9poqt6y5gu9hnji
Tags: 0.7.1+0.7.2pre5-1
* New upstream version.
* Updated patches:
  + [20_allow_system_timer]
    Rediffed for 0.7.2pre5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//=========================================================
2
2
//  MusE
3
3
//  Linux Music Editor
4
 
//    $Id: waveview.cpp,v 1.10.2.7 2005/07/09 21:55:47 lunar_shuttle Exp $
 
4
//    $Id: waveview.cpp,v 1.10.2.8 2005/12/28 22:17:54 spamatica Exp $
5
5
//  (C) Copyright 2000 Werner Schweer (ws@seh.de)
6
6
//=========================================================
7
7
 
604
604
               for (unsigned i=0; i<file_channels; i++) {
605
605
                     tmpdata[i] = new float[tmpdatalen];
606
606
                     }
607
 
 
608
607
               file.seek(tmpdataoffset, 0);
609
608
               file.read(file_channels, tmpdata, tmpdatalen);
610
609
               file.close();
778
777
      exttmpFile.close();
779
778
 
780
779
      // Forkaborkabork
781
 
      int pid = vfork();
 
780
      int pid = fork();
782
781
      if (pid == 0) {
783
 
            if (execlp(config.externalWavEditor.latin1(), "", exttmpFileName.latin1(), 0) == -1) {
 
782
            if (execlp(config.externalWavEditor.latin1(), config.externalWavEditor.latin1(), exttmpFileName.latin1(), 0) == -1) {
784
783
                  perror("Failed to launch external editor");
785
784
                  // Get out of here
786
 
                  exit(-1);
787
 
                  }
 
785
                  
 
786
                   
 
787
                  // cannot report error through gui, we are in another fork!
788
788
                  //@!TODO: Handle unsuccessful attempts
 
789
                  exit(99);
 
790
                  }
 
791
            exit(0);
789
792
            }
790
793
      else if (pid == -1) {
791
794
            perror("fork failed");
792
795
            }
793
796
      else {
794
 
            waitpid(pid, 0, 0);
 
797
            int status;
 
798
            waitpid(pid, &status, 0);
 
799
            //printf ("status=%d\n",status);
 
800
            if( WEXITSTATUS(status) != 0 ){
 
801
                   QMessageBox::warning(this, tr("MusE - external editor failed"),
 
802
                         tr("MusE was unable to launch the external editor\ncheck if the editor setting in:\n"
 
803
                         "Global Settings->Audio:External Waveditor\nis set to a valid editor."));
 
804
            }
 
805
            
795
806
            if (exttmpFile.openRead()) {
796
 
                  printf("Could not reopen temporary file again!\n");
797
 
                  }
 
807
                printf("Could not reopen temporary file!\n");
 
808
                }
798
809
            else {
799
 
                  // Re-read file again
800
 
                  exttmpFile.seek(0, 0);
801
 
                  size_t sz = exttmpFile.read(file_channels, tmpdata, tmpdatalen);
802
 
                  if (sz != tmpdatalen) {
 
810
                // Re-read file again
 
811
                exttmpFile.seek(0, 0);
 
812
                size_t sz = exttmpFile.read(file_channels, tmpdata, tmpdatalen);
 
813
                if (sz != tmpdatalen) {
803
814
                        // File must have been shrunken - not good. Alert user.
804
815
                        QMessageBox::critical(this, tr("MusE - file size changed"),
805
 
                              tr("When editing in external editor - you should not change the filesize\nsince it must fit the selected region.\n\nMissing data is muted"));
 
816
                            tr("When editing in external editor - you should not change the filesize\nsince it must fit the selected region.\n\nMissing data is muted"));
806
817
                        for (unsigned i=0; i<file_channels; i++) {
807
 
                              for (unsigned j=sz; j<tmpdatalen; j++) {
 
818
                            for (unsigned j=sz; j<tmpdatalen; j++) {
808
819
                                    tmpdata[i][j] = 0;
809
820
                                    }
810
 
                              }
 
821
                            }
811
822
                        }
812
 
                  }
 
823
                }
813
824
            QDir dir = exttmpFile.dirPath();
814
825
            dir.remove(exttmpFileName);
815
826
            dir.remove(exttmpFile.basename() + ".wca");