--- /tmp/specimen-devel/src/midi.h	2005-07-08 06:25:08.000000000 +0200
+++ ./midi.h	2006-06-08 03:56:47.000000000 +0200
@@ -13,4 +13,6 @@
 int  midi_start ( );
 void midi_stop  ( );
 
+extern int client_id;
+
 #endif /* __MIDI_H__ */
--- /tmp/specimen-devel/src/midi.c	2005-09-15 02:56:41.000000000 +0200
+++ ./midi.c	2006-06-08 03:56:47.000000000 +0200
@@ -14,6 +14,8 @@
 static Atomic    running = 0;
 static pthread_t midi_thread;
 
+int client_id = 0;
+
 /* work out the current bpm from the midi queue. */
 static float calc_bpm (snd_seq_t* handle, int q)
 {
@@ -139,6 +141,8 @@
 	  return MIDI_ERR_SEQ;
      }
 
+     client_id = snd_seq_client_id (*handle);
+
      snd_seq_set_client_name (*handle, "specimen");
      if ((portid = snd_seq_create_simple_port (*handle, "Specimen Sampler",
 					       SND_SEQ_PORT_CAP_WRITE |
--- /tmp/specimen-devel/src/specimen.c	2005-07-26 16:14:33.000000000 +0200
+++ ./specimen.c	2006-06-08 03:56:47.000000000 +0200
@@ -1,5 +1,6 @@
 #include <pthread.h>
 #include <gtk/gtk.h>
+#include <stdio.h>
 #include "specimen.h"
 #include "gui/gui.h"
 #include "midi.h"
@@ -9,8 +10,62 @@
 #include "mixer.h"
 #include "beef.h"
 
+#define HAVE_LASH 
+
+#ifdef HAVE_LASH
+#include <lash/lash.h>
+#endif
+
+#ifdef HAVE_LASH
+lash_client_t *lash_client;
+
+int handle_lash_events() 
+{
+     lash_event_t *event;
+     char filename[1024];
+
+     while ((event = lash_get_event (lash_client)))
+     {
+         switch (lash_event_get_type (event))
+         {
+             case LASH_Save_File:
+                 snprintf (filename, 1023, "%s/beef", lash_event_get_string (event));
+                 beef_write (filename);
+                 lash_send_event (lash_client, event); 
+             break;
+
+             case LASH_Quit:
+                 gtk_main_quit ();
+             break;
+
+             case LASH_Restore_File:
+                 snprintf (filename, 1023, "%s/beef", lash_event_get_string (event));
+                 beef_read (filename);
+                 lash_send_event (lash_client, event);
+                 gui_refresh ();
+             break;
+ 
+             default:
+             break;
+          }
+     }
+     return 1;
+}
+#endif
+
 int main(int argc, char *argv[])
 {
+#ifdef HAVE_LASH
+     int timer_id;
+     lash_event_t *event;
+
+     lash_client = lash_init (lash_extract_args (&argc,  &argv), PACKAGE_NAME, LASH_Config_File, LASH_PROTOCOL (2,0));
+     if (!lash_client)
+     {
+         debug("Could not become LASH client. LASH support disabled\n");
+     }
+#endif
+
      gtk_init(&argc, &argv);
 
      /* constructors */
@@ -20,7 +75,7 @@
      patch_init();
      gui_init();
 
-	 /* load a bank if specified on cmdline */
+      /* load a bank if specified on cmdline */
      if (argc >= 2)
      {
 	 beef_read(argv[1]);
@@ -30,6 +85,21 @@
      /* start */
      midi_start();
      driver_start(0);
+
+#ifdef HAVE_LASH
+     event = lash_event_new_with_type (LASH_Client_Name);
+     lash_event_set_string (event, "Specimen");
+     lash_send_event (lash_client, event);
+
+     event = lash_event_new_with_type (LASH_Jack_Client_Name);
+     lash_event_set_string (event, "specimen");
+     lash_send_event (lash_client, event);
+
+     lash_alsa_client_id (lash_client, client_id);
+
+     timer_id = g_timeout_add (200, handle_lash_events, NULL);
+#endif
+
      gtk_main();
 
      /* stop */
--- /tmp/specimen-devel/src/specimen.h	2005-06-04 17:09:59.000000000 +0200
+++ ./specimen.h	2006-06-08 03:56:47.000000000 +0200
@@ -14,7 +14,7 @@
     FUBAR = -69,
 };
 
-#define DEFAULT_VOLUME 0.7 /* default volume stuff is set to, from 0 to 1 */
+#define DEFAULT_VOLUME 1.0 /* default volume stuff is set to, from 0 to 1 */
 
 #ifndef PIXMAPSDIR
 # define PIXMAPSDIR "./"
--- /tmp/specimen-devel/src/Makefile	2006-06-08 03:59:01.000000000 +0200
+++ ./Makefile	2006-06-08 03:56:47.000000000 +0200
@@ -89,7 +89,7 @@
 AWK = mawk
 CC = gcc
 CCDEPMODE = depmode=gcc3
-CFLAGS = -O3 -DORBIT2=1 -pthread -I/usr/local/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/libart-2.0 -I/usr/include/freetype2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/gconf/2 -I/usr/include/libbonoboui-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gnome-keyring-1 -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr//include -I/usr/include/alsa   -pthread -DPIXMAPSDIR=\"$(pkgdatadir)/pixmaps/\" -Wall -Werror
+CFLAGS = -O3 -DORBIT2=1 -pthread -I/usr/local/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/libart-2.0 -I/usr/include/freetype2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/gconf/2 -I/usr/include/libbonoboui-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gnome-keyring-1 -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr//include -I/usr/include/alsa -I/usr/local/include/lash-1.0  -pthread -DPIXMAPSDIR=\"$(pkgdatadir)/pixmaps/\" -Wall -Werror
 CPP = gcc -E
 CPPFLAGS = 
 CYGPATH_W = echo
@@ -106,7 +106,7 @@
 INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
 LDFLAGS = 
 LIBOBJS = 
-LIBS =  -pthread -L/usr/local/lib -L/usr//lib -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-keyring -lxml2 -lz -lgnome-2 -lpopt -lgnomevfs-2 -lbonobo-2 -lgconf-2 -lbonobo-activation -lORBit-2 -lgthread-2.0 -ljack -lasound -lpthread -lsamplerate -lsndfile -lphat -lgnomecanvas-2 -lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   
+LIBS =  -pthread -L/usr/local/lib -L/usr//lib -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-keyring -lxml2 -lz -lgnome-2 -lpopt -lgnomevfs-2 -lbonobo-2 -lgconf-2 -lbonobo-activation -lORBit-2 -lgthread-2.0 -ljack -lasound -lpthread -lsamplerate -lsndfile -lphat -lgnomecanvas-2 -lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0  -llash 
 LTLIBOBJS = 
 MAKEINFO = ${SHELL} /tmp/specimen-devel/missing --run makeinfo
 OBJEXT = o
