summaryrefslogtreecommitdiff
authorwaspe <waspe>2003-11-03 17:55:02 (UTC)
committer waspe <waspe>2003-11-03 17:55:02 (UTC)
commit6d7e3e8b04b63d92c61d1109c35163690f2c9948 (patch) (unidiff)
tree0b21b31e2ce6df2639469bc2b75d625203a2c298
parentea385e81e3de3ee100a5789a8a8d1b807d89efe0 (diff)
downloadopie-6d7e3e8b04b63d92c61d1109c35163690f2c9948.zip
opie-6d7e3e8b04b63d92c61d1109c35163690f2c9948.tar.gz
opie-6d7e3e8b04b63d92c61d1109c35163690f2c9948.tar.bz2
reolved merge conflict
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 6ec4583..83c148f 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -1,414 +1,413 @@
1/************************************************************************************ 1/************************************************************************************
2 ** 2 **
3 ** This file may be distributed and/or modified under the terms of the 3 ** This file may be distributed and/or modified under the terms of the
4 ** GNU General Public License version 2 as published by the Free Software 4 ** GNU General Public License version 2 as published by the Free Software
5 ** Foundation and appearing in the file LICENSE.GPL included in the 5 ** Foundation and appearing in the file LICENSE.GPL included in the
6 ** packaging of this file. 6 ** packaging of this file.
7 ** 7 **
8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 ** 10 **
11 ************************************************************************************/ 11 ************************************************************************************/
12// copyright 2002 Jeremy Cowgar <jc@cowgar.com> 12// copyright 2002 Jeremy Cowgar <jc@cowgar.com>
13/* 13/*
14 * $Id$ 14 * $Id$
15 */ 15*/
16// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> 16// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com>
17 17
18extern "C" { 18extern "C" {
19#include "adpcm.h" 19#include "adpcm.h"
20} 20}
21 21
22#include <unistd.h> 22#include <unistd.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <fcntl.h> 24#include <fcntl.h>
25#include <sys/ioctl.h> 25#include <sys/ioctl.h>
26#include <linux/soundcard.h> 26#include <linux/soundcard.h>
27 27
28#include <errno.h> 28#include <errno.h>
29 29
30
31typedef struct _waveheader { 30typedef struct _waveheader {
32 u_long main_chunk; /* 'RIFF' */ 31 u_long main_chunk; /* 'RIFF' */
33 u_long length; /* filelen */ 32 u_long length; /* filelen */
34 u_long chunk_type; /* 'WAVE' */ 33 u_long chunk_type; /* 'WAVE' */
35 u_long sub_chunk; /* 'fmt ' */ 34 u_long sub_chunk; /* 'fmt ' */
36 u_long sc_len; /* length of sub_chunk, =16 35 u_long sc_len; /* length of sub_chunk, =16
37 (chunckSize) format len */ 36 (chunckSize) format len */
38 u_short format; /* should be 1 for PCM-code (formatTag) */ 37 u_short format; /* should be 1 for PCM-code (formatTag) */
39 38
40 u_short modus; /* 1 Mono, 2 Stereo (channels) */ 39 u_short modus; /* 1 Mono, 2 Stereo (channels) */
41 u_long sample_fq; /* samples per second (samplesPerSecond) */ 40 u_long sample_fq; /* samples per second (samplesPerSecond) */
42 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ 41 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */
43 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ 42 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */
44 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ 43 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */
45 44
46 u_long data_chunk; /* 'data' */ 45 u_long data_chunk; /* 'data' */
47 46
48 u_long data_length;/* samplecount */ 47 u_long data_length;/* samplecount */
49} WaveHeader; 48} WaveHeader;
50 49
51#define RIFF 0x46464952 50#define RIFF 0x46464952
52#define WAVE 0x45564157 51#define WAVE 0x45564157
53#define FMT 0x20746D66 52#define FMT 0x20746D66
54#define DATA 0x61746164 53#define DATA 0x61746164
55#define PCM_CODE 1 54#define PCM_CODE 1
56#define WAVE_MONO 1 55#define WAVE_MONO 1
57#define WAVE_STEREO 2 56#define WAVE_STEREO 2
58 57
59struct adpcm_state encoder_state; 58struct adpcm_state encoder_state;
60//struct adpcm_state decoder_state; 59//struct adpcm_state decoder_state;
61 60
62#define WAVE_FORMAT_DVI_ADPCM (0x0011) 61#define WAVE_FORMAT_DVI_ADPCM (0x0011)
63#define WAVE_FORMAT_PCM (0x0001) 62#define WAVE_FORMAT_PCM (0x0001)
64 63
65 64
66#include "vmemo.h" 65#include "vmemo.h"
67 66
68#include <qpe/qpeapplication.h> 67#include <qpe/qpeapplication.h>
69#include <qpe/config.h> 68#include <qpe/config.h>
70 69
71#include <qpainter.h> 70#include <qpainter.h>
72#include <qmessagebox.h> 71#include <qmessagebox.h>
73 72
74int seq = 0; 73int seq = 0;
75 74
76/* XPM */ 75/* XPM */
77static char * vmemo_xpm[] = { 76static char * vmemo_xpm[] = {
78 "16 16 102 2", 77 "16 16 102 2",
79 " c None", 78 " c None",
80 ". c #60636A", 79 ". c #60636A",
81 "+ c #6E6E72", 80 "+ c #6E6E72",
82 "@ c #68696E", 81 "@ c #68696E",
83 "# c #4D525C", 82 "# c #4D525C",
84 "$ c #6B6C70", 83 "$ c #6B6C70",
85 "% c #E3E3E8", 84 "% c #E3E3E8",
86 "& c #EEEEF2", 85 "& c #EEEEF2",
87 "* c #EAEAEF", 86 "* c #EAEAEF",
88 "= c #CACAD0", 87 "= c #CACAD0",
89 "- c #474A51", 88 "- c #474A51",
90 "; c #171819", 89 "; c #171819",
91 "> c #9B9B9F", 90 "> c #9B9B9F",
92 ", c #EBEBF0", 91 ", c #EBEBF0",
93 "' c #F4F4F7", 92 "' c #F4F4F7",
94 ") c #F1F1F5", 93 ") c #F1F1F5",
95 "! c #DEDEE4", 94 "! c #DEDEE4",
96 "~ c #57575C", 95 "~ c #57575C",
97 "{ c #010101", 96 "{ c #010101",
98 "] c #A2A2A6", 97 "] c #A2A2A6",
99 "^ c #747477", 98 "^ c #747477",
100 "/ c #B5B5B8", 99 "/ c #B5B5B8",
101 "( c #AEAEB2", 100 "( c #AEAEB2",
102 "_ c #69696D", 101 "_ c #69696D",
103 ": c #525256", 102 ": c #525256",
104 "< c #181C24", 103 "< c #181C24",
105 "[ c #97979B", 104 "[ c #97979B",
106 "} c #A7A7AC", 105 "} c #A7A7AC",
107 "| c #B0B0B4", 106 "| c #B0B0B4",
108 "1 c #C8C8D1", 107 "1 c #C8C8D1",
109 "2 c #75757B", 108 "2 c #75757B",
110 "3 c #46464A", 109 "3 c #46464A",
111 "4 c #494A4F", 110 "4 c #494A4F",
112 "5 c #323234", 111 "5 c #323234",
113 "6 c #909095", 112 "6 c #909095",
114 "7 c #39393B", 113 "7 c #39393B",
115 "8 c #757578", 114 "8 c #757578",
116 "9 c #87878E", 115 "9 c #87878E",
117 "0 c #222224", 116 "0 c #222224",
118 "a c #414144", 117 "a c #414144",
119 "b c #6A6A6E", 118 "b c #6A6A6E",
120 "c c #020C16", 119 "c c #020C16",
121 "d c #6B6B6F", 120 "d c #6B6B6F",
122 "e c #68686D", 121 "e c #68686D",
123 "f c #5B5B60", 122 "f c #5B5B60",
124 "g c #8A8A8F", 123 "g c #8A8A8F",
125 "h c #6B6B6E", 124 "h c #6B6B6E",
126 "i c #ADADB2", 125 "i c #ADADB2",
127 "j c #828289", 126 "j c #828289",
128 "k c #3E3E41", 127 "k c #3E3E41",
129 "l c #CFCFD7", 128 "l c #CFCFD7",
130 "m c #4C4C50", 129 "m c #4C4C50",
131 "n c #000000", 130 "n c #000000",
132 "o c #66666A", 131 "o c #66666A",
133 "p c #505054", 132 "p c #505054",
134 "q c #838388", 133 "q c #838388",
135 "r c #A1A1A7", 134 "r c #A1A1A7",
136 "s c #A9A9AE", 135 "s c #A9A9AE",
137 "t c #A8A8B0", 136 "t c #A8A8B0",
138 "u c #5E5E63", 137 "u c #5E5E63",
139 "v c #3A3A3E", 138 "v c #3A3A3E",
140 "w c #BDBDC6", 139 "w c #BDBDC6",
141 "x c #59595E", 140 "x c #59595E",
142 "y c #76767C", 141 "y c #76767C",
143 "z c #373738", 142 "z c #373738",
144 "A c #717174", 143 "A c #717174",
145 "B c #727278", 144 "B c #727278",
146 "C c #1C1C1E", 145 "C c #1C1C1E",
147 "D c #3C3C3F", 146 "D c #3C3C3F",
148 "E c #ADADB6", 147 "E c #ADADB6",
149 "F c #54555A", 148 "F c #54555A",
150 "G c #8B8C94", 149 "G c #8B8C94",
151 "H c #5A5A5F", 150 "H c #5A5A5F",
152 "I c #BBBBC3", 151 "I c #BBBBC3",
153 "J c #C4C4CB", 152 "J c #C4C4CB",
154 "K c #909098", 153 "K c #909098",
155 "L c #737379", 154 "L c #737379",
156 "M c #343437", 155 "M c #343437",
157 "N c #8F8F98", 156 "N c #8F8F98",
158 "O c #000407", 157 "O c #000407",
159 "P c #2D3137", 158 "P c #2D3137",
160 "Q c #B0B1BC", 159 "Q c #B0B1BC",
161 "R c #3B3C40", 160 "R c #3B3C40",
162 "S c #6E6E74", 161 "S c #6E6E74",
163 "T c #95959C", 162 "T c #95959C",
164 "U c #74747A", 163 "U c #74747A",
165 "V c #1D1D1E", 164 "V c #1D1D1E",
166 "W c #91929A", 165 "W c #91929A",
167 "X c #42444A", 166 "X c #42444A",
168 "Y c #22282E", 167 "Y c #22282E",
169 "Z c #B0B2BC", 168 "Z c #B0B2BC",
170 "` c #898A90", 169 "` c #898A90",
171 " . c #65656A", 170 " . c #65656A",
172 ".. c #999AA2", 171 ".. c #999AA2",
173 "+. c #52535A", 172 "+. c #52535A",
174 "@. c #151B21", 173 "@. c #151B21",
175 "#. c #515257", 174 "#. c #515257",
176 "$. c #B5B5BE", 175 "$. c #B5B5BE",
177 "%. c #616167", 176 "%. c #616167",
178 "&. c #1A1D22", 177 "&. c #1A1D22",
179 "*. c #000713", 178 "*. c #000713",
180 "=. c #1F1F21", 179 "=. c #1F1F21",
181 " ", 180 " ",
182 " . + @ # ", 181 " . + @ # ",
183 " $ % & * = - ", 182 " $ % & * = - ",
184 " ; > , ' ) ! ~ ", 183 " ; > , ' ) ! ~ ",
185 " { ] ^ / ( _ : ", 184 " { ] ^ / ( _ : ",
186 " < [ } | 1 2 3 ", 185 " < [ } | 1 2 3 ",
187 " 4 5 6 7 8 9 0 a b c ", 186 " 4 5 6 7 8 9 0 a b c ",
188 " d e f g h i j 3 k l m n ", 187 " d e f g h i j 3 k l m n ",
189 " o p q r s t u v w n ", 188 " o p q r s t u v w n ",
190 " o x y z A B C D E n ", 189 " o x y z A B C D E n ",
191 " F G H I J K L M N O ", 190 " F G H I J K L M N O ",
192 " P Q R S T U V W X ", 191 " P Q R S T U V W X ",
193 " Y Z ` b ...+. ", 192 " Y Z ` b ...+. ",
194 " @.#.$.%.&. ", 193 " @.#.$.%.&. ",
195 " *.B =. ", 194 " *.B =. ",
196 " n n n n n n n n n "}; 195 " n n n n n n n n n "};
197 196
198 197
199VMemo::VMemo( QWidget *parent, const char *_name ) 198VMemo::VMemo( QWidget *parent, const char *_name )
200 : QWidget( parent, _name ) { 199 : QWidget( parent, _name ) {
201 setFixedHeight( 18 ); 200 setFixedHeight( 18 );
202 setFixedWidth( 14 ); 201 setFixedWidth( 14 );
203 202
204 t_timer = new QTimer( this ); 203 t_timer = new QTimer( this );
205 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); 204 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
206 205
207 Config vmCfg("Vmemo"); 206 Config vmCfg("Vmemo");
208 vmCfg.setGroup("Defaults"); 207 vmCfg.setGroup("Defaults");
209 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); 208 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
210 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); 209 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
211 210
212 qDebug("toggleKey %d", toggleKey); 211 qDebug("toggleKey %d", toggleKey);
213 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 212 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
214 systemZaurus=TRUE; 213 systemZaurus=TRUE;
215 else 214 else
216 systemZaurus=FALSE; 215 systemZaurus=FALSE;
217 216
218 myChannel = new QCopChannel( "QPE/VMemo", this ); 217 myChannel = new QCopChannel( "QPE/VMemo", this );
219 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 218 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
220 this, SLOT(receive(const QCString&, const QByteArray&)) ); 219 this, SLOT(receive(const QCString&, const QByteArray&)) );
221 220
222 if( toggleKey != -1 ) { 221 if( toggleKey != -1 ) {
223 // keyRegister(key, channel, message) 222 // keyRegister(key, channel, message)
224 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 223 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
225 // e << 4096; // Key_Escape 224 // e << 4096; // Key_Escape
226 // e << Key_F5; //4148 225 // e << Key_F5; //4148
227 e << toggleKey; 226 e << toggleKey;
228 e << QString("QPE/VMemo"); 227 e << QString("QPE/VMemo");
229 e << QString("toggleRecord()"); 228 e << QString("toggleRecord()");
230 } 229 }
231 if(toggleKey == 1) 230 if(toggleKey == 1)
232 usingIcon=TRUE; 231 usingIcon=TRUE;
233 else 232 else
234 usingIcon=FALSE; 233 usingIcon=FALSE;
235 if( vmCfg.readNumEntry("hideIcon",0) == 1) 234 if( vmCfg.readNumEntry("hideIcon",0) == 1)
236 hide(); 235 hide();
237 recording = FALSE; 236 recording = FALSE;
238 // } 237 // }
239} 238}
240 239
241VMemo::~VMemo() { 240VMemo::~VMemo() {
242} 241}
243 242
244void VMemo::receive( const QCString &msg, const QByteArray &data ) { 243void VMemo::receive( const QCString &msg, const QByteArray &data ) {
245 qDebug("receive"); 244 qDebug("receive");
246 QDataStream stream( data, IO_ReadOnly ); 245 QDataStream stream( data, IO_ReadOnly );
247 246
248 if (msg == "toggleRecord()") { 247 if (msg == "toggleRecord()") {
249 if (recording) { 248 if (recording) {
250 fromToggle = TRUE; 249 fromToggle = TRUE;
251 stopRecording(); 250 stopRecording();
252 } else { 251 } else {
253 fromToggle = TRUE; 252 fromToggle = TRUE;
254 startRecording(); 253 startRecording();
255 } 254 }
256 } 255 }
257} 256}
258 257
259void VMemo::paintEvent( QPaintEvent* ) { 258void VMemo::paintEvent( QPaintEvent* ) {
260 QPainter p(this); 259 QPainter p(this);
261 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 260 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
262} 261}
263 262
264void VMemo::mousePressEvent( QMouseEvent * me) { 263void VMemo::mousePressEvent( QMouseEvent * me) {
265 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 264 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions
266 mousePressEvent and mouseReleaseEvent with a NULL parameter. */ 265 mousePressEvent and mouseReleaseEvent with a NULL parameter. */
267 266
268// if (!systemZaurus && me != NULL) 267// if (!systemZaurus && me != NULL)
269// return; 268// return;
270// } 269// }
271 270
272 if(!recording) 271 if(!recording)
273 startRecording(); 272 startRecording();
274 else 273 else
275 stopRecording(); 274 stopRecording();
276} 275}
277 276
278void VMemo::mouseReleaseEvent( QMouseEvent * ) { 277void VMemo::mouseReleaseEvent( QMouseEvent * ) {
279} 278}
280 279
281bool VMemo::startRecording() { 280bool VMemo::startRecording() {
282 Config config( "Vmemo" ); 281 Config config( "Vmemo" );
283 config.setGroup( "System" ); 282 config.setGroup( "System" );
284 283
285 useAlerts = config.readBoolEntry("Alert",1); 284 useAlerts = config.readBoolEntry("Alert",1);
286 if(useAlerts) { 285 if(useAlerts) {
287 286
288 msgLabel = new QLabel( 0, "alertLabel" ); 287 msgLabel = new QLabel( 0, "alertLabel" );
289 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); 288 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>");
290 msgLabel->show(); 289 msgLabel->show();
291 } 290 }
292 291
293 qDebug("Start recording engines"); 292 qDebug("Start recording engines");
294 recording = TRUE; 293 recording = TRUE;
295 294
296 if (openDSP() == -1) { 295 if (openDSP() == -1) {
297 recording = FALSE; 296 recording = FALSE;
298 return FALSE; 297 return FALSE;
299 } 298 }
300 299
301 config.setGroup("Defaults"); 300 config.setGroup("Defaults");
302 301
303 date = TimeString::dateString( QDateTime::currentDateTime(),false,true); 302 date = TimeString::dateString( QDateTime::currentDateTime(),false,true);
304 date.replace(QRegExp("'"),""); 303 date.replace(QRegExp("'"),"");
305 date.replace(QRegExp(" "),"_"); 304 date.replace(QRegExp(" "),"_");
306 date.replace(QRegExp(":"),"."); 305 date.replace(QRegExp(":"),".");
307 date.replace(QRegExp(","),""); 306 date.replace(QRegExp(","),"");
308 307
309 QString fName; 308 QString fName;
310 config.setGroup( "System" ); 309 config.setGroup( "System" );
311 fName = QPEApplication::documentDir() ; 310 fName = QPEApplication::documentDir() ;
312 fileName = config.readEntry("RecLocation", fName); 311 fileName = config.readEntry("RecLocation", fName);
313 312
314 int s; 313 int s;
315 s=fileName.find(':'); 314 s=fileName.find(':');
316 if(s) 315 if(s)
317 fileName=fileName.right(fileName.length()-s-2); 316 fileName=fileName.right(fileName.length()-s-2);
318 qDebug("pathname will be "+fileName); 317 qDebug("pathname will be "+fileName);
319 318
320 if( fileName.left(1).find('/') == -1) 319 if( fileName.left(1).find('/') == -1)
321 fileName="/"+fileName; 320 fileName="/"+fileName;
322 if( fileName.right(1).find('/') == -1) 321 if( fileName.right(1).find('/') == -1)
323 fileName+="/"; 322 fileName+="/";
324 fName = "vm_"+ date+ ".wav"; 323 fName = "vm_"+ date+ ".wav";
325 324
326 fileName+=fName; 325 fileName+=fName;
327 qDebug("filename is "+fileName); 326 qDebug("filename is "+fileName);
328// open tmp file here 327// open tmp file here
329 char *pointer; 328 char *pointer;
330 pointer=tmpnam(NULL); 329 pointer=tmpnam(NULL);
331 qDebug("Opening tmp file %s",pointer); 330 qDebug("Opening tmp file %s",pointer);
332 331
333 if(openWAV(pointer ) == -1) { 332 if(openWAV(pointer ) == -1) {
334 333
335 QString err("Could not open the temp file\n"); 334 QString err("Could not open the temp file\n");
336 err += fileName; 335 err += fileName;
337 QMessageBox::critical(0, "vmemo", err, "Abort"); 336 QMessageBox::critical(0, "vmemo", err, "Abort");
338 ::close(dsp); 337 ::close(dsp);
339 return FALSE; 338 return FALSE;
340 } 339 }
341 if( record() ) { 340 if( record() ) {
342 341
343 QString cmd; 342 QString cmd;
344 if( fileName.find(".wav",0,TRUE) == -1) 343 if( fileName.find(".wav",0,TRUE) == -1)
345 fileName += ".wav"; 344 fileName += ".wav";
346 345
347 cmd.sprintf("mv %s "+fileName, pointer); 346 cmd.sprintf("mv %s "+fileName, pointer);
348// move tmp file to regular file here 347// move tmp file to regular file here
349 348
350 system(cmd.latin1()); 349 system(cmd.latin1());
351 350
352 QArray<int> cats(1); 351 QArray<int> cats(1);
353 cats[0] = config.readNumEntry("Category", 0); 352 cats[0] = config.readNumEntry("Category", 0);
354 353
355 QString dlName("vm_"); 354 QString dlName("vm_");
356 dlName += date; 355 dlName += date;
357 DocLnk l; 356 DocLnk l;
358 l.setFile(fileName); 357 l.setFile(fileName);
359 l.setName(dlName); 358 l.setName(dlName);
360 l.setType("audio/x-wav"); 359 l.setType("audio/x-wav");
361 l.setCategories(cats); 360 l.setCategories(cats);
362 l.writeLink(); 361 l.writeLink();
363 return TRUE; 362 return TRUE;
364 } else 363 } else
365 return FALSE; 364 return FALSE;
366 365
367} 366}
368 367
369void VMemo::stopRecording() { 368void VMemo::stopRecording() {
370 show(); 369 show();
371 qDebug("Stopped recording"); 370 qDebug("Stopped recording");
372 recording = FALSE; 371 recording = FALSE;
373 if(useAlerts) { 372 if(useAlerts) {
374 msgLabel->close(); 373 msgLabel->close();
375 msgLabel=0; 374 msgLabel=0;
376 delete msgLabel; 375 delete msgLabel;
377 } 376 }
378 t_timer->stop(); 377 t_timer->stop();
379 Config cfg("Vmemo"); 378 Config cfg("Vmemo");
380 cfg.setGroup("Defaults"); 379 cfg.setGroup("Defaults");
381 if( cfg.readNumEntry("hideIcon",0) == 1 ) 380 if( cfg.readNumEntry("hideIcon",0) == 1 )
382 hide(); 381 hide();
383} 382}
384 383
385int VMemo::openDSP() { 384int VMemo::openDSP() {
386 Config cfg("Vmemo"); 385 Config cfg("Vmemo");
387 cfg.setGroup("Record"); 386 cfg.setGroup("Record");
388 387
389 speed = cfg.readNumEntry("SampleRate", 22050); 388 speed = cfg.readNumEntry("SampleRate", 22050);
390 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) 389 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1)
391 if (cfg.readNumEntry("SixteenBit", 1)==1) { 390 if (cfg.readNumEntry("SixteenBit", 1)==1) {
392 format = AFMT_S16_LE; 391 format = AFMT_S16_LE;
393 resolution = 16; 392 resolution = 16;
394 } else { 393 } else {
395 format = AFMT_U8; 394 format = AFMT_U8;
396 resolution = 8; 395 resolution = 8;
397 } 396 }
398 397
399 qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); 398 qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution);
400 399
401 if(systemZaurus) { 400 if(systemZaurus) {
402 dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 401 dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1
403 channels=1; //zaurus has one input channel 402 channels=1; //zaurus has one input channel
404 } else { 403 } else {
405 dsp = open("/dev/dsp", O_RDONLY); 404 dsp = open("/dev/dsp", O_RDONLY);
406 } 405 }
407 406
408 if(dsp == -1) { 407 if(dsp == -1) {
409 msgLabel->close(); 408 msgLabel->close();
410 msgLabel=0; 409 msgLabel=0;
411 delete msgLabel; 410 delete msgLabel;
412 411
413 perror("open(\"/dev/dsp\")"); 412 perror("open(\"/dev/dsp\")");
414 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); 413 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno);