Line
Link Here
|
0 |
-- unix/jkAudIO_alsa.c 2005-12-14 12:29:38.000000000 +0100 |
0 |
++ unix/jkAudIO_alsa.c 2008-09-01 22:51:20.000000000 +0200 |
Lines 49-54
Link Here
|
49 |
|
49 |
|
50 |
static int minNumChan = 1; |
50 |
static int minNumChan = 1; |
51 |
|
51 |
|
|
|
52 |
static snd_pcm_uframes_t hw_bufsize = 0; |
53 |
|
52 |
int |
54 |
int |
53 |
SnackAudioOpen(ADesc *A, Tcl_Interp *interp, char *device, int mode, int freq, |
55 |
SnackAudioOpen(ADesc *A, Tcl_Interp *interp, char *device, int mode, int freq, |
54 |
int nchannels, int encoding) |
56 |
int nchannels, int encoding) |
Lines 135-140
Link Here
|
135 |
Tcl_AppendResult(interp, "Failed setting HW params.", NULL); |
137 |
Tcl_AppendResult(interp, "Failed setting HW params.", NULL); |
136 |
return TCL_ERROR; |
138 |
return TCL_ERROR; |
137 |
} |
139 |
} |
|
|
140 |
|
141 |
snd_pcm_hw_params_get_buffer_size (hw_params, &hw_bufsize); |
142 |
|
138 |
snd_pcm_hw_params_free(hw_params); |
143 |
snd_pcm_hw_params_free(hw_params); |
139 |
snd_pcm_prepare(A->handle); |
144 |
snd_pcm_prepare(A->handle); |
140 |
if (A->mode == RECORD) { |
145 |
if (A->mode == RECORD) { |
Lines 202-207
Link Here
|
202 |
int i; |
207 |
int i; |
203 |
static char buf[64]; |
208 |
static char buf[64]; |
204 |
|
209 |
|
|
|
210 |
return; |
211 |
|
205 |
if (A->debug > 1) Snack_WriteLog(" Enter SnackAudioPost\n"); |
212 |
if (A->debug > 1) Snack_WriteLog(" Enter SnackAudioPost\n"); |
206 |
|
213 |
|
207 |
for (i = 0; i < 1000; i++) { |
214 |
for (i = 0; i < 1000; i++) { |
Lines 267-278
Link Here
|
267 |
long |
274 |
long |
268 |
SnackAudioPlayed(ADesc *A) |
275 |
SnackAudioPlayed(ADesc *A) |
269 |
{ |
276 |
{ |
270 |
long avail = _snd_pcm_mmap_hw_ptr(A->handle); |
277 |
// FIX Here, _snd_pcm_mmap_hw_ptr is deprecated in new alsalib |
|
|
278 |
long played = A->nWritten - (hw_bufsize - SnackAudioWriteable(A)); |
279 |
// long avail = _snd_pcm_mmap_hw_ptr(A->handle); |
271 |
|
280 |
|
272 |
if (avail < 0) |
281 |
if (played < 0) |
273 |
avail = 0; |
282 |
return 0; |
274 |
|
283 |
|
275 |
return (avail+A->nPlayed); |
284 |
return (played); |
276 |
} |
285 |
} |
277 |
|
286 |
|
278 |
void |
287 |
void |