changeset 995:4f94faa145c1

add alsa support by al3x
author pontscho
date Mon, 04 Jun 2001 17:40:56 +0000
parents 84a887d85203
children a97eb50a2c3b
files libao2/audio_out.c
diffstat 1 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/audio_out.c	Mon Jun 04 16:22:27 2001 +0000
+++ b/libao2/audio_out.c	Mon Jun 04 17:40:56 2001 +0000
@@ -1,4 +1,3 @@
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -6,6 +5,8 @@
 
 #include "audio_out.h"
 
+#include <sys/soundcard.h> /* AFMT_* */
+
 // there are some globals:
 int ao_samplerate=0;
 int ao_channels=0;
@@ -16,9 +17,10 @@
 
 extern ao_functions_t audio_out_oss;
 //extern ao_functions_t audio_out_ossold;
-//extern ao_functions_t audio_out_alsa;
-//extern ao_functions_t audio_out_esd;
 extern ao_functions_t audio_out_null;
+extern ao_functions_t audio_out_alsa5;
+extern ao_functions_t audio_out_alsa9;
+extern ao_functions_t audio_out_esd;
 #ifdef HAVE_SDL
 extern ao_functions_t audio_out_sdl;
 #endif
@@ -27,9 +29,31 @@
 {
         &audio_out_oss,
         &audio_out_null,
+	&audio_out_alsa5,
+//	&audio_out_alsa9,
+//	&audio_out_esd,
 #ifdef HAVE_SDL
         &audio_out_sdl,
 #endif
 	NULL
 };
 
+char *audio_out_format_name(int format)
+{
+    switch (format)
+    {
+	case AFMT_S8:
+	    return("signed 8-bit");
+	case AFMT_U8:
+	    return("unsigned 8-bit");
+	case AFMT_U16_LE:
+	    return("unsigned 16-bit (little-endian)");
+	case AFMT_U16_BE: 
+	    return("unsigned 16-bit (big-endian)");
+	case AFMT_S16_LE:
+	    return("signed 16-bit (little-endian)");
+	case AFMT_S16_BE:
+	    return("unsigned 16-bit (big-endian)");
+    }
+    return("unknown");
+}