author | llornkcor <llornkcor> | 2003-04-04 03:10:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-04 03:10:49 (UTC) |
commit | 96fb30ad1eb833bfcee87960bc96a27c53db90dd (patch) (unidiff) | |
tree | 329ca1700c0e2633fb7ff2d0a5842bf1625db66a | |
parent | 5e2e9b56fcd4db188caf69843bdd4ee92fcfaf11 (diff) | |
download | opie-96fb30ad1eb833bfcee87960bc96a27c53db90dd.zip opie-96fb30ad1eb833bfcee87960bc96a27c53db90dd.tar.gz opie-96fb30ad1eb833bfcee87960bc96a27c53db90dd.tar.bz2 |
qperec->opierec
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 54 | ||||
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 2 |
2 files changed, 28 insertions, 28 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 4223d93..8a0f8db 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -357,49 +357,49 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
357 | } //end main loop | 357 | } //end main loop |
358 | } | 358 | } |
359 | // qDebug("Final %d, %d", filePara.samplesToRecord , filePara.numberOfRecordedSeconds); | 359 | // qDebug("Final %d, %d", filePara.samplesToRecord , filePara.numberOfRecordedSeconds); |
360 | } /// END quickRec() | 360 | } /// END quickRec() |
361 | 361 | ||
362 | // threaded play | 362 | // threaded play |
363 | void playIt() { | 363 | void playIt() { |
364 | 364 | ||
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | 368 | ||
369 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | 369 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> |
370 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | 370 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> |
371 | 371 | ||
372 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | 372 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) |
373 | : QWidget( parent, name, fl ) { | 373 | : QWidget( parent, name, fl ) { |
374 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device | 374 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device |
375 | // autoMute=TRUE; | 375 | // autoMute=TRUE; |
376 | // QPEApplication::grabKeyboard(); | 376 | // QPEApplication::grabKeyboard(); |
377 | 377 | ||
378 | // signal(SIGPIPE, SIG_IGN); | 378 | // signal(SIGPIPE, SIG_IGN); |
379 | 379 | ||
380 | if ( !name ) | 380 | if ( !name ) |
381 | setName( "QpeRec" ); | 381 | setName( "OpieRec" ); |
382 | init(); | 382 | init(); |
383 | initConfig(); | 383 | initConfig(); |
384 | initConnections(); | 384 | initConnections(); |
385 | renameBox = 0; | 385 | renameBox = 0; |
386 | 386 | ||
387 | // open sound device to get volumes | 387 | // open sound device to get volumes |
388 | soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); | 388 | soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); |
389 | 389 | ||
390 | // soundDevice->setDeviceFormat(AFMT_S16_LE); | 390 | // soundDevice->setDeviceFormat(AFMT_S16_LE); |
391 | // soundDevice->setDeviceChannels(1); | 391 | // soundDevice->setDeviceChannels(1); |
392 | // soundDevice->setDeviceRate( 22050); | 392 | // soundDevice->setDeviceRate( 22050); |
393 | 393 | ||
394 | getInVol(); | 394 | getInVol(); |
395 | getOutVol(); | 395 | getOutVol(); |
396 | 396 | ||
397 | soundDevice->closeDevice( true); | 397 | soundDevice->closeDevice( true); |
398 | soundDevice->sd=-1; | 398 | soundDevice->sd=-1; |
399 | soundDevice=0; | 399 | soundDevice=0; |
400 | wavFile=0; | 400 | wavFile=0; |
401 | 401 | ||
402 | if(soundDevice) delete soundDevice; | 402 | if(soundDevice) delete soundDevice; |
403 | 403 | ||
404 | initIconView(); | 404 | initIconView(); |
405 | 405 | ||
@@ -419,49 +419,49 @@ void QtRec::cleanUp() { | |||
419 | stopped=true; | 419 | stopped=true; |
420 | endRecording(); | 420 | endRecording(); |
421 | } | 421 | } |
422 | 422 | ||
423 | ListView1->clear(); | 423 | ListView1->clear(); |
424 | 424 | ||
425 | if(autoMute) | 425 | if(autoMute) |
426 | doMute(false); | 426 | doMute(false); |
427 | 427 | ||
428 | if(wavFile) delete wavFile; | 428 | if(wavFile) delete wavFile; |
429 | // if(soundDevice) delete soundDevice; | 429 | // if(soundDevice) delete soundDevice; |
430 | 430 | ||
431 | // QPEApplication::grabKeyboard(); | 431 | // QPEApplication::grabKeyboard(); |
432 | // QPEApplication::ungrabKeyboard(); | 432 | // QPEApplication::ungrabKeyboard(); |
433 | } | 433 | } |
434 | 434 | ||
435 | void QtRec::init() { | 435 | void QtRec::init() { |
436 | 436 | ||
437 | needsStereoOut=false; | 437 | needsStereoOut=false; |
438 | QPixmap image3( ( const char** ) image3_data ); | 438 | QPixmap image3( ( const char** ) image3_data ); |
439 | QPixmap image4( ( const char** ) image4_data ); | 439 | QPixmap image4( ( const char** ) image4_data ); |
440 | QPixmap image6( ( const char** ) image6_data ); | 440 | QPixmap image6( ( const char** ) image6_data ); |
441 | 441 | ||
442 | stopped=true; | 442 | stopped=true; |
443 | setCaption( tr( "QpeRecord " ) + QString::number(VERSION) ); | 443 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
444 | QGridLayout *layout = new QGridLayout( this ); | 444 | QGridLayout *layout = new QGridLayout( this ); |
445 | layout->setSpacing( 2); | 445 | layout->setSpacing( 2); |
446 | layout->setMargin( 2); | 446 | layout->setMargin( 2); |
447 | 447 | ||
448 | TabWidget = new QTabWidget( this, "TabWidget" ); | 448 | TabWidget = new QTabWidget( this, "TabWidget" ); |
449 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); | 449 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); |
450 | // TabWidget->setTabShape(QTabWidget::Triangular); | 450 | // TabWidget->setTabShape(QTabWidget::Triangular); |
451 | 451 | ||
452 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 452 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
453 | tab = new QWidget( TabWidget, "tab" ); | 453 | tab = new QWidget( TabWidget, "tab" ); |
454 | 454 | ||
455 | QGridLayout *layout1 = new QGridLayout( tab); | 455 | QGridLayout *layout1 = new QGridLayout( tab); |
456 | layout1->setSpacing( 2); | 456 | layout1->setSpacing( 2); |
457 | layout1->setMargin( 2); | 457 | layout1->setMargin( 2); |
458 | 458 | ||
459 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); | 459 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); |
460 | // timeSlider->setFixedWidth(150); | 460 | // timeSlider->setFixedWidth(150); |
461 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); | 461 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); |
462 | // timeSlider->setTickmarks(QSlider::Above); | 462 | // timeSlider->setTickmarks(QSlider::Above); |
463 | 463 | ||
464 | timeLabel = new QLabel( tab, "TimeLabel" ); | 464 | timeLabel = new QLabel( tab, "TimeLabel" ); |
465 | layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); | 465 | layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); |
466 | 466 | ||
467 | playLabel2 = new QLabel(tab, "PlayLabel2" ); | 467 | playLabel2 = new QLabel(tab, "PlayLabel2" ); |
@@ -714,72 +714,72 @@ void QtRec::init() { | |||
714 | inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); | 714 | inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); |
715 | Layout15b->addWidget( inMuteCheckBox ); | 715 | Layout15b->addWidget( inMuteCheckBox ); |
716 | 716 | ||
717 | 717 | ||
718 | Layout19->addLayout( Layout15 ); | 718 | Layout19->addLayout( Layout15 ); |
719 | Layout19->addLayout( Layout15b ); | 719 | Layout19->addLayout( Layout15b ); |
720 | 720 | ||
721 | fillDirectoryCombo(); | 721 | fillDirectoryCombo(); |
722 | 722 | ||
723 | TabWidget->insertTab( tab_3, tr( "Options" ) ); | 723 | TabWidget->insertTab( tab_3, tr( "Options" ) ); |
724 | 724 | ||
725 | } | 725 | } |
726 | 726 | ||
727 | 727 | ||
728 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 728 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
729 | 729 | ||
730 | tab_4 = new QWidget( TabWidget, "tab_4" ); | 730 | tab_4 = new QWidget( TabWidget, "tab_4" ); |
731 | QGridLayout *layout4 = new QGridLayout( tab_4); | 731 | QGridLayout *layout4 = new QGridLayout( tab_4); |
732 | layout4->setSpacing( 2); | 732 | layout4->setSpacing( 2); |
733 | layout4->setMargin( 2); | 733 | layout4->setMargin( 2); |
734 | TabWidget->insertTab( tab_4, tr( "Help")); | 734 | TabWidget->insertTab( tab_4, tr( "Help")); |
735 | 735 | ||
736 | ///////////////////////////////////////////// FIXME change to a real helpfile path | 736 | ///////////////////////////////////////////// FIXME change to a real helpfile path |
737 | QString url="/index.html"; | 737 | QString url="/index.html"; |
738 | HelpWindow *help = new HelpWindow( url, ".", tab_4, "qperec_help"); | 738 | HelpWindow *help = new HelpWindow( url, ".", tab_4, "opierec_help"); |
739 | layout4->addMultiCellWidget( help, 0, 1, 0, 1); | 739 | layout4->addMultiCellWidget( help, 0, 1, 0, 1); |
740 | if( !QFile(url).exists()) { | 740 | if( !QFile(url).exists()) { |
741 | help->hide(); | 741 | help->hide(); |
742 | //help->showMaximized(); | 742 | //help->showMaximized(); |
743 | QLabel *helpLabel; | 743 | QLabel *helpLabel; |
744 | helpLabel = new QLabel( tab_4, "TimeLabel" ); | 744 | helpLabel = new QLabel( tab_4, "TimeLabel" ); |
745 | layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 ); | 745 | layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 ); |
746 | helpLabel->setText( "<B>QpeRec</B><br>" | 746 | helpLabel->setText( "<B>OpieRec</B><br>" |
747 | "Records files in standard wav format<br>" | 747 | "Records files in standard wav format<br>" |
748 | "or a compressed version<br>" | 748 | "or a compressed version<br>" |
749 | "For help, please email the author<br>" | 749 | "For help, please email the author<br>" |
750 | "<B>QpeRec</B> is copyright© 2002 by" | 750 | "<B>OpieRec</B> is copyright© 2002 by" |
751 | " L.J. Potter<br>llornkcor@handhelds.org<BR>" | 751 | " L.J. Potter<br>llornkcor@handhelds.org<BR>" |
752 | "and is licensed under the <B>QPL</B>"); | 752 | "and is licensed under the <B>QPL</B>"); |
753 | } | 753 | } |
754 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 754 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
755 | 755 | ||
756 | } | 756 | } |
757 | 757 | ||
758 | void QtRec::initIconView() { | 758 | void QtRec::initIconView() { |
759 | 759 | ||
760 | ListView1->clear(); | 760 | ListView1->clear(); |
761 | Config cfg("QpeRec"); | 761 | Config cfg("OpieRec"); |
762 | cfg.setGroup("Sounds"); | 762 | cfg.setGroup("Sounds"); |
763 | QString temp; | 763 | QString temp; |
764 | QPixmap image0( ( const char** ) image0_data ); | 764 | QPixmap image0( ( const char** ) image0_data ); |
765 | 765 | ||
766 | 766 | ||
767 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 767 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
768 | for(int i=1;i<= nFiles;i++) { | 768 | for(int i=1;i<= nFiles;i++) { |
769 | 769 | ||
770 | QListViewItem * item; | 770 | QListViewItem * item; |
771 | QString fileS, mediaLocation, fileDate, filePath; | 771 | QString fileS, mediaLocation, fileDate, filePath; |
772 | 772 | ||
773 | // temp.sprintf("%d",i); | 773 | // temp.sprintf("%d",i); |
774 | temp=cfg.readEntry(temp,""); //reads currentFile | 774 | temp=cfg.readEntry(temp,""); //reads currentFile |
775 | filePath = cfg.readEntry(temp,""); //currentFileName | 775 | filePath = cfg.readEntry(temp,""); //currentFileName |
776 | 776 | ||
777 | QFileInfo info(filePath); | 777 | QFileInfo info(filePath); |
778 | fileDate = info.lastModified().toString(); | 778 | fileDate = info.lastModified().toString(); |
779 | 779 | ||
780 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds | 780 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds |
781 | mediaLocation=getStorage( filePath); | 781 | mediaLocation=getStorage( filePath); |
782 | if(info.exists()) { | 782 | if(info.exists()) { |
783 | item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); | 783 | item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); |
784 | item->setPixmap( 0, image0); | 784 | item->setPixmap( 0, image0); |
785 | if(currentFileName == filePath) | 785 | if(currentFileName == filePath) |
@@ -802,49 +802,49 @@ void QtRec::initConnections() { | |||
802 | connect( OutputSlider, SIGNAL(sliderReleased()), this, SLOT( changedOutVolume()) ); | 802 | connect( OutputSlider, SIGNAL(sliderReleased()), this, SLOT( changedOutVolume()) ); |
803 | connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); | 803 | connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); |
804 | 804 | ||
805 | // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) ); | 805 | // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) ); |
806 | // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) ); | 806 | // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) ); |
807 | 807 | ||
808 | connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) ); | 808 | connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) ); |
809 | connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) ); | 809 | connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) ); |
810 | connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) ); | 810 | connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) ); |
811 | connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) ); | 811 | connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) ); |
812 | connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) ); | 812 | connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) ); |
813 | connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) ); | 813 | connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) ); |
814 | connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*))); | 814 | connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*))); |
815 | connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 815 | connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
816 | this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); | 816 | this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); |
817 | connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) )); | 817 | connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) )); |
818 | connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() )); | 818 | connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() )); |
819 | connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() )); | 819 | connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() )); |
820 | connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool))); | 820 | connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool))); |
821 | connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool))); | 821 | connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool))); |
822 | } | 822 | } |
823 | 823 | ||
824 | void QtRec::initConfig() { | 824 | void QtRec::initConfig() { |
825 | int index, fred, i; | 825 | int index, fred, i; |
826 | Config cfg("QpeRec"); | 826 | Config cfg("OpieRec"); |
827 | cfg.setGroup("Settings"); | 827 | cfg.setGroup("Settings"); |
828 | 828 | ||
829 | index = cfg.readNumEntry("samplerate",22050); | 829 | index = cfg.readNumEntry("samplerate",22050); |
830 | bool ok; | 830 | bool ok; |
831 | 831 | ||
832 | for(int ws=0;ws<sampleRateComboBox->count();ws++) { | 832 | for(int ws=0;ws<sampleRateComboBox->count();ws++) { |
833 | fred = sampleRateComboBox->text(ws).toInt(&ok, 10); | 833 | fred = sampleRateComboBox->text(ws).toInt(&ok, 10); |
834 | if(index == fred) { | 834 | if(index == fred) { |
835 | filePara.sampleRate = fred; | 835 | filePara.sampleRate = fred; |
836 | sampleRateComboBox->setCurrentItem(ws); | 836 | sampleRateComboBox->setCurrentItem(ws); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | 839 | ||
840 | i=cfg.readNumEntry("bitrate",16); | 840 | i=cfg.readNumEntry("bitrate",16); |
841 | if(i == 16) | 841 | if(i == 16) |
842 | bitRateComboBox->setCurrentItem( 0); | 842 | bitRateComboBox->setCurrentItem( 0); |
843 | else | 843 | else |
844 | bitRateComboBox->setCurrentItem( 1); | 844 | bitRateComboBox->setCurrentItem( 1); |
845 | filePara.resolution = i; | 845 | filePara.resolution = i; |
846 | 846 | ||
847 | i=cfg.readNumEntry("sizeLimit", 5 ); | 847 | i=cfg.readNumEntry("sizeLimit", 5 ); |
848 | QString temp; | 848 | QString temp; |
849 | // for(int i=1;i<13; i++) { | 849 | // for(int i=1;i<13; i++) { |
850 | // temp = sizeLimitCombo->text(i); | 850 | // temp = sizeLimitCombo->text(i); |
@@ -914,49 +914,49 @@ void QtRec::start() { //play | |||
914 | if( openPlayFile()) | 914 | if( openPlayFile()) |
915 | if( setupAudio( false)) //recording is false | 915 | if( setupAudio( false)) //recording is false |
916 | doPlay(); | 916 | doPlay(); |
917 | } | 917 | } |
918 | } | 918 | } |
919 | 919 | ||
920 | bool QtRec::rec() { //record | 920 | bool QtRec::rec() { //record |
921 | qDebug("rec()"); | 921 | qDebug("rec()"); |
922 | if(!stopped) { | 922 | if(!stopped) { |
923 | qDebug("rec:: !stopped"); | 923 | qDebug("rec:: !stopped"); |
924 | monitoring=true; | 924 | monitoring=true; |
925 | return false; | 925 | return false; |
926 | } else { | 926 | } else { |
927 | qDebug("go ahead and record"); | 927 | qDebug("go ahead and record"); |
928 | secCount=1; | 928 | secCount=1; |
929 | playLabel2->setText("Stop"); | 929 | playLabel2->setText("Stop"); |
930 | monitoring=false; | 930 | monitoring=false; |
931 | setRecordButton(true); | 931 | setRecordButton(true); |
932 | stopped=false; | 932 | stopped=false; |
933 | 933 | ||
934 | if( setupAudio( true)) | 934 | if( setupAudio( true)) |
935 | if(setUpFile()) { | 935 | if(setUpFile()) { |
936 | qDebug("Ok to start recording"); | 936 | qDebug("Ok to start recording"); |
937 | int fileSize=0; | 937 | int fileSize=0; |
938 | Config cfg("QpeRec"); | 938 | Config cfg("OpieRec"); |
939 | cfg.setGroup("Settings"); | 939 | cfg.setGroup("Settings"); |
940 | qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", | 940 | qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", |
941 | soundDevice->getDeviceBits(), | 941 | soundDevice->getDeviceBits(), |
942 | soundDevice->getDeviceRate(), | 942 | soundDevice->getDeviceRate(), |
943 | soundDevice->getDeviceChannels()); | 943 | soundDevice->getDeviceChannels()); |
944 | 944 | ||
945 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | 945 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); |
946 | qDebug("sample rate is %d", filePara.sampleRate); | 946 | qDebug("sample rate is %d", filePara.sampleRate); |
947 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 947 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
948 | 948 | ||
949 | qDebug("size limit %d sec", filePara.SecondsToRecord); | 949 | qDebug("size limit %d sec", filePara.SecondsToRecord); |
950 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 950 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
951 | 951 | ||
952 | if( filePara.SecondsToRecord == 0) { | 952 | if( filePara.SecondsToRecord == 0) { |
953 | fileSize = diskSize; | 953 | fileSize = diskSize; |
954 | } else if( filePara.format==WAVE_FORMAT_PCM) { | 954 | } else if( filePara.format==WAVE_FORMAT_PCM) { |
955 | qDebug("WAVE_FORMAT_PCM"); | 955 | qDebug("WAVE_FORMAT_PCM"); |
956 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 956 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
957 | * filePara.sampleRate *(filePara.resolution/8)+1000; | 957 | * filePara.sampleRate *(filePara.resolution/8)+1000; |
958 | } else { | 958 | } else { |
959 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | 959 | qDebug("WAVE_FORMAT_DVI_ADPCM"); |
960 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 960 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
961 | * filePara.sampleRate *(filePara.resolution/8) )/4+250; | 961 | * filePara.sampleRate *(filePara.resolution/8) )/4+250; |
962 | } | 962 | } |
@@ -1114,49 +1114,49 @@ bool QtRec::setupAudio( bool b) { | |||
1114 | soundDevice = new Device( this, dspString, mixerString, b); | 1114 | soundDevice = new Device( this, dspString, mixerString, b); |
1115 | // soundDevice->openDsp(); | 1115 | // soundDevice->openDsp(); |
1116 | soundDevice->reset(); | 1116 | soundDevice->reset(); |
1117 | 1117 | ||
1118 | qDebug("device has been made %d", soundDevice->sd); | 1118 | qDebug("device has been made %d", soundDevice->sd); |
1119 | 1119 | ||
1120 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> | 1120 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> |
1121 | soundDevice->setDeviceFormat( sampleformat); | 1121 | soundDevice->setDeviceFormat( sampleformat); |
1122 | soundDevice->setDeviceChannels( filePara.channels); | 1122 | soundDevice->setDeviceChannels( filePara.channels); |
1123 | soundDevice->setDeviceRate( filePara.sampleRate); | 1123 | soundDevice->setDeviceRate( filePara.sampleRate); |
1124 | soundDevice->getDeviceFragSize(); | 1124 | soundDevice->getDeviceFragSize(); |
1125 | #ifdef QT_QWS_EBX | 1125 | #ifdef QT_QWS_EBX |
1126 | int frag = FRAGSIZE; | 1126 | int frag = FRAGSIZE; |
1127 | soundDevice->setFragSize( frag); | 1127 | soundDevice->setFragSize( frag); |
1128 | soundDevice->getDeviceFragSize(); | 1128 | soundDevice->getDeviceFragSize(); |
1129 | #endif | 1129 | #endif |
1130 | ///////////////// | 1130 | ///////////////// |
1131 | filePara.sd = soundDevice->sd; | 1131 | filePara.sd = soundDevice->sd; |
1132 | 1132 | ||
1133 | if ( filePara.sd == -1) { | 1133 | if ( filePara.sd == -1) { |
1134 | 1134 | ||
1135 | monitoring=false; | 1135 | monitoring=false; |
1136 | stopped=true; | 1136 | stopped=true; |
1137 | update(); | 1137 | update(); |
1138 | setCaption( tr( "QpeRecord " ) + QString::number(VERSION) ); | 1138 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
1139 | stopped=true; | 1139 | stopped=true; |
1140 | return false; | 1140 | return false; |
1141 | } | 1141 | } |
1142 | if(autoMute) | 1142 | if(autoMute) |
1143 | doMute(false); | 1143 | doMute(false); |
1144 | 1144 | ||
1145 | return true; | 1145 | return true; |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | 1148 | ||
1149 | bool QtRec::setUpFile() { //setup file for recording | 1149 | bool QtRec::setUpFile() { //setup file for recording |
1150 | qDebug("Setting up wavfile"); | 1150 | qDebug("Setting up wavfile"); |
1151 | // if(wavFile) delete wavFile; | 1151 | // if(wavFile) delete wavFile; |
1152 | wavFile = new WavFile( this, (const QString &)"", | 1152 | wavFile = new WavFile( this, (const QString &)"", |
1153 | true, | 1153 | true, |
1154 | filePara.sampleRate, | 1154 | filePara.sampleRate, |
1155 | filePara.channels, | 1155 | filePara.channels, |
1156 | filePara.resolution, | 1156 | filePara.resolution, |
1157 | filePara.format); | 1157 | filePara.format); |
1158 | 1158 | ||
1159 | filePara.fd = wavFile->wavHandle(); | 1159 | filePara.fd = wavFile->wavHandle(); |
1160 | if(filePara.fd == -1) { | 1160 | if(filePara.fd == -1) { |
1161 | return false; | 1161 | return false; |
1162 | } else { | 1162 | } else { |
@@ -1310,129 +1310,129 @@ bool QtRec::doPlay() { | |||
1310 | timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); | 1310 | timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); |
1311 | timeLabel->setText( timeString + tr(" seconds")); | 1311 | timeLabel->setText( timeString + tr(" seconds")); |
1312 | qApp->processEvents(); | 1312 | qApp->processEvents(); |
1313 | 1313 | ||
1314 | if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) { | 1314 | if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) { |
1315 | stopped = true; | 1315 | stopped = true; |
1316 | endPlaying(); | 1316 | endPlaying(); |
1317 | } | 1317 | } |
1318 | // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); | 1318 | // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); |
1319 | // fflush(stdout); | 1319 | // fflush(stdout); |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | // qDebug("\nstopped or paused %d", total/4); | 1323 | // qDebug("\nstopped or paused %d", total/4); |
1324 | if(!paused && !stopped) { | 1324 | if(!paused && !stopped) { |
1325 | stopped = true; | 1325 | stopped = true; |
1326 | // endPlaying(); | 1326 | // endPlaying(); |
1327 | endPlaying(); | 1327 | endPlaying(); |
1328 | } | 1328 | } |
1329 | return true; | 1329 | return true; |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | 1332 | ||
1333 | void QtRec::changebitrateCombo(int i) { | 1333 | void QtRec::changebitrateCombo(int i) { |
1334 | Config cfg("QpeRec"); | 1334 | Config cfg("OpieRec"); |
1335 | cfg.setGroup("Settings"); | 1335 | cfg.setGroup("Settings"); |
1336 | int bits=0; | 1336 | int bits=0; |
1337 | if(i==0) { bits=16; } | 1337 | if(i==0) { bits=16; } |
1338 | else { bits=8; } | 1338 | else { bits=8; } |
1339 | cfg.writeEntry("bitrate", bits); | 1339 | cfg.writeEntry("bitrate", bits); |
1340 | filePara.resolution=bits; | 1340 | filePara.resolution=bits; |
1341 | cfg.write(); | 1341 | cfg.write(); |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | void QtRec::changesamplerateCombo(int i) { | 1344 | void QtRec::changesamplerateCombo(int i) { |
1345 | Config cfg("QpeRec"); | 1345 | Config cfg("OpieRec"); |
1346 | cfg.setGroup("Settings"); | 1346 | cfg.setGroup("Settings"); |
1347 | int rate=0; | 1347 | int rate=0; |
1348 | bool ok; | 1348 | bool ok; |
1349 | rate = sampleRateComboBox->text(i).toInt(&ok, 10); | 1349 | rate = sampleRateComboBox->text(i).toInt(&ok, 10); |
1350 | cfg.writeEntry("samplerate",rate); | 1350 | cfg.writeEntry("samplerate",rate); |
1351 | filePara.sampleRate=rate; | 1351 | filePara.sampleRate=rate; |
1352 | /* soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXER, false); | 1352 | /* soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXER, false); |
1353 | soundDevice->openDsp();*/ | 1353 | soundDevice->openDsp();*/ |
1354 | // | 1354 | // |
1355 | // soundDevice->setDeviceFormat(AFMT_S16_LE); | 1355 | // soundDevice->setDeviceFormat(AFMT_S16_LE); |
1356 | // soundDevice->setDeviceChannels(filePara.channels); | 1356 | // soundDevice->setDeviceChannels(filePara.channels); |
1357 | // soundDevice->setDeviceRate(filePara.sampleRate); | 1357 | // soundDevice->setDeviceRate(filePara.sampleRate); |
1358 | // | 1358 | // |
1359 | // soundDevice->closeDevice( true); | 1359 | // soundDevice->closeDevice( true); |
1360 | // soundDevice=0; | 1360 | // soundDevice=0; |
1361 | // delete soundDevice; | 1361 | // delete soundDevice; |
1362 | qDebug("Change sample rate %d", rate); | 1362 | qDebug("Change sample rate %d", rate); |
1363 | cfg.write(); | 1363 | cfg.write(); |
1364 | 1364 | ||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | 1367 | ||
1368 | void QtRec::changeDirCombo(int index) { | 1368 | void QtRec::changeDirCombo(int index) { |
1369 | Config cfg("QpeRec"); | 1369 | Config cfg("OpieRec"); |
1370 | cfg.setGroup("Settings"); | 1370 | cfg.setGroup("Settings"); |
1371 | QString sName = directoryComboBox->text(index); | 1371 | QString sName = directoryComboBox->text(index); |
1372 | 1372 | ||
1373 | StorageInfo storageInfo; | 1373 | StorageInfo storageInfo; |
1374 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1374 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1375 | QListIterator<FileSystem> it ( fs ); | 1375 | QListIterator<FileSystem> it ( fs ); |
1376 | QString storage; | 1376 | QString storage; |
1377 | for( ; it.current(); ++it ){ | 1377 | for( ; it.current(); ++it ){ |
1378 | if( sName == (*it)->name()+" "+ (*it)->path() || | 1378 | if( sName == (*it)->name()+" "+ (*it)->path() || |
1379 | (*it)->name() == sName ) { | 1379 | (*it)->name() == sName ) { |
1380 | const QString path = (*it)->path(); | 1380 | const QString path = (*it)->path(); |
1381 | recDir = path; | 1381 | recDir = path; |
1382 | cfg.writeEntry("directory", recDir); | 1382 | cfg.writeEntry("directory", recDir); |
1383 | qDebug("new rec dir "+recDir); | 1383 | qDebug("new rec dir "+recDir); |
1384 | } | 1384 | } |
1385 | } | 1385 | } |
1386 | cfg.write(); | 1386 | cfg.write(); |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | 1389 | ||
1390 | void QtRec::changeSizeLimitCombo(int) { | 1390 | void QtRec::changeSizeLimitCombo(int) { |
1391 | Config cfg("QpeRec"); | 1391 | Config cfg("OpieRec"); |
1392 | cfg.setGroup("Settings"); | 1392 | cfg.setGroup("Settings"); |
1393 | cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); | 1393 | cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); |
1394 | cfg.write(); | 1394 | cfg.write(); |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | void QtRec::newSound() { | 1397 | void QtRec::newSound() { |
1398 | qDebug("<<<<<<<<<new sound"); | 1398 | qDebug("<<<<<<<<<new sound"); |
1399 | 1399 | ||
1400 | if( !rec()) { | 1400 | if( !rec()) { |
1401 | qDebug("rec() failed"); | 1401 | qDebug("rec() failed"); |
1402 | endRecording(); | 1402 | endRecording(); |
1403 | deleteSound(); | 1403 | deleteSound(); |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | void QtRec::itClick(QListViewItem *item) { | 1408 | void QtRec::itClick(QListViewItem *item) { |
1409 | currentFile=item->text(0); | 1409 | currentFile=item->text(0); |
1410 | setCaption("QpeRecord "+currentFile); | 1410 | setCaption("OpieRecord "+currentFile); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void QtRec::deleteSound() { | 1413 | void QtRec::deleteSound() { |
1414 | Config cfg("QpeRec"); | 1414 | Config cfg("OpieRec"); |
1415 | cfg.setGroup("Sounds"); | 1415 | cfg.setGroup("Sounds"); |
1416 | if( ListView1->currentItem() == NULL) | 1416 | if( ListView1->currentItem() == NULL) |
1417 | return; | 1417 | return; |
1418 | #ifndef DEV_VERSION | 1418 | #ifndef DEV_VERSION |
1419 | switch ( QMessageBox::warning(this,tr("Delete"), | 1419 | switch ( QMessageBox::warning(this,tr("Delete"), |
1420 | tr("Do you really want to <font size=+2><B>DELETE</B></font>\nthe selected file?"), | 1420 | tr("Do you really want to <font size=+2><B>DELETE</B></font>\nthe selected file?"), |
1421 | tr("Yes"),tr("No"),0,1,1) ) { | 1421 | tr("Yes"),tr("No"),0,1,1) ) { |
1422 | case 0: | 1422 | case 0: |
1423 | #endif | 1423 | #endif |
1424 | { | 1424 | { |
1425 | QString file = ListView1->currentItem()->text(0); | 1425 | QString file = ListView1->currentItem()->text(0); |
1426 | // qDebug("Filename to find is "+file); | 1426 | // qDebug("Filename to find is "+file); |
1427 | QString fileName; | 1427 | QString fileName; |
1428 | fileName = cfg.readEntry( file, ""); | 1428 | fileName = cfg.readEntry( file, ""); |
1429 | QFile f(fileName); | 1429 | QFile f(fileName); |
1430 | // qDebug("fileName is "+fileName); | 1430 | // qDebug("fileName is "+fileName); |
1431 | if(f.exists()) | 1431 | if(f.exists()) |
1432 | if( !f.remove()) | 1432 | if( !f.remove()) |
1433 | QMessageBox::message(tr("Error"),tr("Could not remove file.")); | 1433 | QMessageBox::message(tr("Error"),tr("Could not remove file.")); |
1434 | 1434 | ||
1435 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1435 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1436 | bool found=false; | 1436 | bool found=false; |
1437 | for(int i=0;i<nFiles+1;i++) { | 1437 | for(int i=0;i<nFiles+1;i++) { |
1438 | // qDebug(cfg.readEntry(QString::number(i))); | 1438 | // qDebug(cfg.readEntry(QString::number(i))); |
@@ -1443,49 +1443,49 @@ void QtRec::deleteSound() { | |||
1443 | cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); | 1443 | cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); |
1444 | } | 1444 | } |
1445 | if(found) | 1445 | if(found) |
1446 | cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); | 1446 | cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | cfg.removeEntry(cfg.readEntry(file)); | 1449 | cfg.removeEntry(cfg.readEntry(file)); |
1450 | cfg.removeEntry( file); | 1450 | cfg.removeEntry( file); |
1451 | // cfg.removeEntry( QString::number(nFiles)); | 1451 | // cfg.removeEntry( QString::number(nFiles)); |
1452 | cfg.writeEntry("NumberofFiles", nFiles-1); | 1452 | cfg.writeEntry("NumberofFiles", nFiles-1); |
1453 | cfg.write(); | 1453 | cfg.write(); |
1454 | 1454 | ||
1455 | ListView1->takeItem( ListView1->currentItem() ); | 1455 | ListView1->takeItem( ListView1->currentItem() ); |
1456 | // ListView1->takeItem( ListView1->itemAt(nFiles) ); | 1456 | // ListView1->takeItem( ListView1->itemAt(nFiles) ); |
1457 | delete ListView1->currentItem(); | 1457 | delete ListView1->currentItem(); |
1458 | 1458 | ||
1459 | ListView1->clear(); | 1459 | ListView1->clear(); |
1460 | ListView1->setSelected(ListView1->firstChild(), true); | 1460 | ListView1->setSelected(ListView1->firstChild(), true); |
1461 | initIconView(); | 1461 | initIconView(); |
1462 | update(); | 1462 | update(); |
1463 | } | 1463 | } |
1464 | #ifndef DEV_VERSION | 1464 | #ifndef DEV_VERSION |
1465 | }; | 1465 | }; |
1466 | #endif | 1466 | #endif |
1467 | setCaption( tr( "QpeRecord " ) + QString::number(VERSION) ); | 1467 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
1468 | 1468 | ||
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | void QtRec::keyPressEvent( QKeyEvent *e) { | 1471 | void QtRec::keyPressEvent( QKeyEvent *e) { |
1472 | 1472 | ||
1473 | switch ( e->key() ) { | 1473 | switch ( e->key() ) { |
1474 | /* | 1474 | /* |
1475 | vercel keys-> | 1475 | vercel keys-> |
1476 | right side | 1476 | right side |
1477 | 0 | 1477 | 0 |
1478 | 1 0x1030 Key_F1 | 1478 | 1 0x1030 Key_F1 |
1479 | 2 0x1031 Key_F2 | 1479 | 2 0x1031 Key_F2 |
1480 | 3 0x1032 Key_F3 | 1480 | 3 0x1032 Key_F3 |
1481 | 4 0x1016 Key_PageUp | 1481 | 4 0x1016 Key_PageUp |
1482 | 5 0x1017 Key_PageDown | 1482 | 5 0x1017 Key_PageDown |
1483 | 6 | 1483 | 6 |
1484 | --------------- | 1484 | --------------- |
1485 | left side | 1485 | left side |
1486 | Up 0x1013 Key_Up | 1486 | Up 0x1013 Key_Up |
1487 | Down 0x1015 Key_Down | 1487 | Down 0x1015 Key_Down |
1488 | Left 0x1012 Key_Left | 1488 | Left 0x1012 Key_Left |
1489 | Right 0x1014 Key_Right | 1489 | Right 0x1014 Key_Right |
1490 | 0x1010 Key_Home | 1490 | 0x1010 Key_Home |
1491 | 1491 | ||
@@ -1617,49 +1617,49 @@ void QtRec::endRecording() { | |||
1617 | 1617 | ||
1618 | soundDevice->closeDevice( true); | 1618 | soundDevice->closeDevice( true); |
1619 | 1619 | ||
1620 | recording = false; | 1620 | recording = false; |
1621 | stopped=true; | 1621 | stopped=true; |
1622 | t->stop(); | 1622 | t->stop(); |
1623 | 1623 | ||
1624 | if( wavFile->track.isOpen()) { | 1624 | if( wavFile->track.isOpen()) { |
1625 | wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); | 1625 | wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); |
1626 | // soundDevice->sd=-1; | 1626 | // soundDevice->sd=-1; |
1627 | filePara.numberSamples=0; | 1627 | filePara.numberSamples=0; |
1628 | // filePara.sd=-1; | 1628 | // filePara.sd=-1; |
1629 | wavFile->closeFile(); | 1629 | wavFile->closeFile(); |
1630 | filePara.fd=0; | 1630 | filePara.fd=0; |
1631 | 1631 | ||
1632 | if(wavFile->isTempFile()) { | 1632 | if(wavFile->isTempFile()) { |
1633 | // move tmp file to regular file | 1633 | // move tmp file to regular file |
1634 | QString cmd; | 1634 | QString cmd; |
1635 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); | 1635 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); |
1636 | qDebug("moving tmp file to "+currentFileName); | 1636 | qDebug("moving tmp file to "+currentFileName); |
1637 | system(cmd.latin1()); | 1637 | system(cmd.latin1()); |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | qDebug("Just moved "+wavFile->currentFileName); | 1640 | qDebug("Just moved "+wavFile->currentFileName); |
1641 | Config cfg("QpeRec"); | 1641 | Config cfg("OpieRec"); |
1642 | cfg.setGroup("Sounds"); | 1642 | cfg.setGroup("Sounds"); |
1643 | 1643 | ||
1644 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); | 1644 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); |
1645 | 1645 | ||
1646 | currentFile = QFileInfo(wavFile->currentFileName).fileName(); | 1646 | currentFile = QFileInfo(wavFile->currentFileName).fileName(); |
1647 | currentFile=currentFile.left(currentFile.length()-4); | 1647 | currentFile=currentFile.left(currentFile.length()-4); |
1648 | 1648 | ||
1649 | cfg.writeEntry( "NumberofFiles",nFiles+1); | 1649 | cfg.writeEntry( "NumberofFiles",nFiles+1); |
1650 | cfg.writeEntry( QString::number( nFiles+1), currentFile); | 1650 | cfg.writeEntry( QString::number( nFiles+1), currentFile); |
1651 | cfg.writeEntry( currentFile, wavFile->currentFileName); | 1651 | cfg.writeEntry( currentFile, wavFile->currentFileName); |
1652 | 1652 | ||
1653 | QString time; | 1653 | QString time; |
1654 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 1654 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
1655 | cfg.writeEntry( wavFile->currentFileName, time ); | 1655 | cfg.writeEntry( wavFile->currentFileName, time ); |
1656 | qDebug("writing config numberOfRecordedSeconds "+time); | 1656 | qDebug("writing config numberOfRecordedSeconds "+time); |
1657 | 1657 | ||
1658 | cfg.write(); | 1658 | cfg.write(); |
1659 | qDebug("finished recording"); | 1659 | qDebug("finished recording"); |
1660 | timeLabel->setText(""); | 1660 | timeLabel->setText(""); |
1661 | } | 1661 | } |
1662 | 1662 | ||
1663 | if(soundDevice) delete soundDevice; | 1663 | if(soundDevice) delete soundDevice; |
1664 | 1664 | ||
1665 | initIconView(); | 1665 | initIconView(); |
@@ -1683,190 +1683,190 @@ void QtRec::endPlaying() { | |||
1683 | qDebug("file and sound device closed"); | 1683 | qDebug("file and sound device closed"); |
1684 | stopped=true; | 1684 | stopped=true; |
1685 | recording=false; | 1685 | recording=false; |
1686 | playing=false; | 1686 | playing=false; |
1687 | timeLabel->setText(""); | 1687 | timeLabel->setText(""); |
1688 | monitoring=false; | 1688 | monitoring=false; |
1689 | total = 0; | 1689 | total = 0; |
1690 | filePara.numberSamples=0; | 1690 | filePara.numberSamples=0; |
1691 | filePara.sd=-1; | 1691 | filePara.sd=-1; |
1692 | wavFile->closeFile(); | 1692 | wavFile->closeFile(); |
1693 | filePara.fd=0; | 1693 | filePara.fd=0; |
1694 | // if(wavFile) delete wavFile; //this crashes | 1694 | // if(wavFile) delete wavFile; //this crashes |
1695 | 1695 | ||
1696 | qDebug("track closed"); | 1696 | qDebug("track closed"); |
1697 | timeSlider->setValue(0); | 1697 | timeSlider->setValue(0); |
1698 | 1698 | ||
1699 | if(soundDevice) delete soundDevice; | 1699 | if(soundDevice) delete soundDevice; |
1700 | 1700 | ||
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | bool QtRec::openPlayFile() { | 1703 | bool QtRec::openPlayFile() { |
1704 | 1704 | ||
1705 | qApp->processEvents(); | 1705 | qApp->processEvents(); |
1706 | if( currentFile.isEmpty()) { | 1706 | if( currentFile.isEmpty()) { |
1707 | QMessageBox::message(tr("Qperec"),tr("Please select file to play")); | 1707 | QMessageBox::message(tr("Opierec"),tr("Please select file to play")); |
1708 | endPlaying(); | 1708 | endPlaying(); |
1709 | return false; | 1709 | return false; |
1710 | } | 1710 | } |
1711 | QString currentFileName; | 1711 | QString currentFileName; |
1712 | Config cfg("QpeRec"); | 1712 | Config cfg("OpieRec"); |
1713 | cfg.setGroup("Sounds"); | 1713 | cfg.setGroup("Sounds"); |
1714 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1714 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1715 | for(int i=0;i<nFiles+1;i++) { //look for file | 1715 | for(int i=0;i<nFiles+1;i++) { //look for file |
1716 | if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { | 1716 | if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { |
1717 | currentFileName=cfg.readEntry( currentFile, "" ); | 1717 | currentFileName=cfg.readEntry( currentFile, "" ); |
1718 | qDebug("opening for play: "+currentFileName); | 1718 | qDebug("opening for play: "+currentFileName); |
1719 | } | 1719 | } |
1720 | } | 1720 | } |
1721 | wavFile = new WavFile(this, | 1721 | wavFile = new WavFile(this, |
1722 | currentFileName, | 1722 | currentFileName, |
1723 | false); | 1723 | false); |
1724 | filePara.fd = wavFile->wavHandle(); | 1724 | filePara.fd = wavFile->wavHandle(); |
1725 | if(filePara.fd == -1) { | 1725 | if(filePara.fd == -1) { |
1726 | // if(!track.open(IO_ReadOnly)) { | 1726 | // if(!track.open(IO_ReadOnly)) { |
1727 | QString errorMsg=(QString)strerror(errno); | 1727 | QString errorMsg=(QString)strerror(errno); |
1728 | monitoring=false; | 1728 | monitoring=false; |
1729 | setCaption( tr( "QpeRecord " ) + QString::number(VERSION) ); | 1729 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
1730 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") | 1730 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") |
1731 | +errorMsg+"\n"+currentFile); | 1731 | +errorMsg+"\n"+currentFile); |
1732 | return false; | 1732 | return false; |
1733 | } else { | 1733 | } else { |
1734 | filePara.numberSamples=wavFile->getNumberSamples(); | 1734 | filePara.numberSamples=wavFile->getNumberSamples(); |
1735 | filePara.format = wavFile->getFormat(); | 1735 | filePara.format = wavFile->getFormat(); |
1736 | // qDebug("file %d, samples %f", filePara.fd, filePara.numberSamples); | 1736 | // qDebug("file %d, samples %f", filePara.fd, filePara.numberSamples); |
1737 | filePara.sampleRate= wavFile->getSampleRate(); | 1737 | filePara.sampleRate= wavFile->getSampleRate(); |
1738 | filePara.resolution=wavFile->getResolution(); | 1738 | filePara.resolution=wavFile->getResolution(); |
1739 | timeSlider->setPageStep(1); | 1739 | timeSlider->setPageStep(1); |
1740 | monitoring=true; | 1740 | monitoring=true; |
1741 | timeSlider->setRange(0, filePara.numberSamples ); | 1741 | timeSlider->setRange(0, filePara.numberSamples ); |
1742 | filePara.numberOfRecordedSeconds=(float) filePara.numberSamples / (float)filePara.sampleRate * (float)2; | 1742 | filePara.numberOfRecordedSeconds=(float) filePara.numberSamples / (float)filePara.sampleRate * (float)2; |
1743 | } | 1743 | } |
1744 | 1744 | ||
1745 | return true; | 1745 | return true; |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { | 1748 | void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { |
1749 | if(item == NULL ) | 1749 | if(item == NULL ) |
1750 | return; | 1750 | return; |
1751 | switch (mouse) { | 1751 | switch (mouse) { |
1752 | case 1: { | 1752 | case 1: { |
1753 | if( renameBox !=0 ) //tricky | 1753 | if( renameBox !=0 ) //tricky |
1754 | cancelRename(); | 1754 | cancelRename(); |
1755 | 1755 | ||
1756 | currentFile=item->text(0); | 1756 | currentFile=item->text(0); |
1757 | setCaption( "QpeRecord "+currentFile); | 1757 | setCaption( "OpieRecord "+currentFile); |
1758 | } | 1758 | } |
1759 | break; | 1759 | break; |
1760 | case 2: | 1760 | case 2: |
1761 | showListMenu(item); | 1761 | showListMenu(item); |
1762 | ListView1->clearSelection(); | 1762 | ListView1->clearSelection(); |
1763 | break; | 1763 | break; |
1764 | }; | 1764 | }; |
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | void QtRec::showListMenu(QListViewItem * item) { | 1767 | void QtRec::showListMenu(QListViewItem * item) { |
1768 | if(item == NULL) | 1768 | if(item == NULL) |
1769 | return; | 1769 | return; |
1770 | QPopupMenu *m = new QPopupMenu(this); | 1770 | QPopupMenu *m = new QPopupMenu(this); |
1771 | m->insertItem( tr("Play"), this, SLOT( doMenuPlay() )); | 1771 | m->insertItem( tr("Play"), this, SLOT( doMenuPlay() )); |
1772 | if(Ir::supported()) m->insertItem( tr( "Send with Ir" ), this, SLOT( doBeam() )); | 1772 | if(Ir::supported()) m->insertItem( tr( "Send with Ir" ), this, SLOT( doBeam() )); |
1773 | m->insertItem( tr( "Rename" ), this, SLOT( doRename() )); | 1773 | m->insertItem( tr( "Rename" ), this, SLOT( doRename() )); |
1774 | // #if defined (QTOPIA_INTERNAL_FSLP) | 1774 | // #if defined (QTOPIA_INTERNAL_FSLP) |
1775 | // m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 1775 | // m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
1776 | // #endif | 1776 | // #endif |
1777 | m->insertSeparator(); | 1777 | m->insertSeparator(); |
1778 | m->insertItem( tr("Delete"), this, SLOT( deleteSound() ) ); | 1778 | m->insertItem( tr("Delete"), this, SLOT( deleteSound() ) ); |
1779 | m->exec( QCursor::pos() ); | 1779 | m->exec( QCursor::pos() ); |
1780 | qApp->processEvents(); | 1780 | qApp->processEvents(); |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | void QtRec::fileBeamFinished( Ir *ir) { | 1783 | void QtRec::fileBeamFinished( Ir *ir) { |
1784 | if(ir) | 1784 | if(ir) |
1785 | QMessageBox::message( tr("Ir Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1785 | QMessageBox::message( tr("Ir Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1786 | 1786 | ||
1787 | } | 1787 | } |
1788 | 1788 | ||
1789 | void QtRec::doBeam() { | 1789 | void QtRec::doBeam() { |
1790 | qApp->processEvents(); | 1790 | qApp->processEvents(); |
1791 | if( ListView1->currentItem() == NULL) | 1791 | if( ListView1->currentItem() == NULL) |
1792 | return; | 1792 | return; |
1793 | Ir ir; | 1793 | Ir ir; |
1794 | if( ir.supported()) { | 1794 | if( ir.supported()) { |
1795 | QString file = ListView1->currentItem()->text(0); | 1795 | QString file = ListView1->currentItem()->text(0); |
1796 | Config cfg("QpeRec"); | 1796 | Config cfg("OpieRec"); |
1797 | cfg.setGroup("Sounds"); | 1797 | cfg.setGroup("Sounds"); |
1798 | 1798 | ||
1799 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1799 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1800 | 1800 | ||
1801 | for(int i=0;i<nFiles+1;i++) { | 1801 | for(int i=0;i<nFiles+1;i++) { |
1802 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { | 1802 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { |
1803 | QString filePath = cfg.readEntry(file,""); | 1803 | QString filePath = cfg.readEntry(file,""); |
1804 | Ir *file = new Ir(this, "IR"); | 1804 | Ir *file = new Ir(this, "IR"); |
1805 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1805 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1806 | file->send( filePath, "QpeRec audio file\n"+filePath ); | 1806 | file->send( filePath, "OPieRec audio file\n"+filePath ); |
1807 | } | 1807 | } |
1808 | } | 1808 | } |
1809 | } | 1809 | } |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | void QtRec::doMenuPlay() { | 1812 | void QtRec::doMenuPlay() { |
1813 | qApp->processEvents(); | 1813 | qApp->processEvents(); |
1814 | currentFile = ListView1->currentItem()->text(0); | 1814 | currentFile = ListView1->currentItem()->text(0); |
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | void QtRec::doRename() { | 1817 | void QtRec::doRename() { |
1818 | QRect r = ListView1->itemRect( ListView1->currentItem( )); | 1818 | QRect r = ListView1->itemRect( ListView1->currentItem( )); |
1819 | r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() ); | 1819 | r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() ); |
1820 | r.setX( ListView1->contentsX() ); | 1820 | r.setX( ListView1->contentsX() ); |
1821 | if ( r.width() > ListView1->visibleWidth() ) | 1821 | if ( r.width() > ListView1->visibleWidth() ) |
1822 | r.setWidth( ListView1->visibleWidth() ); | 1822 | r.setWidth( ListView1->visibleWidth() ); |
1823 | 1823 | ||
1824 | renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" ); | 1824 | renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" ); |
1825 | renameBox->setFrame(true); | 1825 | renameBox->setFrame(true); |
1826 | 1826 | ||
1827 | renameBox->setText( ListView1->currentItem()->text(0) ); | 1827 | renameBox->setText( ListView1->currentItem()->text(0) ); |
1828 | 1828 | ||
1829 | renameBox->selectAll(); | 1829 | renameBox->selectAll(); |
1830 | renameBox->installEventFilter( this ); | 1830 | renameBox->installEventFilter( this ); |
1831 | ListView1->addChild( renameBox, r.x(), r.y() ); | 1831 | ListView1->addChild( renameBox, r.x(), r.y() ); |
1832 | renameBox->resize( r.size() ); | 1832 | renameBox->resize( r.size() ); |
1833 | ListView1->viewport()->setFocusProxy( renameBox ); | 1833 | ListView1->viewport()->setFocusProxy( renameBox ); |
1834 | renameBox->setFocus(); | 1834 | renameBox->setFocus(); |
1835 | renameBox->show(); | 1835 | renameBox->show(); |
1836 | 1836 | ||
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | void QtRec::okRename() { | 1839 | void QtRec::okRename() { |
1840 | qDebug("okRename"); | 1840 | qDebug("okRename"); |
1841 | qDebug(renameBox->text()); | 1841 | qDebug(renameBox->text()); |
1842 | QString filename = renameBox->text(); | 1842 | QString filename = renameBox->text(); |
1843 | cancelRename(); | 1843 | cancelRename(); |
1844 | 1844 | ||
1845 | if( ListView1->currentItem() == NULL) | 1845 | if( ListView1->currentItem() == NULL) |
1846 | return; | 1846 | return; |
1847 | 1847 | ||
1848 | Config cfg("QpeRec"); | 1848 | Config cfg("OpieRec"); |
1849 | cfg.setGroup("Sounds"); | 1849 | cfg.setGroup("Sounds"); |
1850 | 1850 | ||
1851 | QString file = ListView1->currentItem()->text(0); | 1851 | QString file = ListView1->currentItem()->text(0); |
1852 | 1852 | ||
1853 | qDebug("filename is " + filename); | 1853 | qDebug("filename is " + filename); |
1854 | 1854 | ||
1855 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1855 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1856 | 1856 | ||
1857 | for(int i=0;i<nFiles+1;i++) { //look for file | 1857 | for(int i=0;i<nFiles+1;i++) { //look for file |
1858 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { | 1858 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { |
1859 | 1859 | ||
1860 | QString filePath = cfg.readEntry(file,""); | 1860 | QString filePath = cfg.readEntry(file,""); |
1861 | 1861 | ||
1862 | cfg.writeEntry( QString::number(i), filename ); | 1862 | cfg.writeEntry( QString::number(i), filename ); |
1863 | cfg.writeEntry( filename, filePath ); | 1863 | cfg.writeEntry( filename, filePath ); |
1864 | cfg.removeEntry(file); | 1864 | cfg.removeEntry(file); |
1865 | cfg.write(); | 1865 | cfg.write(); |
1866 | } | 1866 | } |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | ListView1->takeItem( ListView1->currentItem() ); | 1869 | ListView1->takeItem( ListView1->currentItem() ); |
1870 | delete ListView1->currentItem(); | 1870 | delete ListView1->currentItem(); |
1871 | ListView1->clear(); | 1871 | ListView1->clear(); |
1872 | initIconView(); | 1872 | initIconView(); |
@@ -1911,49 +1911,49 @@ int QtRec::getCurrentSizeLimit() { | |||
1911 | 1911 | ||
1912 | void QtRec::timerBreak() { | 1912 | void QtRec::timerBreak() { |
1913 | qDebug("timer break"); | 1913 | qDebug("timer break"); |
1914 | stop(); | 1914 | stop(); |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | void QtRec::doVolMuting(bool b) { | 1917 | void QtRec::doVolMuting(bool b) { |
1918 | Config cfg( "qpe" ); | 1918 | Config cfg( "qpe" ); |
1919 | cfg. setGroup( "Volume" ); | 1919 | cfg. setGroup( "Volume" ); |
1920 | cfg.writeEntry( "Mute",b); | 1920 | cfg.writeEntry( "Mute",b); |
1921 | cfg.write(); | 1921 | cfg.write(); |
1922 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; | 1922 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; |
1923 | } | 1923 | } |
1924 | 1924 | ||
1925 | void QtRec::doMicMuting(bool b) { | 1925 | void QtRec::doMicMuting(bool b) { |
1926 | // qDebug("mic mute"); | 1926 | // qDebug("mic mute"); |
1927 | Config cfg( "qpe" ); | 1927 | Config cfg( "qpe" ); |
1928 | cfg. setGroup( "Volume" ); | 1928 | cfg. setGroup( "Volume" ); |
1929 | cfg.writeEntry( "MicMute",b); | 1929 | cfg.writeEntry( "MicMute",b); |
1930 | cfg.write(); | 1930 | cfg.write(); |
1931 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; | 1931 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | void QtRec::compressionSelected(bool b) { | 1934 | void QtRec::compressionSelected(bool b) { |
1935 | Config cfg("QpeRec"); | 1935 | Config cfg("OpieRec"); |
1936 | cfg.setGroup("Settings"); | 1936 | cfg.setGroup("Settings"); |
1937 | cfg.writeEntry("wavCompression", b); | 1937 | cfg.writeEntry("wavCompression", b); |
1938 | cfg.writeEntry("bitrate",16); filePara.resolution=16; | 1938 | cfg.writeEntry("bitrate",16); filePara.resolution=16; |
1939 | cfg.write(); | 1939 | cfg.write(); |
1940 | 1940 | ||
1941 | if(b) { | 1941 | if(b) { |
1942 | bitRateComboBox->setEnabled(false); | 1942 | bitRateComboBox->setEnabled(false); |
1943 | bitRateComboBox->setCurrentItem(0); | 1943 | bitRateComboBox->setCurrentItem(0); |
1944 | filePara.resolution=16; | 1944 | filePara.resolution=16; |
1945 | } else{ | 1945 | } else{ |
1946 | bitRateComboBox->setEnabled(true); | 1946 | bitRateComboBox->setEnabled(true); |
1947 | } | 1947 | } |
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | long QtRec::checkDiskSpace(const QString &path) { | 1950 | long QtRec::checkDiskSpace(const QString &path) { |
1951 | 1951 | ||
1952 | struct statfs fs; | 1952 | struct statfs fs; |
1953 | 1953 | ||
1954 | if ( !statfs( path.latin1(), &fs ) ) { | 1954 | if ( !statfs( path.latin1(), &fs ) ) { |
1955 | 1955 | ||
1956 | int blkSize = fs.f_bsize; | 1956 | int blkSize = fs.f_bsize; |
1957 | int availBlks = fs.f_bavail; | 1957 | int availBlks = fs.f_bavail; |
1958 | 1958 | ||
1959 | long mult = blkSize / 1024; | 1959 | long mult = blkSize / 1024; |
@@ -2172,80 +2172,80 @@ void QtRec::setRecordButton(bool b) { | |||
2172 | 2172 | ||
2173 | Rec_PushButton->setDown(true); | 2173 | Rec_PushButton->setDown(true); |
2174 | QPixmap image3( ( const char** ) image3_data ); | 2174 | QPixmap image3( ( const char** ) image3_data ); |
2175 | Stop_PushButton->setPixmap( image3 ); | 2175 | Stop_PushButton->setPixmap( image3 ); |
2176 | if(Stop_PushButton->isDown()) | 2176 | if(Stop_PushButton->isDown()) |
2177 | Stop_PushButton->setDown(true); | 2177 | Stop_PushButton->setDown(true); |
2178 | playLabel2->setText("Stop"); | 2178 | playLabel2->setText("Stop"); |
2179 | 2179 | ||
2180 | } else { //about to stop | 2180 | } else { //about to stop |
2181 | 2181 | ||
2182 | QPixmap image4( ( const char** ) image4_data ); | 2182 | QPixmap image4( ( const char** ) image4_data ); |
2183 | Stop_PushButton->setPixmap( image4); | 2183 | Stop_PushButton->setPixmap( image4); |
2184 | if(Stop_PushButton->isDown()) | 2184 | if(Stop_PushButton->isDown()) |
2185 | Stop_PushButton->setDown(false); | 2185 | Stop_PushButton->setDown(false); |
2186 | playLabel2->setText("Play"); | 2186 | playLabel2->setText("Play"); |
2187 | if(Rec_PushButton->isDown()) | 2187 | if(Rec_PushButton->isDown()) |
2188 | Rec_PushButton->setDown( false); | 2188 | Rec_PushButton->setDown( false); |
2189 | } | 2189 | } |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | void QtRec::fillDirectoryCombo() { | 2192 | void QtRec::fillDirectoryCombo() { |
2193 | if( directoryComboBox->count() > 0) | 2193 | if( directoryComboBox->count() > 0) |
2194 | directoryComboBox->clear(); | 2194 | directoryComboBox->clear(); |
2195 | int index=0; | 2195 | int index=0; |
2196 | Config cfg("QpeRec"); | 2196 | Config cfg("OpieRec"); |
2197 | cfg.setGroup("Settings"); | 2197 | cfg.setGroup("Settings"); |
2198 | QString dir= cfg.readEntry("directory", "/"); | 2198 | QString dir= cfg.readEntry("directory", "/"); |
2199 | StorageInfo storageInfo; | 2199 | StorageInfo storageInfo; |
2200 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 2200 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
2201 | QListIterator<FileSystem> it ( fs ); | 2201 | QListIterator<FileSystem> it ( fs ); |
2202 | QString storage; | 2202 | QString storage; |
2203 | for( ; it.current(); ++it ){ | 2203 | for( ; it.current(); ++it ){ |
2204 | const QString name = (*it)->name(); | 2204 | const QString name = (*it)->name(); |
2205 | const QString path = (*it)->path(); | 2205 | const QString path = (*it)->path(); |
2206 | // directoryComboBox->insertItem(name+" "+path); | 2206 | // directoryComboBox->insertItem(name+" "+path); |
2207 | directoryComboBox->insertItem(name); | 2207 | directoryComboBox->insertItem(name); |
2208 | if(path==dir) | 2208 | if(path==dir) |
2209 | directoryComboBox->setCurrentItem(index); | 2209 | directoryComboBox->setCurrentItem(index); |
2210 | index++; | 2210 | index++; |
2211 | } | 2211 | } |
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | void QtRec::errorStop() { | 2214 | void QtRec::errorStop() { |
2215 | stopped = true; | 2215 | stopped = true; |
2216 | wavFile->closeFile(); | 2216 | wavFile->closeFile(); |
2217 | killTimers(); | 2217 | killTimers(); |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | void QtRec::doMute(bool b) { | 2220 | void QtRec::doMute(bool b) { |
2221 | doVolMuting( b); | 2221 | doVolMuting( b); |
2222 | doMicMuting( b); | 2222 | doMicMuting( b); |
2223 | } | 2223 | } |
2224 | 2224 | ||
2225 | void QtRec::slotAutoMute(bool b) { | 2225 | void QtRec::slotAutoMute(bool b) { |
2226 | autoMute=b; | 2226 | autoMute=b; |
2227 | Config cfg("QpeRec"); | 2227 | Config cfg("OpieRec"); |
2228 | cfg.setGroup("Settings"); | 2228 | cfg.setGroup("Settings"); |
2229 | cfg.writeEntry("useAutoMute",b); | 2229 | cfg.writeEntry("useAutoMute",b); |
2230 | doMute(b); | 2230 | doMute(b); |
2231 | outMuteCheckBox->setChecked( b); | 2231 | outMuteCheckBox->setChecked( b); |
2232 | inMuteCheckBox->setChecked( b); | 2232 | inMuteCheckBox->setChecked( b); |
2233 | } | 2233 | } |
2234 | 2234 | ||
2235 | void QtRec::selectItemByName(const QString & name) { | 2235 | void QtRec::selectItemByName(const QString & name) { |
2236 | QListViewItemIterator it( ListView1 ); | 2236 | QListViewItemIterator it( ListView1 ); |
2237 | for ( ; it.current(); ++it ) | 2237 | for ( ; it.current(); ++it ) |
2238 | if(name == it.current()->text(0)) | 2238 | if(name == it.current()->text(0)) |
2239 | ListView1->setCurrentItem(it.current()); | 2239 | ListView1->setCurrentItem(it.current()); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | 2242 | ||
2243 | long findPeak(long input ) { | 2243 | long findPeak(long input ) { |
2244 | 2244 | ||
2245 | // halfLife = time in seconds for output to decay to half value after an impulse | 2245 | // halfLife = time in seconds for output to decay to half value after an impulse |
2246 | static float output = 0.0; | 2246 | static float output = 0.0; |
2247 | int halfLife = .25; | 2247 | int halfLife = .25; |
2248 | float vsf = .0025; | 2248 | float vsf = .0025; |
2249 | float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); | 2249 | float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); |
2250 | if( input < 0.0 ) | 2250 | if( input < 0.0 ) |
2251 | input = -input; // Absolute value. | 2251 | input = -input; // Absolute value. |
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 09695aa..0bb5736 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp | |||
@@ -23,49 +23,49 @@ | |||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | 25 | ||
26 | WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, | 26 | WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, |
27 | int channels, int resolution, int format ) | 27 | int channels, int resolution, int format ) |
28 | : QObject( parent) | 28 | : QObject( parent) |
29 | { | 29 | { |
30 | qDebug("new wave file"); | 30 | qDebug("new wave file"); |
31 | bool b = makeNwFile; | 31 | bool b = makeNwFile; |
32 | wavSampleRate=sampleRate; | 32 | wavSampleRate=sampleRate; |
33 | wavFormat=format; | 33 | wavFormat=format; |
34 | wavChannels=channels; | 34 | wavChannels=channels; |
35 | wavResolution=resolution; | 35 | wavResolution=resolution; |
36 | useTmpFile=false; | 36 | useTmpFile=false; |
37 | if( b) { | 37 | if( b) { |
38 | newFile(); | 38 | newFile(); |
39 | } else { | 39 | } else { |
40 | openFile(fileName); | 40 | openFile(fileName); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | bool WavFile::newFile() { | 44 | bool WavFile::newFile() { |
45 | 45 | ||
46 | qDebug("Set up new file"); | 46 | qDebug("Set up new file"); |
47 | Config cfg("QpeRec"); | 47 | Config cfg("OpieRec"); |
48 | cfg.setGroup("Settings"); | 48 | cfg.setGroup("Settings"); |
49 | 49 | ||
50 | currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); | 50 | currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); |
51 | QString date; | 51 | QString date; |
52 | date = TimeString::dateString( QDateTime::currentDateTime(),false,true); | 52 | date = TimeString::dateString( QDateTime::currentDateTime(),false,true); |
53 | date.replace(QRegExp("'"),""); | 53 | date.replace(QRegExp("'"),""); |
54 | date.replace(QRegExp(" "),"_"); | 54 | date.replace(QRegExp(" "),"_"); |
55 | date.replace(QRegExp(":"),"."); | 55 | date.replace(QRegExp(":"),"."); |
56 | date.replace(QRegExp(","),""); | 56 | date.replace(QRegExp(","),""); |
57 | 57 | ||
58 | QString currentFile=date; | 58 | QString currentFile=date; |
59 | if(currentFileName.right(1).find("/",0,true) == -1) | 59 | if(currentFileName.right(1).find("/",0,true) == -1) |
60 | currentFileName += "/" + date; | 60 | currentFileName += "/" + date; |
61 | else | 61 | else |
62 | currentFileName += date; | 62 | currentFileName += date; |
63 | currentFileName+=".wav"; | 63 | currentFileName+=".wav"; |
64 | 64 | ||
65 | qDebug("set up file for recording: "+currentFileName); | 65 | qDebug("set up file for recording: "+currentFileName); |
66 | char *pointer; | 66 | char *pointer; |
67 | 67 | ||
68 | if( currentFileName.find("/mnt",0,true) == -1 | 68 | if( currentFileName.find("/mnt",0,true) == -1 |
69 | && currentFileName.find("/tmp",0,true) == -1 ) { | 69 | && currentFileName.find("/tmp",0,true) == -1 ) { |
70 | // if destination file is most likely in flash (assuming jffs2) | 70 | // if destination file is most likely in flash (assuming jffs2) |
71 | // we have to write to a different filesystem first | 71 | // we have to write to a different filesystem first |