author | llornkcor <llornkcor> | 2005-03-12 02:23:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-03-12 02:23:02 (UTC) |
commit | aa7039012cc79c02304e36db16e6f5ff82e19867 (patch) (unidiff) | |
tree | 7e987a42504cfa7fc030bdef813147d61604849d | |
parent | 9815fc1551763226f974f8ea8eab6d0b031e0be3 (diff) | |
download | opie-aa7039012cc79c02304e36db16e6f5ff82e19867.zip opie-aa7039012cc79c02304e36db16e6f5ff82e19867.tar.gz opie-aa7039012cc79c02304e36db16e6f5ff82e19867.tar.bz2 |
remove ouput
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 35 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 13 | ||||
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 36 |
3 files changed, 40 insertions, 44 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 | |||
@@ -711,26 +711,31 @@ void QtRec::initIconView() { | |||
711 | ListView1->setSelected( item, true); | 711 | ListView1->setSelected( item, true); |
712 | } | 712 | } |
713 | } | 713 | } |
714 | } | 714 | } |
715 | 715 | ||
716 | void QtRec::initConnections() { | 716 | 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())); |
731 | 736 | ||
732 | connect(sampleRateComboBox,SIGNAL(activated(int)),this,SLOT(changesamplerateCombo(int))); | 737 | connect(sampleRateComboBox,SIGNAL(activated(int)),this,SLOT(changesamplerateCombo(int))); |
733 | connect(bitRateComboBox,SIGNAL(activated(int)),this,SLOT(changebitrateCombo(int))); | 738 | connect(bitRateComboBox,SIGNAL(activated(int)),this,SLOT(changebitrateCombo(int))); |
734 | connect(directoryComboBox,SIGNAL(activated(int)),this,SLOT(changeDirCombo(int))); | 739 | connect(directoryComboBox,SIGNAL(activated(int)),this,SLOT(changeDirCombo(int))); |
735 | connect(sizeLimitCombo,SIGNAL(activated(int)),this,SLOT(changeSizeLimitCombo(int))); | 740 | connect(sizeLimitCombo,SIGNAL(activated(int)),this,SLOT(changeSizeLimitCombo(int))); |
736 | 741 | ||
@@ -802,28 +807,31 @@ void QtRec::initConfig() { | |||
802 | slotAutoMute(false); | 807 | slotAutoMute(false); |
803 | 808 | ||
804 | Config cofg( "qpe"); | 809 | Config cofg( "qpe"); |
805 | cofg.setGroup( "Volume"); | 810 | cofg.setGroup( "Volume"); |
806 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); | 811 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); |
807 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); | 812 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); |
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) { |
824 | // playLabel2->setText(tr("Play")); | 832 | // playLabel2->setText(tr("Play")); |
825 | stop(); | 833 | stop(); |
826 | } else { | 834 | } else { |
827 | if(ListView1->currentItem() == 0) return; | 835 | if(ListView1->currentItem() == 0) return; |
828 | // playLabel2->setText(tr("Stop")); | 836 | // playLabel2->setText(tr("Stop")); |
829 | currentFile = ListView1->currentItem()->text(0); | 837 | currentFile = ListView1->currentItem()->text(0); |
@@ -855,33 +863,25 @@ bool QtRec::rec() { //record | |||
855 | return false; | 863 | return false; |
856 | } else { | 864 | } else { |
857 | secCount = 1; | 865 | secCount = 1; |
858 | // playLabel2->setText(tr("Stop")); | 866 | // playLabel2->setText(tr("Stop")); |
859 | monitoring = false; | 867 | monitoring = false; |
860 | setRecordButton( true); | 868 | setRecordButton( true); |
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; |
882 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 882 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
883 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; | 883 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; |
884 | } else { | 884 | } else { |
885 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; | 885 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; |
886 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 886 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
887 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; | 887 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; |
@@ -1039,26 +1039,25 @@ bool QtRec::setupAudio( bool b) { | |||
1039 | filePara.format = WAVE_FORMAT_DVI_ADPCM; | 1039 | filePara.format = WAVE_FORMAT_DVI_ADPCM; |
1040 | sampleformat = AFMT_S16_LE; | 1040 | sampleformat = AFMT_S16_LE; |
1041 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; | 1041 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; |
1042 | } | 1042 | } |
1043 | #endif | 1043 | #endif |
1044 | 1044 | ||
1045 | stereo = filePara.channels; | 1045 | stereo = filePara.channels; |
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(); |
1059 | soundDevice->reset(); | 1058 | soundDevice->reset(); |
1060 | 1059 | ||
1061 | odebug << "device has been made " << soundDevice->sd << "" << oendl; | 1060 | odebug << "device has been made " << soundDevice->sd << "" << oendl; |
1062 | 1061 | ||
1063 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> | 1062 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> |
1064 | soundDevice->setDeviceFormat( sampleformat); | 1063 | soundDevice->setDeviceFormat( sampleformat); |
@@ -1080,38 +1079,35 @@ bool QtRec::setupAudio( bool b) { | |||
1080 | update(); | 1079 | update(); |
1081 | setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); | 1080 | setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); |
1082 | return false; | 1081 | return false; |
1083 | } | 1082 | } |
1084 | if(autoMute) | 1083 | if(autoMute) |
1085 | doMute(false); | 1084 | doMute(false); |
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() { |
1112 | 1108 | ||
1113 | if( !paused) { | 1109 | if( !paused) { |
1114 | total = 0; | 1110 | total = 0; |
1115 | filePara.numberOfRecordedSeconds = 0; | 1111 | filePara.numberOfRecordedSeconds = 0; |
1116 | } else { | 1112 | } else { |
1117 | paused = false; | 1113 | paused = false; |
@@ -1216,31 +1212,24 @@ void QtRec::newSound() { | |||
1216 | } | 1212 | } |
1217 | 1213 | ||
1218 | void QtRec::itClick(QListViewItem *item) { | 1214 | void QtRec::itClick(QListViewItem *item) { |
1219 | currentFile = item->text(0); | 1215 | currentFile = item->text(0); |
1220 | setCaption("OpieRecord "+currentFile); | 1216 | setCaption("OpieRecord "+currentFile); |
1221 | } | 1217 | } |
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()) |
1241 | QMessageBox::message( tr("Error"), tr("Could not remove file.")); | 1230 | QMessageBox::message( tr("Error"), tr("Could not remove file.")); |
1242 | 1231 | ||
1243 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); | 1232 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); |
1244 | bool found = false; | 1233 | bool found = false; |
1245 | for(int i=0;i<nFiles+1;i++) { | 1234 | for(int i=0;i<nFiles+1;i++) { |
1246 | 1235 | ||
@@ -1392,27 +1381,25 @@ void QtRec::endRecording() { | |||
1392 | toBeginningButton->setEnabled( true); | 1381 | toBeginningButton->setEnabled( true); |
1393 | toEndButton->setEnabled( true); | 1382 | toEndButton->setEnabled( true); |
1394 | 1383 | ||
1395 | killTimers(); | 1384 | killTimers(); |
1396 | 1385 | ||
1397 | if(autoMute) | 1386 | if(autoMute) |
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; |
1413 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); | 1400 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); |
1414 | odebug << "moving tmp file to "+currentFileName << oendl; | 1401 | odebug << "moving tmp file to "+currentFileName << oendl; |
1415 | system( cmd.latin1()); | 1402 | system( cmd.latin1()); |
1416 | } | 1403 | } |
1417 | 1404 | ||
1418 | odebug << "Just moved " + wavFile->currentFileName << oendl; | 1405 | odebug << "Just moved " + wavFile->currentFileName << oendl; |
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index 642048a..6e81af6 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h | |||
@@ -51,25 +51,32 @@ class QLineEdit; | |||
51 | //AFMT_IMA_ADPCM | 51 | //AFMT_IMA_ADPCM |
52 | 52 | ||
53 | class QtRec : public QWidget | 53 | class QtRec : public QWidget |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | 56 | ||
57 | public: | 57 | public: |
58 | static QString appName() { return QString::fromLatin1("opierec"); } | 58 | static QString appName() { return QString::fromLatin1("opierec"); } |
59 | QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 59 | QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
60 | ~QtRec(); | 60 | ~QtRec(); |
61 | QSlider *OutputSlider,*InputSlider; | 61 | QSlider *OutputSlider,*InputSlider; |
62 | 62 | ||
63 | signals: | ||
64 | void stopRecording(); | ||
65 | void startRecording(); | ||
66 | void stopPlaying(); | ||
67 | void startPlaying(); | ||
68 | |||
63 | public slots: | 69 | public slots: |
70 | |||
64 | private: | 71 | private: |
65 | // int fragment; | 72 | // int fragment; |
66 | int fd1; | 73 | int fd1; |
67 | int secCount; | 74 | int secCount; |
68 | QString timeString; | 75 | QString timeString; |
69 | 76 | ||
70 | QLineEdit *renameBox; | 77 | QLineEdit *renameBox; |
71 | QGroupBox* GroupBox1; | 78 | QGroupBox* GroupBox1; |
72 | QString currentFile; | 79 | QString currentFile; |
73 | QString date, currentFileName, tmpFileName; | 80 | QString date, currentFileName, tmpFileName; |
74 | QTimer *t_timer; | 81 | QTimer *t_timer; |
75 | bool needsStereoOut, paused; | 82 | bool needsStereoOut, paused; |
@@ -88,36 +95,40 @@ private: | |||
88 | void getInVol(); | 95 | void getInVol(); |
89 | void getOutVol(); | 96 | void getOutVol(); |
90 | void init(); | 97 | void init(); |
91 | void initConfig(); | 98 | void initConfig(); |
92 | void initConnections(); | 99 | void initConnections(); |
93 | void selectItemByName(const QString &); | 100 | void selectItemByName(const QString &); |
94 | void setRecordButton(bool); | 101 | void setRecordButton(bool); |
95 | void start(); | 102 | void start(); |
96 | void stop(); | 103 | void stop(); |
97 | void timerEvent( QTimerEvent *e ); | 104 | void timerEvent( QTimerEvent *e ); |
98 | 105 | ||
99 | private slots: | 106 | private slots: |
107 | void endPlaying(); | ||
108 | void endRecording(); | ||
100 | 109 | ||
101 | void FastforwardPressed(); | 110 | void FastforwardPressed(); |
102 | void FastforwardReleased(); | 111 | void FastforwardReleased(); |
112 | |||
103 | void changeDirCombo(int); | 113 | void changeDirCombo(int); |
104 | void changeSizeLimitCombo(int); | 114 | void changeSizeLimitCombo(int); |
105 | void changeTimeSlider(int); | 115 | void changeTimeSlider(int); |
106 | void changebitrateCombo(int); | 116 | void changebitrateCombo(int); |
107 | void changeStereoCheck( bool); | 117 | void changeStereoCheck( bool); |
108 | 118 | ||
109 | void changedInVolume(); | 119 | void changedInVolume(); |
110 | void changedOutVolume(); | 120 | void changedOutVolume(); |
111 | void changesamplerateCombo(int); | 121 | void changesamplerateCombo(int); |
122 | |||
112 | void cleanUp(); | 123 | void cleanUp(); |
113 | void compressionSelected(bool); | 124 | void compressionSelected(bool); |
114 | void deleteSound(); | 125 | void deleteSound(); |
115 | void doBeam(); | 126 | void doBeam(); |
116 | void doMenuPlay(); | 127 | void doMenuPlay(); |
117 | void doMicMuting(bool); | 128 | void doMicMuting(bool); |
118 | void doPlayBtn(); | 129 | void doPlayBtn(); |
119 | void doRename(); | 130 | void doRename(); |
120 | void doVolMuting(bool); | 131 | void doVolMuting(bool); |
121 | void forwardTimerTimeout(); | 132 | void forwardTimerTimeout(); |
122 | void itClick(QListViewItem *item); | 133 | void itClick(QListViewItem *item); |
123 | void listPressed(int, QListViewItem *, const QPoint&, int); | 134 | void listPressed(int, QListViewItem *, const QPoint&, int); |
@@ -161,26 +172,24 @@ protected: | |||
161 | int sliderPos, total; | 172 | int sliderPos, total; |
162 | // short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; | 173 | // short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; |
163 | // unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; | 174 | // unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; |
164 | QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup; | 175 | QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup; |
165 | /* short inbuffer[65536], outbuffer[65536]; */ | 176 | /* short inbuffer[65536], outbuffer[65536]; */ |
166 | /* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */ | 177 | /* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */ |
167 | 178 | ||
168 | 179 | ||
169 | bool doPlay(); | 180 | bool doPlay(); |
170 | bool openPlayFile(); | 181 | bool openPlayFile(); |
171 | bool setUpFile(); | 182 | bool setUpFile(); |
172 | bool setupAudio( bool b); | 183 | bool setupAudio( bool b); |
173 | void endPlaying(); | ||
174 | void endRecording(); | ||
175 | void fileBeamFinished( Ir *ir); | 184 | void fileBeamFinished( Ir *ir); |
176 | void keyPressEvent( QKeyEvent *e); | 185 | void keyPressEvent( QKeyEvent *e); |
177 | void keyReleaseEvent( QKeyEvent *e); | 186 | void keyReleaseEvent( QKeyEvent *e); |
178 | void receive( const QCString &, const QByteArray & ); | 187 | void receive( const QCString &, const QByteArray & ); |
179 | void showListMenu(QListViewItem * ); | 188 | void showListMenu(QListViewItem * ); |
180 | #ifndef THREADED | 189 | #ifndef THREADED |
181 | void quickRec(); | 190 | void quickRec(); |
182 | void playIt(); | 191 | void playIt(); |
183 | #endif | 192 | #endif |
184 | 193 | ||
185 | }; | 194 | }; |
186 | 195 | ||
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index b53c416..a0423f0 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp | |||
@@ -143,112 +143,112 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { | |||
143 | 143 | ||
144 | // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels | 144 | // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels |
145 | (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels | 145 | (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels |
146 | 146 | ||
147 | (*hdr).sampleRate = wavSampleRate; //samples per second | 147 | (*hdr).sampleRate = wavSampleRate; //samples per second |
148 | (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second | 148 | (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second |
149 | (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align | 149 | (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align |
150 | (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 | 150 | (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 |
151 | 151 | ||
152 | strncpy((*hdr).dataID, "data", 4); | 152 | strncpy((*hdr).dataID, "data", 4); |
153 | 153 | ||
154 | write( fd,hdr, sizeof(*hdr)); | 154 | write( fd,hdr, sizeof(*hdr)); |
155 | owarn << "writing header: bitrate " << wavResolution << ", samplerate " << wavSampleRate << ", channels " << wavChannels << oendl; | 155 | // owarn << "writing header: bitrate " << wavResolution << ", samplerate " << wavSampleRate << ", channels " << wavChannels << oendl; |
156 | return true; | 156 | return true; |
157 | } | 157 | } |
158 | 158 | ||
159 | bool WavFile::adjustHeaders(int fd, int total) { | 159 | bool WavFile::adjustHeaders(int fd, int total) { |
160 | lseek(fd, 4, SEEK_SET); | 160 | lseek(fd, 4, SEEK_SET); |
161 | int i = total + 36; | 161 | int i = total + 36; |
162 | write( fd, &i, sizeof(i)); | 162 | write( fd, &i, sizeof(i)); |
163 | lseek( fd, 40, SEEK_SET); | 163 | lseek( fd, 40, SEEK_SET); |
164 | write( fd, &total, sizeof(total)); | 164 | write( fd, &total, sizeof(total)); |
165 | owarn << "adjusting header " << total << "" << oendl; | 165 | // owarn << "adjusting header " << total << "" << oendl; |
166 | return true; | 166 | return true; |
167 | } | 167 | } |
168 | 168 | ||
169 | int WavFile::parseWavHeader(int fd) { | 169 | int WavFile::parseWavHeader(int fd) { |
170 | owarn << "Parsing wav header" << oendl; | 170 | // owarn << "Parsing wav header" << oendl; |
171 | char string[4]; | 171 | char string[4]; |
172 | int found; | 172 | int found; |
173 | short fmt; | 173 | short fmt; |
174 | unsigned short ch, bitrate; | 174 | unsigned short ch, bitrate; |
175 | unsigned long samplerrate, longdata; | 175 | unsigned long samplerrate, longdata; |
176 | 176 | ||
177 | if (read(fd, string, 4) < 4) { | 177 | if (read(fd, string, 4) < 4) { |
178 | owarn << " Could not read from sound file." << oendl; | 178 | // owarn << " Could not read from sound file." << oendl; |
179 | return -1; | 179 | return -1; |
180 | } | 180 | } |
181 | if (strncmp(string, "RIFF", 4)) { | 181 | if (strncmp(string, "RIFF", 4)) { |
182 | owarn << " not a valid WAV file." << oendl; | 182 | // owarn << " not a valid WAV file." << oendl; |
183 | return -1; | 183 | return -1; |
184 | } | 184 | } |
185 | lseek(fd, 4, SEEK_CUR); | 185 | lseek(fd, 4, SEEK_CUR); |
186 | if (read(fd, string, 4) < 4) { | 186 | if (read(fd, string, 4) < 4) { |
187 | owarn << "Could not read from sound file." << oendl; | 187 | // owarn << "Could not read from sound file." << oendl; |
188 | return -1; | 188 | return -1; |
189 | } | 189 | } |
190 | if (strncmp(string, "WAVE", 4)) { | 190 | if (strncmp(string, "WAVE", 4)) { |
191 | owarn << "not a valid WAV file." << oendl; | 191 | // owarn << "not a valid WAV file." << oendl; |
192 | return -1; | 192 | return -1; |
193 | } | 193 | } |
194 | found = 0; | 194 | found = 0; |
195 | 195 | ||
196 | while (!found) { | 196 | while (!found) { |
197 | if (read(fd, string, 4) < 4) { | 197 | if (read(fd, string, 4) < 4) { |
198 | owarn << "Could not read from sound file." << oendl; | 198 | // owarn << "Could not read from sound file." << oendl; |
199 | return -1; | 199 | return -1; |
200 | } | 200 | } |
201 | if (strncmp(string, "fmt ", 4)) { | 201 | if (strncmp(string, "fmt ", 4)) { |
202 | if (read(fd, &longdata, 4) < 4) { | 202 | if (read(fd, &longdata, 4) < 4) { |
203 | owarn << "Could not read from sound file." << oendl; | 203 | // owarn << "Could not read from sound file." << oendl; |
204 | return -1; | 204 | return -1; |
205 | } | 205 | } |
206 | lseek(fd, longdata, SEEK_CUR); | 206 | lseek(fd, longdata, SEEK_CUR); |
207 | } else { | 207 | } else { |
208 | lseek(fd, 4, SEEK_CUR); | 208 | lseek(fd, 4, SEEK_CUR); |
209 | if (read(fd, &fmt, 2) < 2) { | 209 | if (read(fd, &fmt, 2) < 2) { |
210 | owarn << "Could not read format chunk." << oendl; | 210 | // owarn << "Could not read format chunk." << oendl; |
211 | return -1; | 211 | return -1; |
212 | } | 212 | } |
213 | if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { | 213 | if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { |
214 | owarn << "Wave file contains unknown format. Unable to continue." << oendl; | 214 | // owarn << "Wave file contains unknown format. Unable to continue." << oendl; |
215 | return -1; | 215 | return -1; |
216 | } | 216 | } |
217 | wavFormat = fmt; | 217 | wavFormat = fmt; |
218 | // compressionFormat=fmt; | 218 | // compressionFormat=fmt; |
219 | owarn << "compressionFormat is " << fmt << "" << oendl; | 219 | // owarn << "compressionFormat is " << fmt << "" << oendl; |
220 | if (read(fd, &ch, 2) < 2) { | 220 | if (read(fd, &ch, 2) < 2) { |
221 | owarn << "Could not read format chunk." << oendl; | 221 | // owarn << "Could not read format chunk." << oendl; |
222 | return -1; | 222 | return -1; |
223 | } else { | 223 | } else { |
224 | wavChannels = ch; | 224 | wavChannels = ch; |
225 | owarn << "File has " << ch << " channels" << oendl; | 225 | // owarn << "File has " << ch << " channels" << oendl; |
226 | } | 226 | } |
227 | if (read(fd, &samplerrate, 4) < 4) { | 227 | if (read(fd, &samplerrate, 4) < 4) { |
228 | owarn << "Could not read from format chunk." << oendl; | 228 | // owarn << "Could not read from format chunk." << oendl; |
229 | return -1; | 229 | return -1; |
230 | } else { | 230 | } else { |
231 | wavSampleRate = samplerrate; | 231 | wavSampleRate = samplerrate; |
232 | // sampleRate = samplerrate; | 232 | // sampleRate = samplerrate; |
233 | owarn << "File has samplerate of " << (int) samplerrate << "" << oendl; | 233 | // owarn << "File has samplerate of " << (int) samplerrate << "" << oendl; |
234 | } | 234 | } |
235 | lseek(fd, 6, SEEK_CUR); | 235 | lseek(fd, 6, SEEK_CUR); |
236 | if (read(fd, &bitrate, 2) < 2) { | 236 | if (read(fd, &bitrate, 2) < 2) { |
237 | owarn << "Could not read format chunk." << oendl; | 237 | // owarn << "Could not read format chunk." << oendl; |
238 | return -1; | 238 | return -1; |
239 | } else { | 239 | } else { |
240 | wavResolution=bitrate; | 240 | wavResolution=bitrate; |
241 | // resolution = bitrate; | 241 | // resolution = bitrate; |
242 | owarn << "File has bitrate of " << bitrate << "" << oendl; | 242 | // owarn << "File has bitrate of " << bitrate << "" << oendl; |
243 | } | 243 | } |
244 | found++; | 244 | found++; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | found = 0; | 247 | found = 0; |
248 | while (!found) { | 248 | while (!found) { |
249 | if (read(fd, string, 4) < 4) { | 249 | if (read(fd, string, 4) < 4) { |
250 | odebug << "Could not read from sound file." << oendl; | 250 | odebug << "Could not read from sound file." << oendl; |
251 | return -1; | 251 | return -1; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (strncmp(string, "data", 4)) { | 254 | if (strncmp(string, "data", 4)) { |