summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp106
1 files changed, 59 insertions, 47 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 10a947e..b29ee62 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -407,8 +407,10 @@ int VMemo::openDSP()
if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) {
perror("ioctl(\"SOUND_PCM_READ_RATE\")");
return -1;
}
+
+ QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute
return 1;
}
@@ -452,88 +454,91 @@ void VMemo::record(void)
qDebug(msg);
if(systemZaurus) {
- msg.sprintf("Recording format zaurus");
- qDebug(msg);
+ 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;
- if(systemZaurus) {
- for (int i = 0; i < result; i++) { //since Z is mono do normally
- monoBuffer[i] = sound[i];
- }
+ // if(systemZaurus) {
+ 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;
+ length+=write(wav, monoBuffer, result);
+ if(length<0)
+ recording=false;
- } else { //ipaq /stereo inputs
+ // } else { //ipaq /stereo inputs
- for (int i = 0; i < result; i+=2) {
- monoBuffer[j] = sound[i];
- // monoBuffer[j] = (sound[i]+sound[i+1])/2;
+ // for (int i = 0; i < result; i+=2) {
+ // monoBuffer[j] = sound[i];
+ // // monoBuffer[j] = (sound[i]+sound[i+1])/2;
- j++;
- }
+ // j++;
+ // }
- length+=write(wav, monoBuffer, result);
- if(length<0)
- recording=false;
- // length+=write(wav, monoBuffer, result/2);
- }
+ // length+=write(wav, monoBuffer, result);
+ // if(length<0)
+ // recording=false;
+ // // length+=write(wav, monoBuffer, result/2);
+ // }
qApp->processEvents();
-// printf("%d\r",length);
-// fflush(stdout);
+ // printf("%d\r",length);
+ // fflush(stdout);
}
-} else { //AFMT_U8
+ } else { //AFMT_U8
// 8bit unsigned
unsigned short sound[512], monoBuffer[512];
while(recording) {
result = read(dsp, sound, 512); // 8192
int j=0;
- if(systemZaurus) {
+ // if(systemZaurus) {
- for (int i = 0; i < result; i++) { //since Z is mono do normally
- monoBuffer[i] = sound[i];
- }
+ for (int i = 0; i < result; i++) { //since Z is mono do normally
+ monoBuffer[i] = sound[i];
+ }
- length+=write(wav, monoBuffer, result);
+ length+=write(wav, monoBuffer, result);
- } else { //ipaq /stereo inputs
+ // } else { //ipaq /stereo inputs
- for (int i = 0; i < result; i+=2) {
- monoBuffer[j] = (sound[i]+sound[i+1])/2;
- j++;
- }
+ // for (int i = 0; i < result; i+=2) {
+ // monoBuffer[j] = (sound[i]+sound[i+1])/2;
+ // j++;
+ // }
- length+=write(wav, monoBuffer, result/2);
+ // length+=write(wav, monoBuffer, result/2);
- if(length<0)
- recording=false;
+ // if(length<0)
+ // recording=false;
- }
+ // }
length += result;
-// printf("%d\r",length);
-// fflush(stdout);
+ // printf("%d\r",length);
+ // fflush(stdout);
}
qApp->processEvents();
}
- } else { // this is specific for ipaqs that do not have 8 bit capabilities
+ } else { // 16 bit only capabilities
- msg.sprintf("Recording format other");
- qDebug(msg);
+
+ msg.sprintf("Recording format other");
+ qDebug(msg);
signed short sound[512], monoBuffer[512];
while(recording) {
@@ -543,14 +548,14 @@ void VMemo::record(void)
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);
+ recording=false;
+ perror("dev/dsp's is a lookin' messy");
+ QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName);
}
-// printf("%d\r",length);
-// fflush(stdout);
+ // printf("%d\r",length);
+ // fflush(stdout);
qApp->processEvents();
}
// qDebug("file has length of %d lasting %d seconds",
// length, (( length / speed) / channels) / 2 );
@@ -578,8 +583,15 @@ void VMemo::record(void)
// if(useAlerts)
// QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName);
qDebug("done recording "+fileName);
QSound::play(Resource::findSound("vmemoe"));
+
+ 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
+
}
int VMemo::setToggleButton(int tog) {