--- src/linux/snd_alsa.c	2005-01-03 13:33:43.120714240 +0000
+++ src/linux/snd_alsa.c	2005-01-03 13:42:26.266184040 +0000
@@ -26,9 +26,9 @@
 
 #include "../client/client.h"
 #include "../client/snd_loc.h"
-#define snd_buf (dma.samples * 2)
 
-static int  snd_inited;
+static int snd_buf;
+static int snd_inited;
 static short *buffer;
 
 static snd_pcm_t *playback_handle;
@@ -45,7 +45,7 @@
 {
   int i;
   int err;
-  int buffersize;
+  snd_pcm_uframes_t buffersize;
   int framesize;
   int format;
 
@@ -156,8 +156,13 @@
     return 0;
   }
 
-  buffer_size = snd_pcm_hw_params_get_buffer_size(hw_params);
-  frame_size = (snd_pcm_format_physical_width(format)*dma.channels)/8;
+  err = snd_pcm_hw_params_get_buffer_size(hw_params, &buffersize);
+  if (err < 0) {
+    Com_Printf("ALSA snd error couldn't get buffer size (%s).\n",snd_strerror(err));
+    snd_pcm_hw_params_free(hw_params);
+    return 0;
+  }
+  framesize = (snd_pcm_format_physical_width(format)*dma.channels)/8;
   
   snd_pcm_hw_params_free(hw_params);
   hw_params = NULL;
@@ -167,7 +172,7 @@
     return 0;
   }
   
-  snd_buf = buffer_size*frame_size;
+  snd_buf = buffersize*framesize;
   
 
   buffer=malloc(snd_buf);


