int secs;
nframes_t fr = session->frame_rate();
- if (session->actively_recording()){
-
- rec_enabled_diskstreams = 0;
- session->foreach_route (this, &ARDOUR_UI::count_recenabled_diskstreams);
-
- if (rec_enabled_diskstreams) {
- frames /= rec_enabled_diskstreams;
- }
-
- } else {
-
- /* hmmm. shall we divide by the route count? or the diskstream count?
- or what? for now, do nothing ...
- */
-
+ rec_enabled_diskstreams = 0;
+ session->foreach_route (this, &ARDOUR_UI::count_recenabled_diskstreams);
+
+ if (rec_enabled_diskstreams) {
+ frames /= rec_enabled_diskstreams;
}
hrs = frames / (fr * 3600);
void map_meter_falloff ();
void toggle_control_protocol (ARDOUR::ControlProtocolInfo*);
+ void toggle_control_protocol_feedback (ARDOUR::ControlProtocolInfo*, const char* group_name, const char* action_name);
};
#endif /* __ardour_gui_h__ */
auditioning_alert_button.set_name ("TransportAuditioningAlert");
auditioning_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::audition_alert_toggle));
+ tooltips().set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
+ tooltips().set_tip (auditioning_alert_button, _("When active, auditioning is taking place\nClick to stop the audition"));
+
alert_box.pack_start (solo_alert_button, false, false);
alert_box.pack_start (auditioning_alert_button, false, false);
}
}
+void
+ARDOUR_UI::toggle_control_protocol_feedback (ControlProtocolInfo* cpi, const char* group, const char* action)
+{
+ if (!session) {
+ /* this happens when we build the menu bar when control protocol support
+ has been used in the past for some given protocol - the item needs
+ to be made active, but there is no session yet.
+ */
+ return;
+ }
+
+ if (cpi->protocol) {
+ Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (group, action);
+
+ if (act) {
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+ bool x = tact->get_active();
+
+ if (tact && x != cpi->protocol->get_feedback()) {
+ cpi->protocol->set_feedback (!x);
+ }
+ }
+ }
+}
+
void
ARDOUR_UI::build_control_surface_menu ()
{
list<ControlProtocolInfo*>::iterator i;
+ bool with_feedback;
/* !!! this has to match the top level entry from ardour.menus */
(bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol), *i)));
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+
+ with_feedback = false;
if ((*i)->protocol || (*i)->requested) {
tact->set_active ();
ui += "<menuitem action='";
ui += action_name;
ui += "'/>\n";
+
+ if ((*i)->supports_feedback) {
+
+ string submenu_name = action_name;
+
+ submenu_name += "SubMenu";
+
+ ActionManager::register_action (editor->editor_actions, submenu_name.c_str(), _("Controls"));
+
+ action_name += "Feedback";
+
+ Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), _("Feedback"),
+ (bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback),
+ *i,
+ "Editor",
+ action_name.c_str())));
+
+ ui += "<menu action='";
+ ui += submenu_name;
+ ui += "'>\n<menuitem action='";
+ ui += action_name;
+ ui += "'/>\n</menu>\n";
+
+ if ((*i)->protocol) {
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+ tact->set_active ((*i)->protocol->get_feedback ());
+ }
+ }
}
}
};
static const gchar *zoom_focus_strings[] = {
- N_("Focus Left"),
- N_("Focus Right"),
- N_("Focus Center"),
- N_("Focus Playhead"),
- N_("Focus Edit Cursor"),
+ N_("Left"),
+ N_("Right"),
+ N_("Center"),
+ N_("Playhead"),
+ N_("Edit Cursor"),
0
};
Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Focus Center", 2+FUDGE, 0);
set_popdown_strings (zoom_focus_selector, internationalize (zoom_focus_strings));
zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
+ ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
zoom_box.pack_start (zoom_focus_selector, false, false);
Editor::export_session()
{
if (session) {
- export_range (0, session->current_end_frame());
+ export_range (session->current_start_frame(), session->current_end_frame());
}
}
std::string path;
bool requested;
bool mandatory;
+ bool supports_feedback;
XMLNode* state;
ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {}
cpi->protocol = 0;
cpi->requested = false;
cpi->mandatory = descriptor->mandatory;
+ cpi->supports_feedback = descriptor->supports_feedback;
cpi->state = 0;
control_protocol_info.push_back (cpi);
nframes_t
Session::available_capture_duration ()
{
- const double scale = 4096.0 / sizeof (Sample);
+ float sample_bytes_on_disk;
+
+ switch (Config->get_native_file_data_format()) {
+ case FormatFloat:
+ sample_bytes_on_disk = 4;
+ break;
+
+ case FormatInt24:
+ sample_bytes_on_disk = 3;
+ break;
+ }
+
+ double scale = 4096.0 / sample_bytes_on_disk;
if (_total_free_4k_blocks * scale > (double) max_frames) {
return max_frames;
void
Session::poke_midi_thread ()
{
- char c;
+ static char c = 0;
if (write (midi_request_pipe[1], &c, 1) != 1) {
error << string_compose(_("cannot send signal to midi thread! (%1)"), strerror (errno)) << endmsg;
virtual int set_feedback (bool yn) { return 0; }
virtual bool get_feedback () const { return false; }
- virtual bool supports_feedback () const { return false; }
sigc::signal<void> ActiveChanged;
void* ptr; /* protocol can store a value here */
void* module; /* not for public access */
int mandatory; /* if non-zero, always load and do not make optional */
+ bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
bool (*probe)(ControlProtocolDescriptor*);
ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
int set_feedback (bool yn);
bool get_feedback () const;
- bool supports_feedback () const { return true; }
XMLNode& get_state ();
int set_state (const XMLNode&);
ptr : 0,
module : 0,
mandatory : 0,
+ supports_feedback : true,
probe : probe_generic_midi_protocol,
initialize : new_generic_midi_protocol,
destroy : delete_generic_midi_protocol
ptr : 0,
module : 0,
mandatory : 0,
+ supports_feedback : false,
probe : probe_tranzport_protocol,
initialize : new_tranzport_protocol,
destroy : delete_tranzport_protocol