aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-03-31 05:28:01 +0000
committerDavid Robillard <d@drobilla.net>2007-03-31 05:28:01 +0000
commitf8883a56e44a42e97ca84392fdbff61e11540fcd (patch)
tree745eef6b5685b9f668c48b36ae6c761bee49b271 /src/gui
parentdd6be02a7478225f19f02432919b64b96b733172 (diff)
downloadmachina-f8883a56e44a42e97ca84392fdbff61e11540fcd.tar.gz
machina-f8883a56e44a42e97ca84392fdbff61e11540fcd.tar.bz2
machina-f8883a56e44a42e97ca84392fdbff61e11540fcd.zip
Realtime MIDI recording.
git-svn-id: http://svn.drobilla.net/lad/machina@383 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/MachinaCanvas.cpp2
-rw-r--r--src/gui/MachinaGUI.cpp39
-rw-r--r--src/gui/MachinaGUI.hpp63
-rw-r--r--src/gui/machina.glade57
4 files changed, 132 insertions, 29 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 134b885..f2a8ebf 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -230,7 +230,7 @@ MachinaCanvas::build(SharedPtr<Machina::Machine> machine)
Gtk::Main::iteration(false);
}
- arrange();
+ //arrange();
/*
while (Gtk::Main::events_pending())
Gtk::Main::iteration(false);
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index de432aa..cf0b07f 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -71,6 +71,9 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
xml->get_widget("bpm_spinbutton", _bpm_spinbutton);
xml->get_widget("quantize_checkbutton", _quantize_checkbutton);
xml->get_widget("quantize_spinbutton", _quantize_spinbutton);
+ xml->get_widget("record_but", _record_button);
+ xml->get_widget("stop_but", _stop_button);
+ xml->get_widget("play_but", _play_button);
xml->get_widget("zoom_normal_but", _zoom_normal_button);
xml->get_widget("zoom_full_but", _zoom_full_button);
xml->get_widget("arrange_but", _arrange_button);
@@ -83,11 +86,16 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
//_zoom_slider->signal_value_changed().connect(sigc::mem_fun(this, &MachinaGUI::zoom_changed));
+ _record_button->signal_toggled().connect(sigc::mem_fun(this, &MachinaGUI::record_toggled));
+ _stop_button->signal_clicked().connect(sigc::mem_fun(this, &MachinaGUI::stop_clicked));
+ _play_button->signal_toggled().connect(sigc::mem_fun(this, &MachinaGUI::play_toggled));
+
_zoom_normal_button->signal_clicked().connect(sigc::bind(
sigc::mem_fun(this, &MachinaGUI::zoom), 1.0));
_zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &MachinaCanvas::zoom_full));
_arrange_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &MachinaCanvas::arrange));
+
_menu_file_open->signal_activate().connect(
sigc::mem_fun(this, &MachinaGUI::menu_file_open));
@@ -226,6 +234,8 @@ MachinaGUI::scrolled_window_event(GdkEvent* event)
void
MachinaGUI::update_toolbar()
{
+ _record_button->set_active(_engine->driver()->recording());
+ _play_button->set_active(true);
_bpm_spinbutton->set_sensitive(_bpm_radiobutton->get_active());
_quantize_spinbutton->set_sensitive(_quantize_checkbutton->get_active());
}
@@ -612,3 +622,32 @@ MachinaGUI::menu_help_help()
_help_dialog->hide();
}
+
+void
+MachinaGUI::record_toggled()
+{
+ if (_record_button->get_active() && ! _engine->driver()->recording()) {
+ _engine->driver()->start_record();
+ } else if (_engine->driver()->recording()) {
+ _engine->driver()->finish_record();
+ _canvas->build(_engine->machine());
+ }
+}
+
+
+void
+MachinaGUI::stop_clicked()
+{
+ if (_engine->driver()->recording())
+ _engine->driver()->finish_record();
+
+ update_toolbar();
+}
+
+
+void
+MachinaGUI::play_toggled()
+{
+}
+
+
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index 5dd943f..96fb772 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -73,6 +73,10 @@ protected:
void update_toolbar();
bool scrolled_window_event(GdkEvent* ev);
+ void record_toggled();
+ void stop_clicked();
+ void play_toggled();
+
void on_pane_position_changed();
void on_messages_expander_changed();
@@ -94,34 +98,37 @@ protected:
Gtk::Main* _gtk_main;
- Gtk::Window* _main_window;
- Gtk::Dialog* _help_dialog;
- Gtk::AboutDialog* _about_window;
- Gtk::Toolbar* _toolbar;
- Gtk::MenuItem* _menu_file_open;
- Gtk::MenuItem* _menu_file_save;
- Gtk::MenuItem* _menu_file_save_as;
- Gtk::MenuItem* _menu_file_quit;
- Gtk::MenuItem* _menu_import_midi;
- Gtk::MenuItem* _menu_export_midi;
- Gtk::MenuItem* _menu_export_graphviz;
- Gtk::MenuItem* _menu_help_about;
- Gtk::CheckMenuItem* _menu_view_toolbar;
- //Gtk::CheckMenuItem* _menu_view_messages;
- Gtk::MenuItem* _menu_view_refresh;
- Gtk::MenuItem* _menu_help_help;
- Gtk::ScrolledWindow* _canvas_scrolledwindow;
- Gtk::TextView* _status_text;
- Gtk::Paned* _main_paned;
- Gtk::Expander* _messages_expander;
- Gtk::RadioButton* _slave_radiobutton;
- Gtk::RadioButton* _bpm_radiobutton;
- Gtk::SpinButton* _bpm_spinbutton;
- Gtk::CheckButton* _quantize_checkbutton;
- Gtk::SpinButton* _quantize_spinbutton;
- Gtk::ToolButton* _zoom_normal_button;
- Gtk::ToolButton* _zoom_full_button;
- Gtk::ToolButton* _arrange_button;
+ Gtk::Window* _main_window;
+ Gtk::Dialog* _help_dialog;
+ Gtk::AboutDialog* _about_window;
+ Gtk::Toolbar* _toolbar;
+ Gtk::MenuItem* _menu_file_open;
+ Gtk::MenuItem* _menu_file_save;
+ Gtk::MenuItem* _menu_file_save_as;
+ Gtk::MenuItem* _menu_file_quit;
+ Gtk::MenuItem* _menu_import_midi;
+ Gtk::MenuItem* _menu_export_midi;
+ Gtk::MenuItem* _menu_export_graphviz;
+ Gtk::MenuItem* _menu_help_about;
+ Gtk::CheckMenuItem* _menu_view_toolbar;
+ //Gtk::CheckMenuItem* _menu_view_messages;
+ Gtk::MenuItem* _menu_view_refresh;
+ Gtk::MenuItem* _menu_help_help;
+ Gtk::ScrolledWindow* _canvas_scrolledwindow;
+ Gtk::TextView* _status_text;
+ Gtk::Paned* _main_paned;
+ Gtk::Expander* _messages_expander;
+ Gtk::RadioButton* _slave_radiobutton;
+ Gtk::RadioButton* _bpm_radiobutton;
+ Gtk::SpinButton* _bpm_spinbutton;
+ Gtk::CheckButton* _quantize_checkbutton;
+ Gtk::SpinButton* _quantize_spinbutton;
+ Gtk::ToggleToolButton* _record_button;
+ Gtk::ToolButton* _stop_button;
+ Gtk::ToggleToolButton* _play_button;
+ Gtk::ToolButton* _zoom_normal_button;
+ Gtk::ToolButton* _zoom_full_button;
+ Gtk::ToolButton* _arrange_button;
};
#endif // MACHINA_GUI_H
diff --git a/src/gui/machina.glade b/src/gui/machina.glade
index 5b12fa1..01f8ec1 100644
--- a/src/gui/machina.glade
+++ b/src/gui/machina.glade
@@ -238,6 +238,63 @@
<property name="show_arrow">True</property>
<child>
+ <widget class="GtkToggleToolButton" id="record_but">
+ <property name="visible">True</property>
+ <property name="stock_id">gtk-media-record</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolButton" id="stop_but">
+ <property name="visible">True</property>
+ <property name="stock_id">gtk-media-stop</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleToolButton" id="play_but">
+ <property name="visible">True</property>
+ <property name="stock_id">gtk-media-play</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem4">
+ <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="toolitem1">
<property name="visible">True</property>
<property name="visible_horizontal">True</property>