changeset 525:6e332a32d2f5 trunk

[svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
author giacomo
date Fri, 27 Jan 2006 12:00:13 -0800
parents 2d0c099a1e85
children c41406418769
files Plugins/Input/amidi-plug/amidi-plug.c Plugins/Input/amidi-plug/i_configure.c Plugins/Input/amidi-plug/i_configure.h
diffstat 3 files changed, 10 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/amidi-plug/amidi-plug.c	Thu Jan 26 23:22:49 2006 -0800
+++ b/Plugins/Input/amidi-plug/amidi-plug.c	Fri Jan 27 12:00:13 2006 -0800
@@ -72,12 +72,10 @@
 
 static void amidiplug_init( void )
 {
-  gchar * alsaversion;
   g_log_set_handler(NULL , G_LOG_LEVEL_WARNING , g_log_default_handler , NULL);
   DEBUGMSG( "init, read configuration\n" );
   /* read configuration */
-  alsaversion = (gchar *)snd_asoundlib_version(); /* get ALSA-lib version */
-  i_configure_cfg_read( alsaversion );
+  i_configure_cfg_read();
   amidiplug_playing_status = AMIDIPLUG_STOP;
 }
 
--- a/Plugins/Input/amidi-plug/i_configure.c	Thu Jan 26 23:22:49 2006 -0800
+++ b/Plugins/Input/amidi-plug/i_configure.c	Fri Jan 27 12:00:13 2006 -0800
@@ -24,7 +24,7 @@
 /* internals */
 void i_configure_upd_portlist( void );
 void i_configure_upd_mixercardlist( void );
-gchar * i_configure_read_seq_ports_default( gchar * );
+gchar * i_configure_read_seq_ports_default( void );
 gboolean i_configure_ev_checktoggle( GtkTreeModel * , GtkTreePath * , GtkTreeIter * , gpointer );
 void i_configure_ev_changetoggle( GtkCellRendererToggle * , gchar * , gpointer );
 
@@ -330,10 +330,9 @@
 }
 
 
-gchar * i_configure_read_seq_ports_default( gchar * alsaversion )
+gchar * i_configure_read_seq_ports_default( void )
 {
   FILE * fp = NULL;
-  gchar ** alsaversion_toks = NULL;
   /* first try, get seq ports from proc on card0 */
   fp = fopen( "/proc/asound/card0/wavetableD1" , "rb" );
   if ( fp )
@@ -358,32 +357,13 @@
     fclose( fp );
   }
 
-  /* second try, go with different "possible" defaults depending on ALSA version;
-     this is just a fallback, not expected to work all of the times; expecially
-     considering that the lib version is checked, not the driver one (even if
-     the version number is most likely the same) */
-  alsaversion_toks = g_strsplit( alsaversion , "." , 4 );
-  if ( strtol( alsaversion_toks[0] , NULL , 10 ) < 2 )
-  {
-    if ( strtol( alsaversion_toks[1] , NULL , 10 ) < 1 )
-    {
-      if ( strtol( alsaversion_toks[2] , NULL , 10 ) < 11 )
-      {
-        /* alsa version <= 1.0.10 */
-        g_strfreev( alsaversion_toks );
-        DEBUGMSG( "init, default seq port value tentatively set to 65:0 (ALSA %s)\n" , alsaversion );
-        return g_strdup( "65:0" );
-      }
-    }
-  }
-  /* alsa version > 1.0.10 */
-  g_strfreev( alsaversion_toks );
-  DEBUGMSG( "init, default seq port value tentatively set to 17:0 (ALSA %s)\n" , alsaversion );
-  return g_strdup( "17:0" );
+  /* second option: do not set ports at all, let the user
+     select the right ones in the nice preferences dialog :) */
+  return g_strdup( "" );
 }
 
 
-void i_configure_cfg_read( gchar * alsaversion )
+void i_configure_cfg_read( void )
 {
   ConfigFile *cfgfile;
   cfgfile = xmms_cfg_open_default_file();
@@ -391,7 +371,7 @@
   if (!cfgfile)
   {
     /* use defaults */
-    amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default( alsaversion );
+    amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default();
     amidiplug_cfg.mixer_card_id = 0;
     amidiplug_cfg.mixer_control_name = g_strdup( "Synth" );
     amidiplug_cfg.mixer_control_id = 0;
@@ -399,7 +379,7 @@
   else
   {
     if ( !xmms_cfg_read_string( cfgfile , "amidi-plug" , "writable_ports" , &amidiplug_cfg.seq_writable_ports ) )
-      amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default( alsaversion ); /* default value */
+      amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default(); /* default value */
 
     if ( !xmms_cfg_read_int( cfgfile , "amidi-plug" , "mixer_card_id" , &amidiplug_cfg.mixer_card_id ) )
       amidiplug_cfg.mixer_card_id = 0; /* default value */
--- a/Plugins/Input/amidi-plug/i_configure.h	Thu Jan 26 23:22:49 2006 -0800
+++ b/Plugins/Input/amidi-plug/i_configure.h	Fri Jan 27 12:00:13 2006 -0800
@@ -72,7 +72,7 @@
 void i_configure_ev_bcancel( void );
 void i_configure_ev_bok( void );
 void i_configure_cfg_save( void );
-void i_configure_cfg_read( gchar * );
+void i_configure_cfg_read( void );
 
 
 #endif /* !_I_CONFIGURE_H */