Enlightenment CVS committal

Author  : raster
Project : e_modules
Module  : echo

Dir     : e_modules/echo/src


Modified Files:
        e_mod_alsa.c e_mod_config.c e_mod_main.c 


Log Message:


make it actually recognise my cards - use the old method the old mixer used.
also fix segv.

===================================================================
RCS file: /cvs/e/e_modules/echo/src/e_mod_alsa.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_alsa.c        11 Jan 2008 02:19:03 -0000      1.2
+++ e_mod_alsa.c        14 Jan 2008 09:31:29 -0000      1.3
@@ -35,6 +35,36 @@
 e_mod_alsa_get_cards(void) 
 {
    Evas_List *cards = NULL;
+#if 1
+   int i, err;
+   char buf[256];
+   snd_ctl_t *control;
+   snd_ctl_card_info_t *hw_info;
+   
+   snd_ctl_card_info_alloca(&hw_info);
+   for (i = 0; i < 32; i++)
+     {
+       char *name;
+       
+       snprintf(buf, sizeof(buf), "hw:%d", i);
+       if ((err = snd_ctl_open(&control, buf, 0)) < 0) break;
+       if ((err = snd_ctl_card_info(control, hw_info)) < 0)
+         {
+            printf("Cannot get hardware info: %s: %s\n", buf,
+                   snd_strerror(err));
+            snd_ctl_close(control);
+            continue;
+         }
+       snd_ctl_close(control);
+       name = snd_ctl_card_info_get_name(hw_info);
+       if (name)
+         {
+            cards = evas_list_append(cards, evas_stringshare_add(name));
+         }
+     }
+   
+#else
+   /* doesnt seem to work for 2 cards for me? */
    int i = -1, err = -1;
 
    err = snd_card_next(&i);
@@ -48,6 +78,7 @@
         i++;
         err = snd_card_next(&i);
      }
+#endif   
    return cards;
 }
 
===================================================================
RCS file: /cvs/e/e_modules/echo/src/e_mod_config.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_config.c      10 Jan 2008 20:32:37 -0000      1.2
+++ e_mod_config.c      14 Jan 2008 09:31:29 -0000      1.3
@@ -69,7 +69,7 @@
 {
    Evas_Object *o = NULL, *of = NULL;
    Evas_Object *ow = NULL;
-   Evas_List *l = NULL;
+   Evas_List *l = NULL, *list;
    E_Radio_Group *rg;
    int i = 0;
 
@@ -81,14 +81,18 @@
 
    of = e_widget_framelist_add(evas, D_("Sound Cards"), 0);
    rg = e_widget_radio_group_new(&(cfdata->card));
-   for (i = 0, l = echo_sys->get_cards(); l; l = l->next, i++) 
+   list = echo_sys->get_cards();
+   for (i = 0, l = list; l; l = l->next, i++) 
      {
         char *name = NULL;
 
-        if (!(name = l->data)) continue;
+       name = l->data;
+        if (!name) continue;
         ow = e_widget_radio_add(evas, name, i, rg);
         e_widget_framelist_object_append(of, ow);
+       evas_stringshare_del(name);
      }
+   if (list) evas_list_free(list);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
    of = e_widget_frametable_add(evas, D_("Channels"), 0);
===================================================================
RCS file: /cvs/e/e_modules/echo/src/e_mod_main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_main.c        11 Jan 2008 02:25:02 -0000      1.8
+++ e_mod_main.c        14 Jan 2008 09:31:29 -0000      1.9
@@ -350,11 +350,17 @@
    echo_cfg->card.id = 0;
    echo_cfg->channel.id = 0;
    echo_cfg->channel.name = NULL;
-   if (e_mod_system_init(0))
+   if (e_mod_system_init(echo_cfg->card.id))
      {
+       char *name = NULL;
+       
         if (echo_sys->get_channel_name)
-          echo_cfg->channel.name = 
-          evas_stringshare_add(echo_sys->get_channel_name(0));
+         name = echo_sys->get_channel_name(echo_cfg->card.id);
+       if (name)
+         {
+            echo_cfg->channel.name = evas_stringshare_add(name);
+            free(name);
+         }
         e_mod_system_shutdown();
      }
    IFMODCFGEND;



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to