Diffstat (limited to 'noncore/multimedia/opierec/qtrec.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 143 |
1 files changed, 57 insertions, 86 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index bc6abcc..0a6e5ae 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -5,3 +5,2 @@ | |||
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | |||
7 | #define DEV_VERSION | 6 | #define DEV_VERSION |
@@ -118,7 +117,9 @@ Device *soundDevice; | |||
118 | 117 | ||
119 | // threaded recording | 118 | |
120 | //fuckin fulgy here | 119 | #ifdef THREADED |
121 | //void quickRec() | 120 | void quickRec() |
122 | //{ | 121 | #else |
123 | void QtRec::quickRec() { | 122 | void QtRec::quickRec() |
123 | #endif | ||
124 | { | ||
124 | 125 | ||
@@ -159,3 +160,3 @@ void QtRec::quickRec() { | |||
159 | if ( stopped) { | 160 | if ( stopped) { |
160 | qDebug("quickRec:: stopped"); | 161 | // qDebug("quickRec:: stopped"); |
161 | break; | 162 | break; |
@@ -235,3 +236,2 @@ void QtRec::quickRec() { | |||
235 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels; | 236 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels; |
236 | |||
237 | qApp->processEvents(); | 237 | qApp->processEvents(); |
@@ -245,3 +245,4 @@ void QtRec::quickRec() { | |||
245 | 245 | ||
246 | } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; | 246 | } else { |
247 | // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; | ||
247 | unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; | 248 | unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; |
@@ -284,7 +285,11 @@ void QtRec::quickRec() { | |||
284 | 285 | ||
285 | void QtRec::playIt() | ||
286 | 286 | ||
287 | //void playIt() | 287 | #ifdef THREADED |
288 | void playIt() | ||
289 | #else | ||
290 | void QtRec::playIt() | ||
291 | #endif | ||
288 | { | 292 | { |
289 | int bytesWritten, number; | 293 | int bytesWritten = 0; |
294 | int number = 0; | ||
290 | int total = 0; // Total number of bytes read in so far. | 295 | int total = 0; // Total number of bytes read in so far. |
@@ -324,4 +329,4 @@ void QtRec::playIt() | |||
324 | // timeLabel->setText( timeString+ tr(" seconds")); | 329 | // timeLabel->setText( timeString+ tr(" seconds")); |
325 | printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); | 330 | // printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); |
326 | fflush(stdout); | 331 | // fflush(stdout); |
327 | 332 | ||
@@ -410,4 +415,4 @@ void QtRec::playIt() | |||
410 | } | 415 | } |
411 | printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); | 416 | // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); |
412 | fflush(stdout); | 417 | // fflush(stdout); |
413 | } | 418 | } |
@@ -416,3 +421,2 @@ void QtRec::playIt() | |||
416 | 421 | ||
417 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | ||
418 | 422 | ||
@@ -429,3 +433,10 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | |||
429 | // open sound device to get volumes | 433 | // open sound device to get volumes |
430 | soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); | 434 | Config hwcfg("OpieRec"); |
435 | hwcfg.setGroup("Hardware"); | ||
436 | |||
437 | |||
438 | soundDevice = new Device( this, | ||
439 | hwcfg.readEntry( "Audio",DSPSTROUT), | ||
440 | hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); | ||
441 | // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); | ||
431 | 442 | ||
@@ -642,8 +653,2 @@ void QtRec::init() { | |||
642 | 653 | ||
643 | QWidget *d = QApplication::desktop(); | ||
644 | int width = d->width(); | ||
645 | int height = d->height(); | ||
646 | |||
647 | if( width < height) { | ||
648 | |||
649 | tab_5 = new QWidget( TabWidget, "tab_5" ); | 654 | tab_5 = new QWidget( TabWidget, "tab_5" ); |
@@ -698,48 +703,2 @@ void QtRec::init() { | |||
698 | 703 | ||
699 | } else {// landscape | ||
700 | |||
701 | // Layout16->addWidget( dirGroup ); | ||
702 | // Layout18->addLayout( Layout16 ); | ||
703 | Layout15 = new QVBoxLayout(this); | ||
704 | Layout15->setSpacing( 2 ); | ||
705 | Layout15->setMargin( 0 ); | ||
706 | |||
707 | Layout15b = new QVBoxLayout(this); | ||
708 | Layout15b->setSpacing( 2 ); | ||
709 | Layout15b->setMargin( 0 ); | ||
710 | |||
711 | TextLabel2 = new QLabel( tab_3, "InputLabel" ); | ||
712 | TextLabel2->setText( tr( "In")); | ||
713 | TextLabel2->setFixedWidth(35); | ||
714 | Layout15->addWidget( TextLabel2 ); | ||
715 | |||
716 | TextLabel3 = new QLabel( tab_3, "OutputLabel" ); | ||
717 | TextLabel3->setText( tr( "Out" ) ); | ||
718 | Layout15b->addWidget( TextLabel3 ); | ||
719 | |||
720 | InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" ); | ||
721 | InputSlider->setTickmarks(QSlider::Both); | ||
722 | Layout15->addWidget( InputSlider); | ||
723 | |||
724 | OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" ); | ||
725 | OutputSlider->setTickmarks(QSlider::Both); | ||
726 | |||
727 | Layout15b->addWidget( OutputSlider ); | ||
728 | |||
729 | outMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); | ||
730 | Layout15->addWidget( outMuteCheckBox ); | ||
731 | |||
732 | inMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); | ||
733 | inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); | ||
734 | Layout15b->addWidget( inMuteCheckBox ); | ||
735 | |||
736 | |||
737 | Layout19->addLayout( Layout15 ); | ||
738 | Layout19->addLayout( Layout15b ); | ||
739 | |||
740 | fillDirectoryCombo(); | ||
741 | |||
742 | TabWidget->insertTab( tab_3, tr( "Options" ) ); | ||
743 | |||
744 | } | ||
745 | 704 | ||
@@ -762,3 +721,3 @@ void QtRec::initIconView() { | |||
762 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 721 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
763 | qDebug("init number of files %d", nFiles); | 722 | // qDebug("init number of files %d", nFiles); |
764 | 723 | ||
@@ -1010,7 +969,9 @@ bool QtRec::rec() { //record | |||
1010 | filePara.fileName=currentFile.latin1(); | 969 | filePara.fileName=currentFile.latin1(); |
1011 | // qDebug("Start recording thread"); | 970 | qDebug("Start recording thread"); |
1012 | stopped = false; | 971 | stopped = false; |
1013 | 972 | ||
1014 | // pthread_t thread1; | 973 | #ifdef THREADED |
1015 | // pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | 974 | pthread_t thread1; |
975 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | ||
976 | #endif | ||
1016 | toBeginningButton->setEnabled( false); | 977 | toBeginningButton->setEnabled( false); |
@@ -1019,3 +980,5 @@ bool QtRec::rec() { //record | |||
1019 | startTimer(1000); | 980 | startTimer(1000); |
981 | #ifndef THREADED | ||
1020 | quickRec(); | 982 | quickRec(); |
983 | #endif | ||
1021 | } | 984 | } |
@@ -1072,3 +1035,3 @@ bool QtRec::setupAudio( bool b) { | |||
1072 | int sampleformat, stereo, flags; | 1035 | int sampleformat, stereo, flags; |
1073 | char * dspString, *mixerString; | 1036 | QString dspString, mixerString; |
1074 | 1037 | ||
@@ -1076,4 +1039,5 @@ bool QtRec::setupAudio( bool b) { | |||
1076 | 1039 | ||
1040 | if( !b) { | ||
1041 | // we want to play | ||
1077 | #ifdef PDAUDIO //ALSA | 1042 | #ifdef PDAUDIO //ALSA |
1078 | if( !b) { // we want to play | ||
1079 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 1043 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
@@ -1092,3 +1056,2 @@ bool QtRec::setupAudio( bool b) { | |||
1092 | #else | 1056 | #else |
1093 | if( !b) { | ||
1094 | // we want to play | 1057 | // we want to play |
@@ -1105,4 +1068,6 @@ bool QtRec::setupAudio( bool b) { | |||
1105 | flags = O_WRONLY; | 1068 | flags = O_WRONLY; |
1106 | dspString = DSPSTROUT; | 1069 | Config hwcfg("OpieRec"); |
1107 | mixerString = DSPSTRMIXEROUT; | 1070 | hwcfg.setGroup("Hardware"); |
1071 | dspString = hwcfg.readEntry( "Audio", DSPSTROUT); | ||
1072 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); | ||
1108 | recording = false; | 1073 | recording = false; |
@@ -1140,4 +1105,6 @@ bool QtRec::setupAudio( bool b) { | |||
1140 | // flags= O_RDONLY; | 1105 | // flags= O_RDONLY; |
1141 | dspString = DSPSTRIN; | 1106 | Config hwcfg("OpieRec"); |
1142 | mixerString = DSPSTRMIXEROUT; | 1107 | hwcfg.setGroup("Hardware"); |
1108 | dspString = hwcfg.readEntry( "Audio", DSPSTRIN); | ||
1109 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); | ||
1143 | recording = true; | 1110 | recording = true; |
@@ -1222,3 +1189,3 @@ bool QtRec::doPlay() { | |||
1222 | 1189 | ||
1223 | timeString.sprintf("%d", filePara.numberOfRecordedSeconds); | 1190 | timeString.sprintf("%f", filePara.numberOfRecordedSeconds); |
1224 | timeLabel->setText( timeString+ tr(" seconds")); | 1191 | timeLabel->setText( timeString+ tr(" seconds")); |
@@ -1235,4 +1202,6 @@ bool QtRec::doPlay() { | |||
1235 | startTimer( 1000); | 1202 | startTimer( 1000); |
1236 | // pthread_t thread2; | 1203 | #ifdef THREADED |
1237 | // pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); | 1204 | pthread_t thread2; |
1205 | pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); | ||
1206 | #endif | ||
1238 | 1207 | ||
@@ -1240,4 +1209,5 @@ bool QtRec::doPlay() { | |||
1240 | toEndButton->setEnabled( false); | 1209 | toEndButton->setEnabled( false); |
1210 | #ifndef THREADED | ||
1241 | playIt(); | 1211 | playIt(); |
1242 | 1212 | #endif | |
1243 | return true; | 1213 | return true; |
@@ -1868,3 +1838,3 @@ void QtRec::receive( const QCString &msg, const QByteArray & ) { | |||
1868 | ///////////////////////////// timerEvent | 1838 | ///////////////////////////// timerEvent |
1869 | void QtRec::timerEvent( QTimerEvent *e ) { | 1839 | void QtRec::timerEvent( QTimerEvent * ) { |
1870 | 1840 | ||
@@ -2162 +2132,2 @@ void QtRec::changeStereoCheck(bool b) { | |||
2162 | 2132 | ||
2133 | |||