summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp3
-rw-r--r--src/AlsaDriver.h1
-rw-r--r--src/LashDriver.cpp79
-rw-r--r--src/Makefile.am6
-rw-r--r--src/Patchage.cpp6
-rw-r--r--src/PatchageFlowCanvas.cpp7
-rw-r--r--src/PatchageFlowCanvas.h8
-rw-r--r--src/PatchageModule.h2
-rw-r--r--src/PatchagePort.h13
-rw-r--r--src/main.cpp6
-rw-r--r--src/patchage.glade25
11 files changed, 109 insertions, 47 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index ef2428a..84c2bbc 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -17,8 +17,6 @@
#include <string>
#include <iostream>
#include <cassert>
-#include <sys/poll.h>
-#include <errno.h>
#include "PatchageFlowCanvas.h"
#include "AlsaDriver.h"
#include "Patchage.h"
@@ -525,3 +523,4 @@ AlsaDriver::m_refresh_main()
}
}
}
+
diff --git a/src/AlsaDriver.h b/src/AlsaDriver.h
index 86efce3..daafbdd 100644
--- a/src/AlsaDriver.h
+++ b/src/AlsaDriver.h
@@ -71,5 +71,4 @@ private:
pthread_t m_refresh_thread;
};
-
#endif // ALSADRIVER_H
diff --git a/src/LashDriver.cpp b/src/LashDriver.cpp
index ee92176..759c718 100644
--- a/src/LashDriver.cpp
+++ b/src/LashDriver.cpp
@@ -48,16 +48,16 @@ LashDriver::attach(bool launch_daemon)
if (m_client)
return;
- int lash_flags = LASH_Config_File;
+ int lash_flags = LASH_Server_Interface | LASH_Config_File;
if (!launch_daemon)
lash_flags |= LASH_No_Start_Server;
m_client = lash_init(m_args, PACKAGE_NAME, lash_flags, LASH_PROTOCOL(2, 0));
- if (m_client == NULL) {
+ if (!m_client) {
m_app->status_message("[LASH] Unable to attach to server");
} else {
- lash_event_t* event = lash_event_new_with_type(LASH_Client_Name);
- lash_event_set_string(event, "Patchage");
- lash_send_event(m_client, event);
+ //lash_event_t* event = lash_event_new_with_type(LASH_Client_Name);
+ //lash_event_set_string(event, "Patchage");
+ //lash_send_event(m_client, event);
signal_attached.emit();
m_app->status_message("[LASH] Attached");
}
@@ -100,27 +100,72 @@ LashDriver::handle_event(lash_event_t* ev)
const char* c_str = lash_event_get_string(ev);
string str = (c_str == NULL) ? "" : c_str;
- //cout << "[LashDriver] LASH Event. Type = " << type << ", string = " << str << "**********" << endl;
+ cout << "[LashDriver] LASH Event. Type = " << (unsigned int)type << ", string = " << str << "**********" << endl;
- if (type == LASH_Save_File) {
- //cout << "[LashDriver] LASH Save File - " << str << endl;
+ switch (type) {
+ case LASH_Project_Add:
+ cerr << "LASH project add\n";
+ break;
+ case LASH_Project_Remove:
+ cerr << "LASH remove\n";
+ break;
+ case LASH_Project_Dir:
+ cerr << "LASH project dir\n";
+ break;
+ case LASH_Project_Name:
+ cerr << "LASH project name\n";
+ break;
+ case LASH_Client_Add:
+ cerr << "LASH client add\n";
+ break;
+ case LASH_Client_Name:
+ cerr << "LASH client name\n";
+ break;
+ case LASH_Jack_Client_Name:
+ cerr << "LASH jack client name\n";
+ break;
+ case LASH_Alsa_Client_ID:
+ cerr << "LASH alsa client id\n";
+ break;
+ case LASH_Percentage:
+ cerr << "LASH percentage\n";
+ break;
+ case LASH_Save:
+ cerr << "LASH save\n";
+ break;
+ case LASH_Restore_Data_Set:
+ cerr << "LASH restore data set\n";
+ break;
+ case LASH_Server_Lost:
+ cerr << "LASH server lost\n";
+ break;
+ case LASH_Client_Remove:
+ cerr << "LASH client remove\n";
+ break;
+ case LASH_Save_File:
+ cout << "[LashDriver] LASH Save File - " << str << endl;
m_app->store_window_location();
m_app->state_manager()->save(str.append("/locations"));
lash_send_event(m_client, lash_event_new_with_type(LASH_Save_File));
- } else if (type == LASH_Restore_File) {
- //cout << "[LashDriver] LASH Restore File - " << str << endl;
+ break;
+
+ case LASH_Restore_File:
+ cout << "[LashDriver] LASH Restore File - " << str << endl;
m_app->state_manager()->load(str.append("/locations"));
m_app->update_state();
lash_send_event(m_client, lash_event_new_with_type(LASH_Restore_File));
- } else if (type == LASH_Save_Data_Set) {
- //cout << "[LashDriver] LASH Save Data Set - " << endl;
-
- // Tell LASH we're done
+ break;
+
+ case LASH_Save_Data_Set:
+ cout << "[LashDriver] LASH Save Data Set - " << endl;
lash_send_event(m_client, lash_event_new_with_type(LASH_Save_Data_Set));
- } else if (type == LASH_Quit) {
- //stop_thread();
+ break;
+
+ case LASH_Quit:
+ cout << "[LashDriver] Quit" << endl;
m_client = NULL;
m_app->quit();
+ break;
}
}
@@ -132,7 +177,7 @@ LashDriver::handle_config(lash_config_t* conf)
const void* val = NULL;
size_t val_size = 0;
- //cout << "[LashDriver] LASH Config. Key = " << key << endl;
+ cout << "[LashDriver] LASH Config. Key = " << key << endl;
key = lash_config_get_key(conf);
val = lash_config_get_value(conf);
diff --git a/src/Makefile.am b/src/Makefile.am
index 320d81a..8a63179 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,11 +22,13 @@ patchage_SOURCES = \
Driver.h \
JackDriver.h \
JackDriver.cpp \
- AlsaDriver.h \
- AlsaDriver.cpp \
PatchageFlowCanvas.h \
PatchageFlowCanvas.cpp
if WITH_LASH
patchage_SOURCES += LashDriver.h LashDriver.cpp
endif
+
+if WITH_ALSA
+patchage_SOURCES += AlsaDriver.h AlsaDriver.cpp
+endif
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 02fdd5b..b11b255 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -153,8 +153,10 @@ Patchage::Patchage(int argc, char** argv)
m_menu_lash_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_connect));
m_menu_lash_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_lash_disconnect));
#endif
+#ifdef HAVE_ALSA
m_menu_alsa_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_alsa_connect));
m_menu_alsa_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_alsa_disconnect));
+#endif
m_menu_store_positions->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_store_positions));
m_menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_file_quit));
m_menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_view_refresh));
@@ -339,7 +341,8 @@ Patchage::attach_menu_items()
sigc::mem_fun(m_menu_jack_connect, &Gtk::MenuItem::set_sensitive), true));
m_jack_driver->signal_detached.connect(sigc::bind(
sigc::mem_fun(m_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), false));
-
+
+#ifdef HAVE_ALSA
m_alsa_driver->signal_attached.connect(sigc::bind(
sigc::mem_fun(m_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), false));
m_alsa_driver->signal_attached.connect(sigc::bind(
@@ -349,6 +352,7 @@ Patchage::attach_menu_items()
sigc::mem_fun(m_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), true));
m_alsa_driver->signal_detached.connect(sigc::bind(
sigc::mem_fun(m_menu_alsa_disconnect, &Gtk::MenuItem::set_sensitive), false));
+#endif
}
diff --git a/src/PatchageFlowCanvas.cpp b/src/PatchageFlowCanvas.cpp
index 7485b6e..5cf4c35 100644
--- a/src/PatchageFlowCanvas.cpp
+++ b/src/PatchageFlowCanvas.cpp
@@ -43,6 +43,7 @@ PatchageFlowCanvas::find_module(const string& name, ModuleType type)
}
+#ifdef HAVE_ALSA
boost::shared_ptr<PatchagePort>
PatchageFlowCanvas::find_port(const snd_seq_addr_t* alsa_addr)
{
@@ -59,7 +60,7 @@ PatchageFlowCanvas::find_port(const snd_seq_addr_t* alsa_addr)
return boost::shared_ptr<PatchagePort>();
}
-
+#endif
void
PatchageFlowCanvas::connect(boost::shared_ptr<Port> port1, boost::shared_ptr<Port> port2)
@@ -72,8 +73,10 @@ PatchageFlowCanvas::connect(boost::shared_ptr<Port> port1, boost::shared_ptr<Por
if (p1->type() == JACK_AUDIO && p2->type() == JACK_AUDIO
|| (p1->type() == JACK_MIDI && p2->type() == JACK_MIDI))
m_app->jack_driver()->connect(p1, p2);
+#ifdef HAVE_ALSA
else if (p1->type() == ALSA_MIDI && p2->type() == ALSA_MIDI)
m_app->alsa_driver()->connect(p1, p2);
+#endif
else
status_message("WARNING: Cannot make connection, incompatible port types.");
}
@@ -101,8 +104,10 @@ PatchageFlowCanvas::disconnect(boost::shared_ptr<Port> port1, boost::shared_ptr<
if (input->type() == JACK_AUDIO && output->type() == JACK_AUDIO
|| input->type() == JACK_MIDI && output->type() == JACK_MIDI)
m_app->jack_driver()->disconnect(output, input);
+#ifdef HAVE_ALSA
else if (input->type() == ALSA_MIDI && output->type() == ALSA_MIDI)
m_app->alsa_driver()->disconnect(output, input);
+#endif
else
status_message("ERROR: Attempt to disconnect ports with mismatched types");
}
diff --git a/src/PatchageFlowCanvas.h b/src/PatchageFlowCanvas.h
index a99d658..6af51f7 100644
--- a/src/PatchageFlowCanvas.h
+++ b/src/PatchageFlowCanvas.h
@@ -18,9 +18,14 @@
#define PATCHAGEPATCHBAYAREA_H
#include <string>
+#ifdef HAVE_ALSA
#include <alsa/asoundlib.h>
+#endif
#include <flowcanvas/FlowCanvas.h>
#include "StateManager.h"
+
+
+
class Patchage;
class PatchageModule;
class PatchagePort;
@@ -34,8 +39,9 @@ public:
PatchageFlowCanvas(Patchage* m_app, int width, int height);
boost::shared_ptr<PatchageModule> find_module(const string& name, ModuleType type);
+#ifdef HAVE_ALSA
boost::shared_ptr<PatchagePort> find_port(const snd_seq_addr_t* alsa_addr);
-
+#endif
void connect(boost::shared_ptr<Port> port1, boost::shared_ptr<Port> port2);
void disconnect(boost::shared_ptr<Port> port1, boost::shared_ptr<Port> port2);
diff --git a/src/PatchageModule.h b/src/PatchageModule.h
index f58948d..e047c52 100644
--- a/src/PatchageModule.h
+++ b/src/PatchageModule.h
@@ -20,7 +20,9 @@
#include <string>
#include <libgnomecanvasmm.h>
+#ifdef HAVE_ALSA
#include <alsa/asoundlib.h>
+#endif
#include <flowcanvas/FlowCanvas.h>
#include <flowcanvas/Module.h>
#include "PatchageFlowCanvas.h"
diff --git a/src/PatchagePort.h b/src/PatchagePort.h
index ec069a3..13c51a8 100644
--- a/src/PatchagePort.h
+++ b/src/PatchagePort.h
@@ -17,13 +17,17 @@
#ifndef PATCHAGEPORT_H
#define PATCHAGEPORT_H
+#include "config.h"
#include <string>
#include <list>
-#include <alsa/asoundlib.h>
#include <flowcanvas/Port.h>
#include <flowcanvas/Module.h>
#include <boost/shared_ptr.hpp>
+#ifdef HAVE_ALSA
+#include <alsa/asoundlib.h>
+#endif
+
using namespace LibFlowCanvas;
using std::string; using std::list;
@@ -41,24 +45,29 @@ public:
: Port(module, name, is_input, color),
m_type(type)
{
+#ifdef HAVE_ALSA
m_alsa_addr.client = '\0';
m_alsa_addr.port = '\0';
+#endif
}
virtual ~PatchagePort() {}
+#ifdef HAVE_ALSA
// FIXME: This driver specific crap really needs to go
void alsa_addr(const snd_seq_addr_t addr) { m_alsa_addr = addr; }
const snd_seq_addr_t* alsa_addr() const
{ return (m_type == ALSA_MIDI) ? &m_alsa_addr : NULL; }
-
+#endif
/** Returns the full name of this port, as "modulename:portname" */
string full_name() const { return m_module.lock()->name() + ":" + m_name; }
PortType type() const { return m_type; }
private:
+#ifdef HAVE_ALSA
snd_seq_addr_t m_alsa_addr;
+#endif
PortType m_type;
};
diff --git a/src/main.cpp b/src/main.cpp
index a2da0ef..851d88f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,12 +30,6 @@ int main(int argc, char** argv)
{
try {
- //lash_args_t* const lash_args = lash_extract_args(&argc, &argv);
-
- //lash_client_t* const lash_server_client = lash_init(lash_args, "Patchage Server Interface",
- // LASH_Server_Interface, LASH_PROTOCOL(2, 0));
-
-
Gnome::Canvas::init();
Gtk::Main app(argc, argv);
diff --git a/src/patchage.glade b/src/patchage.glade
index f6dada3..85d8eba 100644
--- a/src/patchage.glade
+++ b/src/patchage.glade
@@ -241,6 +241,7 @@
<child>
<widget class="GtkImageMenuItem" id="disconnect_from_jack_menuitem">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="label" translatable="yes">Disconnect from JACK</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_disconnect_from_jack1_activate" last_modification_time="Sun, 21 May 2006 23:48:26 GMT"/>
@@ -291,6 +292,7 @@
<child>
<widget class="GtkImageMenuItem" id="disconnect_from_alsa_menuitem">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="label" translatable="yes">Disconnect from ALSA</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_disconnect_from_alsa_menuitem_activate" last_modification_time="Mon, 22 May 2006 00:10:31 GMT"/>
@@ -363,6 +365,7 @@
<child>
<widget class="GtkImageMenuItem" id="disconnect_from_lash_menuitem">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="label" translatable="yes">Disconnect from LASH</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_disconnect_from_lash1_activate" last_modification_time="Mon, 22 May 2006 01:14:33 GMT"/>
@@ -479,6 +482,7 @@
<child>
<widget class="GtkButton" id="rewind_but">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
@@ -513,6 +517,7 @@
<child>
<widget class="GtkButton" id="play_but">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
@@ -547,6 +552,7 @@
<child>
<widget class="GtkButton" id="stop_but">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
@@ -573,20 +579,8 @@
</child>
<child>
- <widget class="GtkSeparatorToolItem" id="separatortoolitem3">
- <property name="visible">True</property>
- <property name="draw">True</property>
- <property name="visible_horizontal">True</property>
- <property name="visible_vertical">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkToolItem" id="toolitem14">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
@@ -636,6 +630,7 @@
<child>
<widget class="GtkButton" id="zoom_normal_but">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
@@ -670,6 +665,7 @@
<child>
<widget class="GtkButton" id="zoom_full_but">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
@@ -697,6 +693,7 @@
<child>
<widget class="GtkToolItem" id="toolitem1">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
@@ -704,7 +701,7 @@
<child>
<widget class="GtkHScale" id="zoom_scale">
- <property name="width_request">200</property>
+ <property name="width_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="draw_value">False</property>