2 patches inspired from 3.0. remove unused butler buffers(drobilla), and region gain (colinf)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5952 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Ben Loftis 2009-10-27 22:27:15 +00:00
parent 6a0469c10d
commit 18dbb55c93
4 changed files with 47 additions and 12 deletions

View File

@ -22,6 +22,7 @@
#include <ardour/audioregion.h>
#include <ardour/playlist.h>
#include <ardour/utils.h>
#include <ardour/dB.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/stop_signal.h>
#include <cmath>
@ -52,8 +53,8 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
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);
end_clock.set_session (&_session);
@ -124,6 +125,20 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
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_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);
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);
lower_hbox.pack_start (sep2, false, false);
@ -143,6 +158,7 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
name_changed ();
bounds_changed (Change (StartChanged|LengthChanged|PositionChanged|StartChanged|Region::SyncOffsetChanged));
gain_changed ();
_region->StateChanged.connect (mem_fun(*this, &AudioRegionEditor::region_changed));
@ -165,6 +181,10 @@ AudioRegionEditor::region_changed (Change what_changed)
if (what_changed & Change (BoundsChanged|StartChanged|Region::SyncOffsetChanged)) {
bounds_changed (what_changed);
}
if (what_changed & AudioRegion::ScaleAmplitudeChanged) {
gain_changed ();
}
}
gint
@ -208,7 +228,8 @@ AudioRegionEditor::connect_editor_events ()
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));
}
@ -270,6 +291,24 @@ AudioRegionEditor::length_clock_changed ()
length_clock.set (_region->length());
}
void
AudioRegionEditor::gain_changed ()
{
float const 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 const gain = dB_to_coefficient (gain_adjustment.get_value());
if (_region->scale_amplitude() != gain) {
_region->set_scale_amplitude (gain);
}
}
void
AudioRegionEditor::audition_button_toggled ()
{

View File

@ -79,6 +79,7 @@ class AudioRegionEditor : public RegionEditor
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;
@ -90,6 +91,8 @@ class AudioRegionEditor : public RegionEditor
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 +101,7 @@ class AudioRegionEditor : public RegionEditor
void region_changed (ARDOUR::Change);
void bounds_changed (ARDOUR::Change);
void name_changed ();
void gain_changed ();
void audition_state_changed (bool);
@ -107,6 +111,7 @@ class AudioRegionEditor : public RegionEditor
void position_clock_changed ();
void end_clock_changed ();
void length_clock_changed ();
void gain_adjustment_changed ();
void audition_button_toggled ();

View File

@ -1186,8 +1186,6 @@ class Session : public PBD::StatefulDestructible
bool pending_abort;
bool pending_auto_loop;
Sample* butler_mixdown_buffer;
float* butler_gain_buffer;
pthread_t butler_thread;
Glib::Mutex butler_request_lock;
Glib::Cond butler_paused;

View File

@ -282,8 +282,6 @@ Session::Session (AudioEngine &eng,
_midi_port (default_midi_port),
pending_events (2048),
state_tree (0),
butler_mixdown_buffer (0),
butler_gain_buffer (0),
_send_smpte_update (false),
midi_thread (pthread_t (0)),
midi_requests (128), // the size of this should match the midi request pool size
@ -354,8 +352,6 @@ Session::Session (AudioEngine &eng,
_midi_port (default_midi_port),
pending_events (2048),
state_tree (0),
butler_mixdown_buffer (0),
butler_gain_buffer (0),
_send_smpte_update (false),
midi_thread (pthread_t (0)),
midi_requests (16),
@ -650,9 +646,6 @@ Session::destroy ()
i = tmp;
}
delete [] butler_mixdown_buffer;
delete [] butler_gain_buffer;
Crossfade::set_buffer_size (0);
delete mmc;