From 6b23d5f8ab419170ebc579322c3234142d9f4e51 Mon Sep 17 00:00:00 2001 From: Michael Schwendt Date: Nov 10 2009 14:30:52 +0000 Subject: - Upgrade to 2.2-beta2 - Add patch to use old/working ladspa plugin from 2.0.1 (#533641). --- diff --git a/.cvsignore b/.cvsignore index f503eb4..430dd64 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -audacious-plugins-fedora-2.2-beta1.tar.bz2 +audacious-plugins-fedora-2.2-beta2.tar.bz2 diff --git a/audacious-plugins-2.2-beta1-filewriter-dialogs.patch b/audacious-plugins-2.2-beta1-filewriter-dialogs.patch deleted file mode 100644 index 0fe6f62..0000000 --- a/audacious-plugins-2.2-beta1-filewriter-dialogs.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/filewriter.c audacious-plugins-2.2-beta1-filewriter/src/filewriter/filewriter.c ---- audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/filewriter.c 2009-10-20 23:37:23.000000000 +0200 -+++ audacious-plugins-2.2-beta1-filewriter/src/filewriter/filewriter.c 2009-10-29 14:53:36.000000000 +0100 -@@ -423,6 +423,7 @@ - if (!configure_win) - { - configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); -+ gtk_window_set_type_hint(GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG); - - gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", - GTK_SIGNAL_FUNC(configure_destroy), NULL); -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/mp3.c audacious-plugins-2.2-beta1-filewriter/src/filewriter/mp3.c ---- audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/mp3.c 2009-10-20 23:37:23.000000000 +0200 -+++ audacious-plugins-2.2-beta1-filewriter/src/filewriter/mp3.c 2009-10-29 14:54:32.000000000 +0100 -@@ -719,6 +719,7 @@ - - if (!configure_win) { - configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); -+ gtk_window_set_type_hint(GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG); - - gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/vorbis.c audacious-plugins-2.2-beta1-filewriter/src/filewriter/vorbis.c ---- audacious-plugins-fedora-2.2-beta1-orig/src/filewriter/vorbis.c 2009-10-20 23:37:23.000000000 +0200 -+++ audacious-plugins-2.2-beta1-filewriter/src/filewriter/vorbis.c 2009-10-29 14:54:21.000000000 +0100 -@@ -273,6 +273,7 @@ - if (configure_win == NULL) - { - configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); -+ gtk_window_set_type_hint(GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG); - g_signal_connect(G_OBJECT(configure_win), "destroy", G_CALLBACK(gtk_widget_destroyed), NULL); - - gtk_window_set_title(GTK_WINDOW(configure_win), _("Vorbis Encoder Configuration")); diff --git a/audacious-plugins-2.2-beta1-modplug.patch b/audacious-plugins-2.2-beta1-modplug.patch deleted file mode 100644 index 6bb00dd..0000000 --- a/audacious-plugins-2.2-beta1-modplug.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/modplug/modplugbmp.cxx audacious-plugins-fedora-2.2-beta1-modplug/src/modplug/modplugbmp.cxx ---- audacious-plugins-fedora-2.2-beta1-orig/src/modplug/modplugbmp.cxx 2009-10-20 23:37:24.000000000 +0200 -+++ audacious-plugins-fedora-2.2-beta1-modplug/src/modplug/modplugbmp.cxx 2009-10-24 23:47:44.000000000 +0200 -@@ -295,15 +295,6 @@ - if(mStopped) - break; - -- //wait for buffer space to free up. -- while(((mOutPlug->buffer_free() -- < (int)mBufSize)) -- && (!mStopped)) -- usleep(10000); -- -- if(mStopped) -- break; -- - playback->pass_audio - ( - playback, -@@ -423,15 +414,16 @@ - ); - mPlayed = 0; - -- Tuple* ti = GetSongTuple( aFilename ); -- if ( ti ) -- aModName = format_and_free_ti( ti, &aLength ); -+ Tuple* ti = GetSongTuple( aFilename ); -+ if ( ti ) { -+ ipb->set_tuple(ipb,ti); -+ } - - ipb->set_params - ( - ipb, -- aModName, -- aLength, -+ NULL, -+ 0, - mSoundFile->GetNumChannels() * 1000, - mModProps.mFrequency, - mModProps.mChannels -@@ -464,9 +456,6 @@ - - mStopped = true; - mPaused = false; -- -- g_thread_join(ipb->thread); -- ipb->thread = NULL; - } - - void ModplugXMMS::Pause(bool aPaused) -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/modplug/modplugbmp.h audacious-plugins-fedora-2.2-beta1-modplug/src/modplug/modplugbmp.h ---- audacious-plugins-fedora-2.2-beta1-orig/src/modplug/modplugbmp.h 2009-10-20 23:37:24.000000000 +0200 -+++ audacious-plugins-fedora-2.2-beta1-modplug/src/modplug/modplugbmp.h 2009-10-24 23:44:09.000000000 +0200 -@@ -126,7 +126,6 @@ - float mPreampFactor; - - void PlayLoop(InputPlayback *); -- static void* PlayThread(void* arg); - const char* Bool2OnOff(bool aValue); - }; - diff --git a/audacious-plugins-2.2-beta1-pulseaudio.patch b/audacious-plugins-2.2-beta1-pulseaudio.patch deleted file mode 100644 index c705cab..0000000 --- a/audacious-plugins-2.2-beta1-pulseaudio.patch +++ /dev/null @@ -1,816 +0,0 @@ -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/configure audacious-plugins-fedora-2.2-beta1-pulseaudio/configure ---- audacious-plugins-fedora-2.2-beta1-orig/configure 2009-10-20 23:37:27.000000000 +0200 -+++ audacious-plugins-fedora-2.2-beta1-pulseaudio/configure 2009-10-25 12:25:40.619069584 +0100 -@@ -7483,7 +7483,7 @@ - - - INPUT_PLUGINS="tonegen console psf xsf metronom vtx" --OUTPUT_PLUGINS="crossfade null" -+OUTPUT_PLUGINS="crossfade null pulse_audio" - EFFECT_PLUGINS="audiocompress crystalizer ladspa voice_removal sndstretch stereo_plugin echo_plugin" - GENERAL_PLUGINS="song_change alarm skins vfstrace gtkui" - VISUALIZATION_PLUGINS="blur_scope spectrum" -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/pulse_audio/Makefile audacious-plugins-fedora-2.2-beta1-pulseaudio/src/pulse_audio/Makefile ---- audacious-plugins-fedora-2.2-beta1-orig/src/pulse_audio/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ audacious-plugins-fedora-2.2-beta1-pulseaudio/src/pulse_audio/Makefile 2009-10-25 12:25:40.627063872 +0100 -@@ -0,0 +1,12 @@ -+PLUGIN = pulse_audio${PLUGIN_SUFFIX} -+ -+SRCS = pulse_audio.c -+ -+include ../../buildsys.mk -+include ../../extra.mk -+ -+plugindir := ${plugindir}/${OUTPUT_PLUGIN_DIR} -+ -+CFLAGS += ${PLUGIN_CFLAGS} -+CPPFLAGS += ${PLUGIN_CPPFLAGS} ${BEEP_DEFINES} ${MOWGLI_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} -I../.. -+LIBS += -lpulse ${GTK_LIBS} ${GLIB_LIBS} -diff -Nur audacious-plugins-fedora-2.2-beta1-orig/src/pulse_audio/pulse_audio.c audacious-plugins-fedora-2.2-beta1-pulseaudio/src/pulse_audio/pulse_audio.c ---- audacious-plugins-fedora-2.2-beta1-orig/src/pulse_audio/pulse_audio.c 1970-01-01 01:00:00.000000000 +0100 -+++ audacious-plugins-fedora-2.2-beta1-pulseaudio/src/pulse_audio/pulse_audio.c 2009-10-25 12:10:17.000000000 +0100 -@@ -0,0 +1,784 @@ -+/*** -+ This file is part of xmms-pulse. -+ -+ xmms-pulse is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ xmms-pulse is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with xmms-pulse; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -+ USA. -+***/ -+ -+#include "config.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+ -+static pa_context *context = NULL; -+static pa_stream *stream = NULL; -+static pa_threaded_mainloop *mainloop = NULL; -+ -+static pa_cvolume volume; -+static int volume_valid = 0; -+ -+static int do_trigger = 0; -+static uint64_t written = 0; -+static int time_offset_msec = 0; -+static int just_flushed = 0; -+ -+static int connected = 0; -+ -+static pa_time_event *volume_time_event = NULL; -+ -+#define CHECK_DEAD_GOTO(label, warn) do { \ -+if (!mainloop || \ -+ !context || pa_context_get_state(context) != PA_CONTEXT_READY || \ -+ !stream || pa_stream_get_state(stream) != PA_STREAM_READY) { \ -+ if (warn) \ -+ AUDDBG("Connection died: %s", context ? pa_strerror(pa_context_errno(context)) : "NULL"); \ -+ goto label; \ -+ } \ -+} while(0); -+ -+#define CHECK_CONNECTED(retval) \ -+do { \ -+ if (!connected) return retval; \ -+} while (0); -+ -+static const char* get_song_name(void) { -+ static char t[256]; -+ char *str, *u; -+ -+ if (!(str = aud_playback_get_title())) -+ return "Playback Stream"; -+ snprintf(t, sizeof(t), "%s", u = pa_locale_to_utf8(str)); -+ pa_xfree(u); -+ -+ return t; -+} -+ -+static void info_cb(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) { -+ assert(c); -+ -+ if (!i) -+ return; -+ -+ volume = i->volume; -+ volume_valid = 1; -+} -+ -+static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) { -+ pa_operation *o; -+ -+ assert(c); -+ -+ if (!stream || -+ index != pa_stream_get_index(stream) || -+ (t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE) && -+ t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW))) -+ return; -+ -+ if (!(o = pa_context_get_sink_input_info(c, index, info_cb, NULL))) { -+ AUDDBG("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(c))); -+ return; -+ } -+ -+ pa_operation_unref(o); -+} -+ -+static void context_state_cb(pa_context *c, void *userdata) { -+ assert(c); -+ -+ switch (pa_context_get_state(c)) { -+ case PA_CONTEXT_READY: -+ case PA_CONTEXT_TERMINATED: -+ case PA_CONTEXT_FAILED: -+ pa_threaded_mainloop_signal(mainloop, 0); -+ break; -+ -+ case PA_CONTEXT_UNCONNECTED: -+ case PA_CONTEXT_CONNECTING: -+ case PA_CONTEXT_AUTHORIZING: -+ case PA_CONTEXT_SETTING_NAME: -+ break; -+ } -+} -+ -+static void stream_state_cb(pa_stream *s, void * userdata) { -+ assert(s); -+ -+ switch (pa_stream_get_state(s)) { -+ -+ case PA_STREAM_READY: -+ case PA_STREAM_FAILED: -+ case PA_STREAM_TERMINATED: -+ pa_threaded_mainloop_signal(mainloop, 0); -+ break; -+ -+ case PA_STREAM_UNCONNECTED: -+ case PA_STREAM_CREATING: -+ break; -+ } -+} -+ -+static void stream_success_cb(pa_stream *s, int success, void *userdata) { -+ assert(s); -+ -+ if (userdata) -+ *(int*) userdata = success; -+ -+ pa_threaded_mainloop_signal(mainloop, 0); -+} -+ -+static void context_success_cb(pa_context *c, int success, void *userdata) { -+ assert(c); -+ -+ if (userdata) -+ *(int*) userdata = success; -+ -+ pa_threaded_mainloop_signal(mainloop, 0); -+} -+ -+static void stream_request_cb(pa_stream *s, size_t length, void *userdata) { -+ assert(s); -+ -+ pa_threaded_mainloop_signal(mainloop, 0); -+} -+ -+static void stream_latency_update_cb(pa_stream *s, void *userdata) { -+ assert(s); -+ -+ pa_threaded_mainloop_signal(mainloop, 0); -+} -+ -+static void pulse_get_volume(int *l, int *r) { -+ pa_cvolume v; -+ int b = 0; -+ -+ *l = *r = 100; -+ -+ if (connected) { -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ v = volume; -+ b = volume_valid; -+ -+ fail: -+ pa_threaded_mainloop_unlock(mainloop); -+ } else { -+ v = volume; -+ b = volume_valid; -+ } -+ -+ if (b) { -+ if (v.channels == 2) { -+ *l = (int) ((v.values[0]*100)/PA_VOLUME_NORM); -+ *r = (int) ((v.values[1]*100)/PA_VOLUME_NORM); -+ } else -+ *l = *r = (int) ((pa_cvolume_avg(&v)*100)/PA_VOLUME_NORM); -+ } -+} -+ -+static void volume_time_cb(pa_mainloop_api *api, pa_time_event *e, const struct timeval *tv, void *userdata) { -+ pa_operation *o; -+ -+ if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL))) -+ AUDDBG("pa_context_set_sink_input_volume() failed: %s", pa_strerror(pa_context_errno(context))); -+ else -+ pa_operation_unref(o); -+ -+ /* We don't wait for completion of this command */ -+ -+ api->time_free(volume_time_event); -+ volume_time_event = NULL; -+} -+ -+static void pulse_set_volume(int l, int r) { -+ -+ if (connected) { -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ } -+ -+ if (!volume_valid || volume.channels != 1) { -+ volume.values[0] = ((pa_volume_t) l * PA_VOLUME_NORM)/100; -+ volume.values[1] = ((pa_volume_t) r * PA_VOLUME_NORM)/100; -+ volume.channels = 2; -+ } else { -+ volume.values[0] = ((pa_volume_t) l * PA_VOLUME_NORM)/100; -+ volume.channels = 1; -+ } -+ -+ volume_valid = 1; -+ -+ if (connected && !volume_time_event) { -+ struct timeval tv; -+ pa_mainloop_api *api = pa_threaded_mainloop_get_api(mainloop); -+ volume_time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), volume_time_cb, NULL); -+ } -+ -+fail: -+ if (connected) -+ pa_threaded_mainloop_unlock(mainloop); -+} -+ -+static void pulse_pause(short b) { -+ pa_operation *o = NULL; -+ int success = 0; -+ -+ CHECK_CONNECTED(); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ if (!(o = pa_stream_cork(stream, b, stream_success_cb, &success))) { -+ AUDDBG("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!success) -+ AUDDBG("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context))); -+ -+fail: -+ -+ if (o) -+ pa_operation_unref(o); -+ -+ pa_threaded_mainloop_unlock(mainloop); -+} -+ -+static int pulse_free(void) { -+ size_t l = 0; -+ pa_operation *o = NULL; -+ -+ CHECK_CONNECTED(0); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ if ((l = pa_stream_writable_size(stream)) == (size_t) -1) { -+ AUDDBG("pa_stream_writable_size() failed: %s", pa_strerror(pa_context_errno(context))); -+ l = 0; -+ goto fail; -+ } -+ -+ /* If this function is called twice with no pulse_write() call in -+ * between this means we should trigger the playback */ -+ if (do_trigger) { -+ int success = 0; -+ -+ if (!(o = pa_stream_trigger(stream, stream_success_cb, &success))) { -+ AUDDBG("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!success) -+ AUDDBG("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context))); -+ } -+ -+fail: -+ if (o) -+ pa_operation_unref(o); -+ -+ pa_threaded_mainloop_unlock(mainloop); -+ -+ do_trigger = !!l; -+ return (int) l; -+} -+ -+static int pulse_get_written_time(void) { -+ int r = 0; -+ -+ CHECK_CONNECTED(0); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ r = (int) (((double) written*1000) / pa_bytes_per_second(pa_stream_get_sample_spec(stream))); -+ -+fail: -+ pa_threaded_mainloop_unlock(mainloop); -+ -+ return r; -+} -+ -+static int pulse_get_output_time(void) { -+ int r = 0; -+ pa_usec_t t; -+ -+ CHECK_CONNECTED(0); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ -+ for (;;) { -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ if (pa_stream_get_time(stream, &t) >= 0) -+ break; -+ -+ if (pa_context_errno(context) != PA_ERR_NODATA) { -+ AUDDBG("pa_stream_get_time() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ r = (int) (t / 1000); -+ -+ if (just_flushed) { -+ time_offset_msec -= r; -+ just_flushed = 0; -+ } -+ -+ r += time_offset_msec; -+ -+fail: -+ pa_threaded_mainloop_unlock(mainloop); -+ -+ return r; -+} -+ -+static int pulse_playing(void) { -+ int r = 0; -+ const pa_timing_info *i; -+ -+ CHECK_CONNECTED(0); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ -+ for (;;) { -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ if ((i = pa_stream_get_timing_info(stream))) -+ break; -+ -+ if (pa_context_errno(context) != PA_ERR_NODATA) { -+ AUDDBG("pa_stream_get_timing_info() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ r = i->playing; -+ -+fail: -+ pa_threaded_mainloop_unlock(mainloop); -+ -+ return r; -+} -+ -+static void pulse_flush(int time) { -+ pa_operation *o = NULL; -+ int success = 0; -+ -+ CHECK_CONNECTED(); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ /* gapless playback: new stream, reset the title. --nenolod */ -+ if (time == 0) { -+ pa_stream_set_name(stream, get_song_name(), stream_success_cb, &success); -+ } -+ -+ if (!(o = pa_stream_flush(stream, stream_success_cb, &success))) { -+ AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!success) -+ AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context))); -+ -+ written = (uint64_t) (((double) time * pa_bytes_per_second(pa_stream_get_sample_spec(stream))) / 1000); -+ just_flushed = 1; -+ time_offset_msec = time; -+ -+fail: -+ if (o) -+ pa_operation_unref(o); -+ -+ pa_threaded_mainloop_unlock(mainloop); -+} -+ -+static void pulse_write(void* ptr, int length) { -+ gint writeoffs, remain, writable; -+ -+ CHECK_CONNECTED(); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 1); -+ -+ /* break large fragments into smaller fragments. --nenolod */ -+ for (writeoffs = 0, remain = length; -+ writeoffs < length; -+ writeoffs += writable, remain -= writable) -+ { -+ gpointer pptr = ptr + writeoffs; -+ -+ writable = length - writeoffs; -+ size_t fragsize = pa_stream_writable_size(stream); -+ -+ /* don't write more than what PA is willing to handle right now. */ -+ if (writable > fragsize) -+ writable = fragsize; -+ -+ if (pa_stream_write(stream, pptr, writable, NULL, PA_SEEK_RELATIVE, 0) < 0) { -+ AUDDBG("pa_stream_write() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ } -+ -+ do_trigger = 0; -+ written += length; -+ -+fail: -+ pa_threaded_mainloop_unlock(mainloop); -+} -+ -+static void drain(void) { -+ pa_operation *o = NULL; -+ int success = 0; -+ -+ CHECK_CONNECTED(); -+ -+ pa_threaded_mainloop_lock(mainloop); -+ CHECK_DEAD_GOTO(fail, 0); -+ -+ if (!(o = pa_stream_drain(stream, stream_success_cb, &success))) { -+ AUDDBG("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto fail; -+ } -+ -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!success) -+ AUDDBG("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context))); -+ -+fail: -+ if (o) -+ pa_operation_unref(o); -+ -+ pa_threaded_mainloop_unlock(mainloop); -+} -+ -+static void pulse_close(void) -+{ -+ drain(); -+ -+ connected = 0; -+ -+ if (mainloop) -+ pa_threaded_mainloop_stop(mainloop); -+ -+ if (stream) { -+ pa_stream_disconnect(stream); -+ pa_stream_unref(stream); -+ stream = NULL; -+ } -+ -+ if (context) { -+ pa_context_disconnect(context); -+ pa_context_unref(context); -+ context = NULL; -+ } -+ -+ if (mainloop) { -+ pa_threaded_mainloop_free(mainloop); -+ mainloop = NULL; -+ } -+ -+ volume_time_event = NULL; -+} -+ -+static OutputPluginInitStatus pulse_init(void) { -+ pa_sample_spec ss; -+ -+ g_assert(!mainloop); -+ g_assert(!context); -+ g_assert(!stream); -+ g_assert(!connected); -+ -+ ss.format = PA_SAMPLE_S16NE; -+ ss.rate = 44100; -+ ss.channels = 2; -+ -+ if (!pa_sample_spec_valid(&ss)) -+ return OUTPUT_PLUGIN_INIT_FAIL; -+ -+ if (!(mainloop = pa_threaded_mainloop_new())) { -+ pulse_close(); -+ return OUTPUT_PLUGIN_INIT_FAIL; -+ } -+ -+ pulse_close(); -+ return OUTPUT_PLUGIN_INIT_FOUND_DEVICES; -+} -+ -+static int pulse_open(AFormat fmt, int rate, int nch) { -+ pa_sample_spec ss; -+ pa_operation *o = NULL; -+ int success; -+ -+ g_assert(!mainloop); -+ g_assert(!context); -+ g_assert(!stream); -+ g_assert(!connected); -+ -+ switch(fmt) -+ { -+ case FMT_U8: -+ ss.format = PA_SAMPLE_U8; -+ break; -+ case FMT_S16_LE: -+ ss.format = PA_SAMPLE_S16LE; -+ break; -+ case FMT_S16_BE: -+ ss.format = PA_SAMPLE_S16BE; -+ break; -+ case FMT_S16_NE: -+ ss.format = PA_SAMPLE_S16NE; -+ break; -+#if 0 /* pulseaudio only handles 16 and 32bit formats*/ -+ case FMT_S24_LE: -+ ss.format = PA_SAMPLE_S24LE; -+ break; -+ case FMT_S24_BE: -+ ss.format = PA_SAMPLE_S24BE; -+ break; -+ case FMT_S24_NE: -+ ss.format = PA_SAMPLE_S24NE; -+ break; -+#endif -+ case FMT_S32_LE: -+ ss.format = PA_SAMPLE_S32LE; -+ break; -+ case FMT_S32_BE: -+ ss.format = PA_SAMPLE_S32BE; -+ break; -+ case FMT_S32_NE: -+ ss.format = PA_SAMPLE_S32NE; -+ break; -+ case FMT_FLOAT: -+ ss.format = PA_SAMPLE_FLOAT32NE; -+ break; -+ default: -+ return FALSE; -+ } -+ ss.rate = rate; -+ ss.channels = nch; -+ -+ if (!pa_sample_spec_valid(&ss)) -+ return FALSE; -+ -+ if (!(mainloop = pa_threaded_mainloop_new())) { -+ AUDDBG("Failed to allocate main loop"); -+ goto fail; -+ } -+ -+ pa_threaded_mainloop_lock(mainloop); -+ -+ if (!(context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "Audacious"))) { -+ AUDDBG("Failed to allocate context"); -+ goto unlock_and_fail; -+ } -+ -+ pa_context_set_state_callback(context, context_state_cb, NULL); -+ pa_context_set_subscribe_callback(context, subscribe_cb, NULL); -+ -+ if (pa_context_connect(context, NULL, 0, NULL) < 0) { -+ AUDDBG("Failed to connect to server: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ if (pa_threaded_mainloop_start(mainloop) < 0) { -+ AUDDBG("Failed to start main loop"); -+ goto unlock_and_fail; -+ } -+ -+ /* Wait until the context is ready */ -+ pa_threaded_mainloop_wait(mainloop); -+ -+ if (pa_context_get_state(context) != PA_CONTEXT_READY) { -+ AUDDBG("Failed to connect to server: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ if (!(stream = pa_stream_new(context, get_song_name(), &ss, NULL))) { -+ AUDDBG("Failed to create stream: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ pa_stream_set_state_callback(stream, stream_state_cb, NULL); -+ pa_stream_set_write_callback(stream, stream_request_cb, NULL); -+ pa_stream_set_latency_update_callback(stream, stream_latency_update_cb, NULL); -+ -+ /* Connect stream with sink and default volume */ -+ if (pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL) < 0) { -+ AUDDBG("Failed to connect stream: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ /* Wait until the stream is ready */ -+ pa_threaded_mainloop_wait(mainloop); -+ -+ if (pa_stream_get_state(stream) != PA_STREAM_READY) { -+ AUDDBG("Failed to connect stream: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ /* Now subscribe to events */ -+ if (!(o = pa_context_subscribe(context, PA_SUBSCRIPTION_MASK_SINK_INPUT, context_success_cb, &success))) { -+ AUDDBG("pa_context_subscribe() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ success = 0; -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!success) { -+ AUDDBG("pa_context_subscribe() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ pa_operation_unref(o); -+ -+ /* Now request the initial stream info */ -+ if (!(o = pa_context_get_sink_input_info(context, pa_stream_get_index(stream), info_cb, NULL))) { -+ AUDDBG("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ -+ while (pa_operation_get_state(o) != PA_OPERATION_DONE) { -+ CHECK_DEAD_GOTO(fail, 1); -+ pa_threaded_mainloop_wait(mainloop); -+ } -+ -+ if (!volume_valid) { -+ AUDDBG("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context))); -+ goto unlock_and_fail; -+ } -+ pa_operation_unref(o); -+ -+ do_trigger = 0; -+ written = 0; -+ time_offset_msec = 0; -+ just_flushed = 0; -+ connected = 1; -+ volume_time_event = NULL; -+ -+ pa_threaded_mainloop_unlock(mainloop); -+ -+ return TRUE; -+ -+unlock_and_fail: -+ -+ if (o) -+ pa_operation_unref(o); -+ -+ pa_threaded_mainloop_unlock(mainloop); -+ -+fail: -+ -+ pulse_close(); -+ -+ return FALSE; -+} -+ -+static void pulse_about(void) { -+ static GtkWidget *dialog; -+ -+ if (dialog != NULL) -+ return; -+ -+ dialog = audacious_info_dialog( -+ _("About Audacious PulseAudio Output Plugin"), -+ _("Audacious PulseAudio Output Plugin\n\n " -+ "This program is free software; you can redistribute it and/or modify\n" -+ "it under the terms of the GNU General Public License as published by\n" -+ "the Free Software Foundation; either version 2 of the License, or\n" -+ "(at your option) any later version.\n" -+ "\n" -+ "This program is distributed in the hope that it will be useful,\n" -+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" -+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" -+ "GNU General Public License for more details.\n" -+ "\n" -+ "You should have received a copy of the GNU General Public License\n" -+ "along with this program; if not, write to the Free Software\n" -+ "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n" -+ "USA."), -+ _("OK"), -+ FALSE, -+ NULL, -+ NULL); -+ -+ gtk_signal_connect( -+ GTK_OBJECT(dialog), -+ "destroy", -+ GTK_SIGNAL_FUNC(gtk_widget_destroyed), -+ &dialog); -+} -+ -+static OutputPlugin pulse_op = { -+ .description = "PulseAudio Output Plugin", -+ .probe_priority = 8, -+ .init = pulse_init, -+ .about = pulse_about, -+ .get_volume = pulse_get_volume, -+ .set_volume = pulse_set_volume, -+ .open_audio = pulse_open, -+ .write_audio = pulse_write, -+ .close_audio = pulse_close, -+ .flush = pulse_flush, -+ .pause = pulse_pause, -+ .buffer_free = pulse_free, -+ .buffer_playing = pulse_playing, -+ .output_time = pulse_get_output_time, -+ .written_time = pulse_get_written_time, -+}; -+ -+OutputPlugin *pulse_oplist[] = { &pulse_op, NULL }; -+ -+SIMPLE_OUTPUT_PLUGIN(pulser, pulse_oplist); diff --git a/audacious-plugins-2.2-ladspa-backto201.patch b/audacious-plugins-2.2-ladspa-backto201.patch new file mode 100644 index 0000000..468e946 --- /dev/null +++ b/audacious-plugins-2.2-ladspa-backto201.patch @@ -0,0 +1,1853 @@ +diff -Nur audacious-plugins-2.2-beta2/src/ladspa/ladspa.c audacious-plugins-2.2-beta2-ladspa/src/ladspa/ladspa.c +--- audacious-plugins-2.2-beta2/src/ladspa/ladspa.c 2009-11-09 14:57:13.000000000 +0100 ++++ audacious-plugins-2.2-beta2-ladspa/src/ladspa/ladspa.c 2009-05-14 04:41:59.000000000 +0200 +@@ -43,57 +43,58 @@ + #define MAX_SAMPLES 8192 + #define MAX_KNOBS 64 + +-typedef struct +-{ +- char *name; +- char *filename; +- long int id; +- long int unique_id; +- gboolean stereo; ++typedef struct { ++ char *name; ++ char *filename; ++ long int id; ++ long int unique_id; ++ gboolean stereo; + } ladspa_plugin; + +-typedef struct +-{ +- void *library; +- char *filename; +- gboolean stereo; +- gboolean restored; +- const LADSPA_Descriptor *descriptor; +- LADSPA_Handle *handle; /* left or mono */ +- LADSPA_Handle *handle2; /* right stereo */ +- GtkWidget *window; +- guint timeout; +- GtkAdjustment *adjustments[MAX_KNOBS]; +- LADSPA_Data knobs[MAX_KNOBS]; ++typedef struct { ++ void *library; ++ char *filename; ++ gboolean stereo; ++ gboolean restored; ++ const LADSPA_Descriptor *descriptor; ++ LADSPA_Handle *handle; /* left or mono */ ++ LADSPA_Handle *handle2; /* right stereo */ ++ GtkWidget *window; ++ guint timeout; ++ GtkAdjustment *adjustments[MAX_KNOBS]; ++ LADSPA_Data knobs[MAX_KNOBS]; + } plugin_instance; + +-static void start(void); +-static void stop(void); +-static int apply_effect(gpointer * d, gint length, AFormat afmt, gint srate, gint nch); ++static void start (void); ++static void stop (void); ++static int apply_effect (gpointer *d, gint length, AFormat afmt, ++ gint srate, gint nch); + static void configure(void); + +-static void restore(void); +-static plugin_instance *add_plugin(ladspa_plugin * plugin); ++static void restore (void); ++static plugin_instance * add_plugin (ladspa_plugin *plugin); + static void find_all_plugins(void); + static void find_plugins(char *path_entry); +-static ladspa_plugin *get_plugin_by_id(const gchar * basename, long id); +-static plugin_instance *load(char *filename, long int num); +-static void reboot_plugins(void); +-static void boot_plugin(plugin_instance * instance); +-static void port_assign(plugin_instance * instance); +-static void ladspa_shutdown(plugin_instance * instance); +-static void unload(plugin_instance * instance); ++static ladspa_plugin *get_plugin_by_id(long id); ++static plugin_instance * load (char *filename, long int num); ++static void reboot_plugins (void); ++static void boot_plugin (plugin_instance *instance); ++static void port_assign(plugin_instance *instance); ++static void ladspa_shutdown (plugin_instance *instance); ++static void unload (plugin_instance *instance); + +-static GtkWidget *make_plugin_clist(void); ++static GtkWidget * make_plugin_clist(void); + static void make_run_clist(void); +-static void sort_column(GtkCList * clist, gint column, gpointer user_data); +-static void select_plugin(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data); +-static void unselect_plugin(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data); +-static void add_plugin_clicked(GtkButton * button, gpointer user_data); +-static void remove_plugin_clicked(GtkButton * button, gpointer user_data); +-static void configure_plugin_clicked(GtkButton * button, gpointer user_data); ++static void sort_column(GtkCList *clist, gint column, gpointer user_data); ++static void select_plugin(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data); ++static void unselect_plugin(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data); ++static void add_plugin_clicked (GtkButton *button, gpointer user_data); ++static void remove_plugin_clicked (GtkButton *button, gpointer user_data); ++static void configure_plugin_clicked (GtkButton *button, gpointer user_data); + +-static void draw_plugin(plugin_instance * instance); ++static void draw_plugin(plugin_instance *instance); + + static LADSPA_Data left[MAX_SAMPLES], right[MAX_SAMPLES], trash[MAX_SAMPLES]; + +@@ -101,1034 +102,873 @@ + + static GSList *plugin_list, *running_plugins; + +-static ladspa_plugin *selected_plugin; +-static plugin_instance *selected_instance; ++static ladspa_plugin * selected_plugin; ++static plugin_instance * selected_instance; + +-static struct +-{ +- AFormat afmt; +- gint srate; +- gint nch; +- gboolean ignore; +- gboolean running; +- gboolean initialised; +-} state = +-{ +-0, 0, 0, FALSE, FALSE, FALSE}; ++static struct { ++ AFormat afmt; ++ gint srate; ++ gint nch; ++ gboolean ignore; ++ gboolean running; ++ gboolean initialised; ++} state = { 0, 0, 0, FALSE, FALSE, FALSE}; + + static GtkWidget *config_window = NULL, *run_clist = NULL; + + static EffectPlugin ladspa_ep = { +- .description = PLUGIN_NAME, +- .init = start, +- .cleanup = stop, +- .configure = configure, +- .mod_samples = apply_effect, ++ .description = PLUGIN_NAME, ++ .init = start, ++ .cleanup = stop, ++ .configure = configure, ++ .mod_samples = apply_effect, + }; + + EffectPlugin *ladspa_eplist[] = { &ladspa_ep, NULL }; + + DECLARE_PLUGIN(ladspa, NULL, NULL, NULL, NULL, ladspa_eplist, NULL, NULL, NULL); + +-static void start(void) ++static void start (void) + { +- if (state.initialised == FALSE) +- { +- restore(); +- } +- else if (state.srate > 0) +- { +- reboot_plugins(); +- } +- state.running = TRUE; ++ if (state.initialised == FALSE) { ++ restore(); ++ } else if (state.srate > 0) { ++ reboot_plugins(); ++ } ++ state.running = TRUE; + } + +-static void restore(void) ++static void restore (void) + { +- GSList *list; +- mcs_handle_t *db; +- gint k, plugins = 0; +- +- if (plugin_list == NULL) +- find_all_plugins(); +- +- db = aud_cfg_db_open(); +- +- aud_cfg_db_get_int(db, "ladspa", "plugins", &plugins); +- +- /* XXX: this sucks. we need some way to iterate over these sections. --nenolod */ +- for (list = plugin_list; list != NULL; list = g_slist_next(list)) +- { +- ladspa_plugin *plugin = (ladspa_plugin *) list->data; +- gchar *bn; +- +- bn = g_path_get_basename(plugin->filename); ++ mcs_handle_t *db; ++ gint k, plugins= 0; + +- for (k = 0; k < plugins; ++k) +- { +- gint id; +- int port, ports = 0; +- gchar *section; +- plugin_instance *instance; ++ db = aud_cfg_db_open(); + +- section = g_strdup_printf("ladspa_plugin:%s:%d", bn, k); +- +- aud_cfg_db_get_int(db, section, "id", &id); +- aud_cfg_db_get_int(db, section, "ports", &ports); +- +- instance = add_plugin(get_plugin_by_id(bn, id)); +- if (!instance) +- continue; /* couldn't load this plugin */ +- +- for (port = 0; port < ports && port < MAX_KNOBS; ++port) +- { +- gchar *key = g_strdup_printf("port%d", port); +- aud_cfg_db_get_float(db, section, key, &(instance->knobs[port])); +- } +- +- instance->restored = TRUE; +- g_free(section); +- } ++ aud_cfg_db_get_int(db, "ladspa", "plugins", &plugins); ++ for (k= 0; k < plugins; ++k) { ++ gint id; ++ int port, ports= 0; ++ plugin_instance *instance; ++ gchar *section = g_strdup_printf("ladspa_plugin%d", k); + +- g_free(bn); ++ aud_cfg_db_get_int(db, section, "id", &id); ++ instance = add_plugin(get_plugin_by_id(id)); ++ if (!instance) continue; /* couldn't load this plugin */ ++ aud_cfg_db_get_int(db, section, "ports", &ports); ++ for (port= 0; port < ports && port < MAX_KNOBS; ++port) { ++ gchar *key = g_strdup_printf("port%d", port); ++ aud_cfg_db_get_float(db, section, key, &(instance->knobs[port])); + } ++ instance->restored = TRUE; ++ g_free(section); ++ } + +- aud_cfg_db_close(db); +- state.initialised = TRUE; ++ state.initialised = TRUE; ++ aud_cfg_db_close(db); + } + +-static ladspa_plugin *get_plugin_by_id(const gchar * basename, long id) ++static ladspa_plugin *get_plugin_by_id(long id) + { +- GSList *list; +- ladspa_plugin *plugin; +- +- if (plugin_list == NULL) +- find_all_plugins(); +- +- for (list = plugin_list; list != NULL; list = g_slist_next(list)) +- { +- gchar *bn; +- plugin = (ladspa_plugin *) list->data; ++ GSList *list; ++ ladspa_plugin *plugin; + +- bn = g_path_get_basename(plugin->filename); +- if (plugin->unique_id == id && !g_ascii_strcasecmp(basename, bn)) +- { +- g_free(bn); +- return plugin; +- } ++ if (plugin_list == NULL) { ++ find_all_plugins(); ++ } + +- g_free(bn); ++ for (list= plugin_list; list != NULL; list = g_slist_next(list)) { ++ plugin = (ladspa_plugin *) list->data; ++ if (plugin->unique_id == id) { ++ return plugin; + } ++ } + +- return NULL; ++ return NULL; + } + +-static void find_all_plugins(void) ++static void find_all_plugins (void) + { +- char *ladspa_path, *directory; ++ char *ladspa_path, *directory; + +- plugin_list = NULL; /* empty list */ +- ladspa_path = getenv("LADSPA_PATH"); +- if (ladspa_path == NULL) +- { +- /* Fallback, look in obvious places */ +- find_plugins("/usr/lib/ladspa"); +- find_plugins("/usr/local/lib/ladspa"); +- } +- else +- { +- ladspa_path = g_strdup(ladspa_path); ++ plugin_list = NULL; /* empty list */ ++ ladspa_path= getenv("LADSPA_PATH"); ++ if (ladspa_path == NULL) { ++ /* Fallback, look in obvious places */ ++ find_plugins("/usr/lib/ladspa"); ++ find_plugins("/usr/local/lib/ladspa"); ++ } else { ++ ladspa_path = g_strdup(ladspa_path); + +- directory = strtok(ladspa_path, ":"); +- while (directory != NULL) +- { +- find_plugins(directory); +- directory = strtok(NULL, ":"); +- } +- g_free(ladspa_path); ++ directory = strtok(ladspa_path, ":"); ++ while (directory != NULL) { ++ find_plugins(directory); ++ directory = strtok(NULL, ":"); + } ++ g_free(ladspa_path); ++ } + } + +-static plugin_instance *load(char *filename, long int num) ++static plugin_instance * load (char *filename, long int num) + { +- LADSPA_Descriptor_Function descriptor_fn; +- plugin_instance *instance; ++ LADSPA_Descriptor_Function descriptor_fn; ++ plugin_instance *instance; + +- instance = g_new0(plugin_instance, 1); ++ instance = g_new0(plugin_instance, 1); + +- instance->filename = filename; +- instance->library = dlopen(filename, RTLD_NOW); +- if (instance->library == NULL) +- { +- g_free(instance); +- return NULL; +- } +- descriptor_fn = dlsym(instance->library, "ladspa_descriptor"); +- if (descriptor_fn == NULL) +- { +- g_free(instance); +- return NULL; +- } +- instance->descriptor = descriptor_fn(num); ++ instance->filename = filename; ++ instance->library = dlopen(filename, RTLD_NOW); ++ if (instance->library == NULL) { ++ g_free(instance); ++ return NULL; ++ } ++ descriptor_fn = dlsym(instance->library, "ladspa_descriptor"); ++ if (descriptor_fn == NULL) { ++ g_free(instance); ++ return NULL; ++ } ++ instance->descriptor = descriptor_fn(num); + +- return instance; ++ return instance; + } + +-static void unload(plugin_instance * instance) ++static void unload (plugin_instance * instance) + { +- if (instance->window) +- { +- gtk_widget_destroy(instance->window); +- instance->window = NULL; +- } ++ if (instance->window) { ++ gtk_widget_destroy(instance->window); ++ instance->window = NULL; ++ } + +- if (instance->timeout) +- { +- gtk_timeout_remove(instance->timeout); +- } ++ if (instance->timeout) { ++ gtk_timeout_remove(instance->timeout); ++ } + +- ladspa_shutdown(instance); ++ ladspa_shutdown(instance); + +- if (instance->library) +- { +- dlclose(instance->library); +- } ++ if (instance->library) { ++ dlclose(instance->library); ++ } + } + +-static void stop(void) ++static void stop (void) + { +- GSList *list; +- mcs_handle_t *db; +- gint plugins = 0; ++ GSList *list; ++ mcs_handle_t *db; ++ gint plugins = 0; + +- if (state.running == FALSE) +- { +- return; +- } +- state.running = FALSE; +- db = aud_cfg_db_open(); +- G_LOCK(running_plugins); +- for (list = running_plugins; list != NULL; list = g_slist_next(list)) +- { +- plugin_instance *instance = (plugin_instance *) list->data; +- gchar *bn; +- gchar *section; +- int port, ports = 0; +- +- bn = g_path_get_basename(instance->filename); +- section = g_strdup_printf("ladspa_plugin:%s:%ld", bn, instance->descriptor->UniqueID); +- g_free(bn); ++ if (state.running == FALSE) { ++ return; ++ } ++ state.running = FALSE; ++ db = aud_cfg_db_open(); ++ G_LOCK (running_plugins); ++ for (list= running_plugins; list != NULL; list = g_slist_next(list)) { ++ plugin_instance *instance = (plugin_instance *) list->data; ++ gchar *section = g_strdup_printf("ladspa_plugin%d", plugins++); ++ int port, ports= 0; + +- aud_cfg_db_set_int(db, section, "id", instance->descriptor->UniqueID); +- aud_cfg_db_set_string(db, section, "file", instance->filename); +- aud_cfg_db_set_string(db, section, "label", (gchar *) instance->descriptor->Label); ++ aud_cfg_db_set_int(db, section, "id", instance->descriptor->UniqueID); ++ aud_cfg_db_set_string(db, section, "file", instance->filename); ++ aud_cfg_db_set_string(db, section, "label", (gchar *) ++ instance->descriptor->Label); + +- ports = instance->descriptor->PortCount; +- if (ports > MAX_KNOBS) +- ports = MAX_KNOBS; +- for (port = 0; port < ports; ++port) +- { +- gchar *key = g_strdup_printf("port%d", port); +- aud_cfg_db_set_float(db, section, key, instance->knobs[port]); +- g_free(key); +- } +- aud_cfg_db_set_int(db, section, "ports", ports); +- g_free(section); +- ladspa_shutdown(instance); ++ ports = instance->descriptor->PortCount; ++ if (ports > MAX_KNOBS) ports = MAX_KNOBS; ++ for (port= 0; port < ports; ++port) { ++ gchar *key = g_strdup_printf("port%d", port); ++ aud_cfg_db_set_float(db, section, key, instance->knobs[port]); ++ g_free(key); + } +- G_UNLOCK(running_plugins); ++ aud_cfg_db_set_int(db, section, "ports", ports); ++ g_free(section); ++ ladspa_shutdown (instance); ++ } ++ G_UNLOCK (running_plugins); + +- aud_cfg_db_set_int(db, "ladspa", "plugins", plugins); +- aud_cfg_db_close(db); ++ aud_cfg_db_set_int(db, "ladspa", "plugins", plugins); ++ aud_cfg_db_close(db); + } + +-static void ladspa_shutdown(plugin_instance * instance) ++static void ladspa_shutdown (plugin_instance *instance) + { +- const LADSPA_Descriptor *descriptor = instance->descriptor; ++ const LADSPA_Descriptor * descriptor= instance->descriptor; + +- if (instance->handle) +- { +- if (descriptor->deactivate) +- { +- descriptor->deactivate(instance->handle); +- } +- descriptor->cleanup(instance->handle); +- instance->handle = NULL; ++ if (instance->handle) { ++ if (descriptor->deactivate) { ++ descriptor->deactivate(instance->handle); + } +- if (instance->handle2) +- { +- if (descriptor->deactivate) +- { +- descriptor->deactivate(instance->handle2); +- } +- descriptor->cleanup(instance->handle2); +- instance->handle2 = NULL; ++ descriptor->cleanup(instance->handle); ++ instance->handle = NULL; ++ } ++ if (instance->handle2) { ++ if (descriptor->deactivate) { ++ descriptor->deactivate(instance->handle2); + } ++ descriptor->cleanup(instance->handle2); ++ instance->handle2 = NULL; ++ } + } + +-static void boot_plugin(plugin_instance * instance) ++static void boot_plugin (plugin_instance *instance) + { +- const LADSPA_Descriptor *descriptor = instance->descriptor; ++ const LADSPA_Descriptor * descriptor = instance->descriptor; + +- ladspa_shutdown(instance); +- instance->handle = descriptor->instantiate(descriptor, state.srate); +- if (state.nch > 1 && !instance->stereo) +- { +- /* Create an additional instance */ +- instance->handle2 = descriptor->instantiate(descriptor, state.srate); +- } ++ ladspa_shutdown(instance); ++ instance->handle = descriptor->instantiate(descriptor, state.srate); ++ if (state.nch > 1 && !instance->stereo) { ++ /* Create an additional instance */ ++ instance->handle2 = descriptor->instantiate(descriptor, state.srate); ++ } + +- port_assign(instance); ++ port_assign(instance); + +- if (descriptor->activate) +- { +- descriptor->activate(instance->handle); +- if (instance->handle2) +- { +- descriptor->activate(instance->handle2); +- } ++ if (descriptor->activate) { ++ descriptor->activate(instance->handle); ++ if (instance->handle2) { ++ descriptor->activate(instance->handle2); + } ++ } + } + +-static void reboot_plugins(void) ++static void reboot_plugins (void) + { +- GSList *list; ++ GSList *list; + +- G_LOCK(running_plugins); +- for (list = running_plugins; list != NULL; list = g_slist_next(list)) +- { +- boot_plugin((plugin_instance *) list->data); +- } +- G_UNLOCK(running_plugins); ++ G_LOCK (running_plugins); ++ for (list= running_plugins; list != NULL; list = g_slist_next(list)) { ++ boot_plugin ((plugin_instance *) list->data); ++ } ++ G_UNLOCK (running_plugins); + } + +-static int apply_effect(gpointer * d, gint length, AFormat afmt, gint srate, gint nch) ++static int apply_effect (gpointer *d, gint length, AFormat afmt, ++ gint srate, gint nch) + { +- gint16 *raw16 = *d; +- GSList *list; +- plugin_instance *instance; +- int k; ++ gint16 *raw16 = *d; ++ GSList *list; ++ plugin_instance *instance; ++ int k; + +- if (running_plugins == NULL || state.running == FALSE) +- { +- return length; +- } +- +- if (state.afmt != afmt || state.srate != srate || state.nch != nch) +- { +- state.afmt = afmt; +- state.srate = srate; +- state.nch = nch; +- +- if (nch < 1 || nch > 2) +- state.ignore = 1; +- else if (afmt == FMT_S16_NE) +- state.ignore = 0; ++ if (running_plugins == NULL || state.running == FALSE) { ++ return length; ++ } ++ ++ if (state.afmt != afmt || state.srate != srate || state.nch != nch) { ++ state.afmt = afmt; ++ state.srate = srate; ++ state.nch = nch; ++ ++ if (nch < 1 || nch > 2) ++ state.ignore = 1; ++ else if (afmt == FMT_S16_NE) ++ state.ignore = 0; + #if G_BYTE_ORDER == G_LITTLE_ENDIAN +- else if (afmt == FMT_S16_LE) +- state.ignore = 0; ++ else if (afmt == FMT_S16_LE) ++ state.ignore = 0; + #elif G_BYTE_ORDER == G_BIG_ENDIAN +- else if (afmt == FMT_S16_BE) +- state.ignore = 0; ++ else if (afmt == FMT_S16_BE) ++ state.ignore = 0; + #endif +- else +- state.ignore = 1; +- +- reboot_plugins(); +- } +- +- if (state.ignore || length > MAX_SAMPLES * 2) +- { +- return length; +- } +- +- if (state.nch == 1) +- { +- for (k = 0; k < length / 2; ++k) +- { +- left[k] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); +- } +- G_LOCK(running_plugins); +- for (list = running_plugins; list != NULL; list = g_slist_next(list)) +- { +- instance = (plugin_instance *) list->data; +- if (instance->handle) +- { +- instance->descriptor->run(instance->handle, length / 2); +- } +- } +- G_UNLOCK(running_plugins); +- for (k = 0; k < length / 2; ++k) +- { +- raw16[k] = CLAMP((int)(left[k] * 32768.0f), -32768, 32767); +- } +- } + else +- { +- for (k = 0; k < length / 2; k += 2) +- { +- left[k / 2] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); +- } +- for (k = 1; k < length / 2; k += 2) +- { +- right[k / 2] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); +- } +- G_LOCK(running_plugins); +- for (list = running_plugins; list != NULL; list = g_slist_next(list)) +- { +- instance = (plugin_instance *) list->data; +- if (instance->handle) +- { +- instance->descriptor->run(instance->handle, length / 4); +- } +- if (instance->handle2) +- { +- instance->descriptor->run(instance->handle2, length / 4); +- } +- } +- G_UNLOCK(running_plugins); +- for (k = 0; k < length / 2; k += 2) +- { +- raw16[k] = CLAMP((int)(left[k / 2] * 32768.0f), -32768, 32767); +- } +- for (k = 1; k < length / 2; k += 2) +- { +- raw16[k] = CLAMP((int)(right[k / 2] * 32768.0f), -32768, 32767); +- } +- } ++ state.ignore = 1; + +- return length; +-} ++ reboot_plugins(); ++ } + +-static void port_assign(plugin_instance * instance) +-{ +- unsigned long port; +- unsigned long inputs = 0, outputs = 0; +- const LADSPA_Descriptor *plugin = instance->descriptor; +- +- for (port = 0; port < plugin->PortCount; ++port) +- { +- +- if (LADSPA_IS_PORT_CONTROL(plugin->PortDescriptors[port])) +- { +- if (port < MAX_KNOBS) +- { +- plugin->connect_port(instance->handle, port, &(instance->knobs[port])); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, &(instance->knobs[port])); +- } +- else +- { +- plugin->connect_port(instance->handle, port, trash); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, trash); +- } ++ if (state.ignore || length > MAX_SAMPLES * 2) { ++ return length; ++ } + +- } +- else if (LADSPA_IS_PORT_AUDIO(plugin->PortDescriptors[port])) +- { ++ if (state.nch == 1) { ++ for (k= 0; k < length / 2; ++k) { ++ left[k] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); ++ } ++ G_LOCK (running_plugins); ++ for (list= running_plugins; list != NULL; list = g_slist_next(list)) { ++ instance = (plugin_instance *) list->data; ++ if (instance->handle) { ++ instance->descriptor->run(instance->handle, length / 2); ++ } ++ } ++ G_UNLOCK (running_plugins); ++ for (k= 0; k < length / 2; ++k) { ++ raw16[k] = CLAMP((int) (left[k] * 32768.0f), -32768, 32767); ++ } ++ } else { ++ for (k= 0; k < length / 2; k += 2) { ++ left[k/2] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); ++ } ++ for (k= 1; k < length / 2; k += 2) { ++ right[k/2] = ((LADSPA_Data) raw16[k]) * (1.0f / 32768.0f); ++ } ++ G_LOCK (running_plugins); ++ for (list= running_plugins; list != NULL; list = g_slist_next(list)) { ++ instance = (plugin_instance *) list->data; ++ if (instance->handle) { ++ instance->descriptor->run(instance->handle, length / 4); ++ } ++ if (instance->handle2) { ++ instance->descriptor->run(instance->handle2, length / 4); ++ } ++ } ++ G_UNLOCK (running_plugins); ++ for (k= 0; k < length / 2; k += 2) { ++ raw16[k] = CLAMP((int) (left[k/2] * 32768.0f), -32768, 32767); ++ } ++ for (k= 1; k < length / 2; k += 2) { ++ raw16[k] = CLAMP((int) (right[k/2] * 32768.0f), -32768, 32767); ++ } ++ } ++ ++ return length; ++} ++ ++static void port_assign(plugin_instance * instance) { ++ unsigned long port; ++ unsigned long inputs= 0, outputs= 0; ++ const LADSPA_Descriptor * plugin = instance->descriptor; ++ ++ for (port = 0; port < plugin->PortCount; ++port) { ++ ++ if (LADSPA_IS_PORT_CONTROL(plugin->PortDescriptors[port])) { ++ if (port < MAX_KNOBS) { ++ plugin->connect_port(instance->handle, port, &(instance->knobs[port])); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, &(instance->knobs[port])); ++ } else { ++ plugin->connect_port(instance->handle, port, trash); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, trash); ++ } + +- if (LADSPA_IS_PORT_INPUT(plugin->PortDescriptors[port])) +- { +- if (inputs == 0) +- { +- plugin->connect_port(instance->handle, port, left); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, right); +- } +- else if (inputs == 1 && instance->stereo) +- { +- plugin->connect_port(instance->handle, port, right); +- } +- else +- { +- plugin->connect_port(instance->handle, port, trash); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, trash); +- } +- inputs++; +- +- } +- else if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[port])) +- { +- if (outputs == 0) +- { +- plugin->connect_port(instance->handle, port, left); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, right); +- } +- else if (outputs == 1 && instance->stereo) +- { +- plugin->connect_port(instance->handle, port, right); +- } +- else +- { +- plugin->connect_port(instance->handle, port, trash); +- if (instance->handle2) +- plugin->connect_port(instance->handle2, port, trash); +- } +- outputs++; ++ } else if (LADSPA_IS_PORT_AUDIO(plugin->PortDescriptors[port])) { + +- } ++ if (LADSPA_IS_PORT_INPUT(plugin->PortDescriptors[port])) { ++ if (inputs == 0) { ++ plugin->connect_port(instance->handle, port, left); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, right); ++ } else if (inputs == 1 && instance->stereo) { ++ plugin->connect_port(instance->handle, port, right); ++ } else { ++ plugin->connect_port(instance->handle, port, trash); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, trash); ++ } ++ inputs++; ++ ++ } else if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[port])) { ++ if (outputs == 0) { ++ plugin->connect_port(instance->handle, port, left); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, right); ++ } else if (outputs == 1 && instance->stereo) { ++ plugin->connect_port(instance->handle, port, right); ++ } else { ++ plugin->connect_port(instance->handle, port, trash); ++ if (instance->handle2) ++ plugin->connect_port(instance->handle2, port, trash); + } ++ outputs++; ++ ++ } + } ++ } + + } + + static void find_plugins(char *path_entry) + { +- ladspa_plugin *plugin; +- void *library = NULL; +- char lib_name[PATH_MAX]; +- LADSPA_Descriptor_Function descriptor_fn; +- const LADSPA_Descriptor *descriptor; +- DIR *dir; +- struct dirent *dirent; +- long int k; +- unsigned long int port, input, output; +- +- dir = opendir(path_entry); +- if (dir == NULL) +- return; +- +- while ((dirent = readdir(dir))) +- { +- snprintf(lib_name, PATH_MAX, "%s/%s", path_entry, dirent->d_name); +- library = dlopen(lib_name, RTLD_LAZY); +- if (library == NULL) +- { +- continue; +- } +- descriptor_fn = dlsym(library, "ladspa_descriptor"); +- if (descriptor_fn == NULL) +- { +- dlclose(library); +- continue; +- } +- +- for (k = 0;; ++k) +- { +- descriptor = descriptor_fn(k); +- if (descriptor == NULL) +- { +- break; +- } +- plugin = g_new(ladspa_plugin, 1); +- plugin->name = g_strdup(descriptor->Name); +- plugin->filename = g_strdup(lib_name); +- plugin->id = k; +- plugin->unique_id = descriptor->UniqueID; +- for (input = output = port = 0; port < descriptor->PortCount; ++port) +- { +- if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[port])) +- { +- if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[port])) +- input++; +- if (LADSPA_IS_PORT_OUTPUT(descriptor->PortDescriptors[port])) +- output++; +- } +- else if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[port])) +- { +- } +- } +- if (input >= 2 && output >= 2) +- { +- plugin->stereo = TRUE; +- } +- else +- { +- plugin->stereo = FALSE; +- } +- plugin_list = g_slist_prepend(plugin_list, plugin); +- } +- dlclose(library); +- } +- +- closedir(dir); ++ ladspa_plugin *plugin; ++ void *library = NULL; ++ char lib_name[PATH_MAX]; ++ LADSPA_Descriptor_Function descriptor_fn; ++ const LADSPA_Descriptor *descriptor; ++ DIR *dir; ++ struct dirent *dirent; ++ long int k; ++ unsigned long int port, input, output; ++ ++ dir= opendir(path_entry); ++ if (dir == NULL) return; ++ ++ while ((dirent= readdir(dir))) { ++ snprintf(lib_name, PATH_MAX, "%s/%s", path_entry, dirent->d_name); ++ library = dlopen(lib_name, RTLD_LAZY); ++ if (library == NULL) { ++ continue; ++ } ++ descriptor_fn = dlsym(library, "ladspa_descriptor"); ++ if (descriptor_fn == NULL) { ++ dlclose(library); ++ continue; ++ } ++ ++ for (k= 0;; ++k) { ++ descriptor= descriptor_fn(k); ++ if (descriptor == NULL) { ++ break; ++ } ++ plugin = g_new(ladspa_plugin, 1); ++ plugin->name= g_strdup(descriptor->Name); ++ plugin->filename= g_strdup(lib_name); ++ plugin->id= k; ++ plugin->unique_id= descriptor->UniqueID; ++ for (input = output = port = 0; port < descriptor->PortCount; ++port) { ++ if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[port])) { ++ if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[port])) ++ input++; ++ if (LADSPA_IS_PORT_OUTPUT(descriptor->PortDescriptors[port])) ++ output++; ++ } else if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[port])) { ++ } ++ } ++ if (input >= 2 && output >= 2) { ++ plugin->stereo= TRUE; ++ } else { ++ plugin->stereo= FALSE; ++ } ++ plugin_list = g_slist_prepend(plugin_list, plugin); ++ } ++ dlclose(library); ++ } ++ ++ closedir(dir); ++ return; ++} ++ ++static void value_changed(GtkAdjustment *adjustment, gpointer *user_data) ++{ ++ LADSPA_Data *data = (LADSPA_Data *) user_data; ++ ++ G_LOCK (running_plugins); ++ *data = (LADSPA_Data) adjustment->value; ++ G_UNLOCK (running_plugins); ++} ++ ++static void toggled(GtkToggleButton *togglebutton, gpointer *user_data) ++{ ++ LADSPA_Data *data = (LADSPA_Data *) user_data; ++ ++ if (gtk_toggle_button_get_active(togglebutton)) { ++ G_LOCK (running_plugins); ++ *data = (LADSPA_Data) 1.0f; ++ G_UNLOCK (running_plugins); ++ } else { ++ G_LOCK (running_plugins); ++ *data = (LADSPA_Data) -1.0f; ++ G_UNLOCK (running_plugins); ++ } ++} ++ ++static int update_instance (gpointer data) ++{ ++ plugin_instance *instance = (plugin_instance *) data; ++ unsigned long k; ++ ++ G_LOCK (running_plugins); ++ for (k = 0; k < MAX_KNOBS && k < instance->descriptor->PortCount; ++k) { ++ if (LADSPA_IS_PORT_OUTPUT(instance->descriptor->PortDescriptors[k]) ++ && LADSPA_IS_PORT_CONTROL(instance->descriptor->PortDescriptors[k])) { ++ instance->adjustments[k]->value = instance->knobs[k]; ++ gtk_adjustment_value_changed(instance->adjustments[k]); ++ } ++ } ++ G_UNLOCK (running_plugins); ++ return TRUE; ++} ++ ++static void draw_plugin(plugin_instance *instance) ++{ ++ const LADSPA_Descriptor *plugin = instance->descriptor; ++ const LADSPA_PortRangeHint *hints = plugin->PortRangeHints; ++ LADSPA_Data fact, min, max, step, start; ++ int dp; ++ unsigned long k; ++ gboolean no_ui = TRUE; ++ GtkWidget *widget, *vbox, *hbox; ++ GtkObject *adjustment; ++ ++ if (instance->window != NULL) { ++ /* Just show window */ ++ gtk_widget_show(instance->window); + return; +-} +- +-static void value_changed(GtkAdjustment * adjustment, gpointer * user_data) +-{ +- LADSPA_Data *data = (LADSPA_Data *) user_data; +- +- G_LOCK(running_plugins); +- *data = (LADSPA_Data) adjustment->value; +- G_UNLOCK(running_plugins); +-} +- +-static void toggled(GtkToggleButton * togglebutton, gpointer * user_data) +-{ +- LADSPA_Data *data = (LADSPA_Data *) user_data; ++ } + +- if (gtk_toggle_button_get_active(togglebutton)) +- { +- G_LOCK(running_plugins); +- *data = (LADSPA_Data) 1.0f; +- G_UNLOCK(running_plugins); +- } +- else +- { +- G_LOCK(running_plugins); +- *data = (LADSPA_Data) - 1.0f; +- G_UNLOCK(running_plugins); +- } +-} ++ instance->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ gtk_window_set_title(GTK_WINDOW(instance->window), plugin->Name); + +-static int update_instance(gpointer data) +-{ +- plugin_instance *instance = (plugin_instance *) data; +- unsigned long k; ++ vbox= gtk_vbox_new(FALSE, 3); + +- G_LOCK(running_plugins); +- for (k = 0; k < MAX_KNOBS && k < instance->descriptor->PortCount; ++k) +- { +- if (LADSPA_IS_PORT_OUTPUT(instance->descriptor->PortDescriptors[k]) && LADSPA_IS_PORT_CONTROL(instance->descriptor->PortDescriptors[k])) +- { +- instance->adjustments[k]->value = instance->knobs[k]; +- gtk_adjustment_value_changed(instance->adjustments[k]); +- } ++ for (k = 0; k < MAX_KNOBS && k < plugin->PortCount; ++k) { ++ if (! LADSPA_IS_PORT_CONTROL(plugin->PortDescriptors[k])) ++ continue; ++ no_ui = FALSE; ++ hbox = gtk_hbox_new(FALSE, 3); ++ widget = gtk_label_new(plugin->PortNames[k]); ++ gtk_container_add(GTK_CONTAINER(hbox), widget); ++ ++ if (LADSPA_IS_HINT_TOGGLED(hints[k].HintDescriptor)) { ++ widget = gtk_toggle_button_new_with_label("Press"); ++ g_signal_connect(G_OBJECT(widget), "toggled", ++ G_CALLBACK(toggled), &(instance->knobs[k])); ++ gtk_container_add(GTK_CONTAINER(hbox), widget); ++ gtk_container_add(GTK_CONTAINER(vbox), hbox); ++ continue; ++ } ++ ++ if (LADSPA_IS_HINT_SAMPLE_RATE(hints[k].HintDescriptor)) { ++ fact = state.srate ? state.srate : 44100.0f; ++ } else { ++ fact = 1.0f; ++ } ++ ++ if (LADSPA_IS_HINT_BOUNDED_BELOW(hints[k].HintDescriptor)) { ++ min= hints[k].LowerBound * fact; ++ } else { ++ min= -10000.0f; ++ } ++ ++ if (LADSPA_IS_HINT_BOUNDED_ABOVE(hints[k].HintDescriptor)) { ++ max= hints[k].UpperBound * fact; ++ } else { ++ max= 10000.0f; ++ } ++ ++ /* infinity */ ++ if (10000.0f <= max - min) { ++ dp = 1; ++ step = 5.0f; ++ ++ /* 100.0 ... lots */ ++ } else if (100.0f < max - min) { ++ dp = 0; ++ step = 5.0f; ++ ++ /* 10.0 ... 100.0 */ ++ } else if (10.0f < max - min) { ++ dp = 1; ++ step = 0.5f; ++ ++ /* 1.0 ... 10.0 */ ++ } else if (1.0f < max - min) { ++ dp = 2; ++ step = 0.05f; ++ ++ /* 0.0 ... 1.0 */ ++ } else { ++ dp = 3; ++ step = 0.005f; ++ } ++ ++ if (LADSPA_IS_HINT_INTEGER(hints[k].HintDescriptor)) { ++ dp = 0; ++ if (step < 1.0f) step = 1.0f; ++ } ++ ++ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hints[k].HintDescriptor)) { ++ start = min; ++ } else if (LADSPA_IS_HINT_DEFAULT_LOW(hints[k].HintDescriptor)) { ++ start = min * 0.75f + max * 0.25f; ++ } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hints[k].HintDescriptor)) { ++ start = min * 0.5f + max * 0.5f; ++ } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hints[k].HintDescriptor)) { ++ start = min * 0.25f + max * 0.75f; ++ } else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hints[k].HintDescriptor)) { ++ start = max; ++ } else if (LADSPA_IS_HINT_DEFAULT_0(hints[k].HintDescriptor)) { ++ start = 0.0f; ++ } else if (LADSPA_IS_HINT_DEFAULT_1(hints[k].HintDescriptor)) { ++ start = 1.0f; ++ } else if (LADSPA_IS_HINT_DEFAULT_100(hints[k].HintDescriptor)) { ++ start = 100.0f; ++ } else if (LADSPA_IS_HINT_DEFAULT_440(hints[k].HintDescriptor)) { ++ start = 440.0f; ++ } else if (LADSPA_IS_HINT_INTEGER(hints[k].HintDescriptor)) { ++ start = min; ++ } else if (max >= 0.0f && min <= 0.0f) { ++ start = 0.0f; ++ } else { ++ start = min * 0.5f + max * 0.5f; ++ } ++ ++ if (instance->restored) { ++ start = instance->knobs[k]; ++ } else { ++ instance->knobs[k] = start; ++ } ++ adjustment = gtk_adjustment_new(start, min, max, step, step * 10.0, 0.0); ++ instance->adjustments[k] = GTK_ADJUSTMENT(adjustment); ++ widget = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), step, dp); ++ if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[k])) { ++ gtk_widget_set_sensitive(widget, FALSE); ++ } else { ++ g_signal_connect(adjustment, "value-changed", ++ G_CALLBACK(value_changed), &(instance->knobs[k])); ++ } ++ gtk_container_add(GTK_CONTAINER(hbox), widget); ++ widget = gtk_hscale_new(GTK_ADJUSTMENT(adjustment)); ++ gtk_scale_set_digits(GTK_SCALE(widget), dp); ++ if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[k])) { ++ gtk_widget_set_sensitive(widget, FALSE); + } +- G_UNLOCK(running_plugins); +- return TRUE; +-} +- +-static void draw_plugin(plugin_instance * instance) +-{ +- const LADSPA_Descriptor *plugin = instance->descriptor; +- const LADSPA_PortRangeHint *hints = plugin->PortRangeHints; +- LADSPA_Data fact, min, max, step, start; +- int dp; +- unsigned long k; +- gboolean no_ui = TRUE; +- GtkWidget *widget, *vbox, *hbox; +- GtkObject *adjustment; +- +- if (instance->window != NULL) +- { +- /* Just show window */ +- gtk_widget_show(instance->window); +- return; +- } +- +- instance->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); +- gtk_window_set_title(GTK_WINDOW(instance->window), plugin->Name); +- +- vbox = gtk_vbox_new(FALSE, 3); +- +- for (k = 0; k < MAX_KNOBS && k < plugin->PortCount; ++k) +- { +- if (!LADSPA_IS_PORT_CONTROL(plugin->PortDescriptors[k])) +- continue; +- no_ui = FALSE; +- hbox = gtk_hbox_new(FALSE, 3); +- widget = gtk_label_new(plugin->PortNames[k]); +- gtk_container_add(GTK_CONTAINER(hbox), widget); +- +- if (LADSPA_IS_HINT_TOGGLED(hints[k].HintDescriptor)) +- { +- widget = gtk_toggle_button_new_with_label("Press"); +- g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(toggled), &(instance->knobs[k])); +- gtk_container_add(GTK_CONTAINER(hbox), widget); +- gtk_container_add(GTK_CONTAINER(vbox), hbox); +- continue; +- } +- +- if (LADSPA_IS_HINT_SAMPLE_RATE(hints[k].HintDescriptor)) +- { +- fact = state.srate ? state.srate : 44100.0f; +- } +- else +- { +- fact = 1.0f; +- } +- +- if (LADSPA_IS_HINT_BOUNDED_BELOW(hints[k].HintDescriptor)) +- { +- min = hints[k].LowerBound * fact; +- } +- else +- { +- min = -10000.0f; +- } +- +- if (LADSPA_IS_HINT_BOUNDED_ABOVE(hints[k].HintDescriptor)) +- { +- max = hints[k].UpperBound * fact; +- } +- else +- { +- max = 10000.0f; +- } +- +- /* infinity */ +- if (10000.0f <= max - min) +- { +- dp = 1; +- step = 5.0f; +- +- /* 100.0 ... lots */ +- } +- else if (100.0f < max - min) +- { +- dp = 0; +- step = 5.0f; +- +- /* 10.0 ... 100.0 */ +- } +- else if (10.0f < max - min) +- { +- dp = 1; +- step = 0.5f; +- +- /* 1.0 ... 10.0 */ +- } +- else if (1.0f < max - min) +- { +- dp = 2; +- step = 0.05f; +- +- /* 0.0 ... 1.0 */ +- } +- else +- { +- dp = 3; +- step = 0.005f; +- } +- +- if (LADSPA_IS_HINT_INTEGER(hints[k].HintDescriptor)) +- { +- dp = 0; +- if (step < 1.0f) +- step = 1.0f; +- } +- +- if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hints[k].HintDescriptor)) +- { +- start = min; +- } +- else if (LADSPA_IS_HINT_DEFAULT_LOW(hints[k].HintDescriptor)) +- { +- start = min * 0.75f + max * 0.25f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hints[k].HintDescriptor)) +- { +- start = min * 0.5f + max * 0.5f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_HIGH(hints[k].HintDescriptor)) +- { +- start = min * 0.25f + max * 0.75f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hints[k].HintDescriptor)) +- { +- start = max; +- } +- else if (LADSPA_IS_HINT_DEFAULT_0(hints[k].HintDescriptor)) +- { +- start = 0.0f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_1(hints[k].HintDescriptor)) +- { +- start = 1.0f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_100(hints[k].HintDescriptor)) +- { +- start = 100.0f; +- } +- else if (LADSPA_IS_HINT_DEFAULT_440(hints[k].HintDescriptor)) +- { +- start = 440.0f; +- } +- else if (LADSPA_IS_HINT_INTEGER(hints[k].HintDescriptor)) +- { +- start = min; +- } +- else if (max >= 0.0f && min <= 0.0f) +- { +- start = 0.0f; +- } +- else +- { +- start = min * 0.5f + max * 0.5f; +- } ++ gtk_container_add(GTK_CONTAINER(hbox), widget); + +- if (instance->restored) +- { +- start = instance->knobs[k]; +- } +- else +- { +- instance->knobs[k] = start; +- } +- adjustment = gtk_adjustment_new(start, min, max, step, step * 10.0, 0.0); +- instance->adjustments[k] = GTK_ADJUSTMENT(adjustment); +- widget = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), step, dp); +- if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[k])) +- { +- gtk_widget_set_sensitive(widget, FALSE); +- } +- else +- { +- g_signal_connect(adjustment, "value-changed", G_CALLBACK(value_changed), &(instance->knobs[k])); +- } +- gtk_container_add(GTK_CONTAINER(hbox), widget); +- widget = gtk_hscale_new(GTK_ADJUSTMENT(adjustment)); +- gtk_scale_set_digits(GTK_SCALE(widget), dp); +- if (LADSPA_IS_PORT_OUTPUT(plugin->PortDescriptors[k])) +- { +- gtk_widget_set_sensitive(widget, FALSE); +- } +- gtk_container_add(GTK_CONTAINER(hbox), widget); ++ gtk_container_add(GTK_CONTAINER(vbox), hbox); ++ } + +- gtk_container_add(GTK_CONTAINER(vbox), hbox); +- } ++ if (no_ui) { ++ widget = gtk_label_new(_("This LADSPA plugin has no user controls")); ++ gtk_container_add(GTK_CONTAINER(vbox), widget); ++ } + +- if (no_ui) +- { +- widget = gtk_label_new(_("This LADSPA plugin has no user controls")); +- gtk_container_add(GTK_CONTAINER(vbox), widget); +- } ++ instance->timeout = gtk_timeout_add(100, update_instance, instance); + +- instance->timeout = gtk_timeout_add(100, update_instance, instance); ++ gtk_container_add(GTK_CONTAINER(instance->window), vbox); + +- gtk_container_add(GTK_CONTAINER(instance->window), vbox); +- +- g_signal_connect(G_OBJECT(instance->window), "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); +- gtk_widget_show_all(instance->window); ++ g_signal_connect (G_OBJECT (instance->window), "delete_event", ++ G_CALLBACK (gtk_widget_hide_on_delete), NULL); ++ gtk_widget_show_all(instance->window); + } + +-static void sort_column(GtkCList * clist, gint column, gpointer user_data) ++static void sort_column(GtkCList *clist, gint column, gpointer user_data) + { +- gtk_clist_set_sort_column(clist, column); +- gtk_clist_sort(clist); ++ gtk_clist_set_sort_column(clist, column); ++ gtk_clist_sort(clist); + } + +-static void unselect_instance(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data) ++static void unselect_instance(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data) + { +- selected_instance = NULL; ++ selected_instance= NULL; + } + +-static void select_instance(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data) ++static void select_instance(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data) + { +- selected_instance = (plugin_instance *) gtk_clist_get_row_data(clist, row); ++ selected_instance= (plugin_instance *) gtk_clist_get_row_data(clist, row); + } + +-static void reorder_instance(GtkCList * clist, gint from, gint to, gpointer user_data) ++static void reorder_instance(GtkCList *clist, gint from, gint to, ++ gpointer user_data) + { +- void *data; ++ void *data; + +- G_LOCK(running_plugins); +- data = g_slist_nth_data(running_plugins, from); +- running_plugins = g_slist_remove(running_plugins, data); +- running_plugins = g_slist_insert(running_plugins, data, to); +- G_UNLOCK(running_plugins); ++ G_LOCK (running_plugins); ++ data = g_slist_nth_data(running_plugins, from); ++ running_plugins= g_slist_remove(running_plugins, data); ++ running_plugins= g_slist_insert(running_plugins, data, to); ++ G_UNLOCK (running_plugins); + } + + static void make_run_clist(void) + { +- char *titles[1] = { _("Name") }; +- GSList *list; ++ char * titles[1] = { _("Name") }; ++ GSList *list; + +- run_clist = gtk_clist_new_with_titles(1, titles); +- gtk_clist_column_titles_passive(GTK_CLIST(run_clist)); +- gtk_clist_set_reorderable(GTK_CLIST(run_clist), TRUE); +- g_signal_connect(G_OBJECT(run_clist), "select-row", G_CALLBACK(select_instance), NULL); +- g_signal_connect(G_OBJECT(run_clist), "unselect-row", G_CALLBACK(unselect_instance), NULL); +- g_signal_connect(G_OBJECT(run_clist), "row-move", G_CALLBACK(reorder_instance), NULL); +- +- G_LOCK(running_plugins); +- for (list = running_plugins; list != NULL; list = g_slist_next(list)) +- { +- gint row; +- gchar *line[1]; +- plugin_instance *instance = (plugin_instance *) list->data; +- +- line[0] = (char *)instance->descriptor->Name; +- row = gtk_clist_append(GTK_CLIST(run_clist), line); +- gtk_clist_set_row_data(GTK_CLIST(run_clist), row, (gpointer) instance); +- gtk_clist_select_row(GTK_CLIST(run_clist), row, 0); +- } +- G_UNLOCK(running_plugins); ++ run_clist = gtk_clist_new_with_titles(1, titles); ++ gtk_clist_column_titles_passive(GTK_CLIST (run_clist)); ++ gtk_clist_set_reorderable(GTK_CLIST (run_clist), TRUE); ++ g_signal_connect(G_OBJECT(run_clist), "select-row", ++ G_CALLBACK(select_instance), NULL); ++ g_signal_connect(G_OBJECT(run_clist), "unselect-row", ++ G_CALLBACK(unselect_instance), NULL); ++ g_signal_connect(G_OBJECT(run_clist), "row-move", ++ G_CALLBACK(reorder_instance), NULL); ++ ++ G_LOCK (running_plugins); ++ for (list= running_plugins; list != NULL; list = g_slist_next(list)) { ++ gint row; ++ gchar *line[1]; ++ plugin_instance *instance = (plugin_instance *) list->data; ++ ++ line[0] = (char *) instance->descriptor->Name; ++ row = gtk_clist_append(GTK_CLIST (run_clist), line); ++ gtk_clist_set_row_data(GTK_CLIST (run_clist), row, (gpointer) instance); ++ gtk_clist_select_row(GTK_CLIST(run_clist), row, 0); ++ } ++ G_UNLOCK (running_plugins); + } + +-static plugin_instance *add_plugin(ladspa_plugin * plugin) ++static plugin_instance * add_plugin (ladspa_plugin *plugin) + { +- plugin_instance *instance; +- char *line[1]; +- gint row; ++ plugin_instance *instance; ++ char * line[1]; ++ gint row; + +- if (plugin == NULL) +- { +- return NULL; +- } ++ if (plugin == NULL) { ++ return NULL; ++ } + +- instance = load(plugin->filename, plugin->id); +- if (instance == NULL) +- { +- return NULL; +- } ++ instance = load(plugin->filename, plugin->id); ++ if (instance == NULL) { ++ return NULL; ++ } + +- instance->stereo = plugin->stereo; +- if (state.srate && state.running) +- { +- /* Jump right in */ +- boot_plugin(instance); +- } ++ instance->stereo = plugin->stereo; ++ if (state.srate && state.running) { ++ /* Jump right in */ ++ boot_plugin(instance); ++ } + +- if (run_clist) +- { +- line[0] = (char *)instance->descriptor->Name; +- row = gtk_clist_append(GTK_CLIST(run_clist), line); +- gtk_clist_set_row_data(GTK_CLIST(run_clist), row, (gpointer) instance); +- gtk_clist_select_row(GTK_CLIST(run_clist), row, 0); +- draw_plugin(instance); +- } +- G_LOCK(running_plugins); +- running_plugins = g_slist_append(running_plugins, instance); +- G_UNLOCK(running_plugins); ++ if (run_clist) { ++ line[0] = (char *) instance->descriptor->Name; ++ row = gtk_clist_append(GTK_CLIST (run_clist), line); ++ gtk_clist_set_row_data(GTK_CLIST (run_clist), row, (gpointer) instance); ++ gtk_clist_select_row(GTK_CLIST(run_clist), row, 0); ++ draw_plugin(instance); ++ } ++ G_LOCK (running_plugins); ++ running_plugins = g_slist_append(running_plugins, instance); ++ G_UNLOCK (running_plugins); + +- return instance; ++ return instance; + } + + +-static void unselect_plugin(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data) ++static void unselect_plugin(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data) + { +- selected_plugin = NULL; ++ selected_plugin= NULL; + } + +-static void select_plugin(GtkCList * clist, gint row, gint column, GdkEventButton * event, gpointer user_data) ++static void select_plugin(GtkCList *clist, gint row, gint column, ++ GdkEventButton *event, gpointer user_data) + { +- selected_plugin = (ladspa_plugin *) gtk_clist_get_row_data(clist, row); +- gtk_clist_unselect_all(GTK_CLIST(run_clist)); +- if (event->type == GDK_2BUTTON_PRESS) +- { +- /* Double click */ +- add_plugin(selected_plugin); +- } ++ selected_plugin = (ladspa_plugin *) gtk_clist_get_row_data(clist, row); ++ gtk_clist_unselect_all(GTK_CLIST(run_clist)); ++ if (event->type == GDK_2BUTTON_PRESS) { ++ /* Double click */ ++ add_plugin(selected_plugin); ++ } + } + +-static GtkWidget *make_plugin_clist(void) ++static GtkWidget * make_plugin_clist(void) + { +- ladspa_plugin *plugin; +- GSList *list; +- GtkWidget *clist; +- char number[14]; +- char *titles[2] = { _("UID"), _("Name") }; +- char *line[2]; +- gint row; ++ ladspa_plugin *plugin; ++ GSList *list; ++ GtkWidget *clist; ++ char number[14]; ++ char * titles[2] = { _("UID"), _("Name") }; ++ char * line[2]; ++ gint row; + +- find_all_plugins(); ++ find_all_plugins(); + +- clist = gtk_clist_new_with_titles(2, titles); +- gtk_clist_column_titles_active(GTK_CLIST(clist)); +- gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE); +- gtk_clist_set_sort_column(GTK_CLIST(clist), 1); +- +- for (list = plugin_list; list != NULL; list = g_slist_next(list)) +- { +- plugin = (ladspa_plugin *) list->data; +- snprintf(number, sizeof(number), "%ld", plugin->unique_id); +- line[0] = number; +- line[1] = plugin->name; +- row = gtk_clist_append(GTK_CLIST(clist), line); +- gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer) plugin); +- } +- gtk_clist_sort(GTK_CLIST(clist)); +- +- g_signal_connect(G_OBJECT(clist), "click-column", G_CALLBACK(sort_column), NULL); +- g_signal_connect(G_OBJECT(clist), "select-row", G_CALLBACK(select_plugin), NULL); +- g_signal_connect(G_OBJECT(clist), "unselect-row", G_CALLBACK(unselect_plugin), NULL); ++ clist = gtk_clist_new_with_titles(2, titles); ++ gtk_clist_column_titles_active(GTK_CLIST (clist)); ++ gtk_clist_set_column_auto_resize (GTK_CLIST (clist), 0, TRUE); ++ gtk_clist_set_sort_column(GTK_CLIST (clist), 1); + +- return clist; +-} ++ for (list= plugin_list; list != NULL; list = g_slist_next(list)) { ++ plugin = (ladspa_plugin *) list->data; ++ snprintf(number, sizeof(number), "%ld", plugin->unique_id); ++ line[0] = number; ++ line[1] = plugin->name; ++ row = gtk_clist_append(GTK_CLIST (clist), line); ++ gtk_clist_set_row_data(GTK_CLIST (clist), row, (gpointer) plugin); ++ } ++ gtk_clist_sort(GTK_CLIST (clist)); + +-static void add_plugin_clicked(GtkButton * button, gpointer user_data) +-{ +- add_plugin(selected_plugin); ++ g_signal_connect(G_OBJECT(clist), "click-column", ++ G_CALLBACK(sort_column), NULL); ++ g_signal_connect(G_OBJECT(clist), "select-row", ++ G_CALLBACK(select_plugin), NULL); ++ g_signal_connect(G_OBJECT(clist), "unselect-row", ++ G_CALLBACK(unselect_plugin), NULL); ++ ++ return clist; + } + +-static void remove_plugin_clicked(GtkButton * button, gpointer user_data) ++static void add_plugin_clicked (GtkButton *button, gpointer user_data) + { +- plugin_instance *instance = selected_instance; +- gint row; +- +- if (instance == NULL) +- { +- return; +- } +- row = gtk_clist_find_row_from_data(GTK_CLIST(run_clist), (gpointer) instance); +- gtk_clist_remove(GTK_CLIST(run_clist), row); +- +- G_LOCK(running_plugins); +- running_plugins = g_slist_remove(running_plugins, instance); +- unload(instance); +- G_UNLOCK(running_plugins); +- selected_instance = NULL; ++ add_plugin(selected_plugin); + } + +-static void configure_plugin_clicked(GtkButton * button, gpointer user_data) ++static void remove_plugin_clicked (GtkButton *button, gpointer user_data) + { +- if (selected_instance) +- { +- draw_plugin(selected_instance); +- } ++ plugin_instance *instance = selected_instance; ++ gint row; ++ ++ if (instance == NULL) { ++ return; ++ } ++ row = gtk_clist_find_row_from_data(GTK_CLIST(run_clist), (gpointer) instance); ++ gtk_clist_remove(GTK_CLIST(run_clist), row); ++ ++ G_LOCK (running_plugins); ++ running_plugins = g_slist_remove(running_plugins, instance); ++ unload(instance); ++ G_UNLOCK (running_plugins); ++ selected_instance= NULL; ++} ++ ++static void configure_plugin_clicked (GtkButton *button, gpointer user_data) ++{ ++ if (selected_instance) { ++ draw_plugin(selected_instance); ++ } + } + + static void configure(void) + { +- GtkWidget *widget, *vbox, *hbox, *bbox, *frame; ++ GtkWidget *widget, *vbox, *hbox, *bbox, *frame; + +- if (config_window) +- { +- /* just show the window */ +- gtk_widget_show(config_window); +- return; +- } +- +- config_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); +- vbox = gtk_vbox_new(FALSE, 0); +- hbox = gtk_hbox_new(TRUE, 0); +- +- frame = gtk_frame_new(_("Installed plugins")); +- widget = gtk_scrolled_window_new(NULL, NULL); +- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); +- gtk_container_add(GTK_CONTAINER(widget), make_plugin_clist()); +- gtk_container_add(GTK_CONTAINER(frame), widget); +- gtk_container_add(GTK_CONTAINER(hbox), frame); +- +- +- frame = gtk_frame_new(_("Running plugins")); +- widget = gtk_scrolled_window_new(NULL, NULL); +- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); +- if (run_clist == NULL) +- { +- make_run_clist(); +- } +- gtk_container_add(GTK_CONTAINER(widget), run_clist); +- gtk_container_add(GTK_CONTAINER(frame), widget); +- gtk_container_add(GTK_CONTAINER(hbox), frame); +- gtk_container_add(GTK_CONTAINER(vbox), hbox); ++ if (config_window) { ++ /* just show the window */ ++ gtk_widget_show(config_window); ++ return; ++ } + +- /* Buttons */ +- bbox = gtk_hbutton_box_new(); +- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD); +- widget = gtk_button_new_with_label(_("Add")); +- g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(add_plugin_clicked), NULL); +- gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); +- widget = gtk_button_new_with_label(_("Remove")); +- g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remove_plugin_clicked), NULL); +- gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); +- widget = gtk_button_new_with_label(_("Configure")); +- g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(configure_plugin_clicked), NULL); +- gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); +- +- gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); +- +- gtk_container_add(GTK_CONTAINER(config_window), vbox); +- +- gtk_window_set_title(GTK_WINDOW(config_window), _("LADSPA Plugin Catalog")); +- gtk_widget_set_usize(config_window, 380, 400); +- g_signal_connect(G_OBJECT(config_window), "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); ++ config_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ vbox= gtk_vbox_new(FALSE, 0); ++ hbox= gtk_hbox_new(TRUE, 0); ++ ++ frame= gtk_frame_new(_("Installed plugins")); ++ widget = gtk_scrolled_window_new(NULL, NULL); ++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), ++ GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); ++ gtk_container_add(GTK_CONTAINER(widget), make_plugin_clist()); ++ gtk_container_add(GTK_CONTAINER(frame), widget); ++ gtk_container_add(GTK_CONTAINER(hbox), frame); ++ ++ ++ frame= gtk_frame_new(_("Running plugins")); ++ widget = gtk_scrolled_window_new(NULL, NULL); ++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), ++ GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); ++ if (run_clist == NULL) { ++ make_run_clist(); ++ } ++ gtk_container_add(GTK_CONTAINER(widget), run_clist); ++ gtk_container_add(GTK_CONTAINER(frame), widget); ++ gtk_container_add(GTK_CONTAINER(hbox), frame); ++ gtk_container_add(GTK_CONTAINER(vbox), hbox); ++ ++ /* Buttons */ ++ bbox = gtk_hbutton_box_new(); ++ gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD); ++ widget = gtk_button_new_with_label(_("Add")); ++ g_signal_connect(G_OBJECT(widget), "clicked", ++ G_CALLBACK(add_plugin_clicked), NULL); ++ gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); ++ widget = gtk_button_new_with_label(_("Remove")); ++ g_signal_connect(G_OBJECT(widget), "clicked", ++ G_CALLBACK(remove_plugin_clicked), NULL); ++ gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); ++ widget = gtk_button_new_with_label(_("Configure")); ++ g_signal_connect(G_OBJECT(widget), "clicked", ++ G_CALLBACK(configure_plugin_clicked), NULL); ++ gtk_box_pack_end_defaults(GTK_BOX(bbox), widget); ++ ++ gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); ++ ++ gtk_container_add(GTK_CONTAINER(config_window), vbox); ++ ++ gtk_window_set_title(GTK_WINDOW(config_window), _("LADSPA Plugin Catalog")); ++ gtk_widget_set_usize(config_window, 380, 400); ++ g_signal_connect (G_OBJECT (config_window), "delete_event", ++ G_CALLBACK (gtk_widget_hide_on_delete), NULL); + +- gtk_widget_show_all(config_window); ++ gtk_widget_show_all(config_window); + } diff --git a/audacious-plugins.spec b/audacious-plugins.spec index 56f0832..627073f 100644 --- a/audacious-plugins.spec +++ b/audacious-plugins.spec @@ -1,6 +1,3 @@ -# TODO: -# - merge patches 10,11,12 from 2.1-13 - # Minimum audacious/audacious-plugins version in inter-package # dependencies. # We need 2.2 as 2.1 is insufficient. @@ -8,7 +5,7 @@ Name: audacious-plugins Version: 2.2 -Release: 0.4.beta1%{?dist} +Release: 0.4.beta2%{?dist} Summary: Plugins for the Audacious media player Group: Applications/Multimedia URL: http://audacious-media-player.org/ @@ -19,19 +16,13 @@ URL: http://audacious-media-player.org/ License: GPLv2 and GPLv2+ and LGPLv2+ and MIT and BSD # Modified source tarball to remove problematic files. -# Removed: aac alc demac tta wma -# Not removed (no codec included): madplug mms +# Removed: aac madplug # Disabled via options where possible, see %%build. -Source0: audacious-plugins-fedora-%{version}-beta1.tar.bz2 +Source0: audacious-plugins-fedora-%{version}-beta2.tar.bz2 #Source0: http://distfiles.atheme.org/audacious-plugins-%{version}.tgz Patch2: audacious-plugins-2.0.1-xmms-skindir.patch -# merged upstream -Patch3: audacious-plugins-2.2-beta1-pulseaudio.patch -# merged upstream -Patch4: audacious-plugins-2.2-beta1-modplug.patch -# merged upstream -Patch5: audacious-plugins-2.2-beta1-filewriter-dialogs.patch +Patch12: audacious-plugins-2.2-ladspa-backto201.patch BuildRequires: audacious-devel >= %{aud_ver} BuildRequires: jack-audio-connection-kit-devel libsamplerate-devel @@ -151,12 +142,10 @@ vortex compressed files. %prep #setup -q -n audacious-plugins-fedora-%{version} -%setup -q -n audacious-plugins-fedora-%{version}-beta1 +%setup -q -n audacious-plugins-fedora-%{version}-beta2 %patch2 -p1 -b .xmms-skindir -%patch3 -p1 -b .add-pulseaudio -%patch4 -p1 -b .modplug -%patch5 -p1 -b .filewriter-dialogs +%patch12 -p1 -b .ladspa sed -i '\,^.SILENT:,d' buildsys.mk.in @@ -239,6 +228,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Nov 10 2009 Michael Schwendt - 2.2-0.4.beta2 +- Upgrade to 2.2-beta2 +- Add patch to use old/working ladspa plugin from 2.0.1 (#533641). + * Fri Oct 30 2009 Michael Schwendt - 2.2-0.4.beta1 - Fix non-top-level filewriter plugin dialogs. diff --git a/sources b/sources index 9ee5de8..ba51e76 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -97dff09ad6a5735cb5d42a5e4b26fee6 audacious-plugins-fedora-2.2-beta1.tar.bz2 +0614404820605ecdd79101e3e2e5044d audacious-plugins-fedora-2.2-beta2.tar.bz2