-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 101 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
2 files changed, 40 insertions, 63 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index c237726..6793b4e 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -341,608 +341,585 @@ void playIt() timeSlider->setValue( total/4); // timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); // if(filePara.numberOfRecordedSeconds>1) // timeLabel->setText( timeString+ tr(" seconds")); // printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); // fflush(stdout); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { // if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) { stopped = true; break; } } } else { // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; memset( inbuffer, 0, BUFSIZE); memset( outbuffer, 0, BUFSIZE); for(;;) { // play loop if ( stopped) { break; return; } // stop if playing was set to false number = ::read( filePara.fd, inbuffer, BUFSIZE); // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel // // for (int i=0;i< number ; i++) { //2*i is left channel // outbuffer[i+1]= outbuffer[i]=inbuffer[i]; // } bytesWritten = ::write( filePara.sd, inbuffer, number); waveform->newSamples( inbuffer, number); //-------------->>>> out to device // total+=bytesWritten; // if(filePara.channels==1) // total += bytesWritten/2; //mono // else total += bytesWritten; timeSlider->setValue( total); filePara.numberSamples = total; filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); // timeLabel->setText( timeString + tr(" seconds")); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; break; } } // printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); // fflush(stdout); } //end loop } else { /////////////////////////////// format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; memset( unsigned_inbuffer, 0, BUFSIZE); for(;;) { // main loop if (stopped) { break; // stop if playing was set to false return; } number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE); //data = (val >> 8) ^ 0x80; // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten ); total += bytesWritten; timeSlider->setValue( total); filePara.numberSamples = total; filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); // timeLabel->setText( timeString + tr(" seconds")); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { // if( total >= filePara.numberSamples ) { stopped = true; break; } // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); // fflush(stdout); } } } QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { if ( !name ) setName( "OpieRec" ); init(); initConfig(); initConnections(); renameBox = 0; // open sound device to get volumes 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); // soundDevice->setDeviceFormat(AFMT_S16_LE); // soundDevice->setDeviceChannels(1); // soundDevice->setDeviceRate( 22050); getInVol(); getOutVol(); soundDevice->closeDevice( true); soundDevice->sd = -1; soundDevice = 0; wavFile = 0; - // if( soundDevice) delete soundDevice; - - initIconView(); + QTimer::singleShot(100,this, SLOT(initIconView())); if( autoMute) doMute( true); - ListView1->setFocus(); +// ListView1->setFocus(); playing = false; } QtRec::~QtRec() { // if( soundDevice) delete soundDevice; } void QtRec::cleanUp() { if( !stopped) { stopped = true; endRecording(); } ListView1->clear(); if( autoMute) doMute(false); // if( wavFile) delete wavFile; // if(soundDevice) delete soundDevice; } void QtRec::init() { needsStereoOut = false; QPixmap image3( ( const char** ) image3_data ); QPixmap image4( ( const char** ) image4_data ); QPixmap image6( ( const char** ) image6_data ); stopped = true; setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); // TabWidget->setTabShape(QTabWidget::Triangular); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab = new QWidget( TabWidget, "tab" ); QGridLayout *layout1 = new QGridLayout( tab); layout1->setSpacing( 2); layout1->setMargin( 2); timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); // timeLabel = new QLabel( tab, "TimeLabel" ); // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); // playLabel2 = new QLabel(tab, "PlayLabel2" ); // playLabel2->setText(tr("Play") ); // playLabel2->setFixedHeight( 18); // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); Stop_PushButton->setFixedSize( 22, 22); Stop_PushButton->setPixmap( image4 ); toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); toBeginningButton->setFixedSize( 22, 22); toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); toEndButton = new QPushButton( tab, "End_PushButton" ); layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); toEndButton->setFixedSize( 22, 22); toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); // QLabel *recLabel2; // recLabel2 = new QLabel( tab, "recLabel2" ); // recLabel2->setText(tr("Rec")); // recLabel2->setFixedHeight( 18); // layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); Rec_PushButton->setFixedSize( 22, 22); Rec_PushButton->setPixmap( image6 ); t = new QTimer( this ); connect( t, SIGNAL( timeout() ), SLOT( timerBreak() ) ); rewindTimer = new QTimer( this ); connect( rewindTimer, SIGNAL( timeout() ), this, SLOT( rewindTimerTimeout() ) ); forwardTimer = new QTimer( this ); connect( forwardTimer, SIGNAL( timeout() ), this, SLOT( forwardTimerTimeout() ) ); deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); deleteSoundButton->setText( tr( "Del" ) ); ListView1 = new QListView( tab, "IconView1" ); layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); ListView1->addColumn( tr( "Name" ) ); // ListView1->setColumnWidth( 0, 140); ListView1->setSorting( 1, false); ListView1->addColumn( tr( "Time" ) ); //in seconds // ListView1->setColumnWidth( 1, -1); // ListView1->addColumn( tr("Location") ); // ListView1->setColumnWidth( 2, -1); // ListView1->addColumn( tr("Date") ); // ListView1->setColumnWidth( 3, -1); ListView1->setColumnWidthMode(0, QListView::Maximum); // ListView1->setColumnWidthMode(1, QListView::Maximum); // ListView1->setColumnWidthMode( 0, QListView::Manual); ListView1->setColumnAlignment( 1, QListView::AlignCenter); // ListView1->setColumnAlignment( 2, QListView::AlignRight); // ListView1->setColumnAlignment( 3, QListView::AlignLeft); ListView1->setAllColumnsShowFocus( true ); QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); TabWidget->insertTab( tab, tr( "Files" ) ); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab_3 = new QWidget( TabWidget, "tab_3" ); QGridLayout *glayout3 = new QGridLayout( tab_3 ); glayout3->setSpacing( 2); glayout3->setMargin( 2); //////////////////////////////////// sampleGroup = new QGroupBox( tab_3, "samplegroup" ); sampleGroup->setTitle( tr( "Sample Rate" ) ); sampleGroup->setFixedSize( 95,50); sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); //#ifndef QT_QWS_EBX QString s; int z = 0; while( deviceSampleRates[z] != -1) { sampleRateComboBox->insertItem( s.setNum( deviceSampleRates[z], 10)); z++; } glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0); sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); sizeGroup->setTitle( tr( "Limit Size" ) ); sizeGroup->setFixedSize( 80, 50); sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" ); sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) ); sizeLimitCombo->insertItem(tr("Unlimited")); for(int i=1;i<13; i++) { sizeLimitCombo->insertItem( QString::number( i * 5)); } glayout3->addMultiCellWidget( sizeGroup, 0, 0, 1, 1); dirGroup = new QGroupBox( tab_3, "dirGroup" ); dirGroup->setTitle( tr( "File Directory" ) ); dirGroup->setFixedSize( 130, 50); directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" ); directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) ); glayout3->addMultiCellWidget( dirGroup, 1, 1, 0, 0); bitGroup = new QGroupBox( tab_3, "bitGroup" ); bitGroup->setTitle( tr( "Bit Depth" ) ); bitGroup->setFixedSize( 65, 50); bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" ); z = 0; while( deviceBitRates[z] != -1) { bitRateComboBox->insertItem( s.setNum( deviceBitRates[z], 10) ); z++; } bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); stereoCheckBox = new QCheckBox ( tr("Stereo"), tab_3 ); glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); tab_5 = new QWidget( TabWidget, "tab_5" ); QHBoxLayout *Layout19a; Layout19a = new QHBoxLayout( tab_5); Layout19a->setSpacing( 2 ); Layout19a->setMargin( 0 ); Layout15 = new QVBoxLayout( this); Layout15->setSpacing( 2 ); Layout15->setMargin( 0 ); Layout15b = new QVBoxLayout( this); Layout15b->setSpacing( 2 ); Layout15b->setMargin( 0 ); TextLabel2 = new QLabel( tab_5, "InputLabel" ); TextLabel2->setText( tr( "In")); TextLabel2->setFixedWidth( 35); Layout15->addWidget( TextLabel2 ); TextLabel3 = new QLabel( tab_5, "OutputLabel" ); TextLabel3->setText( tr( "Out" ) ); Layout15b->addWidget( TextLabel3 ); InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); InputSlider->setTickmarks( QSlider::Both); Layout15->addWidget( InputSlider); OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); OutputSlider->setTickmarks( QSlider::Both); Layout15b->addWidget( OutputSlider ); outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); Layout15->addWidget( outMuteCheckBox ); inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); Layout15b->addWidget( inMuteCheckBox ); Layout19a->addLayout( Layout15 ); Layout19a->addLayout( Layout15b ); fillDirectoryCombo(); TabWidget->insertTab( tab_3, tr( "Options" ) ); TabWidget->insertTab( tab_5, tr( "Volume" ) ); waveform = new Waveform( this, "waveform" ); // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); waveform->setMinimumSize( QSize( 0, 50 ) ); layout->addMultiCellWidget( waveform, 8, 8, 0, 8); waveform->setBackgroundColor ( black ); } void QtRec::initIconView() { - + owarn << "initIconView" << oendl; ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// odebug << "init number of files " << nFiles << "" << oendl; + owarn << "init number of files " << nFiles << "" << oendl; - for(int i=1;i<= nFiles;i++) { + for(int i = 1; i <= nFiles; i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; temp.sprintf( "%d",i); temp = cfg.readEntry( temp,""); //reads currentFile filePath = cfg.readEntry( temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds mediaLocation = getStorage( filePath); if( info.exists()) { + owarn << "new item " << temp << oendl; item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); item->setPixmap( 0, image0); if( currentFileName == filePath) ListView1->setSelected( item, true); } } } void QtRec::initConnections() { - connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); - - connect( toBeginningButton, SIGNAL( pressed()), - this, SLOT( rewindPressed() )); - connect( toBeginningButton, SIGNAL( released()), - this, SLOT( rewindReleased() )); - connect( toEndButton, SIGNAL( pressed()), - this, SLOT( FastforwardPressed() )); - connect( toEndButton, SIGNAL( released()), - this, SLOT( FastforwardReleased() )); - connect( deleteSoundButton, SIGNAL(released()), - this, SLOT( deleteSound() )); - connect( Stop_PushButton, SIGNAL(released()), - this, SLOT( doPlayBtn() )); - connect( Rec_PushButton, SIGNAL(released()), - this, SLOT( newSound() ) ); - connect( TabWidget, SIGNAL( currentChanged(QWidget*)), - this, SLOT(thisTab(QWidget*) )); - connect( OutputSlider, SIGNAL(sliderReleased()), - this, SLOT( changedOutVolume()) ); - connect( InputSlider, SIGNAL(sliderReleased()), - this, SLOT( changedInVolume()) ); - - connect( sampleRateComboBox, SIGNAL(activated(int)), - this, SLOT( changesamplerateCombo(int)) ); - connect( bitRateComboBox, SIGNAL(activated(int)), - this, SLOT( changebitrateCombo(int)) ); - - connect( directoryComboBox, SIGNAL(activated(int)), - this, SLOT( changeDirCombo(int)) ); - connect( sizeLimitCombo, SIGNAL(activated(int)), - this, SLOT( changeSizeLimitCombo(int)) ); - - connect( stereoCheckBox, SIGNAL(toggled(bool)), - this, SLOT( changeStereoCheck(bool)) ); - - connect( outMuteCheckBox, SIGNAL(toggled(bool)), - this, SLOT( doVolMuting(bool)) ); - connect( inMuteCheckBox , SIGNAL(toggled(bool)), - this, SLOT( doMicMuting(bool)) ); - - connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), - this,SLOT( itClick(QListViewItem*))); - connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), - this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) ); - connect( timeSlider, SIGNAL( sliderMoved(int)), - this, SLOT( changeTimeSlider(int) )); - connect( timeSlider, SIGNAL( sliderPressed()), - this, SLOT( timeSliderPressed() )); - connect( timeSlider, SIGNAL( sliderReleased()), - this, SLOT( timeSliderReleased() )); - connect( compressionCheckBox, SIGNAL( toggled(bool)), - this, SLOT( compressionSelected(bool))); - connect( autoMuteCheckBox, SIGNAL( toggled(bool)), - this, SLOT( slotAutoMute(bool))); + connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); + + connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); + connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased())); + connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed())); + connect(toEndButton,SIGNAL(released()),this,SLOT(FastforwardReleased())); + connect(deleteSoundButton,SIGNAL(released()),this,SLOT(deleteSound())); + connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn())); + connect(Rec_PushButton,SIGNAL(released()),this,SLOT(newSound())); + + connect(TabWidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(thisTab(QWidget*))); + + connect(OutputSlider,SIGNAL(sliderReleased()),this,SLOT(changedOutVolume())); + connect(InputSlider,SIGNAL(sliderReleased()),this,SLOT(changedInVolume())); + + connect(sampleRateComboBox,SIGNAL(activated(int)),this,SLOT(changesamplerateCombo(int))); + connect(bitRateComboBox,SIGNAL(activated(int)),this,SLOT(changebitrateCombo(int))); + connect(directoryComboBox,SIGNAL(activated(int)),this,SLOT(changeDirCombo(int))); + connect(sizeLimitCombo,SIGNAL(activated(int)),this,SLOT(changeSizeLimitCombo(int))); + + connect(stereoCheckBox,SIGNAL(toggled(bool)),this,SLOT(changeStereoCheck(bool))); + connect(outMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doVolMuting(bool))); + connect(inMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doMicMuting(bool))); + + connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),this,SLOT(itClick(QListViewItem*))); + connect(ListView1,SIGNAL(mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),this,SLOT(listPressed(int,QListViewItem*,const QPoint&,int))); + + connect(timeSlider,SIGNAL(sliderMoved(int)),this,SLOT(changeTimeSlider(int))); + connect(timeSlider,SIGNAL(sliderPressed()),this,SLOT(timeSliderPressed())); + connect(timeSlider,SIGNAL(sliderReleased()),this,SLOT(timeSliderReleased())); + + connect(compressionCheckBox,SIGNAL(toggled(bool)),this,SLOT(compressionSelected(bool))); + connect(autoMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(slotAutoMute(bool))); } void QtRec::initConfig() { int index, fred, i; Config cfg("OpieRec"); cfg.setGroup("Settings"); index = cfg.readNumEntry("samplerate",22050); bool ok; for(int ws=0;ws<sampleRateComboBox->count();ws++) { fred = sampleRateComboBox->text(ws).toInt(&ok, 10); if( index == fred) { filePara.sampleRate = fred; sampleRateComboBox->setCurrentItem(ws); } } i = cfg.readNumEntry("bitrate",16); if(i == 16) bitRateComboBox->setCurrentItem( 1); else if(i == 24) bitRateComboBox->setCurrentItem( 2); else if(i == 32) bitRateComboBox->setCurrentItem( 3); else bitRateComboBox->setCurrentItem( 0); filePara.resolution = i; i = cfg.readNumEntry("sizeLimit", 5 ); QString temp; sizeLimitCombo->setCurrentItem((i/5)); stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); if( stereoCheckBox->isChecked()) { filePara.channels = 2; } else { filePara.channels = 1; } compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); if( compressionCheckBox->isChecked()) { bitRateComboBox->setEnabled(false); bitRateComboBox->setCurrentItem(0); filePara.resolution=16; } autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); if( autoMuteCheckBox->isChecked()) slotAutoMute(true); else slotAutoMute(false); Config cofg( "qpe"); cofg.setGroup( "Volume"); outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); } void QtRec::stop() { owarn << "STOP" << oendl; setRecordButton(false); if( !recording) endPlaying(); else endRecording(); timeSlider->setValue(0); } void QtRec::doPlayBtn() { if(!stopped) { // playLabel2->setText(tr("Play")); stop(); } else { if(ListView1->currentItem() == 0) return; // playLabel2->setText(tr("Stop")); currentFile = ListView1->currentItem()->text(0); start(); } } void QtRec::start() { //play if( stopped) { QPixmap image3( ( const char** ) image3_data ); Stop_PushButton->setPixmap( image3 ); Stop_PushButton->setDown( true); stopped = false; paused = false; secCount = 1; if( openPlayFile()) if( setupAudio( false)) //recording is false doPlay(); } } bool QtRec::rec() { //record QString timeString; timeString.sprintf("%.0f", 0.0); // timeLabel->setText( timeString+ " seconds"); if(!stopped) { monitoring = true; return false; } else { secCount = 1; // playLabel2->setText(tr("Stop")); monitoring = false; setRecordButton( true); if( setupAudio( true)) if(setUpFile()) { int fileSize = 0; Config cfg("OpieRec"); cfg.setGroup("Settings"); // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() // << ", device rate " << soundDevice->getDeviceRate() // << ", device channels " << soundDevice->getDeviceChannels() << oendl; //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; filePara.SecondsToRecord = getCurrentSizeLimit(); // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index 3808d99..642048a 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h @@ -5,183 +5,183 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com #ifndef QTREC_H #define QTREC_H #define VERSION 20040628 #include <qpe/ir.h> #include <qfile.h> #include <qimage.h> #include <qlineedit.h> #include <qpixmap.h> #include <qvariant.h> #include <qwidget.h> #include <stdio.h> #include <stdlib.h> #include "device.h" #include "wavFile.h" class QButtonGroup; class QCheckBox; class QComboBox; class QGridLayout; class QGroupBox; class QHBoxLayout; class QIconView; class QIconViewItem; class QLabel; class QLabel; class QListView; class QListViewItem; class QPushButton; class QSlider; class QTabWidget; class QTimer; class QVBoxLayout; class QLineEdit; #define MAX_TRACKS 2 //#define BUFSIZE 4096 // #define BUFSIZE 8182 //Z default buffer size #define BUFSIZE 1024 //#define BUFSIZE 2048 #define FRAGSIZE 0x7fff000A; #define WAVE_FORMAT_DVI_ADPCM (0x0011) #define WAVE_FORMAT_PCM (0x0001) //AFMT_IMA_ADPCM class QtRec : public QWidget { Q_OBJECT public: static QString appName() { return QString::fromLatin1("opierec"); } QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 ); ~QtRec(); QSlider *OutputSlider,*InputSlider; public slots: private: // int fragment; int fd1; int secCount; QString timeString; QLineEdit *renameBox; QGroupBox* GroupBox1; QString currentFile; QString date, currentFileName, tmpFileName; QTimer *t_timer; bool needsStereoOut, paused; bool useTmpFile, autoMute; bool eventFilter( QObject * , QEvent * ); void okRename(); void cancelRename(); QString getStorage(const QString &); bool rec(); int getCurrentSizeLimit(); long checkDiskSpace(const QString &); void doMute(bool); void errorStop(); void fillDirectoryCombo(); void getInVol(); void getOutVol(); void init(); void initConfig(); void initConnections(); void selectItemByName(const QString &); void setRecordButton(bool); void start(); void stop(); void timerEvent( QTimerEvent *e ); private slots: void FastforwardPressed(); void FastforwardReleased(); void changeDirCombo(int); void changeSizeLimitCombo(int); void changeTimeSlider(int); void changebitrateCombo(int); void changeStereoCheck( bool); void changedInVolume(); void changedOutVolume(); void changesamplerateCombo(int); void cleanUp(); void compressionSelected(bool); void deleteSound(); void doBeam(); void doMenuPlay(); void doMicMuting(bool); void doPlayBtn(); void doRename(); void doVolMuting(bool); void forwardTimerTimeout(); void itClick(QListViewItem *item); void listPressed(int, QListViewItem *, const QPoint&, int); void newSound(); void rewindPressed(); void rewindReleased(); void rewindTimerTimeout(); void slotAutoMute(bool); void thisTab(QWidget*); void timeSliderPressed(); void timeSliderReleased(); void timerBreak(); + void initIconView(); /* void changedOutVolume(int); */ /* void changedInVolume(int); */ protected: WavFile *wavFile; QButtonGroup *ButtonGroup1; QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox; QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo; QHBoxLayout* Layout12; QHBoxLayout* Layout13; QHBoxLayout* Layout14; QHBoxLayout* Layout16; QHBoxLayout* Layout17; QHBoxLayout* Layout19; QIconView *IconView1; QLabel *NewSoundLabel,*playLabel2; QLabel *TextLabel3, *TextLabel1, *TextLabel2; QListView *ListView1; QPushButton *Stop_PushButton, *Play_PushButton, *Rec_PushButton, *NewSoundButton, *deleteSoundButton, *toBeginningButton, *toEndButton; QString recDir; QTabWidget *TabWidget; QTimer *t, *rewindTimer, *forwardTimer; QVBoxLayout* Layout15; QVBoxLayout* Layout15b; QVBoxLayout* Layout18; QWidget *tab, *tab_2, *tab_3, *tab_4, *tab_5; int sliderPos, total; // short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; // unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup; /* short inbuffer[65536], outbuffer[65536]; */ /* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */ bool doPlay(); bool openPlayFile(); bool setUpFile(); bool setupAudio( bool b); void endPlaying(); void endRecording(); void fileBeamFinished( Ir *ir); - void initIconView(); void keyPressEvent( QKeyEvent *e); void keyReleaseEvent( QKeyEvent *e); void receive( const QCString &, const QByteArray & ); void showListMenu(QListViewItem * ); #ifndef THREADED void quickRec(); void playIt(); #endif }; #endif // QTREC_H |