summaryrefslogtreecommitdiff
path: root/core/applets/vmemo/vmemo.cpp
Side-by-side diff
Diffstat (limited to 'core/applets/vmemo/vmemo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp108
1 files changed, 56 insertions, 52 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
@@ -14,2 +14,6 @@
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
extern "C" {
@@ -31,3 +35,3 @@ typedef struct _waveheader {
u_long sub_chunk; /* 'fmt ' */
- u_long sc_len; /* length of sub_chunk, =16
+ u_long sc_len; /* length of sub_chunk, =16
(chunckSize) format len */
@@ -200,6 +204,6 @@ VMemo::VMemo( QWidget *parent, const char *_name )
setFixedWidth( 14 );
-
+
t_timer = new QTimer( this );
connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
-
+
Config vmCfg("Vmemo");
@@ -209,8 +213,8 @@ VMemo::VMemo( QWidget *parent, const char *_name )
- qDebug("toggleKey %d", toggleKey);
+ odebug << "toggleKey " << toggleKey << "" << oendl;
if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
systemZaurus=TRUE;
- else
+ else
systemZaurus=FALSE;
-
+
myChannel = new QCopChannel( "QPE/VMemo", this );
@@ -247,3 +251,3 @@ int VMemo::position()
void VMemo::receive( const QCString &msg, const QByteArray &data ) {
- qDebug("receive");
+ odebug << "receive" << oendl;
QDataStream stream( data, IO_ReadOnly );
@@ -269,3 +273,3 @@ void VMemo::mousePressEvent( QMouseEvent * me) {
mousePressEvent and mouseReleaseEvent with a NULL parameter. */
-
+
// if (!systemZaurus && me != NULL)
@@ -295,3 +299,3 @@ bool VMemo::startRecording() {
- qDebug("Start recording engines");
+ odebug << "Start recording engines" << oendl;
recording = TRUE;
@@ -302,3 +306,3 @@ bool VMemo::startRecording() {
}
-
+
config.setGroup("Defaults");
@@ -320,3 +324,3 @@ bool VMemo::startRecording() {
fileName=fileName.right(fileName.length()-s-2);
- qDebug("pathname will be "+fileName);
+ odebug << "pathname will be "+fileName << oendl;
@@ -327,10 +331,10 @@ bool VMemo::startRecording() {
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);
-
+ pointer=tmpnam(NULL);
+ odebug << "Opening tmp file " << pointer << "" << oendl;
+
if(openWAV(pointer ) == -1) {
@@ -351,3 +355,3 @@ bool VMemo::startRecording() {
// move tmp file to regular file here
-
+
system(cmd.latin1());
@@ -356,3 +360,3 @@ bool VMemo::startRecording() {
cats[0] = config.readNumEntry("Category", 0);
-
+
QString dlName("vm_");
@@ -368,3 +372,3 @@ bool VMemo::startRecording() {
return FALSE;
-
+
}
@@ -373,3 +377,3 @@ void VMemo::stopRecording() {
show();
- qDebug("Stopped recording");
+ odebug << "Stopped recording" << oendl;
recording = FALSE;
@@ -390,3 +394,3 @@ int VMemo::openDSP() {
cfg.setGroup("Record");
-
+
speed = cfg.readNumEntry("SampleRate", 22050);
@@ -401,3 +405,3 @@ int VMemo::openDSP() {
- qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution);
+ odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl;
@@ -409,3 +413,3 @@ int VMemo::openDSP() {
}
-
+
if(dsp == -1) {
@@ -414,3 +418,3 @@ int VMemo::openDSP() {
delete msgLabel;
-
+
perror("open(\"/dev/dsp\")");
@@ -420,3 +424,3 @@ int VMemo::openDSP() {
}
-
+
if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) {
@@ -439,3 +443,3 @@ int VMemo::openDSP() {
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute
-
+
return 1;
@@ -454,3 +458,3 @@ int VMemo::openWAV(const char *filename) {
useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
-
+
WaveHeader wh;
@@ -458,3 +462,3 @@ int VMemo::openWAV(const char *filename) {
wh.main_chunk = RIFF;
- wh.length=0;
+ wh.length=0;
wh.chunk_type = WAVE;
@@ -465,3 +469,3 @@ int VMemo::openWAV(const char *filename) {
else
- wh.format = PCM_CODE;
+ wh.format = PCM_CODE;
wh.modus = channels;
@@ -469,6 +473,6 @@ int VMemo::openWAV(const char *filename) {
wh.byte_p_sec = speed * channels * resolution/8;
- wh.byte_p_spl = channels * (resolution / 8);
+ wh.byte_p_spl = channels * (resolution / 8);
wh.bit_p_spl = resolution;
wh.data_chunk = DATA;
- wh.data_length= 0;
+ wh.data_length= 0;
// qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d"
@@ -476,3 +480,3 @@ int VMemo::openWAV(const char *filename) {
write (wav, &wh, sizeof(WaveHeader));
-
+
return 1;
@@ -485,3 +489,3 @@ bool VMemo::record() {
msg.sprintf("Recording format %d", format);
- qDebug(msg);
+ odebug << msg << oendl;
Config config("Vmemo");
@@ -496,3 +500,3 @@ bool VMemo::record() {
msg.sprintf("Recording format other");
- qDebug(msg);
+ odebug << msg << oendl;
@@ -515,3 +519,3 @@ bool VMemo::record() {
perror("recording error ");
-// qDebug(currentFileName);
+// odebug << currentFileName << oendl;
QMessageBox::message(tr("Note"),tr("error recording"));
@@ -542,3 +546,3 @@ bool VMemo::record() {
}
- // printf("%d\r",length);
+ // odebug << "" << length << "\r" << oendl;
// fflush(stdout);
@@ -561,4 +565,4 @@ bool VMemo::record() {
track.close();
- qDebug("Track closed");
-
+ odebug << "Track closed" << oendl;
+
if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)
@@ -575,3 +579,3 @@ bool VMemo::record() {
QString currentFile = "vm_"+ date;
-
+
float numberOfRecordedSeconds=(float) length / (float)speed * (float)2;
@@ -585,3 +589,3 @@ bool VMemo::record() {
cfgO.writeEntry( currentFileName, time );
- // qDebug("writing config numberOfRecordedSeconds "+time);
+ // odebug << "writing config numberOfRecordedSeconds "+time << oendl;
@@ -589,3 +593,3 @@ bool VMemo::record() {
- qDebug("done recording "+fileName);
+ odebug << "done recording "+fileName << oendl;
@@ -604,28 +608,28 @@ int VMemo::setToggleButton(int tog) {
case 0:
- return -1;
- break;
+ return -1;
+ break;
case 1:
- return 0;
- break;
+ return 0;
+ break;
case 2:
return Key_F24; //was Escape
- break;
+ break;
case 3:
return Key_Space;
- break;
+ break;
case 4:
return Key_F12;
- break;
+ break;
case 5:
return Key_F9;
- break;
+ break;
case 6:
return Key_F10;
- break;
+ break;
case 7:
return Key_F11;
- break;
+ break;
case 8:
return Key_F13;
- break;
+ break;
};