clean up that godawful ugly latency GUI in plugin UIs

git-svn-id: svn://localhost/ardour2/branches/3.0@5038 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-05-04 17:49:28 +00:00
parent 807bc4c3d6
commit 49f28513f5
7 changed files with 61 additions and 10 deletions

View file

@ -82,11 +82,11 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>"))); Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
combo_label->set_use_markup (true); combo_label->set_use_markup (true);
Label* latency_label = manage (new Label (_("<span size=\"large\">Latency</span>"))); latency_button.add (latency_label);
latency_label->set_use_markup (true); latency_button.signal_clicked().connect (mem_fun (*this, &PlugUIBase::latency_button_clicked));
set_latency_label ();
smaller_hbox->pack_start (*latency_label, false, false, 10);
smaller_hbox->pack_start (latency_gui, false, false, 10); smaller_hbox->pack_start (latency_button, false, false, 10);
smaller_hbox->pack_start (preset_combo, false, false); smaller_hbox->pack_start (preset_combo, false, false);
smaller_hbox->pack_start (save_button, false, false); smaller_hbox->pack_start (save_button, false, false);
smaller_hbox->pack_start (bypass_button, false, true); smaller_hbox->pack_start (bypass_button, false, true);

View file

@ -45,7 +45,7 @@ LatencyGUI::LatencyGUI (Latent& l, nframes64_t sr, nframes64_t psz)
/* max 1 second, step by frames, page by msecs */ /* max 1 second, step by frames, page by msecs */
adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f), adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f),
bc (adjustment, ignored, sigc::mem_fun (*this, &LatencyGUI::latency_printer)), bc (adjustment, ignored, sigc::mem_fun (*this, &LatencyGUI::latency_printer)),
reset_button (_("Automatic")) reset_button (_("Reset"))
{ {
Widget* w; Widget* w;

View file

@ -50,6 +50,7 @@
#include <lrdf.h> #include <lrdf.h>
#include "ardour_dialog.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "prompter.h" #include "prompter.h"
#include "plugin_ui.h" #include "plugin_ui.h"
@ -57,6 +58,7 @@
#include "gui_thread.h" #include "gui_thread.h"
#include "public_editor.h" #include "public_editor.h"
#include "keyboard.h" #include "keyboard.h"
#include "latency_gui.h"
#include "plugin_eq_gui.h" #include "plugin_eq_gui.h"
#include "i18n.h" #include "i18n.h"
@ -345,7 +347,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
plugin (insert->plugin()), plugin (insert->plugin()),
save_button(_("Add")), save_button(_("Add")),
bypass_button (_("Bypass")), bypass_button (_("Bypass")),
latency_gui (*pi, pi->session().frame_rate(), pi->session().get_block_size()), latency_gui (0),
eqgui_toggle (_("Freq Analysis")) eqgui_toggle (_("Freq Analysis"))
{ {
//preset_combo.set_use_arrows_always(true); //preset_combo.set_use_arrows_always(true);
@ -389,6 +391,36 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
PlugUIBase::~PlugUIBase() PlugUIBase::~PlugUIBase()
{ {
delete latency_gui;
}
void
PlugUIBase::set_latency_label ()
{
char buf[64];
nframes_t l = insert->effective_latency ();
nframes_t sr = insert->session().frame_rate();
if (l < sr / 1000) {
snprintf (buf, sizeof (buf), "latency (%d samples)", l);
} else {
snprintf (buf, sizeof (buf), "latency (%.2f msecs)", (float) l / ((float) sr / 1000.0f));
}
latency_label.set_text (buf);
}
void
PlugUIBase::latency_button_clicked ()
{
if (!latency_gui) {
latency_gui = new LatencyGUI (*(insert.get()), insert->session().frame_rate(), insert->session().get_block_size());
latency_dialog = new ArdourDialog ("Edit Latency", false, false);
latency_dialog->get_vbox()->pack_start (*latency_gui);
latency_dialog->signal_hide().connect (mem_fun (*this, &PlugUIBase::set_latency_label));
}
latency_dialog->show_all ();
} }
void void

View file

@ -43,8 +43,6 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "ardour_dialog.h"
#include "latency_gui.h"
#include "automation_controller.h" #include "automation_controller.h"
namespace ARDOUR { namespace ARDOUR {
@ -67,6 +65,9 @@ namespace Gtkmm2ext {
class PixmapButton; class PixmapButton;
} }
class LatencyGUI;
class ArdourDialog;
class PlugUIBase : public virtual sigc::trackable class PlugUIBase : public virtual sigc::trackable
{ {
public: public:
@ -83,6 +84,8 @@ class PlugUIBase : public virtual sigc::trackable
virtual void update_presets (); virtual void update_presets ();
void latency_button_clicked ();
protected: protected:
boost::shared_ptr<ARDOUR::PluginInsert> insert; boost::shared_ptr<ARDOUR::PluginInsert> insert;
boost::shared_ptr<ARDOUR::Plugin> plugin; boost::shared_ptr<ARDOUR::Plugin> plugin;
@ -91,7 +94,12 @@ class PlugUIBase : public virtual sigc::trackable
Gtk::ToggleButton bypass_button; Gtk::ToggleButton bypass_button;
Gtk::EventBox focus_button; Gtk::EventBox focus_button;
LatencyGUI latency_gui; Gtk::Label latency_label;
Gtk::Button latency_button;
void set_latency_label ();
LatencyGUI* latency_gui;
ArdourDialog* latency_dialog;
Gtk::Expander plugin_eq_bin; Gtk::Expander plugin_eq_bin;
Gtk::ToggleButton eqgui_toggle; Gtk::ToggleButton eqgui_toggle;

View file

@ -13,6 +13,14 @@ class Latent {
virtual nframes_t signal_latency() const = 0; virtual nframes_t signal_latency() const = 0;
nframes_t user_latency () const { return _user_latency; } nframes_t user_latency () const { return _user_latency; }
nframes_t effective_latency() const {
if (_user_latency) {
return _user_latency;
} else {
return signal_latency ();
}
}
virtual void set_latency_delay (nframes_t val) { _own_latency = val; } virtual void set_latency_delay (nframes_t val) { _own_latency = val; }
virtual void set_user_latency (nframes_t val) { _user_latency = val; } virtual void set_user_latency (nframes_t val) { _user_latency = val; }

View file

@ -683,6 +683,8 @@ LV2PluginInfo::discover (void* lv2_world)
LV2World* world = (LV2World*)lv2_world; LV2World* world = (LV2World*)lv2_world;
SLV2Plugins plugins = slv2_world_get_all_plugins(world->world); SLV2Plugins plugins = slv2_world_get_all_plugins(world->world);
cerr << "Discovered " << slv2_plugins_size (plugins) << " Lv2 plugins\n";
for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) { for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) {
SLV2Plugin p = slv2_plugins_get_at(plugins, i); SLV2Plugin p = slv2_plugins_get_at(plugins, i);
LV2PluginInfoPtr info (new LV2PluginInfo(lv2_world, p)); LV2PluginInfoPtr info (new LV2PluginInfo(lv2_world, p));

View file

@ -127,6 +127,7 @@ PluginManager::PluginManager ()
} }
#ifdef HAVE_SLV2 #ifdef HAVE_SLV2
cerr << "Creating a new lv2 world\n";
_lv2_world = new LV2World(); _lv2_world = new LV2World();
#endif #endif