From 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 04 Apr 2004 13:54:40 +0000 Subject: convert to Opie Debugging Framework --- (limited to 'noncore/multimedia/opierec') diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index ce49e96..5319d97 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp @@ -2,20 +2,20 @@ #include "device.h" +/* OPIE */ +#include #include #include +using namespace Opie::Core; - +/* STD */ #include #include #include #include #include #include -#include -// #include -// #include -// #include +#include #include #include @@ -32,10 +32,10 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco devRate=-1; if( !record){ //playing - qDebug("setting up DSP for playing"); + odebug << "setting up DSP for playing" << oendl; flags = O_WRONLY; } else { //recording - qDebug("setting up DSP for recording"); + odebug << "setting up DSP for recording" << oendl; flags = O_RDWR; // flags = O_RDONLY; @@ -96,7 +96,7 @@ void Device::changedOutVolume(int vol) { cfg.setGroup("Volume"); cfg.writeEntry("VolumePercent", QString::number( vol )); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; - qWarning("changing output vol %d", vol); + owarn << "changing output vol " << vol << "" << oendl; } ::close(fd); } @@ -111,7 +111,7 @@ void Device::changedInVolume(int vol ) { cfg.setGroup("Volume"); cfg.writeEntry("Mic", QString::number(vol )); QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; - qWarning("changing input volume %d", vol); + owarn << "changing input volume " << vol << "" << oendl; } ::close(fd); } @@ -149,22 +149,22 @@ exit(1); break; case 0: { */ -qDebug("Opening %s",dspstr); +odebug << "Opening " << dspstr << "" << oendl; if (( sd = ::open( dspstr, flags)) == -1) { perror("open(\"/dev/dsp\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; return -1; } -qDebug("Opening mixer"); +odebug << "Opening mixer" << oendl; int mixerHandle=0; if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { perror("open(\"/dev/mixer\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; } if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ @@ -180,7 +180,7 @@ qDebug("Opening mixer"); /* close(pipefd[0]); write(pipefd[1], message, sizeof(message)); close(pipefd[1]); - // qDebug("%d",soundDevice->sd ); + // odebug << "" << soundDevice->sd << "" << oendl; _exit(0); } default: @@ -206,13 +206,13 @@ qDebug("Opening mixer"); */ // bool ok; // sd = s.toInt(&ok, 10); -// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); +// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl; // f2.close(); // } ::close(mixerHandle ); -// qDebug("open device %s", dspstr); -// qDebug("success! %d",sd); +// odebug << "open device " << dspstr << "" << oendl; +// odebug << "success! " << sd << "" << oendl; return sd; } @@ -230,12 +230,12 @@ bool Device::closeDevice( bool) { ::close( sd); //close sound device // sdfd=0; // sd=0; -// qDebug("closed dsp"); +// odebug << "closed dsp" << oendl; return true; } bool Device::setDeviceFormat( int form) { - qDebug("set device res %d %d", form, sd); + odebug << "set device res " << form << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); return false; @@ -245,7 +245,7 @@ bool Device::setDeviceFormat( int form) { } bool Device::setDeviceChannels( int ch) { - qDebug("set channels %d %d", ch, sd); + odebug << "set channels " << ch << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); return false; @@ -255,7 +255,7 @@ bool Device::setDeviceChannels( int ch) { } bool Device::setDeviceRate( int rate) { - qDebug("set rate %d %d", rate, sd); + odebug << "set rate " << rate << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { perror("ioctl(\"SNDCTL_DSP_SPEED\")"); return false; @@ -318,9 +318,9 @@ int Device::getDeviceFragSize() { int frag_size; if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { - qDebug("no fragsize"); + odebug << "no fragsize" << oendl; } else { - qDebug("driver says frag size is %d", frag_size); + odebug << "driver says frag size is " << frag_size << "" << oendl; } return frag_size; } diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp index 6aebaa1..7f984c3 100644 --- a/noncore/multimedia/opierec/helpwindow.cpp +++ b/noncore/multimedia/opierec/helpwindow.cpp @@ -9,14 +9,19 @@ *****************************************************************************/ #include "helpwindow.h" -#include -#include +/* OPIE */ +#include #include +using namespace Opie::Core; +/* QT */ +#include +#include #include #include +/* STD */ #include HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) @@ -25,7 +30,7 @@ HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* par QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); - qDebug(_path); + odebug << _path << oendl; browser = new QTextBrowser( this ); QStringList Strlist; Strlist.append( home_); diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro index 7b08f0e..ea1bae3 100644 --- a/noncore/multimedia/opierec/opierec.pro +++ b/noncore/multimedia/opierec/opierec.pro @@ -1,6 +1,4 @@ -#CONFIG = qt warn_on pdaudio -CONFIG = qt warn_on opie -#CONFIG = qt warn_on quick-app +CONFIG = qt warn_on HEADERS = adpcm.h \ pixmaps.h \ helpwindow.h \ @@ -29,7 +27,7 @@ contains(CONFIG, pdaudio) { # DESTDIR=$(QPEDIR)/bin } -contains(CONFIG, opie) { +!contains(CONFIG, pdaudio) { INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include DESTDIR=$(OPIEDIR)/bin diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 1c64ab1..2187d5a 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -8,24 +8,22 @@ #include "pixmaps.h" #include "qtrec.h" #include "waveform.h" - -#include - extern "C" { #include "adpcm.h" } -#include - +/* OPIE */ +#include #include #include #include #include #include +using namespace Opie::Core; +/* QT */ #include #include -//#include #include #include #include @@ -38,6 +36,7 @@ extern "C" { #include #include +/* STD */ #include #include #include @@ -53,7 +52,7 @@ extern "C" { #include #include #include - +#include #ifdef PDAUDIO //ALSA #include @@ -136,17 +135,17 @@ void quickRec() int level = 0; int threshold = 0; // int bits = filePara.resolution; -// qDebug("bits %d", bits); +// odebug << "bits " << bits << "" << oendl; if( filePara.resolution == 16 ) { //AFMT_S16_LE) -// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); -// qDebug("samples to record %d", filePara.samplesToRecord); -// qDebug("%d", filePara.sd); +// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; +// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; +// odebug << "" << filePara.sd << "" << oendl; level = 7; threshold = 0; if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { -// qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); +// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> char abuf[ BUFSIZE/2 ]; short sbuf[ BUFSIZE ]; @@ -157,7 +156,7 @@ void quickRec() for(;;) { if ( stopped) { -// qDebug("quickRec:: stopped"); +// odebug << "quickRec:: stopped" << oendl; break; } @@ -166,7 +165,7 @@ void quickRec() if(number <= 0) { perror("recording error "); - qDebug( "%s %d", filePara.fileName, number); + odebug << "" << filePara.fileName << " " << number << "" << oendl; stopped = true; return; } @@ -192,14 +191,14 @@ void quickRec() } } else { // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> - qDebug("start recording WAVE_FORMAT_PCM"); + odebug << "start recording WAVE_FORMAT_PCM" << oendl; short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; memset( inbuffer, 0, BUFSIZE); memset( outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false return; @@ -210,7 +209,7 @@ void quickRec() if( number <= 0) { perror( "recording error "); - qDebug( filePara.fileName); + odebug << filePara.fileName << oendl; stopped = true; return; } @@ -250,7 +249,7 @@ void quickRec() for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } @@ -373,7 +372,7 @@ void playIt() qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { - qWarning("Jane! Stop this crazy thing!"); + owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; break; @@ -718,7 +717,7 @@ void QtRec::initIconView() { QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// qDebug("init number of files %d", nFiles); +// odebug << "init number of files " << nFiles << "" << oendl; for(int i=1;i<= nFiles;i++) { @@ -860,7 +859,7 @@ void QtRec::initConfig() { } void QtRec::stop() { - qWarning("STOP"); + owarn << "STOP" << oendl; setRecordButton(false); if( !recording) @@ -922,20 +921,20 @@ bool QtRec::rec() { //record // soundDevice->getDeviceChannels()); //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); -// qDebug("sample rate is %d", filePara.sampleRate); +// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; filePara.SecondsToRecord = getCurrentSizeLimit(); -// qDebug("size limit %d sec", filePara.SecondsToRecord); +// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); if( filePara.SecondsToRecord == 0) { fileSize = diskSize; } else if( filePara.format == WAVE_FORMAT_PCM) { -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; fileSize = (filePara.SecondsToRecord ) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) + 1000; } else { -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; fileSize = ((filePara.SecondsToRecord) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; } @@ -947,7 +946,7 @@ bool QtRec::rec() { //record paused = false; } // else { - qDebug("Setting timeslider %d", filePara.samplesToRecord); + odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); // } @@ -966,7 +965,7 @@ bool QtRec::rec() { //record setCaption( msg); #endif filePara.fileName=currentFile.latin1(); - qDebug("Start recording thread"); + odebug << "Start recording thread" << oendl; stopped = false; #ifdef THREADED @@ -1010,13 +1009,13 @@ void QtRec::thisTab(QWidget* widg) { void QtRec::getOutVol( ) { filePara.outVol = soundDevice->getOutVolume(); -// qDebug("out vol %d", filePara.outVol); +// odebug << "out vol " << filePara.outVol << "" << oendl; OutputSlider->setValue( -filePara.outVol); } void QtRec::getInVol() { filePara.inVol = soundDevice->getInVolume(); -// qDebug("in vol %d", filePara.inVol); +// odebug << "in vol " << filePara.inVol << "" << oendl; InputSlider->setValue( -filePara.inVol); } @@ -1090,11 +1089,11 @@ bool QtRec::setupAudio( bool b) { if( !compressionCheckBox->isChecked()) { filePara.format = WAVE_FORMAT_PCM; -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; } else { filePara.format = WAVE_FORMAT_DVI_ADPCM; sampleformat = AFMT_S16_LE; -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; } #endif @@ -1110,15 +1109,15 @@ bool QtRec::setupAudio( bool b) { } // if(soundDevice) delete soundDevice; - qDebug("<<<<<<<<<<<<<<<<<<changeSettings( filePara.sampleRate, filePara.channels ); soundDevice = new Device( this, dspString, mixerString, b); // soundDevice->openDsp(); soundDevice->reset(); - qDebug("device has been made %d", soundDevice->sd); + odebug << "device has been made " << soundDevice->sd << "" << oendl; ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> soundDevice->setDeviceFormat( sampleformat); @@ -1149,7 +1148,7 @@ bool QtRec::setupAudio( bool b) { bool QtRec::setUpFile() { //setup file for recording -// qDebug("Setting up wavfile"); +// odebug << "Setting up wavfile" << oendl; // if(wavFile) delete wavFile; wavFile = new WavFile( this, (const QString &)"", true, @@ -1182,7 +1181,7 @@ bool QtRec::doPlay() { recording = false; QString num; - qDebug( "Play number of samples %d", filePara.numberSamples); + odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); @@ -1234,7 +1233,7 @@ void QtRec::changesamplerateCombo(int i) { rate = sampleRateComboBox->text(i).toInt(&ok, 10); cfg.writeEntry( "samplerate",rate); filePara.sampleRate=rate; - qDebug( "Change sample rate %d", rate); + odebug << "Change sample rate " << rate << "" << oendl; cfg.write(); } @@ -1254,7 +1253,7 @@ void QtRec::changeDirCombo(int index) { const QString path = (*it)->path(); recDir = path; cfg.writeEntry("directory", recDir); - qDebug("new rec dir "+recDir); + odebug << "new rec dir "+recDir << oendl; } } cfg.write(); @@ -1374,7 +1373,7 @@ void QtRec::keyPressEvent( QKeyEvent *e) { // newSound(); break; case Key_Left: { - qDebug("rewinding"); + odebug << "rewinding" << oendl; if( !e->isAutoRepeat()) rewindPressed(); } @@ -1428,19 +1427,19 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { break; case Key_Up: // stop(); - qDebug("Up"); + odebug << "Up" << oendl; break; case Key_Down: // start(); - // qDebug("Down"); + // odebug << "Down" << oendl; // newSound(); break; case Key_Left: - qDebug("Left"); + odebug << "Left" << oendl; rewindReleased(); break; case Key_Right: - qDebug("Right"); + odebug << "Right" << oendl; FastforwardReleased(); break; } @@ -1475,11 +1474,11 @@ void QtRec::endRecording() { // move tmp file to regular file QString cmd; cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); -// qDebug("moving tmp file to "+currentFileName); +// odebug << "moving tmp file to "+currentFileName << oendl; system( cmd.latin1()); } - qDebug("Just moved " + wavFile->currentFileName); + odebug << "Just moved " + wavFile->currentFileName << oendl; Config cfg("OpieRec"); cfg.setGroup("Sounds"); @@ -1495,10 +1494,10 @@ void QtRec::endRecording() { QString time; time.sprintf("%.2f", filePara.numberOfRecordedSeconds); cfg.writeEntry( wavFile->currentFileName, time ); -// qDebug("writing config numberOfRecordedSeconds "+time); +// odebug << "writing config numberOfRecordedSeconds "+time << oendl; cfg.write(); - qDebug("finished recording"); + odebug << "finished recording" << oendl; timeLabel->setText(""); } @@ -1516,7 +1515,7 @@ void QtRec::endPlaying() { stopped = true; waveform->reset(); // errorStop(); -// qDebug("end playing"); +// odebug << "end playing" << oendl; setRecordButton( false); toBeginningButton->setEnabled( true); @@ -1528,7 +1527,7 @@ void QtRec::endPlaying() { soundDevice->closeDevice( false); soundDevice->sd = -1; // if(soundDevice) delete soundDevice; -// qDebug("file and sound device closed"); +// odebug << "file and sound device closed" << oendl; timeLabel->setText(""); total = 0; filePara.numberSamples = 0; @@ -1537,9 +1536,9 @@ void QtRec::endPlaying() { filePara.fd = 0; // if(wavFile) delete wavFile; //this crashes -// qDebug("track closed"); +// odebug << "track closed" << oendl; killTimers(); - qWarning("reset slider"); + owarn << "reset slider" << oendl; timeSlider->setValue(0); if(soundDevice) delete soundDevice; @@ -1561,7 +1560,7 @@ bool QtRec::openPlayFile() { for(int i=0;isetPageStep(1); monitoring = true; - qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate); + odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); - qWarning("seconds %d", sec); + owarn << "seconds " << sec << "" << oendl; timeSlider->setRange(0, filePara.numberSamples ); } @@ -1690,7 +1689,7 @@ void QtRec::doRename() { } void QtRec::okRename() { - qDebug(renameBox->text()); + odebug << renameBox->text() << oendl; QString filename = renameBox->text(); cancelRename(); @@ -1702,7 +1701,7 @@ void QtRec::okRename() { QString file = ListView1->currentItem()->text(0); - qDebug("filename is " + filename); + odebug << "filename is " + filename << oendl; int nFiles = cfg.readNumEntry("NumberofFiles",0); @@ -1773,7 +1772,7 @@ void QtRec::doVolMuting(bool b) { } void QtRec::doMicMuting(bool b) { - // qDebug("mic mute"); + // odebug << "mic mute" << oendl; Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "MicMute",b); @@ -1829,7 +1828,7 @@ long QtRec::checkDiskSpace(const QString &path) { // char f_fpack[6]; /* Pack name */ void QtRec::receive( const QCString &msg, const QByteArray & ) { - qDebug("Voicerecord received message "+msg); + odebug << "Voicerecord received message "+msg << oendl; } @@ -1854,7 +1853,7 @@ void QtRec::timerEvent( QTimerEvent * ) { stop(); } - qDebug( "%d", secCount ); + odebug << "" << secCount << "" << oendl; QString timeString; #ifdef DEV_VERSION QString msg; @@ -1870,7 +1869,7 @@ void QtRec::timerEvent( QTimerEvent * ) { void QtRec::changeTimeSlider(int index) { if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; - // qDebug("Slider moved to %d",index); + // odebug << "Slider moved to " << index << "" << oendl; paused = true; stopped = true; @@ -1885,7 +1884,7 @@ void QtRec::changeTimeSlider(int index) { void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - // qDebug("slider pressed"); + // odebug << "slider pressed" << oendl; paused = true; stopped = true; } @@ -1894,7 +1893,7 @@ void QtRec::timeSliderReleased() { if( ListView1->currentItem() == 0) return; sliderPos = timeSlider->value(); - // qDebug("slider released %d", sliderPos); + // odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; @@ -1924,7 +1923,7 @@ void QtRec::rewindTimerTimeout() { sliderValue = sliderValue - ( filePara.numberSamples / 100); // if(toBeginningButton->isDown()) timeSlider->setValue( sliderValue ) ; - // qDebug("%d", sliderValue); + // odebug << "" << sliderValue << "" << oendl; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); @@ -1938,7 +1937,7 @@ void QtRec::rewindReleased() { stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // qDebug("rewind released %d", total); + // odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); } @@ -2002,7 +2001,7 @@ QString QtRec::getStorage(const QString &fileName) { // const QString options = (*it)->options(); // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); - // qDebug(name); + // odebug << name << oendl; } return storage; // struct mntent *me; diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 35bc14d..7e9b50f 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp @@ -2,17 +2,20 @@ #include "wavFile.h" #include "qtrec.h" +/* OPIE */ +#include +#include +using namespace Opie::Core; + +/* QT */ #include #include -#include - +/* STD */ #include - #include #include #include - #include #include #include @@ -24,7 +27,7 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int int channels, int resolution, int format ) : QObject( parent) { -//qDebug("new wave file"); +//odebug << "new wave file" << oendl; bool b = makeNwFile; wavSampleRate=sampleRate; wavFormat=format; @@ -40,7 +43,7 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int bool WavFile::newFile() { -// qDebug("Set up new file"); +// odebug << "Set up new file" << oendl; Config cfg("OpieRec"); cfg.setGroup("Settings"); @@ -60,7 +63,7 @@ bool WavFile::newFile() { currentFileName += date; currentFileName+=".wav"; -// qDebug("set up file for recording: "+currentFileName); +// odebug << "set up file for recording: "+currentFileName << oendl; char pointer[] = "/tmp/opierec-XXXXXX"; int fd = 0; @@ -75,7 +78,7 @@ bool WavFile::newFile() { return false; } -// qDebug("Opening tmp file %s",pointer); +// odebug << "Opening tmp file " << pointer << "" << oendl; track.setName( pointer); } else { //just use regular file.. no moving @@ -85,7 +88,7 @@ bool WavFile::newFile() { } if(!track.open( IO_ReadWrite | IO_Truncate)) { QString errorMsg=(QString)strerror(errno); - qDebug(errorMsg); + odebug << errorMsg << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return false; @@ -106,14 +109,14 @@ void WavFile::closeFile() { } int WavFile::openFile(const QString ¤tFileName) { -// qDebug("open play file "+currentFileName); +// odebug << "open play file "+currentFileName << oendl; closeFile(); track.setName(currentFileName); if(!track.open(IO_ReadOnly)) { QString errorMsg=(QString)strerror(errno); - qDebug("<<<<<<<<<<< "+errorMsg+currentFileName); + odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return -1; } else { @@ -131,11 +134,11 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { if( wavFormat == WAVE_FORMAT_PCM) { (*hdr).fmtTag = 1; // PCM -// qDebug("set header WAVE_FORMAT_PCM"); +// odebug << "set header WAVE_FORMAT_PCM" << oendl; } else { (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM - // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); + // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; } // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels @@ -160,12 +163,12 @@ bool WavFile::adjustHeaders(int fd, int total) { write( fd, &i, sizeof(i)); lseek( fd, 40, SEEK_SET); write( fd, &total, sizeof(total)); - qDebug("adjusting header %d", total); + odebug << "adjusting header " << total << "" << oendl; return true; } int WavFile::parseWavHeader(int fd) { - qDebug("Parsing wav header"); + odebug << "Parsing wav header" << oendl; char string[4]; int found; short fmt; @@ -173,39 +176,39 @@ int WavFile::parseWavHeader(int fd) { unsigned long samplerrate, longdata; if (read(fd, string, 4) < 4) { - qDebug(" Could not read from sound file.\n"); + odebug << " Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "RIFF", 4)) { - qDebug(" not a valid WAV file.\n"); + odebug << " not a valid WAV file.\n" << oendl; return -1; } lseek(fd, 4, SEEK_CUR); if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "WAVE", 4)) { - qDebug("not a valid WAV file.\n"); + odebug << "not a valid WAV file.\n" << oendl; return -1; } found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "fmt ", 4)) { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { lseek(fd, 4, SEEK_CUR); if (read(fd, &fmt, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { @@ -215,30 +218,30 @@ int WavFile::parseWavHeader(int fd) { } wavFormat = fmt; // compressionFormat=fmt; - qDebug("compressionFormat is %d", fmt); + odebug << "compressionFormat is " << fmt << "" << oendl; if (read(fd, &ch, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavChannels = ch; - qDebug("File has %d channels", ch); + odebug << "File has " << ch << " channels" << oendl; } if (read(fd, &samplerrate, 4) < 4) { - qDebug("Could not read from format chunk.\n"); + odebug << "Could not read from format chunk.\n" << oendl; return -1; } else { wavSampleRate = samplerrate; // sampleRate = samplerrate; - qDebug("File has samplerate of %d",(int) samplerrate); + odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; } lseek(fd, 6, SEEK_CUR); if (read(fd, &bitrate, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavResolution=bitrate; // resolution = bitrate; - qDebug("File has bitrate of %d", bitrate); + odebug << "File has bitrate of " << bitrate << "" << oendl; } found++; } @@ -246,20 +249,20 @@ int WavFile::parseWavHeader(int fd) { found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "data", 4)) { if (read(fd, &longdata, 4)<4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } else { wavNumberSamples = longdata; diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp index 9cc40b4..7c9a25f 100644 --- a/noncore/multimedia/opierec/waveform.cpp +++ b/noncore/multimedia/opierec/waveform.cpp @@ -19,8 +19,12 @@ **********************************************************************/ #include "waveform.h" -#include +/* OPIE */ +#include +using namespace Opie::Core; +/* QT */ +#include Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) : QWidget( parent, name, fl ) @@ -38,9 +42,9 @@ Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) void Waveform::changeSettings( int frequency, int channels ) { makePixmap(); -// qWarning("change waveform %d, %d", frequency, channels); +// owarn << "change waveform " << frequency << ", " << channels << "" << oendl; samplesPerPixel = frequency * channels / (5 * windowSize); - qWarning("Waveform::changeSettings %d", samplesPerPixel); + owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl; if ( !samplesPerPixel ) samplesPerPixel = 1; currentValue = 0; @@ -96,7 +100,7 @@ void Waveform::newSamples( const short *buf, int len ) } // Copy the final state back to the object. -//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); +//owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl; this->currentValue = currentValue; this->numSamples = numSamples; this->windowPosn = windowPosn; -- cgit v0.9.0.2