Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > 3ab06ffdfdff3c95229bc205c126753b > files > 2

snack-2.2.10-26.mga9.src.rpm

https://build.opensuse.org/package/view_file/openSUSE:Factory/snack/snack-alsa.patch

Index: unix/jkAudIO_alsa.c
===================================================================
--- unix/jkAudIO_alsa.c.orig
+++ unix/jkAudIO_alsa.c
@@ -49,6 +49,8 @@ static int littleEndian = 0;
 
 static int minNumChan = 1;
 
+static snd_pcm_uframes_t hw_bufsize = 0;
+
 int
 SnackAudioOpen(ADesc *A, Tcl_Interp *interp, char *device, int mode, int freq,
 	       int nchannels, int encoding)
@@ -135,6 +137,9 @@ SnackAudioOpen(ADesc *A, Tcl_Interp *int
     Tcl_AppendResult(interp, "Failed setting HW params.", NULL);
     return TCL_ERROR;
   }
+
+  snd_pcm_hw_params_get_buffer_size (hw_params, &hw_bufsize);
+
   snd_pcm_hw_params_free(hw_params);
   snd_pcm_prepare(A->handle);
   if (A->mode == RECORD) {
@@ -202,6 +207,8 @@ SnackAudioPost(ADesc *A)
   int i;
   static char buf[64];
 
+  return;
+      
   if (A->debug > 1) Snack_WriteLog("  Enter SnackAudioPost\n");
 
   for (i = 0; i < 1000; i++) {
@@ -267,12 +274,14 @@ SnackAudioWriteable(ADesc *A)
 long
 SnackAudioPlayed(ADesc *A)
 {
-  long avail = _snd_pcm_mmap_hw_ptr(A->handle);
+  // FIX Here, _snd_pcm_mmap_hw_ptr is deprecated in new alsalib
+  long played = A->nWritten - (hw_bufsize - SnackAudioWriteable(A));
+  // long avail = _snd_pcm_mmap_hw_ptr(A->handle);
   
-  if (avail < 0)
-    avail = 0;
+  if (played < 0)
+   return 0;
 
-  return (avail+A->nPlayed);
+  return (played);
 }
 
 void