summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/JackDriver.cpp18
-rw-r--r--src/JackDriver.h17
-rw-r--r--src/Patchage.cpp11
-rw-r--r--src/Patchage.h3
-rw-r--r--src/patchage.glade157
5 files changed, 204 insertions, 2 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index eef6b2f..9bc837d 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -35,6 +35,8 @@ JackDriver::JackDriver(Patchage* app)
: m_app(app),
m_client(NULL)
{
+ m_last_pos.frame = 0;
+ m_last_pos.valid = (jack_position_bits_t)0;
}
@@ -53,11 +55,14 @@ JackDriver::attach(bool launch_daemon)
if (m_client)
return;
+ jack_set_error_function(error_cb);
+
jack_options_t options = (!launch_daemon) ? JackNoStartServer : JackNullOption;
m_client = jack_client_open("Patchage", options, NULL);
if (m_client == NULL) {
m_app->status_message("[JACK] Unable to attach");
} else {
+ jack_set_error_function(error_cb);
jack_on_shutdown(m_client, jack_shutdown_cb, this);
jack_set_port_registration_callback(m_client, jack_port_registration_cb, this);
jack_set_graph_order_callback(m_client, jack_graph_order_cb, this);
@@ -312,6 +317,12 @@ JackDriver::disconnect(boost::shared_ptr<PatchagePort> const src_port, boost::sh
void
+JackDriver::update_time()
+{
+}
+
+
+void
JackDriver::jack_port_registration_cb(jack_port_id_t port_id, int /*registered*/, void* jack_driver)
{
assert(jack_driver);
@@ -364,3 +375,10 @@ JackDriver::jack_shutdown_cb(void* jack_driver)
}
+void
+JackDriver::error_cb(const char* msg)
+{
+ cerr << "JACK ERROR: " << msg << endl;
+}
+
+
diff --git a/src/JackDriver.h b/src/JackDriver.h
index ece89d3..01dc49d 100644
--- a/src/JackDriver.h
+++ b/src/JackDriver.h
@@ -53,7 +53,18 @@ public:
bool disconnect(boost::shared_ptr<PatchagePort> src,
boost::shared_ptr<PatchagePort> dst);
+
+ void start_transport() { jack_transport_start(m_client); }
+ void stop_transport() { jack_transport_stop(m_client); }
+
+ void rewind_transport() {
+ jack_position_t zero;
+ zero.frame = 0;
+ zero.valid = (jack_position_bits_t)0;
+ jack_transport_reposition(m_client, &zero);
+ }
+
private:
Patchage* m_app;
@@ -64,11 +75,17 @@ private:
list<string> m_added_ports;
list<string> m_removed_ports;
+ jack_position_t m_last_pos;
+
boost::shared_ptr<PatchagePort> create_port(boost::shared_ptr<PatchageModule> parent,
jack_port_t* port);
+ static void error_cb(const char* msg);
+
void destroy_all_ports();
+ void update_time();
+
static void jack_port_registration_cb(jack_port_id_t port_id, int registered, void* controller);
static int jack_graph_order_cb(void* controller);
static void jack_shutdown_cb(void* controller);
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 9ec444b..02fdd5b 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -115,6 +115,9 @@ Patchage::Patchage(int argc, char** argv)
xml->get_widget("status_text", m_status_text);
xml->get_widget("main_paned", m_main_paned);
xml->get_widget("messages_expander", m_messages_expander);
+ xml->get_widget("rewind_but", m_rewind_button);
+ xml->get_widget("play_but", m_play_button);
+ xml->get_widget("stop_but", m_stop_button);
xml->get_widget("zoom_full_but", m_zoom_full_button);
xml->get_widget("zoom_normal_but", m_zoom_normal_button);
@@ -125,6 +128,10 @@ Patchage::Patchage(int argc, char** argv)
m_zoom_slider->signal_value_changed().connect(sigc::mem_fun(this, &Patchage::zoom_changed));
+ m_rewind_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::rewind_transport));
+ m_play_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::start_transport));
+ m_stop_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::stop_transport));
+
m_zoom_normal_button->signal_clicked().connect(sigc::bind(
sigc::mem_fun(this, &Patchage::zoom), 1.0));
@@ -197,10 +204,10 @@ Patchage::~Patchage()
void
Patchage::attach()
{
- m_jack_driver->attach(false);
+ m_jack_driver->attach(true);
#ifdef HAVE_LASH
- m_lash_driver->attach(false);
+ m_lash_driver->attach(true);
#endif
#ifdef HAVE_ALSA
m_alsa_driver->attach();
diff --git a/src/Patchage.h b/src/Patchage.h
index d730b4b..7de2ef0 100644
--- a/src/Patchage.h
+++ b/src/Patchage.h
@@ -126,6 +126,9 @@ protected:
Gtk::TextView* m_status_text;
Gtk::Paned* m_main_paned;
Gtk::Expander* m_messages_expander;
+ Gtk::Button* m_rewind_button;
+ Gtk::Button* m_play_button;
+ Gtk::Button* m_stop_button;
Gtk::Button* m_zoom_normal_button;
Gtk::Button* m_zoom_full_button;
};
diff --git a/src/patchage.glade b/src/patchage.glade
index 7c2f846..1550031 100644
--- a/src/patchage.glade
+++ b/src/patchage.glade
@@ -471,6 +471,163 @@
<property name="show_arrow">True</property>
<child>
+ <widget class="GtkToolItem" id="toolitem11">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkButton" id="rewind_but">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkImage" id="image577">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-previous</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem12">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkButton" id="play_but">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkImage" id="image579">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem13">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkButton" id="stop_but">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkImage" id="image580">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-pause</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </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="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes">00:00:00.000</property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ <property name="width_chars">11</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem2">
+ <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="toolitem7">
<property name="visible">True</property>
<property name="visible_horizontal">True</property>