Diffstat (limited to 'noncore/multimedia/opierec/qtrec.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 9b761aa..9d3d5cf 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -717,14 +717,19 @@ void QtRec::initConnections() { | |||
717 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); | 717 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); |
718 | 718 | ||
719 | connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); | 719 | connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); |
720 | connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased())); | 720 | connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased())); |
721 | connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed())); | 721 | connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed())); |
722 | connect(toEndButton,SIGNAL(released()),this,SLOT(FastforwardReleased())); | 722 | connect(toEndButton,SIGNAL(released()),this,SLOT(FastforwardReleased())); |
723 | |||
723 | connect(deleteSoundButton,SIGNAL(released()),this,SLOT(deleteSound())); | 724 | connect(deleteSoundButton,SIGNAL(released()),this,SLOT(deleteSound())); |
725 | |||
724 | connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn())); | 726 | connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn())); |
727 | // connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn())); | ||
728 | |||
729 | // connect(Rec_PushButton,SIGNAL(released()),this,SIGNAL(startRecording())); | ||
725 | connect(Rec_PushButton,SIGNAL(released()),this,SLOT(newSound())); | 730 | connect(Rec_PushButton,SIGNAL(released()),this,SLOT(newSound())); |
726 | 731 | ||
727 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(thisTab(QWidget*))); | 732 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(thisTab(QWidget*))); |
728 | 733 | ||
729 | connect(OutputSlider,SIGNAL(sliderReleased()),this,SLOT(changedOutVolume())); | 734 | connect(OutputSlider,SIGNAL(sliderReleased()),this,SLOT(changedOutVolume())); |
730 | connect(InputSlider,SIGNAL(sliderReleased()),this,SLOT(changedInVolume())); | 735 | connect(InputSlider,SIGNAL(sliderReleased()),this,SLOT(changedInVolume())); |
@@ -808,16 +813,19 @@ void QtRec::initConfig() { | |||
808 | } | 813 | } |
809 | 814 | ||
810 | void QtRec::stop() { | 815 | void QtRec::stop() { |
811 | // owarn << "STOP" << oendl; | 816 | // owarn << "STOP" << oendl; |
812 | setRecordButton(false); | 817 | setRecordButton(false); |
813 | 818 | ||
814 | if( !recording) | 819 | if( !recording) { |
820 | emit stopPlaying(); | ||
815 | endPlaying(); | 821 | endPlaying(); |
816 | else | 822 | } else { |
823 | emit stopRecording(); | ||
817 | endRecording(); | 824 | endRecording(); |
825 | } | ||
818 | timeSlider->setValue(0); | 826 | timeSlider->setValue(0); |
819 | } | 827 | } |
820 | 828 | ||
821 | void QtRec::doPlayBtn() { | 829 | void QtRec::doPlayBtn() { |
822 | 830 | ||
823 | if(!stopped) { | 831 | if(!stopped) { |
@@ -861,21 +869,13 @@ bool QtRec::rec() { //record | |||
861 | 869 | ||
862 | if( setupAudio( true)) | 870 | if( setupAudio( true)) |
863 | if(setUpFile()) { | 871 | if(setUpFile()) { |
864 | int fileSize = 0; | 872 | int fileSize = 0; |
865 | Config cfg("OpieRec"); | 873 | Config cfg("OpieRec"); |
866 | cfg.setGroup("Settings"); | 874 | cfg.setGroup("Settings"); |
867 | // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() | ||
868 | // << ", device rate " << soundDevice->getDeviceRate() | ||
869 | // << ", device channels " << soundDevice->getDeviceChannels() << oendl; | ||
870 | |||
871 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | ||
872 | // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; | ||
873 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 875 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
874 | |||
875 | // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; | ||
876 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 876 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
877 | 877 | ||
878 | if( filePara.SecondsToRecord == 0) { | 878 | if( filePara.SecondsToRecord == 0) { |
879 | fileSize = diskSize; | 879 | fileSize = diskSize; |
880 | } else if( filePara.format == WAVE_FORMAT_PCM) { | 880 | } else if( filePara.format == WAVE_FORMAT_PCM) { |
881 | // odebug << "WAVE_FORMAT_PCM" << oendl; | 881 | // odebug << "WAVE_FORMAT_PCM" << oendl; |
@@ -1046,13 +1046,12 @@ bool QtRec::setupAudio( bool b) { | |||
1046 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; | 1046 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; |
1047 | flags= O_RDWR; | 1047 | flags= O_RDWR; |
1048 | // flags= O_RDONLY; | 1048 | // flags= O_RDONLY; |
1049 | recording = true; | 1049 | recording = true; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | // if(soundDevice) delete soundDevice; | ||
1053 | owarn << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; | 1052 | owarn << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; |
1054 | // owarn << "change waveform settings" << oendl; | 1053 | // owarn << "change waveform settings" << oendl; |
1055 | waveform->changeSettings( filePara.sampleRate, filePara.channels ); | 1054 | waveform->changeSettings( filePara.sampleRate, filePara.channels ); |
1056 | 1055 | ||
1057 | soundDevice = new Device( this, b); //open rec | 1056 | soundDevice = new Device( this, b); //open rec |
1058 | // soundDevice->openDsp(); | 1057 | // soundDevice->openDsp(); |
@@ -1086,26 +1085,23 @@ bool QtRec::setupAudio( bool b) { | |||
1086 | 1085 | ||
1087 | return true; | 1086 | return true; |
1088 | } | 1087 | } |
1089 | 1088 | ||
1090 | 1089 | ||
1091 | bool QtRec::setUpFile() { //setup file for recording | 1090 | bool QtRec::setUpFile() { //setup file for recording |
1092 | // odebug << "Setting up wavfile" << oendl; | ||
1093 | // if(wavFile) delete wavFile; | ||
1094 | wavFile = new WavFile( this, (const QString &)"", | 1091 | wavFile = new WavFile( this, (const QString &)"", |
1095 | true, | 1092 | true, |
1096 | filePara.sampleRate, | 1093 | filePara.sampleRate, |
1097 | filePara.channels, | 1094 | filePara.channels, |
1098 | filePara.resolution, | 1095 | filePara.resolution, |
1099 | filePara.format); | 1096 | filePara.format); |
1100 | 1097 | ||
1101 | filePara.fd = wavFile->wavHandle(); | 1098 | filePara.fd = wavFile->wavHandle(); |
1102 | if(filePara.fd == -1) { | 1099 | if(filePara.fd == -1) { |
1103 | return false; | 1100 | return false; |
1104 | } else { | 1101 | } else { |
1105 | // filePara.channels=1; | ||
1106 | } | 1102 | } |
1107 | return true; | 1103 | return true; |
1108 | } | 1104 | } |
1109 | 1105 | ||
1110 | /// <<<<<<<<<<<<<<<< PLAY >>>>>>>>>>>>>>>>>>> | 1106 | /// <<<<<<<<<<<<<<<< PLAY >>>>>>>>>>>>>>>>>>> |
1111 | bool QtRec::doPlay() { | 1107 | bool QtRec::doPlay() { |
@@ -1222,19 +1218,12 @@ void QtRec::itClick(QListViewItem *item) { | |||
1222 | 1218 | ||
1223 | void QtRec::deleteSound() { | 1219 | void QtRec::deleteSound() { |
1224 | Config cfg("OpieRec"); | 1220 | Config cfg("OpieRec"); |
1225 | cfg.setGroup("Sounds"); | 1221 | cfg.setGroup("Sounds"); |
1226 | if( ListView1->currentItem() == NULL) | 1222 | if( ListView1->currentItem() == NULL) |
1227 | return; | 1223 | return; |
1228 | // #ifndef DEV_VERSION | ||
1229 | // switch ( QMessageBox::warning(this,tr("Delete"), | ||
1230 | // tr("Do you really want to <font size=+2><B>DELETE</B></font>\nthe selected file?"), | ||
1231 | // tr("Yes"),tr("No"),0,1,1) ) { | ||
1232 | // case 0: | ||
1233 | // #endif | ||
1234 | // { | ||
1235 | QString file = ListView1->currentItem()->text(0); | 1224 | QString file = ListView1->currentItem()->text(0); |
1236 | QString fileName; | 1225 | QString fileName; |
1237 | fileName = cfg.readEntry( file, ""); | 1226 | fileName = cfg.readEntry( file, ""); |
1238 | QFile f( fileName); | 1227 | QFile f( fileName); |
1239 | if( f.exists()) | 1228 | if( f.exists()) |
1240 | if( !f.remove()) | 1229 | if( !f.remove()) |
@@ -1398,15 +1387,13 @@ void QtRec::endRecording() { | |||
1398 | doMute( true); | 1387 | doMute( true); |
1399 | 1388 | ||
1400 | soundDevice->closeDevice( true); | 1389 | soundDevice->closeDevice( true); |
1401 | 1390 | ||
1402 | if( wavFile->track.isOpen()) { | 1391 | if( wavFile->track.isOpen()) { |
1403 | wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); | 1392 | wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); |
1404 | // soundDevice->sd=-1; | ||
1405 | filePara.numberSamples = 0; | 1393 | filePara.numberSamples = 0; |
1406 | // filePara.sd=-1; | ||
1407 | wavFile->closeFile(); | 1394 | wavFile->closeFile(); |
1408 | filePara.fd=0; | 1395 | filePara.fd=0; |
1409 | 1396 | ||
1410 | if( wavFile->isTempFile()) { | 1397 | if( wavFile->isTempFile()) { |
1411 | // move tmp file to regular file | 1398 | // move tmp file to regular file |
1412 | QString cmd; | 1399 | QString cmd; |