gnome-media: extace and vu-meter improvements, patch (fwd)



I sent the following message and the appended patch to
submit@bugs.gnome.org, but apparently the BugTracker isn't capable of
handling MIME messages. Oh well.

Nils
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nils Philippsen                  @college: nils@fht-esslingen.de
Vogelsangstrasse 115             @home:    nils@wombat.dialup.fht-esslingen.de
D 70197 Stuttgart                phone:    +49-711-6599405
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lottery is a tax on people who are bad at math.

---------- Forwarded message ----------
Date: Fri, 19 Feb 1999 19:24:51 +0100 (CET)
From: Nils Philippsen <nils@wombat.dialup.fht-esslingen.de>
To: submit@bugs.gnome.org
Subject: gnome-media: extace and vu-meter improvements, patch

Package: gnome-media
Version: 0.99.5

extace has been famous for its non existing reaction, when esd doesn't
receive sound. vu-meter doesn't turn off its lights when there's no sound.
The attached patch corrects this (extace: via gdk_input_add(), vu-meter:
via an setitimer() hack).

Nils
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nils Philippsen                  @college: nils@fht-esslingen.de
Vogelsangstrasse 115             @home:    nils@wombat.dialup.fht-esslingen.de
D 70197 Stuttgart                phone:    +49-711-6599405
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lottery is a tax on people who are bad at math.
--- gnome-media-0.99.5/extace/extace.c.orig	Mon Jan 18 17:34:26 1999
+++ gnome-media-0.99.5/extace/extace.c	Fri Feb 19 18:38:27 1999
@@ -189,7 +189,7 @@
 #define LWIDTH NSAMP/(2*LEVELS)
 
 void
-draw(void)
+draw(gpointer data, gint source, GdkInputCondition condition)
 {
    gint i,j,k;
    static double levels[LEVELS]=
@@ -586,10 +586,10 @@
    setup_datawindow();
    init_colortab();
    open_sound();
-   for (;;)
-     {
-	while (gtk_events_pending()) gtk_main_iteration();
-	draw();
-     }
+
+   if (sound > 0) /* valid fd */
+      gdk_input_add (sound, GDK_INPUT_READ, draw, NULL);
+
+   gtk_main();
    return 0;
 }
--- gnome-media-0.99.5/extace/ChangeLog.orig	Mon Jan 18 17:34:25 1999
+++ gnome-media-0.99.5/extace/ChangeLog	Fri Feb 19 18:53:15 1999
@@ -1,3 +1,8 @@
+1999-02-19  Nils Philippsen  <nils@fht-esslingen.de>
+
+	* extace.c: added gdk_input_add() for reactions when there
+	  is no sound
+
 1999-01-18  Christopher Blizzard  <blizzard@appliedtheory.com>
 
 	* extace.c: Add check to see where to find gsl headers.
--- gnome-media-0.99.5/vu-meter/main.c.orig	Sun Jan 17 15:11:39 1999
+++ gnome-media-0.99.5/vu-meter/main.c	Fri Feb 19 18:46:56 1999
@@ -23,6 +23,8 @@
 #include <gnome.h>
 #include <esd.h>
 #include <gtkledbar.h>
+#include <sys/time.h>
+#include <signal.h>
 
 gint sound = -1;
 #define RATE   44100
@@ -33,12 +35,24 @@
 GtkWidget   *window;
 gchar       *esd_host = NULL;
 
+#define DELAY (NSAMP*1000)/RATE
+
+struct itimerval timerval = {
+  {0, 0},
+  {0, DELAY*1000},
+};
+
 /* function prototypes to make gcc happy: */
 void update (void);
 char *itoa (int i);
 void open_sound (void);
 void  update_levels (gpointer data, gint source, GdkInputCondition condition);
 
+void sig_alarm (int sig)
+{
+  led_bar_light_percent (dial[0], (0.0));
+  led_bar_light_percent (dial[1], (0.0));
+}
 
 char 
 *itoa (int i)
@@ -104,8 +118,11 @@
   register short val_l, val_r;
   static unsigned short bigl, bigr;
 
-  if (!(read (source, aubuf, NSAMP * 2)))
-    return;
+  signal (SIGALRM, sig_alarm);
+  setitimer (ITIMER_REAL, &timerval, NULL);
+
+  read (source, aubuf, NSAMP * 2);
+
   bigl = bigr = 0;
   for (i = 1; i < NSAMP / 2;)
     {
--- gnome-media-0.99.5/vu-meter/ChangeLog.orig	Sun Jan 17 15:11:38 1999
+++ gnome-media-0.99.5/vu-meter/ChangeLog	Fri Feb 19 18:52:22 1999
@@ -1,3 +1,8 @@
+1999-02-19  Nils Philippsen  <nils@fht-esslingen.de>
+
+	* main.c (sig_alarm, update_levels): Added setitimer() hack
+	  to turn off lights when there is no sound
+
 1999-01-17  Carsten Schaar  <nhadcasc@fs-maphy.uni-hannover.de>
 
 	* main.c (save_state): Removed unused code and set the discard


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]