Diffstat (limited to 'noncore/multimedia/opierec/qtrec.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 129 |
1 files changed, 64 insertions, 65 deletions
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 @@ -9,13 +9,10 @@ #include "qtrec.h" #include "waveform.h" - -#include <pthread.h> - extern "C" { #include "adpcm.h" } -#include <sys/soundcard.h> - +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> @@ -23,8 +20,9 @@ extern "C" { #include <qpe/resource.h> #include <qpe/storage.h> +using namespace Opie::Core; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> -//#include <qdatetime.h> #include <qdir.h> #include <qgroupbox.h> @@ -39,4 +37,5 @@ extern "C" { #include <qtimer.h> +/* STD */ #include <errno.h> #include <fcntl.h> @@ -54,5 +53,5 @@ extern "C" { #include <sys/wait.h> #include <sys/signal.h> - +#include <pthread.h> #ifdef PDAUDIO //ALSA @@ -137,15 +136,15 @@ void quickRec() 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 ]; @@ -158,5 +157,5 @@ void quickRec() for(;;) { if ( stopped) { -// qDebug("quickRec:: stopped"); +// odebug << "quickRec:: stopped" << oendl; break; } @@ -167,5 +166,5 @@ void quickRec() if(number <= 0) { perror("recording error "); - qDebug( "%s %d", filePara.fileName, number); + odebug << "" << filePara.fileName << " " << number << "" << oendl; stopped = true; return; @@ -193,5 +192,5 @@ 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); @@ -200,5 +199,5 @@ void quickRec() for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false @@ -211,5 +210,5 @@ void quickRec() if( number <= 0) { perror( "recording error "); - qDebug( filePara.fileName); + odebug << filePara.fileName << oendl; stopped = true; return; @@ -251,5 +250,5 @@ void quickRec() for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } @@ -374,5 +373,5 @@ void playIt() if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { - qWarning("Jane! Stop this crazy thing!"); + owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; @@ -719,5 +718,5 @@ void QtRec::initIconView() { 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++) { @@ -861,5 +860,5 @@ void QtRec::initConfig() { void QtRec::stop() { - qWarning("STOP"); + owarn << "STOP" << oendl; setRecordButton(false); @@ -923,8 +922,8 @@ bool QtRec::rec() { //record //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()); @@ -932,9 +931,9 @@ bool QtRec::rec() { //record 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; @@ -948,5 +947,5 @@ bool QtRec::rec() { //record } // else { - qDebug("Setting timeslider %d", filePara.samplesToRecord); + odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); @@ -967,5 +966,5 @@ bool QtRec::rec() { //record #endif filePara.fileName=currentFile.latin1(); - qDebug("Start recording thread"); + odebug << "Start recording thread" << oendl; stopped = false; @@ -1011,5 +1010,5 @@ 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); } @@ -1017,5 +1016,5 @@ void QtRec::getOutVol( ) { void QtRec::getInVol() { filePara.inVol = soundDevice->getInVolume(); -// qDebug("in vol %d", filePara.inVol); +// odebug << "in vol " << filePara.inVol << "" << oendl; InputSlider->setValue( -filePara.inVol); } @@ -1091,9 +1090,9 @@ 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 @@ -1111,6 +1110,6 @@ bool QtRec::setupAudio( bool b) { // if(soundDevice) delete soundDevice; - qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); - qWarning("change waveform settings"); + odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; + owarn << "change waveform settings" << oendl; waveform->changeSettings( filePara.sampleRate, filePara.channels ); @@ -1119,5 +1118,5 @@ bool QtRec::setupAudio( bool b) { soundDevice->reset(); - qDebug("device has been made %d", soundDevice->sd); + odebug << "device has been made " << soundDevice->sd << "" << oendl; ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> @@ -1150,5 +1149,5 @@ 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 &)"", @@ -1183,5 +1182,5 @@ bool QtRec::doPlay() { QString num; - qDebug( "Play number of samples %d", filePara.numberSamples); + odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); @@ -1235,5 +1234,5 @@ void QtRec::changesamplerateCombo(int i) { cfg.writeEntry( "samplerate",rate); filePara.sampleRate=rate; - qDebug( "Change sample rate %d", rate); + odebug << "Change sample rate " << rate << "" << oendl; cfg.write(); } @@ -1255,5 +1254,5 @@ void QtRec::changeDirCombo(int index) { recDir = path; cfg.writeEntry("directory", recDir); - qDebug("new rec dir "+recDir); + odebug << "new rec dir "+recDir << oendl; } } @@ -1375,5 +1374,5 @@ void QtRec::keyPressEvent( QKeyEvent *e) { break; case Key_Left: { - qDebug("rewinding"); + odebug << "rewinding" << oendl; if( !e->isAutoRepeat()) rewindPressed(); @@ -1429,17 +1428,17 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { 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; @@ -1476,9 +1475,9 @@ void QtRec::endRecording() { 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"); @@ -1496,8 +1495,8 @@ void QtRec::endRecording() { 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(""); } @@ -1517,5 +1516,5 @@ void QtRec::endPlaying() { waveform->reset(); // errorStop(); -// qDebug("end playing"); +// odebug << "end playing" << oendl; setRecordButton( false); @@ -1529,5 +1528,5 @@ void QtRec::endPlaying() { soundDevice->sd = -1; // if(soundDevice) delete soundDevice; -// qDebug("file and sound device closed"); +// odebug << "file and sound device closed" << oendl; timeLabel->setText(""); total = 0; @@ -1538,7 +1537,7 @@ void QtRec::endPlaying() { // if(wavFile) delete wavFile; //this crashes -// qDebug("track closed"); +// odebug << "track closed" << oendl; killTimers(); - qWarning("reset slider"); + owarn << "reset slider" << oendl; timeSlider->setValue(0); @@ -1562,5 +1561,5 @@ bool QtRec::openPlayFile() { if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { currentFileName = cfg.readEntry( currentFile, "" ); - qDebug("opening for play: " + currentFileName); + odebug << "opening for play: " + currentFileName << oendl; } } @@ -1587,8 +1586,8 @@ bool QtRec::openPlayFile() { 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 ); @@ -1691,5 +1690,5 @@ void QtRec::doRename() { void QtRec::okRename() { - qDebug(renameBox->text()); + odebug << renameBox->text() << oendl; QString filename = renameBox->text(); cancelRename(); @@ -1703,5 +1702,5 @@ void QtRec::okRename() { QString file = ListView1->currentItem()->text(0); - qDebug("filename is " + filename); + odebug << "filename is " + filename << oendl; int nFiles = cfg.readNumEntry("NumberofFiles",0); @@ -1774,5 +1773,5 @@ void QtRec::doVolMuting(bool b) { void QtRec::doMicMuting(bool b) { - // qDebug("mic mute"); + // odebug << "mic mute" << oendl; Config cfg( "qpe" ); cfg. setGroup( "Volume" ); @@ -1830,5 +1829,5 @@ long QtRec::checkDiskSpace(const QString &path) { void QtRec::receive( const QCString &msg, const QByteArray & ) { - qDebug("Voicerecord received message "+msg); + odebug << "Voicerecord received message "+msg << oendl; } @@ -1855,5 +1854,5 @@ void QtRec::timerEvent( QTimerEvent * ) { } - qDebug( "%d", secCount ); + odebug << "" << secCount << "" << oendl; QString timeString; #ifdef DEV_VERSION @@ -1871,5 +1870,5 @@ 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; @@ -1886,5 +1885,5 @@ void QtRec::changeTimeSlider(int index) { void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - // qDebug("slider pressed"); + // odebug << "slider pressed" << oendl; paused = true; stopped = true; @@ -1895,5 +1894,5 @@ void QtRec::timeSliderReleased() { sliderPos = timeSlider->value(); - // qDebug("slider released %d", sliderPos); + // odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); @@ -1925,5 +1924,5 @@ void QtRec::rewindTimerTimeout() { // if(toBeginningButton->isDown()) timeSlider->setValue( sliderValue ) ; - // qDebug("%d", sliderValue); + // odebug << "" << sliderValue << "" << oendl; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; @@ -1939,5 +1938,5 @@ void QtRec::rewindReleased() { int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // qDebug("rewind released %d", total); + // odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); @@ -2003,5 +2002,5 @@ QString QtRec::getStorage(const QString &fileName) { // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); - // qDebug(name); + // odebug << name << oendl; } return storage; |