From f8883a56e44a42e97ca84392fdbff61e11540fcd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 31 Mar 2007 05:28:01 +0000 Subject: Realtime MIDI recording. git-svn-id: http://svn.drobilla.net/lad/machina@383 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaCanvas.cpp | 2 +- src/gui/MachinaGUI.cpp | 39 +++++++++++++++++++++++++++++ src/gui/MachinaGUI.hpp | 63 ++++++++++++++++++++++++++--------------------- src/gui/machina.glade | 57 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 29 deletions(-) (limited to 'src/gui') 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 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 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 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 @@ -237,6 +237,63 @@ True True + + + True + gtk-media-record + True + True + False + False + + + False + True + + + + + + True + gtk-media-stop + True + True + False + + + False + True + + + + + + True + gtk-media-play + True + True + False + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + True -- cgit v1.2.1