Applied the ogg123 patch and some minor fixes. Alex
authorterminatorX <>
Wed, 28 Nov 2001 01:43:09 +0000 (01:43 +0000)
committerterminatorX <>
Wed, 28 Nov 2001 01:43:09 +0000 (01:43 +0000)
ChangeLog
acconfig.h
configure.in
src/tX_audiofile.cc
src/tX_audiofile.h
src/tX_prelis.cc
src/tX_vttgui.cc

index 34605354d811fc5a79944df7de9671bb9231c7a2..243aab7e8caa6f374f894158dd89ad22a819dbc4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,9 +4,16 @@ This is not a GNU-style ChangeLog but you sort of get the idea what was
 changed.
 
 [v3.72]
-- fixed a bug that produced corupt wavfiles on big endian machines
-- hack: made XInput work on XFree>4, proabably breaks XFree<4
-- applied Adrians solo-patch
+- Applied a patch from Matthew Evans <activesx@hotmail.com> that introduces 
+  support for Ogg Vorbis audiofiles. It requires ogg123 and sox to work.
+  Autodetection is supported via configure (--enable-ogg123).
+- Experimental support for input devices other than the core-pointer
+  under XFree86 > 4. This uses the xsetpointer executable that comes with
+  XFree86. configure should autodetect this correct, in case it doesn't
+  use --enable-xetpointer switch.
+- Adrian sent me a patch introducing two new buttons: mute and solo. It's
+  not yet finished though.
+- fixed a bug that produced corrupt wavfiles on big endian machines
 
 [v3.71]
 - applied a big patch from Adrian Reber (adrian@lisas.de). This patch includes:
index a2c8cf08b372488e9a94744f052fd50837279419..728d3ad5a6fb424ced081dfe5ed41d145b53aec7 100644 (file)
@@ -9,6 +9,9 @@
 /* Define if you want UGLY mp3-input "support" - requires sox as well*/
 #undef USE_MPG123_INPUT
 
+/* Define if you want UGLY ogg-input "support" - also requires sox*/
+#undef USE_OGG123_INPUT
+
 /* Define if you want realtime scheduling when tX is run with root privileges*/
 #undef USE_SCHEDULER
 
index 226b10e5e524f3458fce8652250f88b4ab1fae21..5a70d1189766cf9382b065786f86033659dfce89 100644 (file)
@@ -6,6 +6,7 @@ AM_CONFIG_HEADER(config.h)
 dnl AC_ARG_ENABLE(closedev, [  --enable-closedev       close audio device if not in use. [default=yes] ])
 AC_ARG_ENABLE(sox, [  --enable-sox            use sox as input converter. [default=yes] ])
 AC_ARG_ENABLE(mpg123, [  --enable-mpg123         use mpg123 as input converter. [default=yes] ])
+AC_ARG_ENABLE(ogg123, [  --enable-ogg123         use ogg123 as input converter. [default=yes] ])
 dnl AC_ARG_ENABLE(wavonly,  [  --enable-wavonly        enable the builtin wav routines. (no sox/mpg123) ])
 AC_ARG_ENABLE(scheduler,[  --enable-scheduler      enable rt-scheduling (req. root-priv). [default=yes] ])
 AC_ARG_ENABLE(debug,    [  --enable-debug          enable debug output. [default=no] ])
@@ -14,7 +15,7 @@ dnl AC_ARG_ENABLE(3dnow,    [  --enable-3dnow          enables 3DNow! support. [
 dnl AC_ARG_ENABLE(benchmark,[  --enable-benchmark      creates a non-functional test version [default=no] ])
 AC_ARG_ENABLE(wav,          [  --enable-wav            enables the builtin wav-loader [default=yes] ])
 AC_ARG_ENABLE(xsetpointer,  [  --enable-xsetpointer    enables executing of xsetpointer [default=auto] ])
-AC_ARG_ENABLE(alsa,         [  --enable-alsa           use ALSA for sound output [default=auto] ])
+dnl AC_ARG_ENABLE(alsa,         [  --enable-alsa           use ALSA for sound output [default=auto] ])
 AC_ARG_ENABLE(oss,          [  --enable-oss            use OSS for sound output [default=auto] ])
 
 dnl AC_ARG_ENABLE(dial,         [  --enable-dial           use dials instead of scales for effects [default=yes] ])
@@ -67,6 +68,13 @@ if test "$enable_mpg123" != "no"; then
        fi
 fi
 
+if test "$enable_ogg123" != "no"; then
+       AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
+       if test "$OGG123_PROG" = "yes"; then
+               AC_DEFINE(USE_OGG123_INPUT)
+       fi
+fi
+
 if test "$enable_xsetpointer" != "no"; then
        AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
        if test "$XSETPOINTER_PROG" = "yes"; then
@@ -81,25 +89,25 @@ fi
 using_alsa=no
 using_oss=no
 
-if test "$enable_alsa" != "no"; then
-       AC_CHECK_LIB(asound, snd_ctl_open,alsalib=yes,alsalib=no)
-       AC_CHECK_HEADERS(sys/asoundlib.h,alsaheader=yes,alsaheader=no)
-
-       if test "$alsalib" = "yes"; then
-               if test "$alsaheader" = "yes"; then
-                       AC_DEFINE(USE_ALSA)
-                       using_alsa=yes;
-               else 
-                       if test "$enable_alsa" = "yes"; then
-                               AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
-                       fi
-               fi
-       else
-               if test "$enable_alsa" = "yes"; then
-                       AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
-               fi
-       fi
-fi
+dnl if test "$enable_alsa" != "no"; then
+dnl    AC_CHECK_LIB(asound, snd_ctl_open,alsalib=yes,alsalib=no)
+dnl    AC_CHECK_HEADERS(sys/asoundlib.h,alsaheader=yes,alsaheader=no)
+dnl
+dnl    if test "$alsalib" = "yes"; then
+dnl            if test "$alsaheader" = "yes"; then
+dnl                    AC_DEFINE(USE_ALSA)
+dnl                    using_alsa=yes;
+dnl            else 
+dnl                    if test "$enable_alsa" = "yes"; then
+dnl                            AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
+dnl                    fi
+dnl            fi
+dnl    else
+dnl            if test "$enable_alsa" = "yes"; then
+dnl                    AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
+dnl            fi
+dnl    fi
+dnl fi
 
 if test "$enable_oss" != "no"; then
        AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
@@ -114,9 +122,9 @@ if test "$enable_oss" != "no"; then
        fi
 fi
 
-if test "$using_alsa" = "yes"; then
-       AC_MSG_RESULT([termnatorX audiodevice: using ALSA.])
-fi
+dnl if test "$using_alsa" = "yes"; then
+dnl    AC_MSG_RESULT([termnatorX audiodevice: using ALSA.])
+dnl fi
 
 if test "$using_oss" = "yes"; then
        AC_MSG_RESULT([termnatorX audiodevice: using OSS.])
index af0b458a5f060363c783c12d93f7e9fcc85cfe6a..06f04c8b045bf741148e319e6ef6a0940ffc77ba 100644 (file)
@@ -57,7 +57,8 @@ void tx_audiofile :: figure_file_type()
                {
                        ext++;
                        if (!strcasecmp("wav", ext)) file_type=TX_FILE_WAV;
-                       else if (!strncasecmp("mp", ext, 2)) file_type=TX_FILE_MPG123;                  
+                       else if (!strncasecmp("mp", ext, 2)) file_type=TX_FILE_MPG123;
+                       else if (!strncasecmp("ogg", ext, 2)) file_type=TX_FILE_OGG123;
                }
        }
 }
@@ -87,6 +88,14 @@ int tx_audiofile :: load(char *p_file_name)
        }
 #endif 
 
+#ifdef USE_OGG123_INPUT
+       if ((load_err) && (file_type==TX_FILE_OGG123))
+       {
+               load_err=load_ogg123();
+               return(load_err);
+       }
+#endif
+
 #ifdef USE_SOX_INPUT
        if (load_err)
        {
@@ -266,6 +275,20 @@ int tx_audiofile :: load_mpg123()
 }
 #endif 
 
+#ifdef USE_OGG123_INPUT
+int tx_audiofile :: load_ogg123()
+{
+       char command[PATH_MAX*2];
+
+       sprintf(command, OGG123_STR, filename);
+       file = popen(command, "r");
+
+       if (!file) return TX_AUDIO_ERR_OGG123;
+
+       return load_piped();
+}
+#endif
+
 #ifdef USE_BUILTIN_WAV
 #define min(a,b) ((a) < (b) ? (a) : (b))
 int tx_audiofile :: load_wav()
index ec73b3bf1282d8a7fd6336b744afd62ca8f8bcf0..682e3a74fa01c89ce3d78fc536a877361dd090e5 100644 (file)
 #endif
 
 #ifdef USE_MPG123_INPUT
-/*#include "endian.h"  // I don't think this is required
-#ifdef BIG_ENDIAN_MACHINE
-#define MPG123_STR "mpg123 -s \"%s\" | sox -t raw -r 44100 -c 2 -s -w -x - -t wav -c 1 -r 44100 -s -w -"
-#else*/
 #define MPG123_STR "mpg123 -qms \"%s\""
-/*#else
-#define MPG123_STR "mpg123 -qs \"%s\" | sox -t raw -r 44100 -c 2 -s -w - -t raw -c 1 -r 44100 -s -w -"
-#endif
-/*#endif*/
 #endif
 
+#ifdef USE_OGG123_INPUT
+#define OGG123_STR "ogg123 -q -d wav -f - \"%s\" | sox -t wav - -t raw -c 1 -r 44100 -s -w -"
+/* -o file:/dev/stdout because ogg123 doesn't interpret - as stdout */
+/* 20010907: i take that back, it seems that newer versions don't
+ * have that problem */
+#endif /* USE_OGG123_INPUT */
+
 
 #define TX_AUDIO_SUCCESS 0
 #define TX_AUDIO_ERR_ALLOC 1
@@ -57,6 +56,7 @@
 #define TX_AUDIO_ERR_NOT_MONO 7
 #define TX_AUDIO_ERR_WAV_READ 8
 #define TX_AUDIO_ERR_NOT_SUPPORTED 9
+#define TX_AUDIO_ERR_OGG123 10
 
 #define TX_AUDIO_UNDEFINED 0
 #define TX_AUDIO_MMAP 1
@@ -65,6 +65,7 @@
 #define TX_FILE_UNDEFINED 0
 #define TX_FILE_WAV 1
 #define TX_FILE_MPG123 2
+#define TX_FILE_OGG123 3
 
 #include <linux/limits.h>
 #include "tX_types.h"
@@ -92,7 +93,11 @@ class tx_audiofile
 #ifdef USE_MPG123_INPUT        
        int load_mpg123();
 #define NEED_PIPED 1   
-#endif 
+#endif
+#ifdef USE_OGG123_INPUT
+       int load_ogg123();
+#define NEED_PIPED 1
+#endif
 
 #ifdef NEED_PIPED
        int load_piped();
index e6cf65e98e7b0c71c25e60201e6978b47d163975..a134389746248e2adcae8e5156a1513592249821 100644 (file)
@@ -41,7 +41,8 @@ extern "C" {
 #endif
 
 #define PL_SOX_STR "sox \"%s\" -t ossdsp -w -s \"%s\""
-#define PL_MPG123_STR "mpg123 -a \"%s\" %s"
+#define PL_MPG123_STR "mpg123 -a \"%s\" \"%s\""
+#define PL_OGG123_STR "ogg123 -d oss \"%s\" -o \"dsp:%s\""
 
 //FILE *player_handle=NULL;
 pid_t player_pid=0;
@@ -68,8 +69,10 @@ void prelis_start(char *name)
        char *ext;
        pid_t temp;
        int usempg123=0;
+       int useogg123=0;
        int res;
        char dev[PATH_MAX];
+       char ogg123_dev[PATH_MAX];
        char nm[PATH_MAX];
        
        if (!globals.prelis) return;
@@ -82,6 +85,13 @@ void prelis_start(char *name)
                if (strlen(ext)>3)
                {
                        ext++;
+#ifdef USE_OGG123_INPUT
+                       strcpy(ogg123_dev, "dev:");
+                       if (!strncasecmp("ogg", ext, 2))
+//          sprintf(buffer, PL_OGG123_STR, name, globals.audio_device);
+                       useogg123=1;
+                       else
+#endif
 #ifdef USE_MPG123_INPUT                        
                        if (!strncasecmp("mp", ext, 2))                 
 //                     sprintf(buffer, PL_MPG123_STR, name, globals.audio_device);
@@ -106,7 +116,14 @@ void prelis_start(char *name)
        else if (temp==0) /* CHILD */
        {       
                strcpy(dev, globals.audio_device);
+               strcat(ogg123_dev, dev);
                strcpy(nm, name);
+#ifdef USE_OGG123_INPUT
+               if (useogg123)
+                       res=execlp("ogg123", "ogg123", "-q", "-d", "oss", "-o", ogg123_dev,
+                       nm, NULL);
+               else
+#endif
 #ifdef USE_MPG123_INPUT
                if (usempg123)
                        res=execlp("mpg123", "mpg123", "-q", "-a", dev, nm, NULL);
index 8e4d5be0f4e3d21fc94ea5fc3287e1b97ee54934..73faa1c13be44d81b890ee66fcbca0b0b6c88c1b 100644 (file)
@@ -662,6 +662,7 @@ void build_vtt_gui(vtt_class *vtt)
 {
        GtkWidget *tempbox;
        GtkWidget *tempbox2;
+       GtkWidget *tempbox3;
        GtkWidget *dummy;
        char nice_name[FILENAME_BUTTON_MAX];
        
@@ -904,16 +905,20 @@ void build_vtt_gui(vtt_class *vtt)
        gtk_box_pack_start(GTK_BOX(tempbox2), g->pand->get_widget(), WID_FIX);
        gui_set_tooltip(g->pand->get_entry(), "Specifies the position of this turntable within the stereo spectrum: -1 -> left, 0-> center, 1->right.");
 
-       g->mute=gtk_check_button_new_with_label("Mute");
-       gtk_box_pack_start(GTK_BOX(tempbox2), g->mute, WID_FIX);
-       gtk_signal_connect(GTK_OBJECT(g->mute),"clicked", (GtkSignalFunc) mute_volume, vtt);
-       gtk_widget_show(g->mute);
+       tempbox3=gtk_hbox_new(FALSE,2);
+       gtk_widget_show(tempbox3);
 
-       g->solo=gtk_check_button_new_with_label("Solo");
-       gtk_box_pack_start(GTK_BOX(tempbox2), g->solo, WID_FIX);
-       gtk_signal_connect(GTK_OBJECT(g->solo),"clicked", (GtkSignalFunc) solo_vtt, vtt);
-       gtk_widget_show(g->solo);
-       
+       g->mute=gtk_check_button_new_with_label("m");
+       gtk_box_pack_start(GTK_BOX(tempbox3), g->mute, WID_FIX);
+       gtk_signal_connect(GTK_OBJECT(g->mute),"clicked", (GtkSignalFunc) mute_volume, vtt);
+       gtk_widget_show(g->mute);
+
+       g->solo=gtk_check_button_new_with_label("s");
+       gtk_box_pack_start(GTK_BOX(tempbox3), g->solo, WID_FIX);
+       gtk_signal_connect(GTK_OBJECT(g->solo),"clicked", (GtkSignalFunc) solo_vtt, vtt);
+       gtk_widget_show(g->solo);
+
+       gtk_box_pack_start(GTK_BOX(tempbox2), tempbox3, WID_FIX);
 
        tempbox2=gtk_hbox_new(FALSE,0);
        gtk_widget_show(tempbox2);