aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qte/qte-2.3.10/qss-alsa.patch
blob: 5cea5a633ec6eece244061ba3c770b486479605a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
From 7a3ba8948e27a80a9e8a3857e298443c54c8931f Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Sun, 1 Jun 2014 20:31:39 +0300
Subject: [PATCH] Port QSound to use ALSA

ALSA is a default sound system for Linux since 2.6, and OSS is
deprecated. Port QSound to use ALSA instead of OSS.

This implementation mimics old OSS code, and may have bugs. Personally,
I don't like to write samples in timer handler, but I don't know a way
to integrate custom FDs into Qt/E event loop, so let's just do like it
was with OSS.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 configure                    |   4 +
 src/kernel/qsoundqss_qws.cpp | 410 +++++++++++++++++++++++++------------------
 2 files changed, 246 insertions(+), 168 deletions(-)

diff --git a/configure b/configure
index 8e7272d..bbaea60 100755
--- a/configure
+++ b/configure
@@ -1478,6 +1478,10 @@ chmod -w src/tools/qmodules.h
 
 # include math lib for compilers that don't automatically include it
 QT_LIBS="${QT_LIBS} -lm"
+
+# include alsa for sound
+QT_LIBS="${QT_LIBS} -lasound"
+
 [ "x$LIBPNG" = "xno" ] && [ ! "x$REALLY_DONT_USE_LIBPNG" = "xyes" ] && QT_LIBS="${QT_LIBS} -lpng"
 [ "x$ZLIB" = "xno" ] && [ ! "x$REALLY_DONT_USE_LIBZ" = "xyes" ] && QT_LIBS="${QT_LIBS} -lz"
 [ "x$JPEG" = "xyes" ] && QT_LIBS="${QT_LIBS} -ljpeg"
diff --git a/src/kernel/qsoundqss_qws.cpp b/src/kernel/qsoundqss_qws.cpp
index 3dde232..c1cbc78 100644
--- a/src/kernel/qsoundqss_qws.cpp
+++ b/src/kernel/qsoundqss_qws.cpp
@@ -48,12 +48,18 @@
 #include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include <alsa/asoundlib.h>
+
+#define DEFAULT_SND_DEVICE "default"
 
 #define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0
 #define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0
 
+#define SOUND_BUFFER_TIME 200000 /* uS */
+#define SOUND_PERIOD_TIME 50000 /* uS */
+
+static const int sound_buffer_size = (44100 * (QT_QWS_SOUND_16BIT + 1) * (QT_QWS_SOUND_STEREO + 1)) / 2;
+
 // Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails,
 // however 44100 works, 44100 is more common that 44000.
 static int sound_speed = 44100;
@@ -62,35 +68,12 @@ extern int qws_display_id;
 #define SOUND_PIPE	"/tmp/.qt_soundserver-%1"
 #endif
 
-static char *zeroMem = 0;
-
 struct QRiffChunk {
     char id[4];
     Q_UINT32 size;
     char data[4/*size*/];
 };
 
-#if defined(QT_QWS_IPAQ)
-static const int sound_fragment_size = 12;
-#else
-static const int sound_fragment_size = 12;
-#endif
-static const int sound_buffer_size = 1 << sound_fragment_size;
-// nb. there will be an sound startup delay of
-//        2^sound_fragment_size / sound_speed seconds.
-// (eg. sound_fragment_size==12, sound_speed==44000 means 0.093s delay)
-
-#ifdef QT_QWS_SOUND_STEREO
-static int sound_stereo = QT_QWS_SOUND_STEREO;
-#else
-static const int sound_stereo = 0;
-#endif
-#ifdef QT_QWS_SOUND_16BIT
-static bool sound_16bit = QT_QWS_SOUND_16BIT;
-#else
-static const bool sound_16bit = FALSE;
-#endif
-
 class QWSSoundServerClient : public QWSSocket {
     Q_OBJECT
 
@@ -253,7 +236,6 @@ void QWSSoundServerClient::sendDeviceError(int gid, int sid, int err)
 #endif
 
 static const int maxVolume = 100;
-static const int runinLength = 2*sound_buffer_size;
 class QWSSoundServerProvider {
 public:
     QWSSoundServerProvider(int w, int s)
@@ -383,12 +365,12 @@ public:
             if (count && samples_due >= chunkdata.samplesPerSec) {
                 int l = getSample(0,bytesPerSample)*lVolNum/lVolDen;
                 int r = (chunkdata.channels == 2) ? getSample(1,bytesPerSample)*rVolNum/rVolDen : l;
-                if (!sound_stereo && chunkdata.channels == 2) 
+                if (!QT_QWS_SOUND_STEREO && chunkdata.channels == 2) 
                     l += r;
 		if (sampleRunin) {
                     while (sampleRunin && count && samples_due >= chunkdata.samplesPerSec) {
                         mixl++;
-                        if (sound_stereo)
+                        if (QT_QWS_SOUND_STEREO)
                             mixr++;
                         samples_due -= chunkdata.samplesPerSec;
 		        sampleRunin--;
@@ -397,7 +379,7 @@ public:
                 }
                 while (count && samples_due >= chunkdata.samplesPerSec) {
                     *mixl++ += l;
-                    if (sound_stereo)
+                    if (QT_QWS_SOUND_STEREO)
                         *mixr++ += r;
                     samples_due -= chunkdata.samplesPerSec;
                     count--;
@@ -746,10 +728,9 @@ public:
 	connect(this, SIGNAL(deviceError(int, int, int)),
 		server, SIGNAL(deviceError(int, int, int)));
 #endif
-	fd = -1;
+    handle = NULL;
 	active.setAutoDelete(TRUE);
 	unwritten = 0;
-	can_GETOSPACE = TRUE;
     }
 
 signals:
@@ -765,7 +746,7 @@ public slots:
 	    QWSSoundServerStream *b = new QWSSoundServerStream(f, channels, freq, bitspersample, wid, sid);
 	    // check preset volumes.
 	    checkPresetVolumes(wid, sid, b);
-	    b->setPriority(flags & QWSSoundClient::Priority == QWSSoundClient::Priority);
+	    b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority);
 	    active.append(b);
 	    emit deviceReady(wid, sid);
 	}
@@ -789,7 +770,7 @@ public slots:
 	    QWSSoundServerProvider *b = new QWSSoundServerBucket(f, wid, sid);
 	    checkPresetVolumes(wid, sid, b);
 	    b->setVolume(v, v);
-	    b->setPriority(flags & QWSSoundClient::Priority == QWSSoundClient::Priority);
+	    b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority);
 	    active.append(b);
 	    emit deviceReady(wid, sid);
 	}
@@ -946,7 +927,7 @@ public slots:
 	}
     }
 
-    void feedDevice(int fd)
+    void feedDevice(void)
     {
 	if ( !unwritten && active.count() == 0 ) {
 	    closeDevice();
@@ -959,7 +940,7 @@ public slots:
 	QWSSoundServerProvider* bucket;
 
 	// find out how much audio is possible
-	int available = sound_buffer_size;
+	int available = period_size;
 	QList<QWSSoundServerProvider> running;
 	for (bucket = active.first(); bucket; bucket = active.next()) {
 	    int ready = bucket->readySamples(available);
@@ -969,73 +950,72 @@ public slots:
 	    }
 	}
 
-	audio_buf_info info;
-	if ( can_GETOSPACE && ioctl(fd,SNDCTL_DSP_GETOSPACE,&info) ) {
-	    can_GETOSPACE = FALSE;
-	    fcntl( fd, F_SETFL, O_NONBLOCK );
-	}
-	if ( !can_GETOSPACE )
-	    info.fragments = 4; // #### configurable?
-	if ( info.fragments > 0 ) {
-	    if ( !unwritten ) {
-		int left[sound_buffer_size];
-		memset(left,0,available*sizeof(int));
-		int right[sound_buffer_size];
-		if ( sound_stereo )
-		    memset(right,0,available*sizeof(int));
-
-		if (running.count() > 0) {
-		    // should do volume mod here in regards to each bucket to avoid flattened/bad peaks.
-		    for (bucket = running.first(); bucket; bucket = running.next()) {
-			int unused = bucket->add(left,right,available);
-			if (unused > 0) {
-			    // this error is quite serious, as
-			    // it will really screw up mixing.
-			    qDebug("provider lied about samples ready");
-			}
-		    }
-		    if ( sound_16bit ) {
-			short *d = (short*)data;
-			for (int i=0; i<available; i++) {
-			    *d++ = (short)QMAX(QMIN(left[i],32767),-32768);
-			    if ( sound_stereo ) 
-			        *d++ = (short)QMAX(QMIN(right[i],32767),-32768);
-			}
-		    } else {
-			signed char *d = (signed char *)data;
-			for (int i=0; i<available; i++) {
-			    *d++ = (signed char)QMAX(QMIN(left[i]/256,127),-128)+128;
-			    if ( sound_stereo ) 
-			        *d++ = (signed char)QMAX(QMIN(right[i]/256,127),-128)+128;
-			}
-		    }
-		    unwritten = available*(sound_16bit+1)*(sound_stereo+1);
-		    cursor = (char*)data;
-		}
-	    }
-	    // sound open, but nothing written.  Should clear the buffer.
-
-	    int w;
-	    if (unwritten) {
-		w = ::write(fd,cursor,unwritten);
+    if ( !unwritten ) {
+        int left[period_size];
+        memset(left,0,available*sizeof(int));
+        int right[period_size];
+        if ( QT_QWS_SOUND_STEREO )
+            memset(right,0,available*sizeof(int));
+
+        if (running.count() > 0) {
+            // should do volume mod here in regards to each bucket to avoid flattened/bad peaks.
+            for (bucket = running.first(); bucket; bucket = running.next()) {
+            int unused = bucket->add(left,right,available);
+            if (unused > 0) {
+                // this error is quite serious, as
+                // it will really screw up mixing.
+                qDebug("provider lied about samples ready");
+            }
+            }
+            if (QT_QWS_SOUND_16BIT) {
+            short *d = (short*)data;
+            for (int i = 0; i < available; i++) {
+                *d++ = (short)QMAX(QMIN(left[i],32767),-32768);
+                if (QT_QWS_SOUND_STEREO) 
+                    *d++ = (short)QMAX(QMIN(right[i],32767),-32768);
+            }
+            } else {
+            signed char *d = (signed char *)data;
+            for (int i = 0; i < available; i++) {
+                *d++ = (signed char)QMAX(QMIN(left[i]/256,127),-128)+128;
+                if (QT_QWS_SOUND_STEREO) 
+                    *d++ = (signed char)QMAX(QMIN(right[i]/256,127),-128)+128;
+            }
+            }
+            unwritten = available;
+            cursor = (char*)data;
+        }
+    }
+    // sound open, but nothing written.  Should clear the buffer.
+
+    int err;
+    if (unwritten) {
+        int w = 0;
+        do {
+            err = snd_pcm_writei(handle, cursor, unwritten);
+        } while (err == -EAGAIN);
+        if (err < 0) {
+            if (err == -EPIPE) {
+                err = snd_pcm_prepare(handle);
+                if (err < 0) {
+                    qDebug("Can't recover after underrun\n");
+                }
+            } else if (err == -ESTRPIPE) {
+                do {
+                    err = snd_pcm_resume(handle);
+                } while (err == -EAGAIN);
+                err = snd_pcm_prepare(handle);
+                if (err < 0) {
+                    qDebug("Can't recover after underrun\n");
+                }
+            }
+        }
 
-		if ( w < 0 )
-		    if ( !can_GETOSPACE )
-			w = 0;
-		    else
-			return;
+        w = err;
 
-		cursor += w;
-		unwritten -= w;
-	    } else {
-		// write some zeros to clear the buffer?
-		if (!zeroMem)
-		    zeroMem = (char *)calloc(sound_buffer_size, sizeof(char));
-		w = ::write(fd, zeroMem, sound_buffer_size);
-		if (w < 0)
-		    w = 0;
-	    }
-	}
+        cursor += w;
+        unwritten -= w;
+    }
 
 	bucket = active.first(); 
 	while(bucket) {
@@ -1054,11 +1034,11 @@ protected:
     {
 	//qDebug("QSS: timerEvent");
 	if ( event->timerId() == timerId ) {	
-	    if ( fd >= 0 )
-		feedDevice(fd);
-	    if ( fd < 0 ) {
-		killTimer(event->timerId());
-		timerId = 0;
+	    if (handle)
+            feedDevice();
+	    if (!handle) {
+            killTimer(event->timerId());
+            timerId = 0;
 	    }
 	}
     }
@@ -1081,79 +1061,173 @@ private:
 
     bool openDevice()
     {
-	if ( fd < 0 ) {
-	    //
-	    // Don't block open right away.
-	    //
-            bool openOkay = false;
-	    if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
-		int flags = fcntl(fd, F_GETFL);
-		flags &= ~O_NONBLOCK;
-		openOkay = (fcntl(fd, F_SETFL, flags) == 0);
-	    }
-            if (!openOkay) {
-	        qDebug("Failed opening audio device");
-		return false;
-            }
+    snd_pcm_format_t format;
+    snd_pcm_uframes_t size;
+    unsigned int rate;
+    int channels, dir, err;
+    unsigned int buffer_time = SOUND_BUFFER_TIME;
+    unsigned int period_time = SOUND_PERIOD_TIME;
+    snd_pcm_hw_params_t *hwparams;
+    snd_pcm_sw_params_t *swparams;
+    if (!handle) {
+        err = snd_pcm_open(&handle, DEFAULT_SND_DEVICE, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+        if (err < 0) {
+            qDebug("Failed opening audio device");
+            return false;
+        }
+
+        snd_pcm_hw_params_alloca(&hwparams);
+        snd_pcm_sw_params_alloca(&swparams);
+
+        /* Setup soundcard */
+        err = snd_pcm_hw_params_any(handle, hwparams);
+        if (err < 0) {
+            qDebug("No configuration available for playback: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        /* Enable alsa-lib resampling */
+        err = snd_pcm_hw_params_set_rate_resample(handle, hwparams, 1);
+        if (err < 0) {
+            qDebug("Failed to enable alsalib resample: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        /* Set access type */
+        err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
+        if (err < 0) {
+            qDebug("Failed to set access type: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
 
-	    // Setup soundcard at 16 bit mono
-	    int v;
-	    //v=0x00010000+sound_fragment_size;
-	    // um the media player did this instead.
-	    v=0x10000 * 4 + sound_fragment_size;
-	    if ( ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v) )
-		qWarning("Could not set fragments to %08x",v);
 #ifdef QT_QWS_SOUND_16BIT
-	    v=AFMT_S16_LE; if ( ioctl(fd, SNDCTL_DSP_SETFMT, &v) )
-		qWarning("Could not set format %d",v);
-	    if ( AFMT_S16_LE != v )
-		qDebug("Want format %d got %d", AFMT_S16_LE, v);
+        format = SND_PCM_FORMAT_S16;
 #else
-	    v=AFMT_U8; if ( ioctl(fd, SNDCTL_DSP_SETFMT, &v) )
-		qWarning("Could not set format %d",v);
-	    if ( AFMT_U8 != v )
-		qDebug("Want format %d got %d", AFMT_U8, v);
+        format = SND_PCM_FORMAT_S8;
 #endif
-	    v=sound_stereo; if ( ioctl(fd, SNDCTL_DSP_STEREO, &v) )
-		qWarning("Could not set stereo %d",v);
-	    if ( sound_stereo != v )
-		qDebug("Want stereo %d got %d", sound_stereo, v);
+        err = snd_pcm_hw_params_set_format(handle, hwparams, format);
+        if (err < 0) {
+            qDebug("Failed to set format: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
 #ifdef QT_QWS_SOUND_STEREO
-	    sound_stereo=v;
+        channels = 2;
+#else
+        channels = 1;
 #endif
-	    v=sound_speed; if ( ioctl(fd, SNDCTL_DSP_SPEED, &sound_speed) )
-		qWarning("Could not set speed %d",v);
-	    if ( v != sound_speed )
-		qDebug("Want speed %d got %d", v, sound_speed);
-
-	    int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))
-				    /sound_speed/2;
-	    // qDebug("QSS delay: %d", delay);
-	    timerId = startTimer(delay);
-
-	    //
-	    // Check system volume
-	    //
-	    int mixerHandle = ::open( "/dev/mixer", O_RDWR|O_NONBLOCK );
-	    if ( mixerHandle >= 0 ) {
-		int volume;
-		ioctl( mixerHandle, MIXER_READ(0), &volume );
-		close( mixerHandle );
-		if ( volume < 1<<(sound_stereo+sound_16bit) )
-		    qDebug("Want sound at %d got %d",
-			    1<<(sound_stereo+sound_16bit), volume);
-	    } else
-		qDebug( "get volume of audio device failed" );
+        err = snd_pcm_hw_params_set_channels(handle, hwparams, channels);
+        if (err < 0) {
+            qDebug("Failed to set channels count: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        rate = sound_speed;
+        err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, 0);
+        if (err < 0) {
+            qDebug("Failed to set rate %dHz: %s\n", sound_speed, snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
 
+        err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
+        if (err < 0) {
+            qDebug("Failed to set buffer time %duS: %s\n", buffer_time, snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        err = snd_pcm_hw_params_get_buffer_size(hwparams, &size);
+        if (err < 0) {
+            qDebug("Failed to get buffer size: %s", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+        buffer_size = size;
+
+        err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
+        if (err < 0) {
+            qDebug("Failed to set period time %duS: %s\n", period_time, snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        err = snd_pcm_hw_params_get_period_size(hwparams, &size, NULL);
+        if (err < 0) {
+            qDebug("Failed to get period size: %s", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+        period_size = size;
+
+        /* Write the parameters to device */
+        err = snd_pcm_hw_params(handle, hwparams);
+        if (err < 0) {
+            qDebug("Failed to apply hw params: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        /* Set SW params */
+        err = snd_pcm_sw_params_current(handle, swparams);
+        if (err < 0) {
+            qDebug("Failed to determine current swparams for playback: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / period_size) * period_size);
+        if (err < 0) {
+            qDebug("Failed to set start threshold: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
+        if (err < 0) {
+            qDebug("Failed to set avail min: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+        err = snd_pcm_sw_params(handle, swparams);
+        if (err < 0) {
+            qDebug("Failed to apply sw params: %s\n", snd_strerror(err));
+            snd_pcm_close(handle);
+            handle = NULL;
+            return false;
+        }
+
+	    timerId = startTimer(period_time / 2000);
 	}
 	return TRUE;
     }
 
     void closeDevice()
     {
-	if ( fd >= 0 ) {
-	    ::close(fd);
-	    fd = -1;
+	if ( handle ) {
+        snd_pcm_drain(handle);
+        snd_pcm_close(handle);
+        handle = NULL;
 	}
     }
 
@@ -1175,12 +1249,12 @@ private:
 	int soundId;
     };
     QValueList<CompletedInfo> completed;
-
-    int fd;
+    snd_pcm_t *handle;
+    snd_pcm_uframes_t buffer_size;
+    snd_pcm_uframes_t period_size;
     int unwritten;
     char* cursor;
     short data[sound_buffer_size*2];
-    bool can_GETOSPACE;
 #ifndef QT_NO_SOUNDSERVER
     QWSSoundServerSocket *server;
 #endif
-- 
1.9.3