View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002879 | ardour | features | public | 2009-10-23 22:32 | 2011-08-16 11:10 |
| Reporter | colinf | Assigned To | paul | ||
| Priority | normal | Severity | tweak | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | ||
| Product Version | SVN/2.0-ongoing | ||||
| Summary | 0002879: [PATCH] Show region gain in region editor | ||||
| Description | Although it's possible to boost & cut region gains with '^' & '&', there's no means in the UI to either see the gain applied to a region, or to set it directly to a particular value. I thought that the region editor might be a good place to add this, so I did: here's a patch (against 2.0-ongoing r5858 or so). I used a Gtk::Adjustment and a Gtk::SpinButton to show & set the region gain in dBs: perhaps a slider or fader would be better, but this works well enough for me. | ||||
| Tags | No tags attached. | ||||
|
2009-10-23 22:32
|
region-gain-in-editor.patch (4,564 bytes)
Index: gtk2_ardour/audio_region_editor.cc
===================================================================
--- gtk2_ardour/audio_region_editor.cc (revision 5896)
+++ gtk2_ardour/audio_region_editor.cc (working copy)
@@ -25,6 +25,7 @@
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/stop_signal.h>
#include <cmath>
+#include <ardour/dB.h>
#include "audio_region_editor.h"
#include "audio_region_view.h"
@@ -52,7 +53,8 @@
length_clock (X_("regionlength"), true, X_("AudioRegionEditorClock"), true, true),
/* XXX cannot edit sync point or start yet */
sync_offset_clock (X_("regionsyncoffset"), true, X_("AudioRegionEditorClock"), false),
- start_clock (X_("regionstart"), true, X_("AudioRegionEditorClock"), false)
+ start_clock (X_("regionstart"), true, X_("AudioRegionEditorClock"), false),
+ gain_adjustment(accurate_coefficient_to_dB(_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
{
position_clock.set_session (&_session);
@@ -124,10 +126,17 @@
time_table.attach (start_alignment, 0, 1, 4, 5, Gtk::FILL, Gtk::FILL);
time_table.attach (start_clock, 1, 2, 4, 5, Gtk::FILL, Gtk::FILL);
+ gain_label.set_name ("AudioRegionEditorLabel");
+ gain_label.set_text (_("Scale amplitude:"));
+ gain_entry.configure(gain_adjustment, 0.0, 1);
+
lower_hbox.pack_start (time_table, true, true);
lower_hbox.pack_start (sep1, false, false);
lower_hbox.pack_start (sep2, false, false);
+ lower_hbox.pack_start (gain_label, false, false);
+ lower_hbox.pack_start (gain_entry, false, false);
+
get_vbox()->pack_start (top_row_hbox, true, true);
get_vbox()->pack_start (sep3, false, false);
get_vbox()->pack_start (lower_hbox, true, true);
@@ -143,6 +152,7 @@
name_changed ();
bounds_changed (Change (StartChanged|LengthChanged|PositionChanged|StartChanged|Region::SyncOffsetChanged));
+ gain_changed();
_region->StateChanged.connect (mem_fun(*this, &AudioRegionEditor::region_changed));
@@ -165,6 +175,11 @@
if (what_changed & Change (BoundsChanged|StartChanged|Region::SyncOffsetChanged)) {
bounds_changed (what_changed);
}
+
+ if (what_changed & AudioRegion::ScaleAmplitudeChanged) {
+ gain_changed();
+ }
+
}
gint
@@ -208,6 +223,7 @@
position_clock.ValueChanged.connect (mem_fun(*this, &AudioRegionEditor::position_clock_changed));
end_clock.ValueChanged.connect (mem_fun(*this, &AudioRegionEditor::end_clock_changed));
length_clock.ValueChanged.connect (mem_fun(*this, &AudioRegionEditor::length_clock_changed));
+ gain_adjustment.signal_value_changed().connect (mem_fun(*this, &AudioRegionEditor::gain_adjustment_changed));
audition_button.signal_toggled().connect (mem_fun(*this, &AudioRegionEditor::audition_button_toggled));
_session.AuditionActive.connect (mem_fun(*this, &AudioRegionEditor::audition_state_changed));
@@ -271,6 +287,24 @@
}
void
+AudioRegionEditor::gain_changed ()
+{
+ float region_gain_dB = accurate_coefficient_to_dB(_region->scale_amplitude());
+ if (region_gain_dB != gain_adjustment.get_value()) {
+ gain_adjustment.set_value(region_gain_dB);
+ }
+}
+
+void
+AudioRegionEditor::gain_adjustment_changed ()
+{
+ float gain = dB_to_coefficient(gain_adjustment.get_value());
+ if (_region->scale_amplitude() != gain) {
+ _region->set_scale_amplitude(gain);
+ }
+}
+
+void
AudioRegionEditor::audition_button_toggled ()
{
if (audition_button.get_active()) {
Index: gtk2_ardour/audio_region_editor.h
===================================================================
--- gtk2_ardour/audio_region_editor.h (revision 5896)
+++ gtk2_ardour/audio_region_editor.h (working copy)
@@ -79,17 +79,23 @@
Gtk::Label length_label;
Gtk::Label sync_label;
Gtk::Label start_label;
+ Gtk::Label gain_label;
+
Gtk::Alignment position_alignment;
Gtk::Alignment end_alignment;
Gtk::Alignment length_alignment;
Gtk::Alignment sync_alignment;
Gtk::Alignment start_alignment;
+ Gtk::Alignment gain_alignment;
AudioClock position_clock;
AudioClock end_clock;
AudioClock length_clock;
AudioClock sync_offset_clock;
AudioClock start_clock;
+
+ Gtk::Adjustment gain_adjustment;
+ Gtk::SpinButton gain_entry;
Gtk::HSeparator sep3;
Gtk::VSeparator sep1;
@@ -98,6 +104,7 @@
void region_changed (ARDOUR::Change);
void bounds_changed (ARDOUR::Change);
void name_changed ();
+ void gain_changed ();
void audition_state_changed (bool);
@@ -107,6 +114,7 @@
void position_clock_changed ();
void end_clock_changed ();
void length_clock_changed ();
+ void gain_adjustment_changed ();
void audition_button_toggled ();
|
|
|
Applied to 3.0. Thanks! |
|
2009-10-28 10:41
|
region-gain-in-editor-fix-mismerge.patch (1,374 bytes)
Index: gtk2_ardour/audio_region_editor.cc
===================================================================
--- gtk2_ardour/audio_region_editor.cc (revision 5952)
+++ gtk2_ardour/audio_region_editor.cc (working copy)
@@ -54,7 +54,7 @@
/* XXX cannot edit sync point or start yet */
sync_offset_clock (X_("regionsyncoffset"), true, X_("AudioRegionEditorClock"), false),
start_clock (X_("regionstart"), true, X_("AudioRegionEditorClock"), false),
- gain_adjustment(accurate_coefficient_to_dB(_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
+ gain_adjustment(accurate_coefficient_to_dB(_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
{
position_clock.set_session (&_session);
end_clock.set_session (&_session);
@@ -131,13 +131,6 @@
gain_entry.configure (gain_adjustment, 0.0, 1);
time_table.attach (gain_label, 0, 1, 6, 7, Gtk::FILL, Gtk::FILL);
time_table.attach (gain_entry, 1, 2, 6, 7, Gtk::FILL, Gtk::FILL);
-
- gain_label.set_name ("AudioRegionEditorLabel");
- gain_label.set_text (_("Scale amplitude:"));
- gain_label.set_alignment (1, 0.5);
- gain_entry.configure (gain_adjustment, 0.0, 1);
- time_table.attach (gain_label, 0, 1, 6, 7, Gtk::FILL, Gtk::FILL);
- time_table.attach (gain_entry, 1, 2, 6, 7, Gtk::FILL, Gtk::FILL);
lower_hbox.pack_start (time_table, true, true);
lower_hbox.pack_start (sep1, false, false);
|
|
|
Thanks for applying this. It seems to have been mismerged into 2.0-ongoing r5952 (a hunk is repeated), leading to messages like: (ardour-2.8.3:9398): Gtk-CRITICAL **: gtk_table_attach: assertion `child->parent == NULL' failed Attached a patch against r5952 to correct this. Colin. |
|
|
will be in 2.8.4. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-10-23 22:32 | colinf | New Issue | |
| 2009-10-23 22:32 | colinf | File Added: region-gain-in-editor.patch | |
| 2009-10-23 23:22 | cth103 | Note Added: 0006878 | |
| 2009-10-23 23:22 | cth103 | cost | => 0.00 |
| 2009-10-23 23:22 | cth103 | Summary | Show region gain in region editor => [PATCH] Show region gain in region editor |
| 2009-10-23 23:22 | cth103 | Status | new => assigned |
| 2009-10-23 23:22 | cth103 | Assigned To | => paul |
| 2009-10-28 10:41 | colinf | File Added: region-gain-in-editor-fix-mismerge.patch | |
| 2009-10-28 10:42 | colinf | Note Added: 0006911 | |
| 2009-10-31 12:46 | paul | Note Added: 0007014 | |
| 2009-10-31 12:46 | paul | Status | assigned => resolved |
| 2009-10-31 12:46 | paul | Resolution | open => fixed |
| 2011-08-16 11:10 | colinf | Status | resolved => closed |