Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c alert.c areas.c arrange.c borders.c comms.c 
        config.c events.c focus.c globals.c gnome.c groups.c iconify.c 
        ipc.c lists.c main.c pager.c session.c settings.c sound.c 
        sticky.c 


Log Message:
Trivial sound cleanups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -3 -r1.169 -r1.170
--- E.h 3 Jan 2004 12:21:51 -0000       1.169
+++ E.h 3 Jan 2004 12:29:57 -0000       1.170
@@ -218,15 +218,6 @@
   AssignRestartText(c); \
   AssignExitText(d);
 
-/************************************************************************/
-/* sound macro convenience funcs                                        */
-/************************************************************************/
-
-#define AUDIO_PLAY(sclass) \
-ApplySclass(FindItem((sclass), 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
-
-/************************************************************************/
-
 #ifndef HAVE_GETCWD
 #error "ERROR: Enlightenment needs a system with getcwd() in it's libs."
 #error "You may have to upgrade your Operating system, Distribution, base"
@@ -637,6 +628,7 @@
 typedef struct _group Group;
 typedef struct _button Button;
 typedef struct _buttoncontainer Container;
+typedef struct _soundclass SoundClass;
 
 typedef struct _efont Efont;
 
@@ -1159,26 +1151,6 @@
 }
 Desktops;
 
-typedef struct _sample
-{
-   char               *file;
-   int                 rate;
-   int                 format;
-   int                 samples;
-   unsigned char      *data;
-   int                 id;
-}
-Sample;
-
-typedef struct _soundclass
-{
-   char               *name;
-   char               *file;
-   Sample             *sample;
-   unsigned int        ref_count;
-}
-SoundClass;
-
 typedef struct _windowmatch
 {
    char               *name;
@@ -1648,10 +1620,10 @@
 void                EdgeHandleMotion(XEvent * ev);
 
 /* lists.c functions */
-void               *FindItem(char *name, int id, int find_by, int type);
-void                AddItem(void *item, char *name, int id, int type);
-void                AddItemEnd(void *item, char *name, int id, int type);
-void               *RemoveItem(char *name, int id, int find_by, int type);
+void               *FindItem(const char *name, int id, int find_by, int type);
+void                AddItem(void *item, const char *name, int id, int type);
+void                AddItemEnd(void *item, const char *name, int id, int type);
+void               *RemoveItem(const char *name, int id, int find_by, int type);
 void               *RemoveItemByPtr(void *ptritem, int type);
 void              **ListItemType(int *num, int type);
 char              **ListItems(int *num, int type);
@@ -2255,14 +2227,12 @@
 void                HintsSetRootInfo(Window win, Pixmap pmap, int color);
 
 /* sound.c functions */
-Sample             *LoadWav(char *file);
-void                SoundPlay(Sample * s);
-void                DestroySample(Sample * s);
-void                DestroySclass(SoundClass * sclass);
-SoundClass         *CreateSoundClass(char *name, char *file);
-void                ApplySclass(SoundClass * sclass);
+SoundClass         *SclassCreate(const char *name, const char *file);
+const char         *SclassGetName(SoundClass * sclass);
 void                SoundInit(void);
 void                SoundExit(void);
+int                 SoundPlay(const char *name);
+int                 SoundFree(const char *name);
 
 /* regex.c functions */
 int                 matchregexp(const char *rx, const char *s);
@@ -2852,7 +2822,6 @@
 extern Window       init_win_ext;
 extern Window       bpress_win;
 extern int          deskorder[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
-extern int          sound_fd;
 
 #define FILEPATH_LEN_MAX 4096
 extern char         themepath[FILEPATH_LEN_MAX];
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- actions.c   3 Jan 2004 12:21:51 -0000       1.123
+++ actions.c   3 Jan 2004 12:29:57 -0000       1.124
@@ -564,22 +564,22 @@
    sscanf((char *)params, "%1000s %1000s", s, s2);
    if (!strcmp(s, "deskmenu"))
      {
-       AUDIO_PLAY("SOUND_MENU_SHOW");
+       SoundPlay("SOUND_MENU_SHOW");
        ShowDeskMenu();
      }
    else if (!strcmp(s, "taskmenu"))
      {
-       AUDIO_PLAY("SOUND_MENU_SHOW");
+       SoundPlay("SOUND_MENU_SHOW");
        ShowAllTaskMenu();
      }
    else if (!strcmp(s, "groupmenu"))
      {
-       AUDIO_PLAY("SOUND_MENU_SHOW");
+       SoundPlay("SOUND_MENU_SHOW");
        ShowGroupMenu();
      }
    else if (!strcmp(s, "named"))
      {
-       AUDIO_PLAY("SOUND_MENU_SHOW");
+       SoundPlay("SOUND_MENU_SHOW");
        ShowNamedMenu(s2);
      }
 
@@ -874,7 +874,7 @@
        GrabX();
      }
    queue_up = 0;
-   AUDIO_PLAY("SOUND_RESIZE_START");
+   SoundPlay("SOUND_RESIZE_START");
    UnGrabTheButtons();
    GrabConfineThePointer(root.win);
    mode.mode = MODE_RESIZE;
@@ -929,7 +929,7 @@
        GrabX();
      }
    queue_up = 0;
-   AUDIO_PLAY("SOUND_RESIZE_START");
+   SoundPlay("SOUND_RESIZE_START");
    UnGrabTheButtons();
    GrabConfineThePointer(root.win);
    mode.mode = MODE_RESIZE_H;
@@ -978,7 +978,7 @@
        GrabX();
      }
    queue_up = 0;
-   AUDIO_PLAY("SOUND_RESIZE_START");
+   SoundPlay("SOUND_RESIZE_START");
    UnGrabTheButtons();
    GrabConfineThePointer(root.win);
    mode.mode = MODE_RESIZE_V;
@@ -1011,7 +1011,7 @@
    EDBUG(0, "doResizeEnd");
    ewin = GetFocusEwin();
    UnGrabTheButtons();
-   AUDIO_PLAY("SOUND_RESIZE_STOP");
+   SoundPlay("SOUND_RESIZE_STOP");
    if (!ewin)
      {
        if (mode.resizemode > 0)
@@ -1080,7 +1080,7 @@
      }
    UnGrabTheButtons();
    GrabConfineThePointer(root.win);
-   AUDIO_PLAY("SOUND_MOVE_START");
+   SoundPlay("SOUND_MOVE_START");
    mode.mode = MODE_MOVE;
    mode.constrained = constrained;
    mode.start_x = mode.x;
@@ -1153,7 +1153,7 @@
    EDBUG(6, "doMoveEnd");
    ewin = GetFocusEwin();
    UnGrabTheButtons();
-   AUDIO_PLAY("SOUND_MOVE_STOP");
+   SoundPlay("SOUND_MOVE_STOP");
    if (!ewin)
      {
        if (mode.movemode > 0)
@@ -1258,7 +1258,7 @@
    if (!ewin)
       EDBUG_RETURN(0);
 
-   AUDIO_PLAY("SOUND_RAISE");
+   SoundPlay("SOUND_RAISE");
 
    gwins = ListWinGroupMembersForEwin(ewin, ACTION_RAISE, mode.nogroup, &num);
    for (i = 0; i < num; i++)
@@ -1298,7 +1298,7 @@
    if (!ewin)
       EDBUG_RETURN(0);
 
-   AUDIO_PLAY("SOUND_LOWER");
+   SoundPlay("SOUND_LOWER");
 
    gwins = ListWinGroupMembersForEwin(ewin, ACTION_LOWER, mode.nogroup, &num);
    for (i = 0; i < num; i++)
@@ -1547,7 +1547,7 @@
    if (!ewin)
       EDBUG_RETURN(0);
 
-   AUDIO_PLAY("SOUND_WINDOW_CLOSE");
+   SoundPlay("SOUND_WINDOW_CLOSE");
    EDestroyWindow(disp, ewin->client.win);
    EDBUG_RETURN(0);
 }
@@ -1569,7 +1569,7 @@
    GotoDesktop(nd);
 
    if (desks.current != pd)
-      AUDIO_PLAY("SOUND_DESKTOP_SHUT");
+      SoundPlay("SOUND_DESKTOP_SHUT");
 
    EDBUG_RETURN(0);
 }
@@ -1591,7 +1591,7 @@
    GotoDesktop(nd);
 
    if (desks.current != pd)
-      AUDIO_PLAY("SOUND_DESKTOP_SHUT");
+      SoundPlay("SOUND_DESKTOP_SHUT");
 
    EDBUG_RETURN(0);
 }
@@ -1613,7 +1613,7 @@
       d = desks.current;
    else
       d = atoi((char *)params);
-   AUDIO_PLAY("SOUND_DESKTOP_RAISE");
+   SoundPlay("SOUND_DESKTOP_RAISE");
    RaiseDesktop(d);
    EDBUG_RETURN(0);
 }
@@ -1635,7 +1635,7 @@
       d = desks.current;
    else
       d = atoi((char *)params);
-   AUDIO_PLAY("SOUND_DESKTOP_LOWER");
+   SoundPlay("SOUND_DESKTOP_LOWER");
    LowerDesktop(d);
    EDBUG_RETURN(0);
 }
@@ -1877,7 +1877,7 @@
    GotoDesktop(d);
    if (desks.current != pd)
      {
-       AUDIO_PLAY("SOUND_DESKTOP_SHUT");
+       SoundPlay("SOUND_DESKTOP_SHUT");
      }
    EDBUG_RETURN(0);
 }
@@ -2077,8 +2077,6 @@
 int
 doSoundSet(void *params)
 {
-   SoundClass        **lst;
-   int                 num, i;
    char                snd;
 
    EDBUG(6, "doSoundSet");
@@ -2094,24 +2092,10 @@
      }
    if (mode.sound != snd)
      {
-       if (!mode.sound)
-         {
-            lst = (SoundClass **) ListItemType(&num, LIST_TYPE_SCLASS);
-            if (lst)
-              {
-                 for (i = 0; i < num; i++)
-                   {
-                      if (lst[i]->sample)
-                         DestroySample(lst[i]->sample);
-                      lst[i]->sample = NULL;
-                   }
-                 Efree(lst);
-              }
-            close(sound_fd);
-            sound_fd = -1;
-         }
-       else
+       if (mode.sound)
           SoundInit();
+       else
+          SoundExit();
      }
    autosave();
    EDBUG_RETURN(0);
@@ -2316,7 +2300,7 @@
    if (!params)
       EDBUG_RETURN(0);
 
-   ApplySclass(FindItem((char *)params, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay((char *)params);
 
    EDBUG_RETURN(0);
 }
@@ -2335,7 +2319,7 @@
 
    sscanf((char *)params, "%i", &d);
    GotoDesktop(d);
-   AUDIO_PLAY("SOUND_DESKTOP_SHUT");
+   SoundPlay("SOUND_DESKTOP_SHUT");
    EDBUG_RETURN(0);
 }
 
@@ -2569,7 +2553,7 @@
    s = FindItem((char *)params, 0, LIST_FINDBY_NAME, LIST_TYPE_SLIDEOUT);
    if (s)
      {
-       AUDIO_PLAY("SOUND_SLIDEOUT_SHOW");
+       SoundPlay("SOUND_SLIDEOUT_SHOW");
        ShowSlideout(s, mode.context_win);
        s->ref_count++;
      }
@@ -2640,13 +2624,13 @@
        if (gwins[i]->shaded
            && ((curr_group && !curr_group->cfg.mirror) || shaded))
          {
-            AUDIO_PLAY("SOUND_UNSHADE");
+            SoundPlay("SOUND_UNSHADE");
             UnShadeEwin(gwins[i]);
          }
        else if (!gwins[i]->shaded
                 && ((curr_group && !curr_group->cfg.mirror) || !shaded))
          {
-            AUDIO_PLAY("SOUND_SHADE");
+            SoundPlay("SOUND_SHADE");
             ShadeEwin(gwins[i]);
          }
        params = NULL;
@@ -3001,11 +2985,11 @@
    l = atoi((char *)params);
    if (ewin->layer > l)
      {
-       AUDIO_PLAY("SOUND_WINDOW_CHANGE_LAYER_DOWN");
+       SoundPlay("SOUND_WINDOW_CHANGE_LAYER_DOWN");
      }
    else if (ewin->layer < l)
      {
-       AUDIO_PLAY("SOUND_WINDOW_CHANGE_LAYER_UP");
+       SoundPlay("SOUND_WINDOW_CHANGE_LAYER_UP");
      }
    ewin->layer = l;
    RaiseEwin(ewin);
@@ -3121,7 +3105,7 @@
      {
        if (b != gwins[i]->border)
          {
-            AUDIO_PLAY("SOUND_WINDOW_BORDER_CHANGE");
+            SoundPlay("SOUND_WINDOW_BORDER_CHANGE");
             shadechange = 0;
             if (gwins[i]->shaded)
               {
@@ -3522,7 +3506,7 @@
        XGetInputFocus(disp, &win, &rev);
        if (win)
          {
-            AUDIO_PLAY("SOUND_INSERT_KEYS");
+            SoundPlay("SOUND_INSERT_KEYS");
             ev.window = win;
             for (i = 0; i < (int)strlen(s); i++)
               {
@@ -3565,7 +3549,7 @@
      {
        Iconbox            *ib;
 
-       AUDIO_PLAY("SOUND_NEW_ICONBOX");
+       SoundPlay("SOUND_NEW_ICONBOX");
        ib = IconboxCreate(params);
        IconboxShow(ib);
      }
@@ -3579,7 +3563,7 @@
        if (ibl)
           Efree(ibl);
        Esnprintf(s, sizeof(s), "_IB_%i", num);
-       AUDIO_PLAY("SOUND_NEW_ICONBOX");
+       SoundPlay("SOUND_NEW_ICONBOX");
        ib = IconboxCreate(s);
        IconboxShow(ib);
      }
@@ -3648,13 +3632,13 @@
 
    if (!raise)
      {
-       AUDIO_PLAY("SOUND_LOWER");
+       SoundPlay("SOUND_LOWER");
        for (j = 0; j < num; j++)
           LowerEwin(gwins[j]);
      }
    else
      {
-       AUDIO_PLAY("SOUND_RAISE");
+       SoundPlay("SOUND_RAISE");
        for (j = 0; j < num; j++)
           RaiseEwin(gwins[j]);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/alert.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- alert.c     15 Nov 2003 22:27:16 -0000      1.25
+++ alert.c     3 Jan 2004 12:29:57 -0000       1.26
@@ -49,7 +49,7 @@
    va_start(ap, fmt);
    Evsnprintf(text, 10240, fmt, ap);
    va_end(ap);
-   AUDIO_PLAY("SOUND_ALERT");
+   SoundPlay("SOUND_ALERT");
    ShowAlert(text);
 
    EDBUG_RETURN_;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- areas.c     9 Nov 2003 23:17:14 -0000       1.53
+++ areas.c     3 Jan 2004 12:29:57 -0000       1.54
@@ -258,19 +258,19 @@
    dy = ay - desks.desk[desks.current].current_area_y;
    if (dx < 0)
      {
-       AUDIO_PLAY("SOUND_MOVE_AREA_LEFT");
+       SoundPlay("SOUND_MOVE_AREA_LEFT");
      }
    else if (dx > 0)
      {
-       AUDIO_PLAY("SOUND_MOVE_AREA_RIGHT");
+       SoundPlay("SOUND_MOVE_AREA_RIGHT");
      }
    else if (dy < 0)
      {
-       AUDIO_PLAY("SOUND_MOVE_AREA_UP");
+       SoundPlay("SOUND_MOVE_AREA_UP");
      }
    else if (dy > 0)
      {
-       AUDIO_PLAY("SOUND_MOVE_AREA_DOWN");
+       SoundPlay("SOUND_MOVE_AREA_DOWN");
      }
 
    /* if we're in move mode....  and its non opaque undraw our boxes */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/arrange.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- arrange.c   7 Dec 2003 09:18:55 -0000       1.58
+++ arrange.c   3 Jan 2004 12:29:57 -0000       1.59
@@ -771,7 +771,7 @@
      {
        if (!last_res)
          {
-            /* AUDIO_PLAY("SOUND_MOVE_RESIST"); */
+            /* SoundPlay("SOUND_MOVE_RESIST"); */
             last_res = 1;
          }
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- borders.c   3 Jan 2004 12:21:51 -0000       1.116
+++ borders.c   3 Jan 2004 12:29:58 -0000       1.117
@@ -51,7 +51,7 @@
             for (j = 0; j < num_groups; j++)
                RemoveEwinFromGroup(gwins[i], gwins[i]->groups[0]);
             ICCCM_Delete(gwins[i]);
-            AUDIO_PLAY("SOUND_WINDOW_CLOSE");
+            SoundPlay("SOUND_WINDOW_CLOSE");
          }
        Efree(gwins);
      }
@@ -217,8 +217,7 @@
    min = 2;
    firstlast = 0;
    mode.doingslide = 1;
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_SLIDE", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_SLIDE");
 
    if (mode.slidemode > 0)
       GrabX();
@@ -258,9 +257,7 @@
    mode.doingslide = 0;
    if (mode.slidemode > 0)
       UngrabX();
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_SLIDE_END", 0, LIST_FINDBY_NAME,
-               LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_SLIDE_END");
    EDBUG_RETURN_;
 }
 
@@ -286,8 +283,7 @@
    min = 2;
    firstlast = 0;
    mode.doingslide = 1;
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_SLIDE", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_SLIDE");
    if (mode.slidemode > 0)
       GrabX();
    for (k = 0; k <= 1024; k += spd)
@@ -340,9 +336,7 @@
    mode.doingslide = 0;
    if (mode.slidemode > 0)
       UngrabX();
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_SLIDE_END", 0, LIST_FINDBY_NAME,
-               LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_SLIDE_END");
    if (x)
       Efree(x);
    if (y)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- comms.c     3 Jan 2004 12:21:51 -0000       1.38
+++ comms.c     3 Jan 2004 12:29:58 -0000       1.39
@@ -1267,8 +1267,10 @@
               {
                  word(s, wd, w);
                  mode.sound = atoi(w);
-                 if ((mode.sound) && (sound_fd < 0))
+                 if (mode.sound)
                     SoundInit();
+                 else
+                    SoundExit();
               }
             else if (!strcmp(w, "BUTTONMOVERESISTANCE:"))
               {
@@ -2061,7 +2063,7 @@
                    _("Received Unknown Client Message.\n"
                      "Client Name:    %s\n" "Client Version: %s\n"
                      "Message Contents:\n\n" "%s\n"), s1, s2, s);
-          AUDIO_PLAY("SOUND_ERROR_IPC");
+          SoundPlay("SOUND_ERROR_IPC");
        }
      }
    Efree(s);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- config.c    28 Dec 2003 17:57:30 -0000      1.78
+++ config.c    3 Jan 2004 12:29:58 -0000       1.79
@@ -1035,7 +1035,7 @@
 
                  if (ms)
                    {
-                      AUDIO_PLAY("SOUND_SCANNING");
+                      SoundPlay("SOUND_SCANNING");
                       m = MenuCreateFromDirectory(s2, ms, s5);
                       ms->ref_count++;
                    }
@@ -2061,8 +2061,7 @@
        else if (ret == 2)
          {
             sscanf(s, "%4000s %4000s", s1, s2);
-            sc = CreateSoundClass(s1, s2);
-            AddItem(sc, sc->name, 0, LIST_TYPE_SCLASS);
+            sc = SclassCreate(s1, s2);
          }
      }
    Alert(_
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- events.c    30 Nov 2003 15:35:43 -0000      1.39
+++ events.c    3 Jan 2004 12:29:58 -0000       1.40
@@ -254,8 +254,7 @@
 HButtonPress(XEvent * ev)
 {
    EDBUG(7, "HButtonPress");
-   ApplySclass(FindItem
-              ("SOUND_BUTTON_CLICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_BUTTON_CLICK");
    HandleMouseDown(ev);
 #if 0
    {
@@ -317,8 +316,7 @@
 HButtonRelease(XEvent * ev)
 {
    EDBUG(7, "HButtonRelease");
-   ApplySclass(FindItem
-              ("SOUND_BUTTON_RAISE", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_BUTTON_RAISE");
    HandleMouseUp(ev);
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- focus.c     30 Nov 2003 15:35:43 -0000      1.37
+++ focus.c     3 Jan 2004 12:29:58 -0000       1.38
@@ -322,7 +322,7 @@
      {
        CalcEwinSizes(mode.focuswin);
        DrawEwin(mode.focuswin);
-       AUDIO_PLAY("SOUND_FOCUS_SET");
+       SoundPlay("SOUND_FOCUS_SET");
        ICCCM_Focus(mode.focuswin);
      }
 /*   ReZoom(mode.focuswin); */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/globals.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- globals.c   14 Dec 2003 17:24:34 -0000      1.20
+++ globals.c   3 Jan 2004 12:29:58 -0000       1.21
@@ -58,7 +58,6 @@
 Window              init_win_ext = 0;
 Window              bpress_win = 0;
 int                 deskorder[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
-int                 sound_fd = -1;
 char                themepath[FILEPATH_LEN_MAX];
 char                themename[FILEPATH_LEN_MAX];
 char               *command;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/gnome.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- gnome.c     5 Nov 2003 17:24:43 -0000       1.27
+++ gnome.c     3 Jan 2004 12:29:58 -0000       1.28
@@ -848,9 +848,6 @@
                       ewin->sticky = 1;
                       RaiseEwin(ewin);
                       DrawEwin(ewin);
-                      ApplySclass(FindItem
-                                  ("SOUND_WINDOW_STICK", 0, LIST_FINDBY_NAME,
-                                   LIST_TYPE_SCLASS));
                    }
               }
             else
@@ -860,9 +857,6 @@
                       ewin->sticky = 0;
                       RaiseEwin(ewin);
                       DrawEwin(ewin);
-                      ApplySclass(FindItem
-                                  ("SOUND_WINDOW_UNSTICK", 0, LIST_FINDBY_NAME,
-                                   LIST_TYPE_SCLASS));
                    }
               }
          }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/groups.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- groups.c    3 Jan 2004 12:21:52 -0000       1.47
+++ groups.c    3 Jan 2004 12:29:58 -0000       1.48
@@ -620,10 +620,10 @@
 
    if ((d = FindItem("GROUP_SELECTION", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("GROUP_SETTINGS_ACTIVE");
+       SoundPlay("GROUP_SETTINGS_ACTIVE");
        ShowDialog(d);
      }
-   AUDIO_PLAY("SOUND_SETTINGS_GROUP");
+   SoundPlay("SOUND_SETTINGS_GROUP");
 
    d = DialogCreate("GROUP_SELECTION");
    DialogSetTitle(d, _("Window Group Selection"));
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -3 -r1.79 -r1.80
--- iconify.c   27 Dec 2003 19:20:15 -0000      1.79
+++ iconify.c   3 Jan 2004 12:29:58 -0000       1.80
@@ -217,7 +217,7 @@
    if (!ewin->iconified)
      {
        was_shaded = ewin->shaded;
-       AUDIO_PLAY("SOUND_ICONIFY");
+       SoundPlay("SOUND_ICONIFY");
        if (ib)
          {
             if (ib->animate)
@@ -311,7 +311,7 @@
        else
           MoveEwin(ewin, ewin->x + dx, ewin->y + dy);
 
-       AUDIO_PLAY("SOUND_DEICONIFY");
+       SoundPlay("SOUND_DEICONIFY");
        if (ib)
          {
             if (ib->animate)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -3 -r1.125 -r1.126
--- ipc.c       3 Jan 2004 12:21:52 -0000       1.125
+++ ipc.c       3 Jan 2004 12:29:58 -0000       1.126
@@ -1972,9 +1972,7 @@
                  word(params, 3, param3);
                  if (param3[0])
                    {
-                      sc = CreateSoundClass(param1, param2);
-                      if (sc)
-                         AddItem(sc, sc->name, 0, LIST_TYPE_SCLASS);
+                      sc = SclassCreate(param1, param2);
                    }
                  else
                    {
@@ -1983,9 +1981,7 @@
               }
             else if (!strcmp(param1, "delete"))
               {
-                 DestroySclass(RemoveItem
-                               (param2, 0, LIST_FINDBY_NAME,
-                                LIST_TYPE_SCLASS));
+                 SoundFree((char *)param2);
               }
             else
               {
@@ -2016,12 +2012,7 @@
 
    if (params)
      {
-       SoundClass         *soundtoplay;
-
-       soundtoplay = FindItem(params, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS);
-       if (soundtoplay)
-          ApplySclass(soundtoplay);
-       else
+       if (SoundPlay((char *)params))
           Esnprintf(buf, sizeof(buf), "Error: unknown soundclass selected");
      }
    else
@@ -2093,7 +2084,7 @@
             for (i = 0; i < num; i++)
               {
                  buf2[0] = 0;
-                 Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
+                 Esnprintf(buf2, sizeof(buf2), "%s\n", SclassGetName(lst[i]));
                  if (buf)
                     buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
                  else
@@ -3522,26 +3513,8 @@
               {
                  if (mode.sound)
                    {
-
-                      SoundClass        **lst;
-                      int                 num, i;
-
                       mode.sound = 0;
-
-                      lst =
-                         (SoundClass **) ListItemType(&num, LIST_TYPE_SCLASS);
-                      if (lst)
-                        {
-                           for (i = 0; i < num; i++)
-                             {
-                                if (lst[i]->sample)
-                                   DestroySample(lst[i]->sample);
-                                lst[i]->sample = NULL;
-                             }
-                           Efree(lst);
-                        }
-                      close(sound_fd);
-                      sound_fd = -1;
+                      SoundExit();
                    }
               }
             else if (!strcmp(word2, "?"))
@@ -3831,14 +3804,12 @@
    if (!strncmp(operation, "close", 2))
      {
        ICCCM_Delete(ewin);
-       ApplySclass(FindItem("SOUND_WINDOW_CLOSE", 0, LIST_FINDBY_NAME,
-                            LIST_TYPE_SCLASS));
+       SoundPlay("SOUND_WINDOW_CLOSE");
      }
    else if (!strncmp(operation, "annihiliate", 2))
      {
        EDestroyWindow(disp, ewin->client.win);
-       ApplySclass(FindItem("SOUND_WINDOW_CLOSE", 0, LIST_FINDBY_NAME,
-                            LIST_TYPE_SCLASS));
+       SoundPlay("SOUND_WINDOW_CLOSE");
      }
    else if (!strncmp(operation, "iconify", 2))
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/lists.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- lists.c     5 Nov 2003 17:24:44 -0000       1.9
+++ lists.c     3 Jan 2004 12:29:58 -0000       1.10
@@ -23,7 +23,7 @@
 #include "E.h"
 
 void               *
-FindItem(char *name, int id, int find_by, int type)
+FindItem(const char *name, int id, int find_by, int type)
 {
    List               *ptr;
 
@@ -76,7 +76,7 @@
 }
 
 void
-AddItem(void *item, char *name, int id, int type)
+AddItem(void *item, const char *name, int id, int type)
 {
    List               *ptr;
 
@@ -93,7 +93,7 @@
 }
 
 void
-AddItemEnd(void *item, char *name, int id, int type)
+AddItemEnd(void *item, const char *name, int id, int type)
 {
    List               *ptr, *p;
 
@@ -197,7 +197,7 @@
 }
 
 void               *
-RemoveItem(char *name, int id, int find_by, int type)
+RemoveItem(const char *name, int id, int find_by, int type)
 {
    List               *ptr, *pptr;
    void               *p;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- main.c      7 Dec 2003 09:18:55 -0000       1.65
+++ main.c      3 Jan 2004 12:29:58 -0000       1.66
@@ -256,10 +256,8 @@
    RefreshDesktop(0);
    if (mode.sound)
      {
-       ApplySclass(FindItem("SOUND_STARTUP", 0,
-                            LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
-       DestroySclass(RemoveItem("SOUND_STARTUP", 0,
-                                LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+       SoundPlay("SOUND_STARTUP");
+       SoundFree("SOUND_STARTUP");
      }
    /* toss down the dragbar and related */
    InitDesktopControls();
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- pager.c     21 Dec 2003 12:28:10 -0000      1.53
+++ pager.c     3 Jan 2004 12:29:58 -0000       1.54
@@ -1701,7 +1701,7 @@
        GotoDesktop(p->desktop);
        if (p->desktop != desks.current)
          {
-            AUDIO_PLAY("SOUND_DESKTOP_SHUT");
+            SoundPlay("SOUND_DESKTOP_SHUT");
          }
        SetCurrentArea(pax, pay);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- session.c   3 Jan 2004 12:21:52 -0000       1.46
+++ session.c   3 Jan 2004 12:29:58 -0000       1.47
@@ -539,7 +539,7 @@
          }
        if (!strcmp(s, "restart"))
          {
-            AUDIO_PLAY("SOUND_WAIT");
+            SoundPlay("SOUND_WAIT");
             if (sound_fd >= 0)
                close(sound_fd);
             w = MakeExtInitWin();
@@ -565,7 +565,7 @@
          }
        else if (!strcmp(s, "restart_theme"))
          {
-            AUDIO_PLAY("SOUND_WAIT");
+            SoundPlay("SOUND_WAIT");
             if (sound_fd >= 0)
                close(sound_fd);
             w = MakeExtInitWin();
@@ -580,7 +580,7 @@
          }
        else if (!strcmp(s, "restart_wm"))
          {
-            AUDIO_PLAY("SOUND_EXIT");
+            SoundPlay("SOUND_EXIT");
             if (sound_fd >= 0)
                close(sound_fd);
             XCloseDisplay(disp);
@@ -604,7 +604,7 @@
                  FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME,
                           LIST_TYPE_DIALOG)))
               {
-                 AUDIO_PLAY("SOUND_LOGOUT");
+                 SoundPlay("SOUND_LOGOUT");
                  d = DialogCreate("LOGOUT_DIALOG");
                  DialogSetTitle(d, "Are you sure?");
                  DialogSetText(d,
@@ -626,7 +626,7 @@
          }
      }
 
-   AUDIO_PLAY("SOUND_EXIT");
+   SoundPlay("SOUND_EXIT");
    EExit(0);
 }
 
@@ -904,8 +904,7 @@
 callback_die(SmcConn smc_conn, SmPointer client_data)
 {
    if (master_pid == getpid())
-      ApplySclass(FindItem
-                 ("SOUND_EXIT", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+      SoundPlay("SOUND_EXIT");
    EExit(0);
    smc_conn = 0;
    client_data = NULL;
@@ -1156,7 +1155,7 @@
            (d =
             FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
          {
-            AUDIO_PLAY("SOUND_LOGOUT");
+            SoundPlay("SOUND_LOGOUT");
             d = DialogCreate("LOGOUT_DIALOG");
             DialogSetTitle(d, _("Are you sure?"));
             DialogSetText(d,
@@ -1178,7 +1177,7 @@
      }
    else if (!strcmp(s, "restart_wm"))
      {
-       AUDIO_PLAY("SOUND_WAIT");
+       SoundPlay("SOUND_WAIT");
        XCloseDisplay(disp);
        disp = NULL;
        Esnprintf(s, sizeof(s), "exec %s", atword(params, 2));
@@ -1186,7 +1185,7 @@
      }
    else if (!strcmp(s, "restart"))
      {
-       AUDIO_PLAY("SOUND_WAIT");
+       SoundPlay("SOUND_WAIT");
        if (disp)
           init_win_ext = MakeExtInitWin();
 
@@ -1232,7 +1231,7 @@
      }
    else if (!strcmp((char *)s, "restart_theme"))
      {
-       AUDIO_PLAY("SOUND_WAIT");
+       SoundPlay("SOUND_WAIT");
        init_win_ext = MakeExtInitWin();
        if (atword(params, 1) && strlen((char *)params) < 1024)
          {
@@ -1266,7 +1265,7 @@
 
    restarting = False;
    SaveSession(1);
-   AUDIO_PLAY("SOUND_EXIT");
+   SoundPlay("SOUND_EXIT");
    EExit(0);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- settings.c  3 Jan 2004 12:21:52 -0000       1.84
+++ settings.c  3 Jan 2004 12:29:58 -0000       1.85
@@ -103,11 +103,11 @@
 
    if ((d = FindItem("CONFIGURE_PAGER", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_PAGER");
+   SoundPlay("SOUND_SETTINGS_PAGER");
 
    tmp_show_pagers = mode.show_pagers;
    tmp_pager_hiq = mode.pager_hiq;
@@ -390,11 +390,11 @@
 
    if ((d = FindItem("CONFIGURE_FOCUS", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_FOCUS");
+   SoundPlay("SOUND_SETTINGS_FOCUS");
 
    tmp_focus = mode.focusmode;
    tmp_new_focus = mode.all_new_windows_get_focus;
@@ -788,11 +788,11 @@
        FindItem("CONFIGURE_MOVERESIZE", 0, LIST_FINDBY_NAME,
                 LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_MOVERESIZE");
+   SoundPlay("SOUND_SETTINGS_MOVERESIZE");
 
    tmp_move = mode.movemode;
    tmp_resize = mode.resizemode;
@@ -1109,11 +1109,11 @@
    if ((d =
        FindItem("CONFIGURE_DESKTOPS", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_DESKTOPS");
+   SoundPlay("SOUND_SETTINGS_DESKTOPS");
 
    tmp_desktops = mode.numdesktops;
    tmp_desktop_wraparound = mode.desktop_wraparound;
@@ -1303,11 +1303,11 @@
 
    if ((d = FindItem("CONFIGURE_AREA", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_AREA");
+   SoundPlay("SOUND_SETTINGS_AREA");
 
    tmp_area_wraparound = mode.area_wraparound;
    tmp_edge_resist = mode.edge_flip_resistance;
@@ -1482,11 +1482,11 @@
    if ((d =
        FindItem("CONFIGURE_PLACEMENT", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_PLACEMENT");
+   SoundPlay("SOUND_SETTINGS_PLACEMENT");
 
    tmp_with_leader = mode.transientsfollowleader;
    tmp_switch_popup = mode.switchfortransientmap;
@@ -1617,11 +1617,11 @@
    if ((d =
        FindItem("CONFIGURE_AUTORAISE", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_AUTORAISE");
+   SoundPlay("SOUND_SETTINGS_AUTORAISE");
 
    tmp_autoraise = mode.autoraise;
    tmp_autoraisetime = (int)(mode.autoraisetime * 100);
@@ -1717,11 +1717,11 @@
    if ((d =
        FindItem("CONFIGURE_TOOLTIPS", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_TOOLTIPS");
+   SoundPlay("SOUND_SETTINGS_TOOLTIPS");
 
    tmp_tooltips = mode.tooltips;
    tmp_tooltiptime = (int)(mode.tiptime * 100);
@@ -1821,11 +1821,11 @@
        FindItem("CONFIGURE_MISCELLANEOUS", 0, LIST_FINDBY_NAME,
                 LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_MISCELLANEOUS");
+   SoundPlay("SOUND_SETTINGS_MISCELLANEOUS");
 
    tmp_dialog_headers = mode.dialog_headers;
 
@@ -1887,9 +1887,9 @@
    if (val < 2)
      {
        mode.sound = tmp_audio;
-       if ((mode.sound) && (sound_fd < 0))
+       if (mode.sound)
           SoundInit();
-       else if ((!mode.sound) && (sound_fd >= 0))
+       else
           SoundExit();
      }
    autosave();
@@ -1904,11 +1904,11 @@
 
    if ((d = FindItem("CONFIGURE_AUDIO", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_AUDIO");
+   SoundPlay("SOUND_SETTINGS_AUDIO");
 
    tmp_audio = mode.sound;
 
@@ -2043,11 +2043,11 @@
 
    if ((d = FindItem("CONFIGURE_FX", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_FX");
+   SoundPlay("SOUND_SETTINGS_FX");
 
    tmp_saveunders = mode.save_under;
    tmp_warpmenus = mode.warpmenus;
@@ -2961,7 +2961,7 @@
 {
    int                 slider, lower, upper;
 
-   AUDIO_PLAY("SOUND_WAIT");
+   SoundPlay("SOUND_WAIT");
 
    DialogItemSliderGetBounds(bg_sel_slider, &lower, &upper);
 
@@ -3265,11 +3265,11 @@
 
    if ((d = FindItem("CONFIGURE_BG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_BG");
+   SoundPlay("SOUND_SETTINGS_BG");
 
    if ((!bg) || ((bg) && (!strcmp(bg->name, "NONE"))))
      {
@@ -3742,11 +3742,11 @@
    if ((d =
        FindItem("CONFIGURE_ICONBOX", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_ICONBOX");
+   SoundPlay("SOUND_SETTINGS_ICONBOX");
 
    if (!name)
       return;
@@ -4150,11 +4150,11 @@
      }
    if ((d = FindItem("CONFIGURE_GROUP", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("GROUP_SETTINGS_ACTIVE");
+       SoundPlay("GROUP_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_GROUP");
+   SoundPlay("SOUND_SETTINGS_GROUP");
 
    tmp_ewin = ewin;
    tmp_groups = ewin->groups;
@@ -4362,11 +4362,11 @@
        FindItem("CONFIGURE_DEFAULT_GROUP_CONTROL", 0, LIST_FINDBY_NAME,
                 LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_GROUP");
+   SoundPlay("SOUND_SETTINGS_GROUP");
 
    CopyGroupConfig(&(mode.group_config), &tmp_group_cfg);
    tmp_group_swap = mode.group_swapmove;
@@ -4613,11 +4613,11 @@
    /* init remember window */
    if ((d = FindItem("REMEMBER_WINDOW", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
      {
-       AUDIO_PLAY("SOUND_SETTINGS_ACTIVE");
+       SoundPlay("SOUND_SETTINGS_ACTIVE");
        ShowDialog(d);
        return;
      }
-   AUDIO_PLAY("SOUND_SETTINGS_REMEMBER");
+   SoundPlay("SOUND_SETTINGS_REMEMBER");
 
    d = DialogCreate("REMEMBER_WINDOW");
    DialogSetTitle(d, _("Remembered Windows Settings"));
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/sound.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- sound.c     3 Jan 2004 12:21:52 -0000       1.17
+++ sound.c     3 Jan 2004 12:29:58 -0000       1.18
@@ -32,7 +32,27 @@
 #endif
 #endif
 
-Sample             *
+typedef struct
+{
+   char               *file;
+   int                 rate;
+   int                 format;
+   int                 samples;
+   unsigned char      *data;
+   int                 id;
+} Sample;
+
+struct _soundclass
+{
+   char               *name;
+   char               *file;
+   Sample             *sample;
+   unsigned int        ref_count;
+};
+
+static int          sound_fd = -1;
+
+static Sample      *
 LoadWav(char *file)
 {
 #ifdef HAVE_LIBESD
@@ -110,15 +130,14 @@
 #endif
 }
 
-void
-SoundPlay(Sample * s)
+static void
+SamplePlay(Sample * s)
 {
 #ifdef HAVE_LIBESD
    int                 size, confirm = 0;
-
 #endif
 
-   EDBUG(5, "SoundPlay");
+   EDBUG(5, "SamplePlay");
 #ifdef HAVE_LIBESD
    if ((sound_fd < 0) || (!mode.sound) || (!s))
       EDBUG_RETURN_;
@@ -147,37 +166,59 @@
      }
    if (s->id > 0)
       esd_sample_play(sound_fd, s->id);
-   EDBUG_RETURN_;
 #else
    s = NULL;
+#endif
    EDBUG_RETURN_;
+}
+
+static void
+DestroySample(Sample * s)
+{
+   EDBUG(5, "DestroySample");
+
+#ifdef HAVE_LIBESD
+   if ((s->id) && (sound_fd >= 0))
+     {
+/*      Why the hell is this symbol not in esd? */
+/*      it's in esd.h - evil evil evil */
+/*      esd_sample_kill(sound_fd,s->id); */
+       esd_sample_free(sound_fd, s->id);
+     }
 #endif
+   if (s->data)
+      Efree(s->data);
+   if (s->file)
+      Efree(s->file);
+   if (s)
+      Efree(s);
+   EDBUG_RETURN_;
 }
 
 SoundClass         *
-CreateSoundClass(char *name, char *file)
+SclassCreate(const char *name, const char *file)
 {
    SoundClass         *sclass;
 
-   EDBUG(6, "CreateSoundClass");
+   EDBUG(6, "SclassCreate");
    sclass = Emalloc(sizeof(SoundClass));
    if (!sclass)
       EDBUG_RETURN(NULL);
    sclass->name = duplicate(name);
    sclass->file = duplicate(file);
    sclass->sample = NULL;
+   AddItem(sclass, sclass->name, 0, LIST_TYPE_SCLASS);
    EDBUG_RETURN(sclass);
 }
 
 void
-ApplySclass(SoundClass * sclass)
+SclassApply(SoundClass * sclass)
 {
 #ifdef HAVE_LIBESD
    char               *f;
-
 #endif
 
-   EDBUG(4, "ApplySclass");
+   EDBUG(4, "SclassApply");
    if (!sclass)
       EDBUG_RETURN_;
 #ifdef HAVE_LIBESD
@@ -191,43 +232,18 @@
          }
      }
    if ((mode.sound) && (sclass->sample))
-      SoundPlay(sclass->sample);
-   EDBUG_RETURN_;
-#else
-   EDBUG_RETURN_;
-#endif
-}
-
-void
-DestroySample(Sample * s)
-{
-   EDBUG(5, "DestroySample");
-
-#ifdef HAVE_LIBESD
-   if ((s->id) && (sound_fd >= 0))
-     {
-/*      Why the hell is this symbol not in esd? */
-/*      it's in esd.h - evil evil evil */
-/*      esd_sample_kill(sound_fd,s->id); */
-       esd_sample_free(sound_fd, s->id);
-     }
+      SamplePlay(sclass->sample);
 #endif
-   if (s->data)
-      Efree(s->data);
-   if (s->file)
-      Efree(s->file);
-   if (s)
-      Efree(s);
    EDBUG_RETURN_;
 }
 
 void
-DestroySclass(SoundClass * sclass)
+SclassDestroy(SoundClass * sclass)
 {
+   EDBUG(5, "SclassDestroy");
    if (!sclass)
       EDBUG_RETURN_;
-
-   EDBUG(5, "DestroySclass");
+   RemoveItem(sclass->name, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS);
    if (sclass->name)
       Efree(sclass->name);
    if (sclass->file)
@@ -238,12 +254,37 @@
    EDBUG_RETURN_;
 }
 
+const char         *
+SclassGetName(SoundClass * sclass)
+{
+   return sclass->name;
+}
+
+int
+SoundPlay(const char *name)
+{
+   SoundClass         *sclass;
+
+   sclass = FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS);
+   SclassApply(sclass);
+   return sclass != NULL;
+}
+
+int
+SoundFree(const char *name)
+{
+   SoundClass         *sclass;
+
+   sclass = FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS);
+   SclassDestroy(sclass);
+   return sclass != NULL;
+}
+
 void
-SoundInit()
+SoundInit(void)
 {
 #ifdef HAVE_LIBESD
    int                 fd;
-
 #endif
 
    EDBUG(5, "SoundInit");
@@ -265,15 +306,14 @@
        RESET_ALERT;
        mode.sound = 0;
      }
-   EDBUG_RETURN_;
 #else
    mode.sound = 0;
-   EDBUG_RETURN_;
 #endif
+   EDBUG_RETURN_;
 }
 
 void
-SoundExit()
+SoundExit(void)
 {
    SoundClass        **lst;
    int                 num, i;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/sticky.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- sticky.c    5 Nov 2003 17:24:46 -0000       1.16
+++ sticky.c    3 Jan 2004 12:29:58 -0000       1.17
@@ -41,8 +41,7 @@
 
    HintsSetWindowState(ewin);
 
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_UNSTICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_UNSTICK");
 
    EDBUG_RETURN_;
 }
@@ -84,8 +83,7 @@
 
    HintsSetWindowState(ewin);
 
-   ApplySclass(FindItem
-              ("SOUND_WINDOW_STICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+   SoundPlay("SOUND_WINDOW_STICK");
 
    EDBUG_RETURN_;
 }




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to