return act;
}
-
RefPtr<Action>
ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods)
{
<menuitem action='ToggleAutoPlay'/>
<menuitem action='ToggleAutoReturn'/>
<menuitem action='ToggleClick'/>
- <menuitem action='ToggleFollowPlayhead'/>
+ <menuitem action='toggle-follow-playhead'/>
</menu>
</menu>
<menu name='Edit' action='Edit'>
<menuitem action='SoloInPlace'/>
<menuitem action='SoloViaBus'/>
</menu>
+ <menu action='Crossfades'>
+ <menuitem action='toggle-xfades-active'/>
+ <menuitem action='toggle-xfades-visible'/>
+ <menuitem action='toggle-auto-xfades'/>
+ <separator/>
+ <menuitem action='CrossfadesFull'/>
+ <menuitem action='CrossfadesShort'/>
+ </menu>
+ <menu action='Layering'>
+ <menuitem action='LayerLaterHigher'/>
+ <menuitem action='LayerMoveAddHigher'/>
+ <menuitem action='LayerAddHigher'/>
+ </menu>
<separator/>
<menuitem action='SendMTC'/>
<menuitem action='SendMMC'/>
for (list<Preset*>::iterator i = fade_out_presets->begin(); i != fade_out_presets->end(); ++i) {
+ cerr << "looking for xpm " << (*i)->xpm << endl;
+
pxmap = manage (new Image (get_xpm((*i)->xpm)));
pbutton = manage (new Button);
pbutton->add (*pxmap);
void
Editor::session_control_changed (Session::ControlType t)
{
- // right now we're only tracking the loop and punch state
+ // right now we're only tracking some state here
switch (t) {
case Session::AutoLoop:
update_punch_range_view (true);
break;
+ case Session::LayeringModel:
+ update_layering_model ();
+ break;
+
default:
break;
}
session->locations()->StateChanged.connect (mem_fun(*this, &Editor::refresh_location_display_s));
session->locations()->end_location()->changed.connect (mem_fun(*this, &Editor::end_location_changed));
+ bool yn;
+ RefPtr<Action> act;
+
+ act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-active"));
+ if (act) {
+ RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+ /* do it twice to force the change */
+ yn = session->get_crossfades_active();
+ tact->set_active (!yn);
+ tact->set_active (yn);
+ }
+
+ act = ActionManager::get_action (X_("Editor"), X_("toggle-auto-xfades"));
+ if (act) {
+ RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+ /* do it twice to force the change */
+ yn = Config->get_auto_xfade ();
+ tact->set_active (!yn);
+ tact->set_active (yn);
+ }
+
+ /* xfade visibility state set from editor::set_state() */
+
+ update_crossfade_model ();
+ update_layering_model ();
+
reset_scrolling_region ();
redisplay_regions ();
if ((prop = node.property ("follow-playhead"))) {
bool yn = (prop->value() == "yes");
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleFollowPlayhead"));
+ RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
/* do it twice to force the change */
if ((prop = node.property ("xfades-visible"))) {
bool yn = (prop->value() == "yes");
_xfade_visibility = !yn;
- set_xfade_visibility (yn);
+ // set_xfade_visibility (yn);
}
if ((prop = node.property ("show-editor-mixer"))) {
*selection = *state->selection;
time_selection_changed ();
- cerr << "RS: RSC\n";
region_selection_changed ();
/* XXX other selection change handlers? */
void
Editor::toggle_follow_playhead ()
{
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleFollowPlayhead"));
+ RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
set_follow_playhead (tact->get_active());
return key_press_focus_accelerator_handler (*this, ev);
}
+void
+Editor::update_layering_model ()
+{
+ RefPtr<Action> act;
+
+ switch (session->get_layer_model()) {
+ case Session::LaterHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
+ break;
+ case Session::MoveAddHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
+ break;
+ case Session::AddHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
+ break;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+}
+
+
+void
+Editor::update_crossfade_model ()
+{
+ RefPtr<Action> act;
+
+ switch (session->get_xfade_model()) {
+ case FullCrossfade:
+ act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
+ break;
+ case ShortCrossfade:
+ act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort"));
+ break;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+}
+
/* xfades */
- void toggle_xfades_active();
+ void toggle_auto_xfade ();
+ void toggle_xfades_active ();
void toggle_xfade_visibility ();
- void set_xfade_visibility (bool yn);
bool xfade_visibility() const { return _xfade_visibility; }
+ void update_crossfade_model ();
+ void set_crossfade_model (ARDOUR::CrossfadeModel);
+
+ /* layers */
+
+ void set_layer_model (ARDOUR::Session::LayerModel);
+ void update_layering_model ();
/* redirect shared ops menu. caller must free returned menu */
ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
+ ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades"));
ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
+ ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
/* add named actions for the editor */
+
act = ActionManager::register_toggle_action (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), mem_fun (*this, &Editor::editor_mixer_button_toggled));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "toggle-xfades-active", _("Toggle Xfades Active"), mem_fun(*this, &Editor::toggle_xfades_active));
+ RadioAction::Group crossfade_model_group;
+
+ act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesFull", _("Span Entire Overlap"), bind (mem_fun(*this, &Editor::set_crossfade_model), FullCrossfade));
+ ActionManager::session_sensitive_actions.push_back (act);
+ act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesShort", _("Short"), bind (mem_fun(*this, &Editor::set_crossfade_model), ShortCrossfade));
+ ActionManager::session_sensitive_actions.push_back (act);
+
+ act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-active", _("Active"), mem_fun(*this, &Editor::toggle_xfades_active));
+ ActionManager::session_sensitive_actions.push_back (act);
+ act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-visible", _("Visible"), mem_fun(*this, &Editor::toggle_xfade_visibility));
+ ActionManager::session_sensitive_actions.push_back (act);
+ act = ActionManager::register_toggle_action (editor_actions, "toggle-auto-xfades", _("Created Automatically"), mem_fun(*this, &Editor::toggle_auto_xfade));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "playhead-to-next-region-start", _("Playhead to Next Region Start"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (Start)));
act = ActionManager::register_action (editor_actions, "extend-range-to-start-of-region", _("Extend Range to Start of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_toggle_action (editor_actions, "ToggleFollowPlayhead", _("Follow Playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
+ act = ActionManager::register_toggle_action (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "remove-last-capture", _("Remove Last Capture"), (mem_fun(*this, &Editor::remove_last_capture)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_radio_action (editor_actions, meter_hold_group, X_("MeterHoldMedium"), _("Medium"), bind (mem_fun (*this, &Editor::set_meter_hold), 100));
ActionManager::register_radio_action (editor_actions, meter_hold_group, X_("MeterHoldLong"), _("Long"), bind (mem_fun (*this, &Editor::set_meter_hold), 200));
+ RadioAction::Group layer_model_group;
+
+ ActionManager::register_radio_action (editor_actions, layer_model_group, X_("LayerLaterHigher"), _("Later is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::LaterHigher));
+ ActionManager::register_radio_action (editor_actions, layer_model_group, X_("LayerMoveAddHigher"), _("Most Recently Moved/Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::MoveAddHigher));
+ ActionManager::register_radio_action (editor_actions, layer_model_group, X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::AddHigher));
+
ActionManager::add_action_group (rl_actions);
ActionManager::add_action_group (zoom_actions);
ActionManager::add_action_group (mouse_mode_actions);
}
}
+void
+Editor::toggle_auto_xfade ()
+{
+ Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-auto-xfades"));
+ if (act) {
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+ Config->set_auto_xfade (tact->get_active());
+ }
+}
+
+void
+Editor::toggle_xfades_active ()
+{
+ Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-active"));
+ if (session && act) {
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+ session->set_crossfades_active (tact->get_active());
+ }
+}
+
+void
+Editor::toggle_xfade_visibility ()
+{
+ Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-visible"));
+ if (session && act) {
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+ // set_xfade_visibility (tact->get_active());
+ }
+}
+
+void
+Editor::set_layer_model (Session::LayerModel model)
+{
+ /* this is driven by a toggle on a radio group, and so is invoked twice,
+ once for the item that became inactive and once for the one that became
+ active.
+ */
+
+ RefPtr<Action> act;
+
+ if (session) {
+ switch (model) {
+ case Session::LaterHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
+ break;
+ case Session::MoveAddHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
+ break;
+ case Session::AddHigher:
+ act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
+ break;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ session->set_layer_model (model);
+ }
+ }
+ }
+}
+
+void
+Editor::set_crossfade_model (CrossfadeModel model)
+{
+ RefPtr<Action> act;
+
+ /* this is driven by a toggle on a radio group, and so is invoked twice,
+ once for the item that became inactive and once for the one that became
+ active.
+ */
+
+ if (session) {
+ switch (model) {
+ case FullCrossfade:
+ act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
+ break;
+ case ShortCrossfade:
+ act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort"));
+ break;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ session->set_xfade_model (model);
+ }
+ }
+ }
+}
commit_reversible_command ();
}
-void
-Editor::toggle_xfades_active ()
-{
- if (session) {
- session->set_crossfades_active (!session->get_crossfades_active());
- }
-}
-
-void
-Editor::set_xfade_visibility (bool yn)
-{
-
-}
-
-void
-Editor::toggle_xfade_visibility ()
-{
- set_xfade_visibility (!xfade_visibility());
-}
-
void
Editor::remove_last_capture ()
{
using namespace Gtkmm2ext;
using namespace std;
-static const gchar *lmode_strings[] = {
- N_("Later regions are higher"),
- N_("Most recently added/moved/trimmed regions are higher"),
- N_("Most recently added regions are higher"),
- 0
-};
-
-static const gchar *xfl_strings[] = {
- N_("Span entire region overlap"),
- N_("Short fades at the start of the overlap"),
- 0
-};
-
static vector<string> positional_sync_strings;
-static vector<string> layer_mode_strings;
-static vector<string> xfade_model_strings;
OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
: Dialog ("option editor"),
/* Fades */
- auto_xfade_button (_("Automatically create crossfades")),
- xfade_active_button (_("New full-overlap crossfades are unmuted")),
- layer_mode_label (_("Region layering mode")),
- xfade_model_label (_("Crossfade model")),
short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
short_xfade_slider (short_xfade_adjustment),
+ destructo_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
+ destructo_xfade_slider (destructo_xfade_adjustment),
/* Sync */
set_name ("OptionsWindow");
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
- layer_mode_label.set_name ("OptionsLabel");
- xfade_model_label.set_name ("OptionsLabel");
-
VBox *vbox = get_vbox();
set_border_width (3);
session_raid_entry.set_sensitive (false);
smpte_fps_combo.set_sensitive (false);
- layer_mode_combo.set_sensitive (false);
short_xfade_slider.set_sensitive (false);
smpte_offset_negative_button.set_sensitive (false);
click_emphasis_path_entry.set_sensitive (true);
session_raid_entry.set_sensitive (true);
smpte_fps_combo.set_sensitive (true);
- layer_mode_combo.set_sensitive (true);
short_xfade_slider.set_sensitive (true);
smpte_offset_negative_button.set_sensitive (true);
setup_click_editor ();
connect_audition_editor ();
- layer_mode_combo.set_active_text (layer_mode_strings[session->get_layer_model()]);
- xfade_model_combo.set_active_text (xfade_model_strings[session->get_xfade_model()]);
-
short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
add_session_paths ();
OptionEditor::setup_fade_options ()
{
Gtk::HBox* hbox;
- vector<string> dumb;
- auto_xfade_button.set_name ("OptionEditorToggleButton");
- xfade_active_button.set_name ("OptionEditorToggleButton");
-
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->pack_start (auto_xfade_button, false, false);
- fade_packer.pack_start (*hbox, false, false);
-
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->pack_start (xfade_active_button, false, false);
- fade_packer.pack_start (*hbox, false, false);
-
- layer_mode_strings = internationalize (lmode_strings);
-
- dumb.push_back (lmode_strings[Session::LaterHigher]);
- dumb.push_back (lmode_strings[Session::MoveAddHigher]);
- dumb.push_back (lmode_strings[Session::AddHigher]);
- set_popdown_strings (layer_mode_combo, dumb);
-
- layer_mode_combo.signal_changed ().connect (mem_fun(*this, &OptionEditor::layer_mode_chosen));
-
- fixup_combo_size (layer_mode_combo, layer_mode_strings);
-
- hbox = manage (new HBox);
- hbox->set_border_width (5);
- hbox->set_spacing (10);
- hbox->pack_start (layer_mode_label, false, false);
- hbox->pack_start (layer_mode_combo, false, false);
- fade_packer.pack_start (*hbox, false, false);
-
- xfade_model_strings = internationalize (xfl_strings);
-
- dumb.clear ();
- dumb.push_back (xfade_model_strings[FullCrossfade]);
- dumb.push_back (xfade_model_strings[ShortCrossfade]);
- set_popdown_strings (xfade_model_combo, dumb);
-
- xfade_model_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::xfade_model_chosen));
-
- fixup_combo_size (xfade_model_combo, xfade_model_strings);
-
+ Label* label = manage (new Label (_("Short crossfade length (msecs)")));
+ label->set_name ("OptionsLabel");
+
hbox = manage (new HBox);
hbox->set_border_width (5);
hbox->set_spacing (10);
- hbox->pack_start (xfade_model_label, false, false);
- hbox->pack_start (xfade_model_combo, false, false);
+ hbox->pack_start (*label, false, false);
+ hbox->pack_start (short_xfade_slider, true, true);
fade_packer.pack_start (*hbox, false, false);
- auto_xfade_button.set_active (Config->get_auto_xfade());
- /* xfade and layer mode active requires session */
+ short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
- auto_xfade_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_xfade_clicked));
- xfade_active_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::xfade_active_clicked));
-
- Label* short_xfade_label = manage (new Label (_("Short crossfade length (msecs)")));
- short_xfade_label->set_name ("OptionsLabel");
+ label = manage (new Label (_("Destructive crossfade length (msecs)")));
+ label->set_name ("OptionsLabel");
hbox = manage (new HBox);
hbox->set_border_width (5);
hbox->set_spacing (10);
- hbox->pack_start (*short_xfade_label, false, false);
- hbox->pack_start (short_xfade_slider, true, true);
+ hbox->pack_start (*label, false, false);
+ hbox->pack_start (destructo_xfade_slider, true, true);
fade_packer.pack_start (*hbox, false, false);
-
- short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
+
+ destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
fade_packer.show_all ();
}
}
void
-OptionEditor::layer_mode_chosen ()
+OptionEditor::destructo_xfade_adjustment_changed ()
{
- if (!session) {
- return;
- }
-
- string which = layer_mode_combo.get_active_text ();
-
- if (which == layer_mode_strings[Session::LaterHigher]) {
- session->set_layer_model (Session::LaterHigher);
- } else if (which == layer_mode_strings[Session::MoveAddHigher]) {
- session->set_layer_model (Session::MoveAddHigher);
- } else if (which == layer_mode_strings[Session::AddHigher]) {
- session->set_layer_model (Session::AddHigher);
- }
-}
+ float val = destructo_xfade_adjustment.get_value();
-void
-OptionEditor::xfade_model_chosen ()
-{
- if (!session) {
- return;
- }
-
- string which = xfade_model_combo.get_active_text ();
-
- if (which == xfade_model_strings[FullCrossfade]) {
- session->set_xfade_model (FullCrossfade);
- } else if (which == xfade_model_strings[ShortCrossfade]) {
- session->set_xfade_model (ShortCrossfade);
- }
-}
-
-void
-OptionEditor::auto_xfade_clicked ()
-{
- Config->set_auto_xfade (auto_xfade_button.get_active());
-}
-
-void
-OptionEditor::xfade_active_clicked ()
-{
+ /* val is in msecs */
+
if (session) {
- session->set_crossfades_active (xfade_active_button.get_active());
+ Config->set_destructive_xfade_msecs ((uint32_t) floor (val), session->frame_rate());
+ } else {
+ Config->set_destructive_xfade_msecs ((uint32_t) floor (val), 0);
}
}
/* fades */
Gtk::VBox fade_packer;
- Gtk::CheckButton auto_xfade_button;
- Gtk::CheckButton xfade_active_button;
- Gtk::Label layer_mode_label;
- Gtk::ComboBoxText layer_mode_combo;
- Gtk::Label xfade_model_label;
- Gtk::ComboBoxText xfade_model_combo;
Gtk::Adjustment short_xfade_adjustment;
Gtk::HScale short_xfade_slider;
+ Gtk::Adjustment destructo_xfade_adjustment;
+ Gtk::HScale destructo_xfade_slider;
- void auto_xfade_clicked ();
- void xfade_active_clicked ();
- void layer_mode_chosen ();
- void xfade_model_chosen ();
void setup_fade_options();
void short_xfade_adjustment_changed ();
+ void destructo_xfade_adjustment_changed ();
/* Sync */
--- /dev/null
+/* XPM */
+static const gchar * regout2_xpm[] = {
+"25 25 3 1",
+" c None",
+". c #FDFD00",
+"+ c #FEFE00",
+" ",
+" ",
+" .+. ",
+" +++ ",
+" +++ ",
+" +++ ",
+" .++ ",
+" ++ ",
+" ++. ",
+" +++ ",
+" .++ ",
+" +++ ",
+" +++ ",
+" .+++ ",
+" ++++ ",
+" ++++ ",
+" +++++. ",
+" .+++++. ",
+" .++++++. ",
+" .+++++ ",
+" .+. ",
+" ",
+" ",
+" ",
+" "};
virtual void set_follow_playhead (bool yn) = 0;
virtual void toggle_follow_playhead () = 0;
virtual bool follow_playhead() const = 0;
- virtual void toggle_xfade_visibility () = 0;
- virtual void set_xfade_visibility (bool yn) = 0;
- virtual bool xfade_visibility() const = 0;
virtual void ensure_float (Gtk::Window&) = 0;
virtual void show_window () = 0;
virtual TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0;
gain_t get_quieten_at_speed ();
void set_quieten_at_speed (gain_t);
- std::string get_tape_dir ();
- void set_tape_dir (std::string);
+ uint32_t get_destructive_xfade_msecs ();
+ void set_destructive_xfade_msecs (uint32_t, jack_nframes_t sample_rate = 0);
private:
void set_defaults ();
bool midi_feedback_interval_ms_is_user;
bool latched_record_enable;
bool latched_record_enable_is_user;
- std::string tape_dir;
- bool tape_dir_is_user;
+ uint32_t destructive_xfade_msecs;
+ bool destructive_xfade_msecs_is_user;
XMLNode *key_node;
bool user_configuration;
XMLNode& get_state ();
+ static void setup_standard_crossfades (jack_nframes_t sample_rate);
+
private:
static jack_nframes_t xfade_frames;
static gain_t* out_coefficient;
static gain_t* in_coefficient;
- static void setup_standard_crossfades (jack_nframes_t sample_rate);
bool _capture_start;
bool _capture_end;
#include <ardour/ardour.h>
#include <ardour/configuration.h>
#include <ardour/diskstream.h>
+#include <ardour/destructive_filesource.h>
#include "i18n.h"
if (!user_only || latched_record_enable_is_user) {
node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no"));
}
- if (!user_only || tape_dir_is_user) {
- if (!tape_dir.empty()) {
- node->add_child_nocopy(option_node("tape-dir", tape_dir));
- }
+ if (!user_only || destructive_xfade_msecs_is_user) {
+ snprintf(buf, sizeof(buf), "%" PRIu32, destructive_xfade_msecs);
+ node->add_child_nocopy(option_node("destructive_xfade_msecs", string(buf)));
}
/* use-vst is always per-user */
set_midi_feedback_interval_ms (atoi (option_value.c_str()));
} else if (option_name == "latched-record-enable") {
set_latched_record_enable (option_value == "yes");
- } else if (option_name == "tape-dir") {
- set_tape_dir (option_value);
+ } else if (option_name == "destructive_xfade_msecs") {
+ uint32_t v;
+ if (sscanf (option_value.c_str(), "%u", &v) == 1) {
+ set_destructive_xfade_msecs (v);
+ }
}
}
timecode_source_is_synced = true;
use_vst = true; /* if we build with VST_SUPPORT, otherwise no effect */
quieten_at_speed = true;
- tape_dir = "";
+ destructive_xfade_msecs = 2;
midi_feedback_interval_ms = 100;
quieten_at_speed_is_user = false;
midi_feedback_interval_ms_is_user = false;
latched_record_enable_is_user = false;
- tape_dir_is_user = false;
+ destructive_xfade_msecs_is_user = false;
}
Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node)
return latched_record_enable;
}
-string
-Configuration::get_tape_dir ()
+uint32_t
+Configuration::get_destructive_xfade_msecs ()
{
- return tape_dir;
+ return destructive_xfade_msecs;
}
void
-Configuration::set_tape_dir (string path)
+Configuration::set_destructive_xfade_msecs (uint32_t msecs, jack_nframes_t rate)
{
- tape_dir = path;
+ destructive_xfade_msecs = msecs;
+ if (rate) {
+ DestructiveFileSource::setup_standard_crossfades (rate);
+ }
}
void
DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate)
{
- xfade_frames = (jack_nframes_t) floor ((/*Config->get_destructive_crossfade_msecs()*/ 64 / 1000.0) * rate);
+ xfade_frames = (jack_nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate);
+
+ if (out_coefficient) {
+ delete [] out_coefficient;
+ }
+
+ if (in_coefficient) {
+ delete [] in_coefficient;
+ }
out_coefficient = new gain_t[xfade_frames];
in_coefficient = new gain_t[xfade_frames];
string
Session::tape_dir () const
{
- string res = Config->get_tape_dir();
-
- if (!res.empty()) {
- return res;
- }
-
- res = _path;
+ string res = _path;
res += tape_dir_name;
res += '/';
return res;