-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 63ee0b8..84d53e0 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -224,26 +224,26 @@ VMemo::VMemo( QWidget *parent, const char *_name ) connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); if( toggleKey != -1 ) { // QPEApplication::grabKeyboard(); QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); // e << 4096; // Key_Escape // e << Key_F5; //4148 e << toggleKey; e << QString("QPE/VMemo"); e << QString("toggleRecord()"); } - // if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) - // hide(); + if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) + hide(); } } VMemo::~VMemo() { } void VMemo::receive( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); if (msg == "toggleRecord()") { if (recording) { @@ -354,24 +354,25 @@ bool VMemo::startRecording() { l.writeLink(); record(); // delete msgLabel; return TRUE; } void VMemo::stopRecording() { recording = FALSE; if(useAlerts) if( msgLabel) delete msgLabel; + t_timer->stop(); } int VMemo::openDSP() { Config cfg("Vmemo"); cfg.setGroup("Record"); speed = cfg.readNumEntry("SampleRate", 22050); channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) if (cfg.readNumEntry("SixteenBit", 1)==1) { format = AFMT_S16_LE; resolution = 16; @@ -447,41 +448,44 @@ int VMemo::openWAV(const char *filename) // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); write (wav, &wh, sizeof(WaveHeader)); return 1; } void VMemo::record(void) { int length=0, result, value; QString msg; msg.sprintf("Recording format %d", format); qDebug(msg); + Config config("Vmemo"); + config.setGroup("Record"); + int sRate=config.readNumEntry("SizeLimit", 30); - t_timer->start( 30 * 1000+1000, TRUE); + t_timer->start( sRate * 1000+1000, TRUE); if(systemZaurus) { msg.sprintf("Recording format zaurus"); qDebug(msg); signed short sound[512], monoBuffer[512]; if(format==AFMT_S16_LE) { while(recording) { result = read(dsp, sound, 512); // 8192 - int j=0; + // int j=0; for (int i = 0; i < result; i++) { //since Z is mono do normally monoBuffer[i] = sound[i]; } length+=write(wav, monoBuffer, result); if(length<0) recording=false; // for (int i = 0; i < result; i+=2) { // monoBuffer[j] = sound[i]; // // monoBuffer[j] = (sound[i]+sound[i+1])/2; @@ -489,25 +493,25 @@ void VMemo::record(void) // j++; // } qApp->processEvents(); // printf("%d\r",length); // fflush(stdout); } } else { //AFMT_U8 // 8bit unsigned unsigned short sound[512], monoBuffer[512]; while(recording) { result = read(dsp, sound, 512); // 8192 - int j=0; + // int j=0; // if(systemZaurus) { for (int i = 0; i < result; i++) { //since Z is mono do normally monoBuffer[i] = sound[i]; } length+=write(wav, monoBuffer, result); // for (int i = 0; i < result; i+=2) { // monoBuffer[j] = (sound[i]+sound[i+1])/2; // j++; @@ -518,25 +522,25 @@ void VMemo::record(void) // fflush(stdout); } qApp->processEvents(); } } else { // 16 bit only capabilities msg.sprintf("Recording format other"); qDebug(msg); - signed short sound[512], monoBuffer[512]; + signed short sound[512];//, monoBuffer[512]; while(recording) { result = read(dsp, sound, 512); // 8192 write(wav, sound, result); length += result; if(length<0) { recording=false; perror("dev/dsp's is a lookin' messy"); QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |