-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 7dd5b4b..622b1df 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -9,12 +9,16 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ************************************************************************************/ // copyright 2002 Jeremy Cowgar <jc@cowgar.com> // copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + extern "C" { #include "adpcm.h" } #include <unistd.h> #include <stdio.h> @@ -204,13 +208,13 @@ VMemo::VMemo( QWidget *parent, const char *_name ) Config vmCfg("Vmemo"); vmCfg.setGroup("Defaults"); int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); - qDebug("toggleKey %d", toggleKey); + odebug << "toggleKey " << toggleKey << "" << oendl; if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) systemZaurus=TRUE; else systemZaurus=FALSE; myChannel = new QCopChannel( "QPE/VMemo", this ); @@ -242,13 +246,13 @@ VMemo::~VMemo() { int VMemo::position() { return 6; } void VMemo::receive( const QCString &msg, const QByteArray &data ) { - qDebug("receive"); + odebug << "receive" << oendl; QDataStream stream( data, IO_ReadOnly ); if (msg == "toggleRecord()") { if (recording) { fromToggle = TRUE; stopRecording(); @@ -290,13 +294,13 @@ bool VMemo::startRecording() { msgLabel = new QLabel( 0, "alertLabel" ); msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); msgLabel->show(); } - qDebug("Start recording engines"); + odebug << "Start recording engines" << oendl; recording = TRUE; if (openDSP() == -1) { recording = FALSE; return FALSE; } @@ -315,26 +319,26 @@ bool VMemo::startRecording() { fileName = config.readEntry("RecLocation", fName); int s; s=fileName.find(':'); if(s) fileName=fileName.right(fileName.length()-s-2); - qDebug("pathname will be "+fileName); + odebug << "pathname will be "+fileName << oendl; if( fileName.left(1).find('/') == -1) fileName="/"+fileName; if( fileName.right(1).find('/') == -1) fileName+="/"; fName = "vm_"+ date+ ".wav"; fileName+=fName; - qDebug("filename is "+fileName); + odebug << "filename is "+fileName << oendl; // open tmp file here char *pointer; pointer=tmpnam(NULL); - qDebug("Opening tmp file %s",pointer); + odebug << "Opening tmp file " << pointer << "" << oendl; if(openWAV(pointer ) == -1) { QString err("Could not open the temp file\n"); err += fileName; QMessageBox::critical(0, "vmemo", err, "Abort"); @@ -368,13 +372,13 @@ bool VMemo::startRecording() { return FALSE; } void VMemo::stopRecording() { show(); - qDebug("Stopped recording"); + odebug << "Stopped recording" << oendl; recording = FALSE; if(useAlerts) { msgLabel->close(); msgLabel=0; delete msgLabel; } @@ -396,13 +400,13 @@ int VMemo::openDSP() { resolution = 16; } else { format = AFMT_U8; resolution = 8; } - qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); + odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl; if(systemZaurus) { dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 channels=1; //zaurus has one input channel } else { dsp = open("/dev/dsp", O_RDONLY); @@ -480,24 +484,24 @@ int VMemo::openWAV(const char *filename) { bool VMemo::record() { length=0; int result, value; QString msg; msg.sprintf("Recording format %d", format); - qDebug(msg); + odebug << msg << oendl; Config config("Vmemo"); config.setGroup("Record"); int sRate=config.readNumEntry("SizeLimit", 30); if(sRate > 0) t_timer->start( sRate * 1000+1000, TRUE); // if(systemZaurus) { // } else { // 16 bit only capabilities msg.sprintf("Recording format other"); - qDebug(msg); + odebug << msg << oendl; int bufsize=1024; int bytesWritten=0; signed short sound[1024], monoBuffer[1024]; char abuf[bufsize/2]; short sbuf[bufsize]; @@ -510,13 +514,13 @@ bool VMemo::record() { if(useADPCM) result = read( dsp, sbuf, bufsize); // 8192 else result = read(dsp, sound, 1024); // 8192 if( result <= 0) { perror("recording error "); -// qDebug(currentFileName); +// odebug << currentFileName << oendl; QMessageBox::message(tr("Note"),tr("error recording")); recording=FALSE; break; return FALSE; } @@ -537,13 +541,13 @@ bool VMemo::record() { recording=false; perror("dev/dsp's is a lookin' messy"); QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); break; return FALSE; } - // printf("%d\r",length); + // odebug << "" << length << "\r" << oendl; // fflush(stdout); qApp->processEvents(); } // qDebug("file has length of %d lasting %d seconds", // length, (( length / speed) / channels) / 2 ); // } @@ -556,13 +560,13 @@ bool VMemo::record() { write(wav, &value, 4); lseek(wav, 40, SEEK_SET); write(wav, &length, 4); track.close(); - qDebug("Track closed"); + odebug << "Track closed" << oendl; if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) perror("ioctl(\"SNDCTL_DSP_RESET\")"); ::close(dsp); @@ -580,17 +584,17 @@ bool VMemo::record() { cfgO.writeEntry( QString::number( nFiles + 1), currentFile); cfgO.writeEntry( currentFile, currentFileName); QString time; time.sprintf("%.2f", numberOfRecordedSeconds); cfgO.writeEntry( currentFileName, time ); - // qDebug("writing config numberOfRecordedSeconds "+time); + // odebug << "writing config numberOfRecordedSeconds "+time << oendl; cfgO.write(); - qDebug("done recording "+fileName); + odebug << "done recording "+fileName << oendl; Config cfg("qpe"); cfg.setGroup("Volume"); QString foo = cfg.readEntry("Mute","TRUE"); if(foo.find("TRUE",0,TRUE) != -1) QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute |