updated on Sat Jan 21 20:03:50 UTC 2012
[aur-mirror.git] / snack / alsa.patch
blobafbd2cf71951a5e84e2f6a66d6385cbb6460d86e
1 --- ../../snack2.2.10.ori/unix/jkAudIO_alsa.c 2005-12-14 12:29:38.000000000 +0100
2 +++ jkAudIO_alsa.c 2008-09-01 22:51:20.000000000 +0200
3 @@ -49,6 +49,8 @@
5 static int minNumChan = 1;
7 +static snd_pcm_uframes_t hw_bufsize = 0;
9 int
10 SnackAudioOpen(ADesc *A, Tcl_Interp *interp, char *device, int mode, int freq,
11 int nchannels, int encoding)
12 @@ -135,6 +137,9 @@
13 Tcl_AppendResult(interp, "Failed setting HW params.", NULL);
14 return TCL_ERROR;
17 + snd_pcm_hw_params_get_buffer_size (hw_params, &hw_bufsize);
19 snd_pcm_hw_params_free(hw_params);
20 snd_pcm_prepare(A->handle);
21 if (A->mode == RECORD) {
22 @@ -202,6 +207,8 @@
23 int i;
24 static char buf[64];
26 + return;
28 if (A->debug > 1) Snack_WriteLog(" Enter SnackAudioPost\n");
30 for (i = 0; i < 1000; i++) {
31 @@ -267,12 +274,14 @@
32 long
33 SnackAudioPlayed(ADesc *A)
35 - long avail = _snd_pcm_mmap_hw_ptr(A->handle);
36 + // FIX Here, _snd_pcm_mmap_hw_ptr is deprecated in new alsalib
37 + long played = A->nWritten - (hw_bufsize - SnackAudioWriteable(A));
38 + // long avail = _snd_pcm_mmap_hw_ptr(A->handle);
40 - if (avail < 0)
41 - avail = 0;
42 + if (played < 0)
43 + return 0;
45 - return (avail+A->nPlayed);
46 + return (played);
49 void