summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 8a0f8db..28f6546 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -201,9 +201,9 @@ void quickRec() {
201 peak = findPeak((long)sbuf[i]); 201 peak = findPeak((long)sbuf[i]);
202 printf("peak %ld\r",peak); 202 printf("peak %ld\r",peak);
203 fflush(stdout); 203 fflush(stdout);
204 } 204 }
205 205
206 206
207 //------------->>>> out to file 207 //------------->>>> out to file
208 // if(filePara.channels==1) 208 // if(filePara.channels==1)
209 // total += bytesWritten/2; //mono 209 // total += bytesWritten/2; //mono
@@ -279,9 +279,9 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
279 peak = findPeak((long)inbuffer[i]); 279 peak = findPeak((long)inbuffer[i]);
280 printf("peak %ld\r",peak); 280 printf("peak %ld\r",peak);
281 fflush(stdout); 281 fflush(stdout);
282 } 282 }
283 283
284 284
285 filePara.numberSamples = total; 285 filePara.numberSamples = total;
286 if(filePara.SecondsToRecord !=0) 286 if(filePara.SecondsToRecord !=0)
287 timeSlider->setValue( total); 287 timeSlider->setValue( total);
@@ -289,9 +289,9 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
289// fflush(stdout); 289// fflush(stdout);
290 290
291 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); 291 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info);
292// qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2); 292// qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2);
293 293
294 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; 294 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
295 295
296 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 296 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
297 timeLabel->setText( timeString + " seconds"); 297 timeLabel->setText( timeString + " seconds");
@@ -557,9 +557,9 @@ void QtRec::init() {
557 sampleRateComboBox->insertItem( tr( "32000")); 557 sampleRateComboBox->insertItem( tr( "32000"));
558//#endif 558//#endif
559 sampleRateComboBox->insertItem( tr( "22050")); 559 sampleRateComboBox->insertItem( tr( "22050"));
560 //#ifndef QT_QWS_VERCEL_IDR 560 //#ifndef QT_QWS_VERCEL_IDR
561 sampleRateComboBox->insertItem( tr( "16000")); 561 sampleRateComboBox->insertItem( tr( "16000"));
562 sampleRateComboBox->insertItem( tr( "11025")); 562 sampleRateComboBox->insertItem( tr( "11025"));
563 sampleRateComboBox->insertItem( tr( "8000")); 563 sampleRateComboBox->insertItem( tr( "8000"));
564 //#endif 564 //#endif
565 565
@@ -726,32 +726,32 @@ void QtRec::init() {
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, "opierec_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>OpieRec</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>OpieRec</B> is copyright&copy; 2002 by" 750// "<B>OpieRec</B> is copyright&copy; 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
@@ -847,9 +847,9 @@ void QtRec::initConfig() {
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);
851 851
852// sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs")); 852// sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs"));
853// } 853// }
854 sizeLimitCombo->setCurrentItem((i/5)); 854 sizeLimitCombo->setCurrentItem((i/5));
855 855
@@ -929,10 +929,10 @@ bool QtRec::rec() { //record
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("OpieRec"); 938 Config cfg("OpieRec");
@@ -999,9 +999,9 @@ bool QtRec::rec() { //record
999 } 999 }
1000 } //end setUpFile 1000 } //end setUpFile
1001 } //end setupAudio 1001 } //end setupAudio
1002 // _exit( 0); 1002 // _exit( 0);
1003 1003
1004 // ///* default: 1004 // ///* default:
1005// // /* pid greater than zero is parent getting the child's pid */ 1005// // /* pid greater than zero is parent getting the child's pid */
1006// /* printf("Child's pid is %d\n",pid); 1006// /* printf("Child's pid is %d\n",pid);
1007// waitpid( pid, &status, 0); 1007// waitpid( pid, &status, 0);
@@ -1115,19 +1115,19 @@ bool QtRec::setupAudio( bool 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) {
@@ -1350,13 +1350,13 @@ void QtRec::changesamplerateCombo(int i) {
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);
@@ -1988,9 +1988,9 @@ void QtRec::timerEvent( QTimerEvent *e ) {
1988// qDebug( "%d", secCount ); 1988// qDebug( "%d", secCount );
1989#ifdef DEV_VERSION 1989#ifdef DEV_VERSION
1990 QString msg; 1990 QString msg;
1991 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 1991 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
1992 setCaption( msg +" :: "+QString::number(secCount)); 1992 setCaption( msg +" :: "+QString::number(secCount));
1993#endif 1993#endif
1994 1994
1995 if( !playing ) { 1995 if( !playing ) {
1996 if(!recording ){ 1996 if(!recording ){
@@ -2257,9 +2257,9 @@ long findPeak(long input ) {
2257 else 2257 else
2258 { 2258 {
2259// Exponential decay of output when signal is low. 2259// Exponential decay of output when signal is low.
2260 output = output * scalar; 2260 output = output * scalar;
2261// 2261//
2262// When current gets close to 0.0, set current to 0.0 to prevent FP underflow 2262// When current gets close to 0.0, set current to 0.0 to prevent FP underflow
2263// which can cause a severe performance degradation due to a flood 2263// which can cause a severe performance degradation due to a flood
2264// of interrupts. 2264// of interrupts.
2265// 2265//