summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 83f19f5..25ee476 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -197,97 +197,97 @@ void VMemo::mousePressEvent( QMouseEvent * )
197 fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs 197 fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs
198 else 198 else
199 fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); 199 fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/");
200 200
201 fileName += "vm_"; 201 fileName += "vm_";
202 fileName += dt.toString(); 202 fileName += dt.toString();
203 fileName += ".wav"; 203 fileName += ".wav";
204 204
205 // No spaces in the filename 205 // No spaces in the filename
206 fileName.replace(QRegExp("'"),""); 206 fileName.replace(QRegExp("'"),"");
207 fileName.replace(QRegExp(" "),"_"); 207 fileName.replace(QRegExp(" "),"_");
208 fileName.replace(QRegExp(":"),"."); 208 fileName.replace(QRegExp(":"),".");
209 fileName.replace(QRegExp(","),""); 209 fileName.replace(QRegExp(","),"");
210 210
211 if(openWAV(fileName.latin1()) == -1) 211 if(openWAV(fileName.latin1()) == -1)
212 { 212 {
213 // ### Display an error box 213 // ### Display an error box
214 qWarning("VMemo::mousePress() -> WAV error"); 214 qWarning("VMemo::mousePress() -> WAV error");
215 close(dsp); 215 close(dsp);
216 return; 216 return;
217 } 217 }
218 218
219 QArray<int> cats(1); 219 QArray<int> cats(1);
220 cats[0] = vmCfg.readNumEntry("Category", 0); 220 cats[0] = vmCfg.readNumEntry("Category", 0);
221 221
222 QString dlName("vm_"); 222 QString dlName("vm_");
223 dlName += dt.toString(); 223 dlName += dt.toString();
224 DocLnk l; 224 DocLnk l;
225 l.setFile(fileName); 225 l.setFile(fileName);
226 l.setName(dlName); 226 l.setName(dlName);
227 l.setType("audio/x-wav"); 227 l.setType("audio/x-wav");
228 l.setCategories(cats); 228 l.setCategories(cats);
229 l.writeLink(); 229 l.writeLink();
230 230
231 record(); 231 record();
232} 232}
233 233
234void VMemo::mouseReleaseEvent( QMouseEvent * ) 234void VMemo::mouseReleaseEvent( QMouseEvent * )
235{ 235{
236 qWarning("VMemo::mouseRelese() -> Done recording"); 236 qWarning("VMemo::mouseRelese() -> Done recording");
237 recording = FALSE; 237 recording = FALSE;
238} 238}
239 239
240int VMemo::openDSP() 240int VMemo::openDSP()
241{ 241{
242 Config cfg("Sound"); 242 Config cfg("Sound");
243 cfg.setGroup("Record"); 243 cfg.setGroup("Record");
244 244
245 speed = cfg.readNumEntry("SampleRate", 11025); 245 speed = cfg.readNumEntry("SampleRate", 22050);
246 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) 246 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1)
247 if (cfg.readNumEntry("SixteenBit", 1)==1) 247 if (cfg.readNumEntry("SixteenBit", 1)==1)
248 { 248 {
249 format = AFMT_S16_LE; 249 format = AFMT_S16_LE;
250 resolution = 16; 250 resolution = 16;
251 } 251 }
252 else 252 else
253 { 253 {
254 format = AFMT_U8; 254 format = AFMT_U8;
255 resolution = 8; 255 resolution = 8;
256 } 256 }
257 257
258 if(systemZaurus) 258 if(systemZaurus)
259 { 259 {
260 dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 260 dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1
261 channels=1; //zaurus has one input channel 261 channels=1; //zaurus has one input channel
262 } 262 }
263 else 263 else
264 dsp = open("/dev/dsp", O_RDWR); 264 dsp = open("/dev/dsp", O_RDWR);
265 265
266 if(dsp == -1) 266 if(dsp == -1)
267 { 267 {
268 perror("open(\"/dev/dsp\")"); 268 perror("open(\"/dev/dsp\")");
269 return -1; 269 return -1;
270 } 270 }
271 271
272 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) 272 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1)
273 { 273 {
274 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 274 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
275 return -1; 275 return -1;
276 } 276 }
277 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) 277 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1)
278 { 278 {
279 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 279 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
280 return -1; 280 return -1;
281 } 281 }
282 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) 282 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1)
283 { 283 {
284 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 284 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
285 return -1; 285 return -1;
286 } 286 }
287 if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) 287 if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1)
288 { 288 {
289 perror("ioctl(\"SOUND_PCM_READ_RATE\")"); 289 perror("ioctl(\"SOUND_PCM_READ_RATE\")");
290 return -1; 290 return -1;
291 } 291 }
292 292
293 return 1; 293 return 1;