mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 22:55:44 +01:00
actual, vaguely functional beatbox gui
This commit is contained in:
parent
af391b7fc7
commit
29c809a336
4 changed files with 191 additions and 4 deletions
105
gtk2_ardour/beatbox_gui.cc
Normal file
105
gtk2_ardour/beatbox_gui.cc
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
Copyright (C) 2017 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#include "ardour/beatbox.h"
|
||||
#include "beatbox_gui.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
||||
BBGUI::BBGUI (boost::shared_ptr<BeatBox> bb)
|
||||
: ArdourDialog (_("BeatBox"))
|
||||
, bbox (bb)
|
||||
, quantize_off (quantize_group, "None")
|
||||
, quantize_32nd (quantize_group, "ThirtySecond")
|
||||
, quantize_16th (quantize_group, "Sixteenth")
|
||||
, quantize_8th (quantize_group, "Eighth")
|
||||
, quantize_quarter (quantize_group, "Quarter")
|
||||
, quantize_half (quantize_group, "Half")
|
||||
, quantize_whole (quantize_group, "Whole")
|
||||
, play_button ("Run")
|
||||
, clear_button ("Clear")
|
||||
, tempo_adjustment (bb->tempo(), 1, 300, 1, 10)
|
||||
, tempo_spinner (tempo_adjustment)
|
||||
{
|
||||
quantize_off.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 0));
|
||||
quantize_32nd.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 32));
|
||||
quantize_16th.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 16));
|
||||
quantize_8th.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 8));
|
||||
quantize_quarter.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 4));
|
||||
quantize_half.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 2));
|
||||
quantize_whole.signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &BBGUI::set_quantize), 1));
|
||||
|
||||
quantize_button_box.pack_start (quantize_off);
|
||||
quantize_button_box.pack_start (quantize_32nd);
|
||||
quantize_button_box.pack_start (quantize_16th);
|
||||
quantize_button_box.pack_start (quantize_8th);
|
||||
quantize_button_box.pack_start (quantize_quarter);
|
||||
quantize_button_box.pack_start (quantize_half);
|
||||
quantize_button_box.pack_start (quantize_whole);
|
||||
|
||||
play_button.signal_toggled().connect (sigc::mem_fun (*this, &BBGUI::toggle_play));
|
||||
clear_button.signal_clicked().connect (sigc::mem_fun (*this, &BBGUI::clear));
|
||||
|
||||
misc_button_box.pack_start (play_button);
|
||||
misc_button_box.pack_start (clear_button);
|
||||
|
||||
tempo_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &BBGUI::tempo_changed));
|
||||
|
||||
misc_button_box.pack_start (tempo_spinner);
|
||||
|
||||
get_vbox()->pack_start (misc_button_box);
|
||||
get_vbox()->pack_start (quantize_button_box, true, true);
|
||||
|
||||
show_all ();
|
||||
}
|
||||
|
||||
BBGUI::~BBGUI ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BBGUI::tempo_changed ()
|
||||
{
|
||||
float t = tempo_adjustment.get_value();
|
||||
bbox->set_tempo (t);
|
||||
}
|
||||
|
||||
void
|
||||
BBGUI::set_quantize (int divisor)
|
||||
{
|
||||
bbox->set_quantize (divisor);
|
||||
}
|
||||
|
||||
void
|
||||
BBGUI::clear ()
|
||||
{
|
||||
bbox->clear ();
|
||||
}
|
||||
|
||||
void
|
||||
BBGUI::toggle_play ()
|
||||
{
|
||||
if (bbox->running()) {
|
||||
bbox->stop ();
|
||||
} else {
|
||||
bbox->start ();
|
||||
}
|
||||
}
|
||||
70
gtk2_ardour/beatbox_gui.h
Normal file
70
gtk2_ardour/beatbox_gui.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
Copyright (C) 2017 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __gtk2_ardour_beatbox_gui_h__
|
||||
#define __gtk2_ardour_beatbox_gui_h__
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/togglebutton.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/spinbutton.h>
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class BeatBox;
|
||||
}
|
||||
|
||||
class BBGUI : public ArdourDialog {
|
||||
public:
|
||||
BBGUI (boost::shared_ptr<ARDOUR::BeatBox> bb);
|
||||
~BBGUI ();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<ARDOUR::BeatBox> bbox;
|
||||
|
||||
Gtk::RadioButtonGroup quantize_group;
|
||||
Gtk::RadioButton quantize_off;
|
||||
Gtk::RadioButton quantize_32nd;
|
||||
Gtk::RadioButton quantize_16th;
|
||||
Gtk::RadioButton quantize_8th;
|
||||
Gtk::RadioButton quantize_quarter;
|
||||
Gtk::RadioButton quantize_half;
|
||||
Gtk::RadioButton quantize_whole;
|
||||
|
||||
Gtk::ToggleButton play_button;
|
||||
Gtk::Button clear_button;
|
||||
|
||||
Gtk::Adjustment tempo_adjustment;
|
||||
Gtk::SpinButton tempo_spinner;
|
||||
|
||||
Gtk::VBox quantize_button_box;
|
||||
Gtk::HBox misc_button_box;
|
||||
|
||||
|
||||
void set_quantize (int divisor);
|
||||
void toggle_play ();
|
||||
void clear ();
|
||||
void tempo_changed ();
|
||||
};
|
||||
|
||||
#endif /* __gtk2_ardour_beatbox_gui_h__ */
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
#include "actions.h"
|
||||
#include "ardour_dialog.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "beatbox_gui.h"
|
||||
#include "gui_thread.h"
|
||||
#include "io_selector.h"
|
||||
#include "keyboard.h"
|
||||
|
|
@ -1665,7 +1666,7 @@ ProcessorEntry::LuaPluginDisplay::LuaPluginDisplay (ProcessorEntry& e, boost::sh
|
|||
LuaInstance::bind_cairo (LG);
|
||||
luabridge::LuaRef lua_render = luabridge::getGlobal (LG, "render_inline");
|
||||
assert (lua_render.isFunction ());
|
||||
_lua_render_inline = new luabridge::LuaRef (lua_render);
|
||||
_lua_render_inline = new luabridge::LuaRef (lua_render);
|
||||
}
|
||||
|
||||
ProcessorEntry::LuaPluginDisplay::~LuaPluginDisplay ()
|
||||
|
|
@ -3580,9 +3581,19 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
|
|||
|
||||
gidget = io_selector;
|
||||
|
||||
} else if ((beatbox == boost::dynamic_pointer_cast<BeatBox> (processor)) != 0) {
|
||||
cerr << "Beatbox editor goes here\n";
|
||||
return 0;
|
||||
} else if ((beatbox = boost::dynamic_pointer_cast<BeatBox> (processor)) != 0) {
|
||||
|
||||
Window* w = get_processor_ui (beatbox);
|
||||
BBGUI* bbg = 0;
|
||||
|
||||
if (!w) {
|
||||
bbg = new BBGUI (beatbox);
|
||||
set_processor_ui (beatbox, bbg);
|
||||
} else {
|
||||
bbg = dynamic_cast<BBGUI*> (w);
|
||||
}
|
||||
|
||||
gidget = bbg;
|
||||
}
|
||||
|
||||
return gidget;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ gtk2_ardour_sources = [
|
|||
'automation_streamview.cc',
|
||||
'automation_time_axis.cc',
|
||||
'axis_view.cc',
|
||||
'beatbox_gui.cc',
|
||||
'big_clock_window.cc',
|
||||
'bundle_manager.cc',
|
||||
'clock_group.cc',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue