-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 200 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
2 files changed, 58 insertions, 144 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 147f63d..2bf795f 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -109,7 +109,2 @@ void quickRec() { | |||
109 | 109 | ||
110 | qDebug("%d", | ||
111 | filePara.numberSamples/filePara.sampleRate * filePara.channels); | ||
112 | qDebug("samples %d, rate %d, channels %d", | ||
113 | filePara.numberSamples, filePara.sampleRate, filePara.channels); | ||
114 | |||
115 | int total = 0; // Total number of bytes read in so far. | 110 | int total = 0; // Total number of bytes read in so far. |
@@ -129,14 +124,8 @@ void quickRec() { | |||
129 | //rate=filePara.sampleRate; | 124 | //rate=filePara.sampleRate; |
130 | int bits = filePara.resolution; | 125 | // int bits = filePara.resolution; |
131 | qDebug("bits %d", bits); | ||
132 | // if( filePara.format==WAVE_FORMAT_DVI_ADPCM) | ||
133 | // else | ||
134 | audio_buf_info inInfo; | 126 | audio_buf_info inInfo; |
135 | ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo); | 127 | ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo); |
136 | qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal); | 128 | // qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal); |
137 | 129 | ||
138 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 130 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
139 | qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); | ||
140 | qDebug("samples to record %d", filePara.samplesToRecord); | ||
141 | qDebug("%d", filePara.sd); | ||
142 | level=7; | 131 | level=7; |
@@ -147,4 +136,3 @@ void quickRec() { | |||
147 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { | 136 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { |
148 | qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); | 137 | // qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); |
149 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | ||
150 | char abuf[BUFSIZE/2]; | 138 | char abuf[BUFSIZE/2]; |
@@ -158,5 +146,3 @@ void quickRec() { | |||
158 | if (stopped) { | 146 | if (stopped) { |
159 | qDebug("quickRec:: stopped"); | ||
160 | break; // stop if playing was set to false | 147 | break; // stop if playing was set to false |
161 | // return; | ||
162 | } | 148 | } |
@@ -164,11 +150,8 @@ void quickRec() { | |||
164 | number=::read( filePara.sd, sbuf, BUFSIZE); | 150 | number=::read( filePara.sd, sbuf, BUFSIZE); |
165 | |||
166 | if(number <= 0) { | 151 | if(number <= 0) { |
167 | perror("recording error "); | 152 | perror("recording error "); |
168 | qDebug( "%s %d", filePara.fileName, number); | 153 | // qDebug( "%s %d", filePara.fileName, number); |
169 | // errorStop(); | 154 | // errorStop(); |
170 | recording=stopped=false; | 155 | recording=stopped=false; |
171 | // QMessageBox::message("Note", | 156 | // QMessageBox::message("Note", "Error recording to file\n%s",filePara.fileName); |
172 | // "Error recording to file\n%s", | ||
173 | // filePara.fileName); | ||
174 | return; | 157 | return; |
@@ -178,5 +161,3 @@ void quickRec() { | |||
178 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); | 161 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); |
179 | |||
180 | bytesWritten = ::write( filePara.fd , abuf, number/4); | 162 | bytesWritten = ::write( filePara.fd , abuf, number/4); |
181 | |||
182 | long peak; | 163 | long peak; |
@@ -188,4 +169,2 @@ void quickRec() { | |||
188 | } | 169 | } |
189 | |||
190 | |||
191 | //------------->>>> out to file | 170 | //------------->>>> out to file |
@@ -202,13 +181,3 @@ void quickRec() { | |||
202 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; | 181 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; |
203 | |||
204 | // printf("Writing number %d, bytes %d,total %d, sample rate %d, secs %.2f \n", | ||
205 | // number, | ||
206 | // bytesWritten , | ||
207 | // total, | ||
208 | // filePara.sampleRate, | ||
209 | // filePara.numberOfRecordedSeconds); | ||
210 | // fflush(stdout); | ||
211 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); | 182 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); |
212 | // qDebug("%d, %d", info.bytes, (info.bytes / filePara.sampleRate) / 2); | ||
213 | |||
214 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 183 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
@@ -221,4 +190,3 @@ void quickRec() { | |||
221 | } else { | 190 | } else { |
222 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> | 191 | // qDebug("start recording WAVE_FORMAT_PCM"); |
223 | qDebug("start recording WAVE_FORMAT_PCM"); | ||
224 | short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; | 192 | short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; |
@@ -228,5 +196,3 @@ void quickRec() { | |||
228 | if (stopped) { | 196 | if (stopped) { |
229 | qDebug("quickRec:: stopped"); | ||
230 | break; // stop if playing was set to false | 197 | break; // stop if playing was set to false |
231 | return; | ||
232 | } | 198 | } |
@@ -234,9 +200,6 @@ void quickRec() { | |||
234 | number=::read( filePara.sd, inbuffer, BUFSIZE); | 200 | number=::read( filePara.sd, inbuffer, BUFSIZE); |
235 | |||
236 | if(number <= 0) { | 201 | if(number <= 0) { |
237 | perror("recording error "); | 202 | perror("recording error "); |
238 | qDebug( filePara.fileName); | ||
239 | recording=stopped=false; | 203 | recording=stopped=false; |
240 | // errorStop(); | 204 | // errorStop(); |
241 | // QMessageBox::message("Note","error recording to file\n%s",filePara.fileName); | ||
242 | return;// false; | 205 | return;// false; |
@@ -244,3 +207,2 @@ void quickRec() { | |||
244 | /* for (int i=0;i< number;i++) { //2*i is left channel | 207 | /* for (int i=0;i< number;i++) { //2*i is left channel |
245 | |||
246 | outbuffer[i]=inbuffer[i]>>1; // no clippy, please | 208 | outbuffer[i]=inbuffer[i]>>1; // no clippy, please |
@@ -266,4 +228,2 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
266 | } | 228 | } |
267 | |||
268 | |||
269 | filePara.numberSamples = total; | 229 | filePara.numberSamples = total; |
@@ -278,6 +238,4 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
278 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; | 238 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; |
279 | |||
280 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 239 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
281 | timeLabel->setText( timeString + " seconds"); | 240 | timeLabel->setText( timeString + " seconds"); |
282 | |||
283 | qApp->processEvents(); | 241 | qApp->processEvents(); |
@@ -295,3 +253,3 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
295 | if (stopped) { | 253 | if (stopped) { |
296 | qDebug("quickRec:: stopped"); | 254 | // qDebug("quickRec:: stopped"); |
297 | break; // stop if playing was set to false | 255 | break; // stop if playing was set to false |
@@ -350,7 +308,3 @@ void playIt() { | |||
350 | 308 | ||
351 | |||
352 | |||
353 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | 309 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> |
354 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | ||
355 | |||
356 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | 310 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) |
@@ -361,4 +315,2 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | |||
361 | 315 | ||
362 | // signal(SIGPIPE, SIG_IGN); | ||
363 | |||
364 | if ( !name ) | 316 | if ( !name ) |
@@ -413,3 +365,2 @@ void QtRec::cleanUp() { | |||
413 | // if(soundDevice) delete soundDevice; | 365 | // if(soundDevice) delete soundDevice; |
414 | |||
415 | // QPEApplication::grabKeyboard(); | 366 | // QPEApplication::grabKeyboard(); |
@@ -756,5 +707,6 @@ void QtRec::initIconView() { | |||
756 | 707 | ||
757 | // temp.sprintf("%d",i); | 708 | temp.sprintf("%d",i); |
758 | temp=cfg.readEntry(temp,""); //reads currentFile | 709 | temp=cfg.readEntry(temp,""); //reads currentFile |
759 | filePath = cfg.readEntry(temp,""); //currentFileName | 710 | filePath = cfg.readEntry(temp,""); //currentFileName |
711 | // qDebug(filePath); | ||
760 | 712 | ||
@@ -861,3 +813,3 @@ void QtRec::initConfig() { | |||
861 | void QtRec::stop() { | 813 | void QtRec::stop() { |
862 | qDebug("<<<<<<<<<stop()"); | 814 | // qDebug("<<<<<<<<<stop()"); |
863 | setRecordButton(false); | 815 | setRecordButton(false); |
@@ -889,3 +841,2 @@ void QtRec::start() { //play | |||
889 | if(stopped) { | 841 | if(stopped) { |
890 | qDebug("start::"); | ||
891 | QPixmap image3( ( const char** ) image3_data ); | 842 | QPixmap image3( ( const char** ) image3_data ); |
@@ -904,5 +855,3 @@ void QtRec::start() { //play | |||
904 | bool QtRec::rec() { //record | 855 | bool QtRec::rec() { //record |
905 | qDebug("rec()"); | ||
906 | if(!stopped) { | 856 | if(!stopped) { |
907 | qDebug("rec:: !stopped"); | ||
908 | monitoring=true; | 857 | monitoring=true; |
@@ -910,3 +859,2 @@ bool QtRec::rec() { //record | |||
910 | } else { | 859 | } else { |
911 | qDebug("go ahead and record"); | ||
912 | secCount=1; | 860 | secCount=1; |
@@ -919,3 +867,2 @@ bool QtRec::rec() { //record | |||
919 | if(setUpFile()) { | 867 | if(setUpFile()) { |
920 | qDebug("Ok to start recording"); | ||
921 | int fileSize=0; | 868 | int fileSize=0; |
@@ -923,12 +870,6 @@ bool QtRec::rec() { //record | |||
923 | cfg.setGroup("Settings"); | 870 | cfg.setGroup("Settings"); |
924 | qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", | ||
925 | soundDevice->getDeviceBits(), | ||
926 | soundDevice->getDeviceRate(), | ||
927 | soundDevice->getDeviceChannels()); | ||
928 | |||
929 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | 871 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); |
930 | qDebug("sample rate is %d", filePara.sampleRate); | 872 | // qDebug("sample rate is %d", filePara.sampleRate); |
931 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 873 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
932 | 874 | ||
933 | qDebug("size limit %d sec", filePara.SecondsToRecord); | ||
934 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 875 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
@@ -938,3 +879,2 @@ bool QtRec::rec() { //record | |||
938 | } else if( filePara.format==WAVE_FORMAT_PCM) { | 879 | } else if( filePara.format==WAVE_FORMAT_PCM) { |
939 | qDebug("WAVE_FORMAT_PCM"); | ||
940 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 880 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
@@ -942,3 +882,2 @@ bool QtRec::rec() { //record | |||
942 | } else { | 882 | } else { |
943 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | ||
944 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 883 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
@@ -948,4 +887,2 @@ bool QtRec::rec() { //record | |||
948 | filePara.samplesToRecord = fileSize; | 887 | filePara.samplesToRecord = fileSize; |
949 | qDebug("filesize should be %d, bits %d, rate %d", | ||
950 | filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); | ||
951 | if(paused) { | 888 | if(paused) { |
@@ -953,7 +890,3 @@ bool QtRec::rec() { //record | |||
953 | } | 890 | } |
954 | // else { | ||
955 | qDebug("Setting timeslider %d", filePara.samplesToRecord); | ||
956 | // if(fileSize != 0) | ||
957 | timeSlider->setRange(0, filePara.samplesToRecord); | 891 | timeSlider->setRange(0, filePara.samplesToRecord); |
958 | // } | ||
959 | 892 | ||
@@ -973,3 +906,2 @@ bool QtRec::rec() { //record | |||
973 | filePara.fileName=currentFile.latin1(); | 906 | filePara.fileName=currentFile.latin1(); |
974 | qDebug("Start recording thread"); | ||
975 | 907 | ||
@@ -977,3 +909,2 @@ bool QtRec::rec() { //record | |||
977 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | 909 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); |
978 | // quickRec(); | ||
979 | toBeginningButton->setEnabled(false); | 910 | toBeginningButton->setEnabled(false); |
@@ -1012,4 +943,4 @@ void QtRec::thisTab(QWidget* widg) { | |||
1012 | 943 | ||
1013 | if(index==0) { //file page | 944 | // if(index==0) { //file page |
1014 | } | 945 | // } |
1015 | 946 | ||
@@ -1021,4 +952,4 @@ void QtRec::thisTab(QWidget* widg) { | |||
1021 | 952 | ||
1022 | if(index==2) { //help page | 953 | // if(index==2) { //help page |
1023 | } | 954 | // } |
1024 | qApp->processEvents(); | 955 | qApp->processEvents(); |
@@ -1030,3 +961,2 @@ void QtRec::getOutVol( ) { | |||
1030 | filePara.outVol = soundDevice->getOutVolume(); | 961 | filePara.outVol = soundDevice->getOutVolume(); |
1031 | qDebug("out vol %d", filePara.outVol); | ||
1032 | OutputSlider->setValue( -filePara.outVol); | 962 | OutputSlider->setValue( -filePara.outVol); |
@@ -1036,3 +966,2 @@ void QtRec::getInVol() { | |||
1036 | filePara.inVol = soundDevice->getInVolume(); | 966 | filePara.inVol = soundDevice->getInVolume(); |
1037 | qDebug("in vol %d", filePara.inVol); | ||
1038 | InputSlider->setValue( -filePara.inVol); | 967 | InputSlider->setValue( -filePara.inVol); |
@@ -1057,3 +986,2 @@ bool QtRec::setupAudio( bool b) { | |||
1057 | if( !b){ // we want to play | 986 | if( !b){ // we want to play |
1058 | qDebug("setting up DSP for playing"); | ||
1059 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 987 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
@@ -1071,3 +999,2 @@ bool QtRec::setupAudio( bool b) { | |||
1071 | } else { // we want to record | 999 | } else { // we want to record |
1072 | qDebug("setting up DSP for recording"); | ||
1073 | 1000 | ||
@@ -1080,3 +1007,2 @@ bool QtRec::setupAudio( bool b) { | |||
1080 | filePara.format=WAVE_FORMAT_PCM; | 1007 | filePara.format=WAVE_FORMAT_PCM; |
1081 | qDebug("WAVE_FORMAT_PCM"); | ||
1082 | } else { | 1008 | } else { |
@@ -1084,3 +1010,2 @@ bool QtRec::setupAudio( bool b) { | |||
1084 | sampleformat=AFMT_S16_LE; | 1010 | sampleformat=AFMT_S16_LE; |
1085 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | ||
1086 | } | 1011 | } |
@@ -1088,5 +1013,3 @@ bool QtRec::setupAudio( bool b) { | |||
1088 | stereo = filePara.channels = 1; | 1013 | stereo = filePara.channels = 1; |
1089 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; | ||
1090 | flags= O_RDWR; | 1014 | flags= O_RDWR; |
1091 | // flags= O_RDONLY; | ||
1092 | dspString = DSPSTRIN; | 1015 | dspString = DSPSTRIN; |
@@ -1096,3 +1019,2 @@ bool QtRec::setupAudio( bool b) { | |||
1096 | // if(soundDevice) delete soundDevice; | 1019 | // if(soundDevice) delete soundDevice; |
1097 | qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); | ||
1098 | soundDevice = new Device( this, dspString, mixerString, b); | 1020 | soundDevice = new Device( this, dspString, mixerString, b); |
@@ -1101,5 +1023,2 @@ bool QtRec::setupAudio( bool b) { | |||
1101 | 1023 | ||
1102 | qDebug("device has been made %d", soundDevice->sd); | ||
1103 | |||
1104 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> | ||
1105 | soundDevice->setDeviceFormat( sampleformat); | 1024 | soundDevice->setDeviceFormat( sampleformat); |
@@ -1113,3 +1032,3 @@ bool QtRec::setupAudio( bool b) { | |||
1113 | #endif | 1032 | #endif |
1114 | ///////////////// | 1033 | |
1115 | filePara.sd = soundDevice->sd; | 1034 | filePara.sd = soundDevice->sd; |
@@ -1117,3 +1036,2 @@ bool QtRec::setupAudio( bool b) { | |||
1117 | if ( filePara.sd == -1) { | 1036 | if ( filePara.sd == -1) { |
1118 | |||
1119 | monitoring=false; | 1037 | monitoring=false; |
@@ -1121,3 +1039,3 @@ bool QtRec::setupAudio( bool b) { | |||
1121 | update(); | 1039 | update(); |
1122 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1040 | setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); |
1123 | stopped=true; | 1041 | stopped=true; |
@@ -1133,3 +1051,3 @@ bool QtRec::setupAudio( bool b) { | |||
1133 | bool QtRec::setUpFile() { //setup file for recording | 1051 | bool QtRec::setUpFile() { //setup file for recording |
1134 | qDebug("Setting up wavfile"); | 1052 | // qDebug("Setting up wavfile"); |
1135 | // if(wavFile) delete wavFile; | 1053 | // if(wavFile) delete wavFile; |
@@ -1162,3 +1080,3 @@ bool QtRec::doPlay() { | |||
1162 | if( !paused) { | 1080 | if( !paused) { |
1163 | qDebug("new"); | 1081 | // qDebug("new"); |
1164 | total=0; | 1082 | total=0; |
@@ -1175,3 +1093,2 @@ bool QtRec::doPlay() { | |||
1175 | // block=BUFSIZE; | 1093 | // block=BUFSIZE; |
1176 | qDebug("Play number of samples %d", filePara.numberSamples); | ||
1177 | timeSlider->setRange(0, filePara.numberSamples); | 1094 | timeSlider->setRange(0, filePara.numberSamples); |
@@ -1180,7 +1097,7 @@ bool QtRec::doPlay() { | |||
1180 | 1097 | ||
1181 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { | 1098 | // if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { |
1182 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | 1099 | // // qDebug("WAVE_FORMAT_DVI_ADPCM"); |
1183 | } else { | 1100 | // } else { |
1184 | qDebug("WAVE_FORMAT_PCM"); | 1101 | // // qDebug("WAVE_FORMAT_PCM"); |
1185 | } | 1102 | // } |
1186 | QString msg; | 1103 | QString msg; |
@@ -1191,3 +1108,3 @@ bool QtRec::doPlay() { | |||
1191 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { | 1108 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { |
1192 | qDebug("16 bit"); | 1109 | // qDebug("16 bit"); |
1193 | 1110 | ||
@@ -1279,3 +1196,3 @@ bool QtRec::doPlay() { | |||
1279 | } else { /////////////////////////////// format = AFMT_U8; | 1196 | } else { /////////////////////////////// format = AFMT_U8; |
1280 | unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; | 1197 | unsigned char unsigned_inbuffer[BUFSIZE];//, unsigned_outbuffer[BUFSIZE]; |
1281 | memset( unsigned_inbuffer,0,BUFSIZE); | 1198 | memset( unsigned_inbuffer,0,BUFSIZE); |
@@ -1345,3 +1262,3 @@ void QtRec::changesamplerateCombo(int i) { | |||
1345 | // delete soundDevice; | 1262 | // delete soundDevice; |
1346 | qDebug("Change sample rate %d", rate); | 1263 | // qDebug("Change sample rate %d", rate); |
1347 | cfg.write(); | 1264 | cfg.write(); |
@@ -1366,3 +1283,3 @@ void QtRec::changeDirCombo(int index) { | |||
1366 | cfg.writeEntry("directory", recDir); | 1283 | cfg.writeEntry("directory", recDir); |
1367 | qDebug("new rec dir "+recDir); | 1284 | // qDebug("new rec dir "+recDir); |
1368 | } | 1285 | } |
@@ -1381,6 +1298,6 @@ void QtRec::changeSizeLimitCombo(int) { | |||
1381 | void QtRec::newSound() { | 1298 | void QtRec::newSound() { |
1382 | qDebug("<<<<<<<<<new sound"); | 1299 | // qDebug("<<<<<<<<<new sound"); |
1383 | 1300 | ||
1384 | if( !rec()) { | 1301 | if( !rec()) { |
1385 | qDebug("rec() failed"); | 1302 | // qDebug("rec() failed"); |
1386 | endRecording(); | 1303 | endRecording(); |
@@ -1450,3 +1367,3 @@ void QtRec::deleteSound() { | |||
1450 | #endif | 1367 | #endif |
1451 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1368 | setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); |
1452 | 1369 | ||
@@ -1515,3 +1432,3 @@ void QtRec::keyPressEvent( QKeyEvent *e) { | |||
1515 | case Key_Left: { | 1432 | case Key_Left: { |
1516 | qDebug("rewinding"); | 1433 | // qDebug("rewinding"); |
1517 | if( !e->isAutoRepeat()) | 1434 | if( !e->isAutoRepeat()) |
@@ -1569,3 +1486,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1569 | // stop(); | 1486 | // stop(); |
1570 | qDebug("Up"); | 1487 | // qDebug("Up"); |
1571 | break; | 1488 | break; |
@@ -1577,3 +1494,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1577 | case Key_Left: | 1494 | case Key_Left: |
1578 | qDebug("Left"); | 1495 | // qDebug("Left"); |
1579 | rewindReleased(); | 1496 | rewindReleased(); |
@@ -1581,3 +1498,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1581 | case Key_Right: | 1498 | case Key_Right: |
1582 | qDebug("Right"); | 1499 | // qDebug("Right"); |
1583 | FastforwardReleased(); | 1500 | FastforwardReleased(); |
@@ -1588,3 +1505,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1588 | void QtRec::endRecording() { | 1505 | void QtRec::endRecording() { |
1589 | qDebug("endRecording"); | 1506 | // qDebug("endRecording"); |
1590 | setRecordButton(false); | 1507 | setRecordButton(false); |
@@ -1619,3 +1536,3 @@ void QtRec::endRecording() { | |||
1619 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); | 1536 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); |
1620 | qDebug("moving tmp file to "+currentFileName); | 1537 | // qDebug("moving tmp file to "+currentFileName); |
1621 | system(cmd.latin1()); | 1538 | system(cmd.latin1()); |
@@ -1623,3 +1540,3 @@ void QtRec::endRecording() { | |||
1623 | 1540 | ||
1624 | qDebug("Just moved "+wavFile->currentFileName); | 1541 | // qDebug("Just moved "+wavFile->currentFileName); |
1625 | Config cfg("OpieRec"); | 1542 | Config cfg("OpieRec"); |
@@ -1639,6 +1556,6 @@ void QtRec::endRecording() { | |||
1639 | cfg.writeEntry( wavFile->currentFileName, time ); | 1556 | cfg.writeEntry( wavFile->currentFileName, time ); |
1640 | qDebug("writing config numberOfRecordedSeconds "+time); | 1557 | // qDebug("writing config numberOfRecordedSeconds "+time); |
1641 | 1558 | ||
1642 | cfg.write(); | 1559 | cfg.write(); |
1643 | qDebug("finished recording"); | 1560 | // qDebug("finished recording"); |
1644 | timeLabel->setText(""); | 1561 | timeLabel->setText(""); |
@@ -1654,3 +1571,3 @@ void QtRec::endPlaying() { | |||
1654 | 1571 | ||
1655 | qDebug("end playing"); | 1572 | // qDebug("end playing"); |
1656 | setRecordButton(false); | 1573 | setRecordButton(false); |
@@ -1666,3 +1583,3 @@ void QtRec::endPlaying() { | |||
1666 | // if(soundDevice) delete soundDevice; | 1583 | // if(soundDevice) delete soundDevice; |
1667 | qDebug("file and sound device closed"); | 1584 | // qDebug("file and sound device closed"); |
1668 | stopped=true; | 1585 | stopped=true; |
@@ -1679,3 +1596,3 @@ void QtRec::endPlaying() { | |||
1679 | 1596 | ||
1680 | qDebug("track closed"); | 1597 | // qDebug("track closed"); |
1681 | timeSlider->setValue(0); | 1598 | timeSlider->setValue(0); |
@@ -1701,3 +1618,3 @@ bool QtRec::openPlayFile() { | |||
1701 | currentFileName=cfg.readEntry( currentFile, "" ); | 1618 | currentFileName=cfg.readEntry( currentFile, "" ); |
1702 | qDebug("opening for play: "+currentFileName); | 1619 | // qDebug("opening for play: "+currentFileName); |
1703 | } | 1620 | } |
@@ -1712,3 +1629,3 @@ bool QtRec::openPlayFile() { | |||
1712 | monitoring=false; | 1629 | monitoring=false; |
1713 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1630 | setCaption( tr( "OpieRecord " )/* + QString::number(VERSION)*/ ); |
1714 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") | 1631 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") |
@@ -1823,4 +1740,4 @@ void QtRec::doRename() { | |||
1823 | void QtRec::okRename() { | 1740 | void QtRec::okRename() { |
1824 | qDebug("okRename"); | 1741 | // qDebug("okRename"); |
1825 | qDebug(renameBox->text()); | 1742 | // qDebug(renameBox->text()); |
1826 | QString filename = renameBox->text(); | 1743 | QString filename = renameBox->text(); |
@@ -1836,3 +1753,3 @@ void QtRec::okRename() { | |||
1836 | 1753 | ||
1837 | qDebug("filename is " + filename); | 1754 | // qDebug("filename is " + filename); |
1838 | 1755 | ||
@@ -1860,3 +1777,3 @@ void QtRec::okRename() { | |||
1860 | void QtRec::cancelRename() { | 1777 | void QtRec::cancelRename() { |
1861 | qDebug("cancel rename"); | 1778 | // qDebug("cancel rename"); |
1862 | bool resetFocus = ListView1->viewport()->focusProxy() == renameBox; | 1779 | bool resetFocus = ListView1->viewport()->focusProxy() == renameBox; |
@@ -1896,3 +1813,3 @@ int QtRec::getCurrentSizeLimit() { | |||
1896 | void QtRec::timerBreak() { | 1813 | void QtRec::timerBreak() { |
1897 | qDebug("timer break"); | 1814 | // qDebug("timer break"); |
1898 | stop(); | 1815 | stop(); |
@@ -1963,4 +1880,4 @@ long QtRec::checkDiskSpace(const QString &path) { | |||
1963 | 1880 | ||
1964 | void QtRec::receive( const QCString &msg, const QByteArray & ) { | 1881 | void QtRec::receive( const QCString &/* msg*/, const QByteArray & ) { |
1965 | qDebug("Voicerecord received message "+msg); | 1882 | // qDebug("Voicerecord received message "+msg); |
1966 | 1883 | ||
@@ -2229,4 +2146,4 @@ long findPeak(long input ) { | |||
2229 | // halfLife = time in seconds for output to decay to half value after an impulse | 2146 | // halfLife = time in seconds for output to decay to half value after an impulse |
2230 | static float output = 0.0; | 2147 | float output = 0.0; |
2231 | int halfLife = .25; | 2148 | float halfLife = .25; |
2232 | float vsf = .0025; | 2149 | float vsf = .0025; |
@@ -2235,9 +2152,6 @@ long findPeak(long input ) { | |||
2235 | input = -input; // Absolute value. | 2152 | input = -input; // Absolute value. |
2236 | if ( input >= output ) | 2153 | if ( input >= output) { |
2237 | { | ||
2238 | // When we hit a peak, ride the peak to the top. | 2154 | // When we hit a peak, ride the peak to the top. |
2239 | output = input; | 2155 | output = input; |
2240 | } | 2156 | } else { |
2241 | else | ||
2242 | { | ||
2243 | // Exponential decay of output when signal is low. | 2157 | // Exponential decay of output when signal is low. |
@@ -2252,3 +2166,3 @@ long findPeak(long input ) { | |||
2252 | 2166 | ||
2253 | return output; | 2167 | return (long)output; |
2254 | } | 2168 | } |
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index bcf5504..7965c74 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h | |||
@@ -6,3 +6,3 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com | |||
6 | #define QTREC_H | 6 | #define QTREC_H |
7 | #define VERSION 20021202 | 7 | #define VERSION 1.0 |
8 | 8 | ||