-rw-r--r-- | noncore/multimedia/opierec/opierec.pro | 5 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 143 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
3 files changed, 62 insertions, 88 deletions
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro index 39fe493..5651151 100644 --- a/noncore/multimedia/opierec/opierec.pro +++ b/noncore/multimedia/opierec/opierec.pro @@ -1,3 +1,3 @@ -#CONFIG = qt qtopia warn_on release pdaudio -CONFIG = qt warn_on release opie +CONFIG = qt qtopia warn_on release pdaudio +#CONFIG = qt warn_on release opie #CONFIG = qt warn_on release quick-app @@ -25,2 +25,3 @@ contains(CONFIG, pdaudio) { DEFINES += PDAUDIO + DEFINES += THREADED TARGET = qperec 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 @@ ****************************************************************************/ - #define DEV_VERSION @@ -118,7 +117,9 @@ Device *soundDevice; -// threaded recording -//fuckin fulgy here -//void quickRec() -//{ -void QtRec::quickRec() { + +#ifdef THREADED +void quickRec() +#else + void QtRec::quickRec() +#endif +{ @@ -159,3 +160,3 @@ void QtRec::quickRec() { if ( stopped) { - qDebug("quickRec:: stopped"); +// qDebug("quickRec:: stopped"); break; @@ -235,3 +236,2 @@ void QtRec::quickRec() { filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels; - qApp->processEvents(); @@ -245,3 +245,4 @@ void QtRec::quickRec() { - } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; + } else { +// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; @@ -284,7 +285,11 @@ void QtRec::quickRec() { -void QtRec::playIt() -//void playIt() +#ifdef THREADED +void playIt() +#else + void QtRec::playIt() +#endif { - int bytesWritten, number; + int bytesWritten = 0; + int number = 0; int total = 0; // Total number of bytes read in so far. @@ -324,4 +329,4 @@ void QtRec::playIt() // timeLabel->setText( timeString+ tr(" seconds")); - printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); - fflush(stdout); +// printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); +// fflush(stdout); @@ -410,4 +415,4 @@ void QtRec::playIt() } - printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); - fflush(stdout); +// printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); +// fflush(stdout); } @@ -416,3 +421,2 @@ void QtRec::playIt() -/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> @@ -429,3 +433,10 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) // open sound device to get volumes - soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); + Config hwcfg("OpieRec"); + hwcfg.setGroup("Hardware"); + + + soundDevice = new Device( this, + hwcfg.readEntry( "Audio",DSPSTROUT), + hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); +// soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); @@ -642,8 +653,2 @@ void QtRec::init() { - QWidget *d = QApplication::desktop(); - int width = d->width(); - int height = d->height(); - - if( width < height) { - tab_5 = new QWidget( TabWidget, "tab_5" ); @@ -698,48 +703,2 @@ void QtRec::init() { - } else {// landscape - - // Layout16->addWidget( dirGroup ); - // Layout18->addLayout( Layout16 ); - Layout15 = new QVBoxLayout(this); - Layout15->setSpacing( 2 ); - Layout15->setMargin( 0 ); - - Layout15b = new QVBoxLayout(this); - Layout15b->setSpacing( 2 ); - Layout15b->setMargin( 0 ); - - TextLabel2 = new QLabel( tab_3, "InputLabel" ); - TextLabel2->setText( tr( "In")); - TextLabel2->setFixedWidth(35); - Layout15->addWidget( TextLabel2 ); - - TextLabel3 = new QLabel( tab_3, "OutputLabel" ); - TextLabel3->setText( tr( "Out" ) ); - Layout15b->addWidget( TextLabel3 ); - - InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" ); - InputSlider->setTickmarks(QSlider::Both); - Layout15->addWidget( InputSlider); - - OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" ); - OutputSlider->setTickmarks(QSlider::Both); - - Layout15b->addWidget( OutputSlider ); - - outMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); - Layout15->addWidget( outMuteCheckBox ); - - inMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); - inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); - Layout15b->addWidget( inMuteCheckBox ); - - - Layout19->addLayout( Layout15 ); - Layout19->addLayout( Layout15b ); - - fillDirectoryCombo(); - - TabWidget->insertTab( tab_3, tr( "Options" ) ); - - } @@ -762,3 +721,3 @@ void QtRec::initIconView() { int nFiles = cfg.readNumEntry("NumberofFiles",0); - qDebug("init number of files %d", nFiles); +// qDebug("init number of files %d", nFiles); @@ -1010,7 +969,9 @@ bool QtRec::rec() { //record filePara.fileName=currentFile.latin1(); -// qDebug("Start recording thread"); + qDebug("Start recording thread"); stopped = false; -// pthread_t thread1; -// pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); +#ifdef THREADED + pthread_t thread1; + pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); +#endif toBeginningButton->setEnabled( false); @@ -1019,3 +980,5 @@ bool QtRec::rec() { //record startTimer(1000); +#ifndef THREADED quickRec(); +#endif } @@ -1072,3 +1035,3 @@ bool QtRec::setupAudio( bool b) { int sampleformat, stereo, flags; - char * dspString, *mixerString; + QString dspString, mixerString; @@ -1076,4 +1039,5 @@ bool QtRec::setupAudio( bool b) { + if( !b) { +// we want to play #ifdef PDAUDIO //ALSA - if( !b) { // we want to play if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { @@ -1092,3 +1056,2 @@ bool QtRec::setupAudio( bool b) { #else - if( !b) { // we want to play @@ -1105,4 +1068,6 @@ bool QtRec::setupAudio( bool b) { flags = O_WRONLY; - dspString = DSPSTROUT; - mixerString = DSPSTRMIXEROUT; + Config hwcfg("OpieRec"); + hwcfg.setGroup("Hardware"); + dspString = hwcfg.readEntry( "Audio", DSPSTROUT); + mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); recording = false; @@ -1140,4 +1105,6 @@ bool QtRec::setupAudio( bool b) { // flags= O_RDONLY; - dspString = DSPSTRIN; - mixerString = DSPSTRMIXEROUT; + Config hwcfg("OpieRec"); + hwcfg.setGroup("Hardware"); + dspString = hwcfg.readEntry( "Audio", DSPSTRIN); + mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); recording = true; @@ -1222,3 +1189,3 @@ bool QtRec::doPlay() { - timeString.sprintf("%d", filePara.numberOfRecordedSeconds); + timeString.sprintf("%f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); @@ -1235,4 +1202,6 @@ bool QtRec::doPlay() { startTimer( 1000); -// pthread_t thread2; -// pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); +#ifdef THREADED + pthread_t thread2; + pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); +#endif @@ -1240,4 +1209,5 @@ bool QtRec::doPlay() { toEndButton->setEnabled( false); +#ifndef THREADED playIt(); - +#endif return true; @@ -1868,3 +1838,3 @@ void QtRec::receive( const QCString &msg, const QByteArray & ) { ///////////////////////////// timerEvent -void QtRec::timerEvent( QTimerEvent *e ) { +void QtRec::timerEvent( QTimerEvent * ) { @@ -2162 +2132,2 @@ void QtRec::changeStereoCheck(bool b) { + diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index 31cff9e..5878d37 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h @@ -179,4 +179,6 @@ protected: void showListMenu(QListViewItem * ); +#ifndef THREADED void quickRec(); void playIt(); +#endif |