just a little alsa fix

Ed Sweetman <[email protected]> Fri, 20 Sep 2002 21:29:01 -0400
Newsgroups gmane.comp.audio.zinf.user
Message-ID <[email protected]>
This allows the alsa device to be configurable instead of hardcoded.

it has been commited to the cvs.
alsa_fix_beta.patch (text/plain, 2.6 KB)
diff -Naur -x '*.dlf' -x '*.plf' -x '*.ftf' -x '*.mdf' -x '*.pmi' -x '*.ui' -x '*.lmc' -x '*.pmo' -x '*.a' -x '*.asm1' -x '*.doh' -x '*.m4' -x Makefile-plugins -x '*.la' -x '*.lo' -x Makefile.header -x Makefile.towav -x Makefile -x '*.cache' -x '*.log' -x configure -x config.status -x config.h -x '*.o' -x corba -x CVS ./zinf/io/alsa/unix/linux/src/alsapmo.cpp ./workingdir/io/alsa/unix/linux/src/alsapmo.cpp
--- ./zinf/io/alsa/unix/linux/src/alsapmo.cpp	2002-08-06 09:40:14.000000000 -0400
+++ ./workingdir/io/alsa/unix/linux/src/alsapmo.cpp	2002-09-20 21:19:00.000000000 -0400
@@ -41,6 +41,7 @@
 
 /* project headers */
 #include <config.h>
+#include "preferences.h"
 #include "alsapmo.h"
 #include "facontext.h"
 #include "log.h"
@@ -199,15 +200,22 @@
 Error AlsaPMO::Init(OutputInfo* info) 
 {
     int                  err;
+    uint32 		prefsize = 20;
     snd_pcm_hw_params_t *params;
     snd_pcm_sw_params_t *sw_params;
+    char *m_adev = (char*)malloc(sizeof(char)*20);
+    string alsa_dev;
     
     m_properlyInitialized = false;
     m_iDataSize = info->max_buffer_size;
-    err=snd_pcm_open(&m_handle, "plughw:0,0", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); 
+    m_context->prefs->GetPrefString(kALSADevicePref, m_adev, &prefsize);
+    alsa_dev = (string)"plughw:" + (string)m_adev;
+    err=snd_pcm_open(&m_handle, alsa_dev.c_str() , SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); 
+    free(m_adev);
     if (err < 0){
         ReportError("Audio device is busy. Please make sure that "
                     "another program is not using the device.");
+	m_bExit=1;
         return (Error)pmoError_DeviceOpenFailed;
     }
     m_channels=info->number_of_channels;
diff -Naur -x '*.dlf' -x '*.plf' -x '*.ftf' -x '*.mdf' -x '*.pmi' -x '*.ui' -x '*.lmc' -x '*.pmo' -x '*.a' -x '*.asm1' -x '*.doh' -x '*.m4' -x Makefile-plugins -x '*.la' -x '*.lo' -x Makefile.header -x Makefile.towav -x Makefile -x '*.cache' -x '*.log' -x configure -x config.status -x config.h -x '*.o' -x corba -x CVS ./zinf/ui/zinf/unix/src/GTKPreferenceWindow.cpp ./workingdir/ui/zinf/unix/src/GTKPreferenceWindow.cpp
--- ./zinf/ui/zinf/unix/src/GTKPreferenceWindow.cpp	2002-08-06 04:08:35.000000000 -0400
+++ ./workingdir/ui/zinf/unix/src/GTKPreferenceWindow.cpp	2002-09-20 21:14:42.000000000 -0400
@@ -1304,7 +1304,7 @@
     char *one = gtk_entry_get_text(GTK_ENTRY(alsaOneBox));
     char *two = gtk_entry_get_text(GTK_ENTRY(alsaTwoBox));
 
-    proposedValues.alsaOutput = string(one) + string(":") + string(two);
+    proposedValues.alsaOutput = string(one) + string(",") + string(two);
     gtk_widget_set_sensitive(applyButton, TRUE);
 }