From fa5aeb7892fb73d45782b42da731bc5a51418e79 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 26 Oct 2009 14:38:58 +0000 Subject: change the use of "SMPTE" to "Timecode" to reflect the global economy and the end of american dominance on the world audio production stage git-svn-id: svn://localhost/ardour2/branches/3.0@5924 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus.in | 6 +- gtk2_ardour/ardour_ui.cc | 2 +- gtk2_ardour/ardour_ui_options.cc | 2 +- gtk2_ardour/audio_clock.cc | 576 ++++++++++----------- gtk2_ardour/audio_clock.h | 28 +- gtk2_ardour/editing_syms.h | 6 +- gtk2_ardour/editor.cc | 138 ++--- gtk2_ardour/editor.h | 39 +- gtk2_ardour/editor_actions.cc | 40 +- gtk2_ardour/editor_mouse.cc | 16 +- gtk2_ardour/editor_regions.cc | 30 +- gtk2_ardour/editor_rulers.cc | 284 +++++----- gtk2_ardour/enums.cc | 2 +- gtk2_ardour/export_format_dialog.cc | 16 +- gtk2_ardour/export_timespan_selector.cc | 14 +- gtk2_ardour/export_timespan_selector.h | 2 +- gtk2_ardour/session_option_editor.cc | 26 +- gtk2_ardour/sfdb_ui.cc | 2 +- libs/ardour/ardour/element_importer.h | 4 +- libs/ardour/ardour/export_profile_manager.h | 4 +- libs/ardour/ardour/session.h | 64 +-- libs/ardour/ardour/session_configuration_vars.h | 2 +- libs/ardour/ardour/smpte.h | 79 --- libs/ardour/ardour/ticker.h | 4 +- libs/ardour/ardour/timecode.h | 79 +++ libs/ardour/ardour/types.h | 26 +- libs/ardour/audio_diskstream.cc | 2 +- libs/ardour/audio_region_importer.cc | 12 +- libs/ardour/element_importer.cc | 2 +- libs/ardour/enums.cc | 24 +- libs/ardour/export_format_specification.cc | 30 +- libs/ardour/location_importer.cc | 14 +- libs/ardour/mtc_slave.cc | 40 +- libs/ardour/session.cc | 6 +- libs/ardour/session_events.cc | 4 +- libs/ardour/session_midi.cc | 124 ++--- libs/ardour/session_process.cc | 10 +- libs/ardour/session_state.cc | 12 +- libs/ardour/session_time.cc | 286 +++++----- libs/ardour/session_transport.cc | 8 +- libs/ardour/ticker.cc | 4 +- libs/surfaces/control_protocol/basic_ui.cc | 16 +- .../control_protocol/control_protocol/basic_ui.h | 10 +- .../control_protocol/control_protocol/smpte.h | 70 --- .../control_protocol/control_protocol/timecode.h | 70 +++ libs/surfaces/control_protocol/smpte.cc | 302 +++++------ libs/surfaces/mackie/bcf_surface_generated.cc | 14 +- libs/surfaces/mackie/mackie_button_handler.cc | 4 +- libs/surfaces/mackie/mackie_button_handler.h | 4 +- libs/surfaces/mackie/mackie_control_protocol.cc | 42 +- libs/surfaces/mackie/mackie_control_protocol.h | 12 +- libs/surfaces/mackie/mackie_surface_generated.cc | 14 +- libs/surfaces/tranzport/show.cc | 18 +- .../tranzport/tranzport_control_protocol.h | 2 +- 54 files changed, 1331 insertions(+), 1316 deletions(-) delete mode 100644 libs/ardour/ardour/smpte.h create mode 100644 libs/ardour/ardour/timecode.h delete mode 100644 libs/surfaces/control_protocol/control_protocol/smpte.h create mode 100644 libs/surfaces/control_protocol/control_protocol/timecode.h diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 3234bb2fa3..afbbf196f9 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -316,9 +316,9 @@ - - - + + + diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 0a019408ac..f10f287ef8 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -382,7 +382,7 @@ ARDOUR_UI::post_engine () primary_clock.set_mode (AudioClock::BBT); secondary_clock.set_mode (AudioClock::MinSec); } else { - primary_clock.set_mode (AudioClock::SMPTE); + primary_clock.set_mode (AudioClock::Timecode); secondary_clock.set_mode (AudioClock::BBT); } diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 29c7c3cc6c..9370315a8f 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -416,7 +416,7 @@ ARDOUR_UI::parameter_changed (std::string p) shuttle_units_button.set_label(_("ST")); break; } - } else if (p == "video-pullup" || p == "smpte-format") { + } else if (p == "video-pullup" || p == "timecode-format") { if (session) { primary_clock.set (session->audible_frame(), true); secondary_clock.set (session->audible_frame(), true); diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 42531732fa..361ee252bc 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -50,10 +50,10 @@ sigc::signal AudioClock::ModeChanged; vector AudioClock::clocks; const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = { - 2, /* SMPTE_Hours */ - 2, /* SMPTE_Minutes */ - 2, /* SMPTE_Seconds */ - 2, /* SMPTE_Frames */ + 2, /* Timecode_Hours */ + 2, /* Timecode_Minutes */ + 2, /* Timecode_Seconds */ + 2, /* Timecode_Frames */ 2, /* MS_Hours */ 2, /* MS_Minutes */ 5, /* MS_Seconds */ @@ -89,36 +89,36 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg if (with_info) { frames_upper_info_label = manage (new Label); frames_lower_info_label = manage (new Label); - smpte_upper_info_label = manage (new Label); - smpte_lower_info_label = manage (new Label); + timecode_upper_info_label = manage (new Label); + timecode_lower_info_label = manage (new Label); bbt_upper_info_label = manage (new Label); bbt_lower_info_label = manage (new Label); frames_upper_info_label->set_name ("AudioClockFramesUpperInfo"); frames_lower_info_label->set_name ("AudioClockFramesLowerInfo"); - smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo"); - smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo"); + timecode_upper_info_label->set_name ("AudioClockTimecodeUpperInfo"); + timecode_lower_info_label->set_name ("AudioClockTimecodeLowerInfo"); bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo"); bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo"); - Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0); - Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0); + Gtkmm2ext::set_size_request_to_display_given_text(*timecode_upper_info_label, "23.98",0,0); + Gtkmm2ext::set_size_request_to_display_given_text(*timecode_lower_info_label, "NDF",0,0); Gtkmm2ext::set_size_request_to_display_given_text(*bbt_upper_info_label, "88|88",0,0); Gtkmm2ext::set_size_request_to_display_given_text(*bbt_lower_info_label, "888.88",0,0); frames_info_box.pack_start (*frames_upper_info_label, true, true); frames_info_box.pack_start (*frames_lower_info_label, true, true); - smpte_info_box.pack_start (*smpte_upper_info_label, true, true); - smpte_info_box.pack_start (*smpte_lower_info_label, true, true); + timecode_info_box.pack_start (*timecode_upper_info_label, true, true); + timecode_info_box.pack_start (*timecode_lower_info_label, true, true); bbt_info_box.pack_start (*bbt_upper_info_label, true, true); bbt_info_box.pack_start (*bbt_lower_info_label, true, true); } else { frames_upper_info_label = 0; frames_lower_info_label = 0; - smpte_upper_info_label = 0; - smpte_lower_info_label = 0; + timecode_upper_info_label = 0; + timecode_lower_info_label = 0; bbt_upper_info_label = 0; bbt_lower_info_label = 0; } @@ -146,21 +146,21 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg ms_minutes_ebox.add (ms_minutes_label); ms_seconds_ebox.add (ms_seconds_label); - smpte_packer.set_homogeneous (false); - smpte_packer.set_border_width (2); - smpte_packer.pack_start (hours_ebox, false, false); - smpte_packer.pack_start (colon1, false, false); - smpte_packer.pack_start (minutes_ebox, false, false); - smpte_packer.pack_start (colon2, false, false); - smpte_packer.pack_start (seconds_ebox, false, false); - smpte_packer.pack_start (colon3, false, false); - smpte_packer.pack_start (frames_ebox, false, false); + timecode_packer.set_homogeneous (false); + timecode_packer.set_border_width (2); + timecode_packer.pack_start (hours_ebox, false, false); + timecode_packer.pack_start (colon1, false, false); + timecode_packer.pack_start (minutes_ebox, false, false); + timecode_packer.pack_start (colon2, false, false); + timecode_packer.pack_start (seconds_ebox, false, false); + timecode_packer.pack_start (colon3, false, false); + timecode_packer.pack_start (frames_ebox, false, false); if (with_info) { - smpte_packer.pack_start (smpte_info_box, false, false, 5); + timecode_packer.pack_start (timecode_info_box, false, false, 5); } - smpte_packer_hbox.pack_start (smpte_packer, true, false); + timecode_packer_hbox.pack_start (timecode_packer, true, false); bbt_packer.set_homogeneous (false); bbt_packer.set_border_width (2); @@ -194,7 +194,7 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg set_widget_name (widget_name); _mode = BBT; /* lie to force mode switch */ - set_mode (SMPTE); + set_mode (Timecode); pack_start (clock_frame, true, true); @@ -210,9 +210,9 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg */ clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); - clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours)); + clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), Timecode_Hours)); - Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed)); + Session::TimecodeOffsetChanged.connect (mem_fun (*this, &AudioClock::timecode_offset_changed)); if (editable) { setup_events (); @@ -295,10 +295,10 @@ AudioClock::setup_events () ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS); ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS); - hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours)); - minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes)); - seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds)); - frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames)); + hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Hours)); + minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Minutes)); + seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Seconds)); + frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Frames)); audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames)); bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars)); beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats)); @@ -307,10 +307,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes)); ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds)); - hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours)); - minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes)); - seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds)); - frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames)); + hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Hours)); + minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Minutes)); + seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Seconds)); + frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Frames)); audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames)); bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars)); beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats)); @@ -319,10 +319,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes)); ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds)); - hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours)); - minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes)); - seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds)); - frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames)); + hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Hours)); + minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Minutes)); + seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Seconds)); + frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Frames)); audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames)); bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars)); beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats)); @@ -331,10 +331,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes)); ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds)); - hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours)); - minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes)); - seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds)); - frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames)); + hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Hours)); + minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Minutes)); + seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Seconds)); + frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Frames)); audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames)); bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars)); beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats)); @@ -343,10 +343,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes)); ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds)); - hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours)); - minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes)); - seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds)); - frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames)); + hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Hours)); + minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Minutes)); + seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Seconds)); + frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Frames)); audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames)); bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars)); beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats)); @@ -355,10 +355,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes)); ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds)); - hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours)); - minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes)); - seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds)); - frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames)); + hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Hours)); + minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Minutes)); + seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Seconds)); + frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Frames)); audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames)); bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars)); beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats)); @@ -367,10 +367,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes)); ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds)); - hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours)); - minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes)); - seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds)); - frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames)); + hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Hours)); + minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Minutes)); + seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Seconds)); + frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Frames)); audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames)); bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars)); beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats)); @@ -379,10 +379,10 @@ AudioClock::setup_events () ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes)); ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds)); - hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours)); - minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes)); - seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds)); - frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames)); + hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Hours)); + minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Minutes)); + seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Seconds)); + frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Frames)); audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames)); bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars)); beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats)); @@ -447,8 +447,8 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, char which) } switch (_mode) { - case SMPTE: - set_smpte (when, force); + case Timecode: + set_timecode (when, force); break; case BBT: @@ -471,12 +471,12 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, char which) } void -AudioClock::smpte_offset_changed () +AudioClock::timecode_offset_changed () { nframes_t current; switch (_mode) { - case SMPTE: + case Timecode: if (is_duration) { current = current_duration(); } else { @@ -560,61 +560,61 @@ AudioClock::set_minsec (nframes_t when, bool force) } void -AudioClock::set_smpte (nframes_t when, bool force) +AudioClock::set_timecode (nframes_t when, bool force) { char buf[32]; - SMPTE::Time smpte; + Timecode::Time timecode; if (is_duration) { - session->smpte_duration (when, smpte); + session->timecode_duration (when, timecode); } else { - session->smpte_time (when, smpte); + session->timecode_time (when, timecode); } - if (force || smpte.hours != last_hrs || smpte.negative != last_negative) { - if (smpte.negative) { - sprintf (buf, "-%02" PRIu32, smpte.hours); + if (force || timecode.hours != last_hrs || timecode.negative != last_negative) { + if (timecode.negative) { + sprintf (buf, "-%02" PRIu32, timecode.hours); } else { - sprintf (buf, " %02" PRIu32, smpte.hours); + sprintf (buf, " %02" PRIu32, timecode.hours); } hours_label.set_text (buf); - last_hrs = smpte.hours; - last_negative = smpte.negative; + last_hrs = timecode.hours; + last_negative = timecode.negative; } - if (force || smpte.minutes != last_mins) { - sprintf (buf, "%02" PRIu32, smpte.minutes); + if (force || timecode.minutes != last_mins) { + sprintf (buf, "%02" PRIu32, timecode.minutes); minutes_label.set_text (buf); - last_mins = smpte.minutes; + last_mins = timecode.minutes; } - if (force || smpte.seconds != last_secs) { - sprintf (buf, "%02" PRIu32, smpte.seconds); + if (force || timecode.seconds != last_secs) { + sprintf (buf, "%02" PRIu32, timecode.seconds); seconds_label.set_text (buf); - last_secs = smpte.seconds; + last_secs = timecode.seconds; } - if (force || smpte.frames != last_frames) { - sprintf (buf, "%02" PRIu32, smpte.frames); + if (force || timecode.frames != last_frames) { + sprintf (buf, "%02" PRIu32, timecode.frames); frames_label.set_text (buf); - last_frames = smpte.frames; + last_frames = timecode.frames; } - if (smpte_upper_info_label) { - double smpte_frames = session->smpte_frames_per_second(); + if (timecode_upper_info_label) { + double timecode_frames = session->timecode_frames_per_second(); - if ( fmod(smpte_frames, 1.0) == 0.0) { - sprintf (buf, "%u", int (smpte_frames)); + if ( fmod(timecode_frames, 1.0) == 0.0) { + sprintf (buf, "%u", int (timecode_frames)); } else { - sprintf (buf, "%.2f", smpte_frames); + sprintf (buf, "%.2f", timecode_frames); } - if (smpte_upper_info_label->get_text() != buf) { - smpte_upper_info_label->set_text (buf); + if (timecode_upper_info_label->get_text() != buf) { + timecode_upper_info_label->set_text (buf); } - if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) { - if (session->smpte_drop_frames()) { + if ((fabs(timecode_frames - 29.97) < 0.0001) || timecode_frames == 30) { + if (session->timecode_drop_frames()) { sprintf (buf, "DF"); } else { sprintf (buf, "NDF"); @@ -624,8 +624,8 @@ AudioClock::set_smpte (nframes_t when, bool force) buf[0] = '\0'; } - if (smpte_lower_info_label->get_text() != buf) { - smpte_lower_info_label->set_text (buf); + if (timecode_lower_info_label->get_text() != buf) { + timecode_lower_info_label->set_text (buf); } } } @@ -712,7 +712,7 @@ void AudioClock::focus () { switch (_mode) { - case SMPTE: + case Timecode: hours_ebox.grab_focus (); break; @@ -750,16 +750,16 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field) bool move_on = false; switch (field) { - case SMPTE_Hours: + case Timecode_Hours: label = &hours_label; break; - case SMPTE_Minutes: + case Timecode_Minutes: label = &minutes_label; break; - case SMPTE_Seconds: + case Timecode_Seconds: label = &seconds_label; break; - case SMPTE_Frames: + case Timecode_Frames: label = &frames_label; break; @@ -895,12 +895,12 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field) if (key_entry_state) { switch (field) { - case SMPTE_Hours: - case SMPTE_Minutes: - case SMPTE_Seconds: - case SMPTE_Frames: - // Check SMPTE fields for sanity (may also adjust fields) - smpte_sanitize_display(); + case Timecode_Hours: + case Timecode_Minutes: + case Timecode_Seconds: + case Timecode_Frames: + // Check Timecode fields for sanity (may also adjust fields) + timecode_sanitize_display(); break; case Bars: case Beats: @@ -926,18 +926,18 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field) switch (field) { - /* SMPTE */ + /* Timecode */ - case SMPTE_Hours: + case Timecode_Hours: minutes_ebox.grab_focus (); break; - case SMPTE_Minutes: + case Timecode_Minutes: seconds_ebox.grab_focus (); break; - case SMPTE_Seconds: + case Timecode_Seconds: frames_ebox.grab_focus (); break; - case SMPTE_Frames: + case Timecode_Frames: clock_base.grab_focus (); break; @@ -994,19 +994,19 @@ AudioClock::field_focus_in_event (GdkEventFocus */*ev*/, Field field) Keyboard::magic_widget_grab_focus (); switch (field) { - case SMPTE_Hours: + case Timecode_Hours: hours_ebox.set_flags (Gtk::HAS_FOCUS); hours_ebox.set_state (Gtk::STATE_ACTIVE); break; - case SMPTE_Minutes: + case Timecode_Minutes: minutes_ebox.set_flags (Gtk::HAS_FOCUS); minutes_ebox.set_state (Gtk::STATE_ACTIVE); break; - case SMPTE_Seconds: + case Timecode_Seconds: seconds_ebox.set_flags (Gtk::HAS_FOCUS); seconds_ebox.set_state (Gtk::STATE_ACTIVE); break; - case SMPTE_Frames: + case Timecode_Frames: frames_ebox.set_flags (Gtk::HAS_FOCUS); frames_ebox.set_state (Gtk::STATE_ACTIVE); break; @@ -1050,19 +1050,19 @@ AudioClock::field_focus_out_event (GdkEventFocus */*ev*/, Field field) { switch (field) { - case SMPTE_Hours: + case Timecode_Hours: hours_ebox.unset_flags (Gtk::HAS_FOCUS); hours_ebox.set_state (Gtk::STATE_NORMAL); break; - case SMPTE_Minutes: + case Timecode_Minutes: minutes_ebox.unset_flags (Gtk::HAS_FOCUS); minutes_ebox.set_state (Gtk::STATE_NORMAL); break; - case SMPTE_Seconds: + case Timecode_Seconds: seconds_ebox.unset_flags (Gtk::HAS_FOCUS); seconds_ebox.set_state (Gtk::STATE_NORMAL); break; - case SMPTE_Frames: + case Timecode_Frames: frames_ebox.unset_flags (Gtk::HAS_FOCUS); frames_ebox.set_state (Gtk::STATE_NORMAL); break; @@ -1135,16 +1135,16 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field) switch (ev->button) { case 1: switch (field) { - case SMPTE_Hours: + case Timecode_Hours: hours_ebox.grab_focus(); break; - case SMPTE_Minutes: + case Timecode_Minutes: minutes_ebox.grab_focus(); break; - case SMPTE_Seconds: + case Timecode_Seconds: seconds_ebox.grab_focus(); break; - case SMPTE_Frames: + case Timecode_Frames: frames_ebox.grab_focus(); break; @@ -1335,17 +1335,17 @@ AudioClock::get_frames (Field field,nframes_t pos,int dir) nframes_t frames = 0; BBT_Time bbt; switch (field) { - case SMPTE_Hours: + case Timecode_Hours: frames = (nframes_t) floor (3600.0 * session->frame_rate()); break; - case SMPTE_Minutes: + case Timecode_Minutes: frames = (nframes_t) floor (60.0 * session->frame_rate()); break; - case SMPTE_Seconds: + case Timecode_Seconds: frames = session->frame_rate(); break; - case SMPTE_Frames: - frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second()); + case Timecode_Frames: + frames = (nframes_t) floor (session->frame_rate() / session->timecode_frames_per_second()); break; case AudioFrames: @@ -1391,8 +1391,8 @@ AudioClock::current_time (nframes_t pos) const nframes_t ret = 0; switch (_mode) { - case SMPTE: - ret = smpte_frame_from_display (); + case Timecode: + ret = timecode_frame_from_display (); break; case BBT: ret = bbt_frame_from_display (pos); @@ -1419,8 +1419,8 @@ AudioClock::current_duration (nframes_t pos) const nframes_t ret = 0; switch (_mode) { - case SMPTE: - ret = smpte_frame_from_display (); + case Timecode: + ret = timecode_frame_from_display (); break; case BBT: ret = bbt_frame_duration_from_display (pos); @@ -1442,9 +1442,9 @@ AudioClock::current_duration (nframes_t pos) const } void -AudioClock::smpte_sanitize_display() +AudioClock::timecode_sanitize_display() { - // Check SMPTE fields for sanity, possibly adjusting values + // Check Timecode fields for sanity, possibly adjusting values if (atoi(minutes_label.get_text()) > 59) { minutes_label.set_text("59"); } @@ -1453,7 +1453,7 @@ AudioClock::smpte_sanitize_display() seconds_label.set_text("59"); } - switch ((long)rint(session->smpte_frames_per_second())) { + switch ((long)rint(session->timecode_frames_per_second())) { case 24: if (atoi(frames_label.get_text()) > 23) { frames_label.set_text("23"); @@ -1473,7 +1473,7 @@ AudioClock::smpte_sanitize_display() break; } - if (session->smpte_drop_frames()) { + if (session->timecode_drop_frames()) { if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) { frames_label.set_text("02"); } @@ -1481,272 +1481,272 @@ AudioClock::smpte_sanitize_display() } nframes_t -AudioClock::smpte_frame_from_display () const +AudioClock::timecode_frame_from_display () const { if (session == 0) { return 0; } - SMPTE::Time smpte; + Timecode::Time timecode; nframes_t sample; - smpte.hours = atoi (hours_label.get_text()); - smpte.minutes = atoi (minutes_label.get_text()); - smpte.seconds = atoi (seconds_label.get_text()); - smpte.frames = atoi (frames_label.get_text()); - smpte.rate = session->smpte_frames_per_second(); - smpte.drop= session->smpte_drop_frames(); + timecode.hours = atoi (hours_label.get_text()); + timecode.minutes = atoi (minutes_label.get_text()); + timecode.seconds = atoi (seconds_label.get_text()); + timecode.frames = atoi (frames_label.get_text()); + timecode.rate = session->timecode_frames_per_second(); + timecode.drop= session->timecode_drop_frames(); - session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ ); #if 0 -#define SMPTE_SAMPLE_TEST_1 -#define SMPTE_SAMPLE_TEST_2 -#define SMPTE_SAMPLE_TEST_3 -#define SMPTE_SAMPLE_TEST_4 -#define SMPTE_SAMPLE_TEST_5 -#define SMPTE_SAMPLE_TEST_6 -#define SMPTE_SAMPLE_TEST_7 - - // Testcode for smpte<->sample conversions (P.S.) - SMPTE::Time smpte1; +#define Timecode_SAMPLE_TEST_1 +#define Timecode_SAMPLE_TEST_2 +#define Timecode_SAMPLE_TEST_3 +#define Timecode_SAMPLE_TEST_4 +#define Timecode_SAMPLE_TEST_5 +#define Timecode_SAMPLE_TEST_6 +#define Timecode_SAMPLE_TEST_7 + + // Testcode for timecode<->sample conversions (P.S.) + Timecode::Time timecode1; nframes_t sample1; nframes_t oldsample = 0; - SMPTE::Time smpte2; + Timecode::Time timecode2; nframes_t sample_increment; - sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second); + sample_increment = (long)rint(session->frame_rate() / session->timecode_frames_per_second); -#ifdef SMPTE_SAMPLE_TEST_1 +#ifdef Timecode_SAMPLE_TEST_1 // Test 1: use_offset = false, use_subframes = false cout << "use_offset = false, use_subframes = false" << endl; for (int i = 0; i < 108003; i++) { - session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ ); if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; - cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + cout << "timecode1: " << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode1: " << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment( smpte1 ); + session->timecode_increment( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif -#ifdef SMPTE_SAMPLE_TEST_2 +#ifdef Timecode_SAMPLE_TEST_2 // Test 2: use_offset = true, use_subframes = false cout << "use_offset = true, use_subframes = false" << endl; - smpte1.hours = 0; - smpte1.minutes = 0; - smpte1.seconds = 0; - smpte1.frames = 0; - smpte1.subframes = 0; + timecode1.hours = 0; + timecode1.minutes = 0; + timecode1.seconds = 0; + timecode1.frames = 0; + timecode1.subframes = 0; sample1 = oldsample = 0; - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 108003; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ ); -// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; +// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; -// cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; +// cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment( smpte1 ); + session->timecode_increment( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif -#ifdef SMPTE_SAMPLE_TEST_3 +#ifdef Timecode_SAMPLE_TEST_3 // Test 3: use_offset = true, use_subframes = false, decrement cout << "use_offset = true, use_subframes = false, decrement" << endl; - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 108003; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ ); -// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; +// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; -// cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; +// cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_decrement( smpte1 ); + session->timecode_decrement( timecode1 ); } cout << "sample_decrement: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif -#ifdef SMPTE_SAMPLE_TEST_4 +#ifdef Timecode_SAMPLE_TEST_4 // Test 4: use_offset = true, use_subframes = true cout << "use_offset = true, use_subframes = true" << endl; for (long sub = 5; sub < 80; sub += 5) { - smpte1.hours = 0; - smpte1.minutes = 0; - smpte1.seconds = 0; - smpte1.frames = 0; - smpte1.subframes = 0; + timecode1.hours = 0; + timecode1.minutes = 0; + timecode1.seconds = 0; + timecode1.frames = 0; + timecode1.subframes = 0; sample1 = oldsample = (sample_increment * sub) / 80; - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ ); cout << "starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 108003; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ ); if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; //break; } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames || timecode2.subframes != timecode1.subframes) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment( smpte1 ); + session->timecode_increment( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; for (int i = 0; i < 108003; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ ); if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; //break; } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames || timecode2.subframes != timecode1.subframes) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_decrement( smpte1 ); + session->timecode_decrement( timecode1 ); } cout << "sample_decrement: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; } #endif -#ifdef SMPTE_SAMPLE_TEST_5 +#ifdef Timecode_SAMPLE_TEST_5 // Test 5: use_offset = true, use_subframes = false, increment seconds cout << "use_offset = true, use_subframes = false, increment seconds" << endl; - smpte1.hours = 0; - smpte1.minutes = 0; - smpte1.seconds = 0; - smpte1.frames = 0; - smpte1.subframes = 0; + timecode1.hours = 0; + timecode1.minutes = 0; + timecode1.seconds = 0; + timecode1.frames = 0; + timecode1.subframes = 0; sample1 = oldsample = 0; sample_increment = session->frame_rate(); - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 3600; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ ); -// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; +// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; -// cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; +// cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { @@ -1754,48 +1754,48 @@ AudioClock::smpte_frame_from_display () const // break; // } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment_seconds( smpte1 ); + session->timecode_increment_seconds( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif -#ifdef SMPTE_SAMPLE_TEST_6 +#ifdef Timecode_SAMPLE_TEST_6 // Test 6: use_offset = true, use_subframes = false, increment minutes cout << "use_offset = true, use_subframes = false, increment minutes" << endl; - smpte1.hours = 0; - smpte1.minutes = 0; - smpte1.seconds = 0; - smpte1.frames = 0; - smpte1.subframes = 0; + timecode1.hours = 0; + timecode1.minutes = 0; + timecode1.seconds = 0; + timecode1.frames = 0; + timecode1.subframes = 0; sample1 = oldsample = 0; sample_increment = session->frame_rate() * 60; - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 60; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ ); -// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; +// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; -// cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; +// cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { @@ -1803,47 +1803,47 @@ AudioClock::smpte_frame_from_display () const // break; // } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment_minutes( smpte1 ); + session->timecode_increment_minutes( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif -#ifdef SMPTE_SAMPLE_TEST_7 +#ifdef Timecode_SAMPLE_TEST_7 // Test 7: use_offset = true, use_subframes = false, increment hours cout << "use_offset = true, use_subframes = false, increment hours" << endl; - smpte1.hours = 0; - smpte1.minutes = 0; - smpte1.seconds = 0; - smpte1.frames = 0; - smpte1.subframes = 0; + timecode1.hours = 0; + timecode1.minutes = 0; + timecode1.seconds = 0; + timecode1.frames = 0; + timecode1.subframes = 0; sample1 = oldsample = 0; sample_increment = session->frame_rate() * 60 * 60; - session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl; for (int i = 0; i < 10; i++) { - session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); - session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); + session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ ); + session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ ); -// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; +// cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; -// cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; +// cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { @@ -1851,21 +1851,21 @@ AudioClock::smpte_frame_from_display () const // break; // } - if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { - cout << "ERROR: smpte2 not equal smpte1" << endl; - cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; + if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) { + cout << "ERROR: timecode2 not equal timecode1" << endl; + cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> "; cout << "sample: " << sample1 << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; break; } oldsample = sample1; - session->smpte_increment_hours( smpte1 ); + session->timecode_increment_hours( timecode1 ); } cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; - cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; + cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl; #endif #endif @@ -1948,7 +1948,7 @@ AudioClock::build_ops_menu () ops_menu->set_name ("ArdourContextMenu"); if (!Profile->get_sae()) { - ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE))); + ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), Timecode))); } ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT))); ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec))); @@ -1977,8 +1977,8 @@ AudioClock::set_mode (Mode m) _mode = m; switch (_mode) { - case SMPTE: - clock_base.add (smpte_packer_hbox); + case Timecode: + clock_base.add (timecode_packer_hbox); break; case BBT: @@ -2016,7 +2016,7 @@ AudioClock::set_size_requests () /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */ switch (_mode) { - case SMPTE: + case Timecode: Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5); Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5); Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5); diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 2de4cee3eb..d8083e1c73 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -35,7 +35,7 @@ class AudioClock : public Gtk::HBox { public: enum Mode { - SMPTE, + Timecode, BBT, MinSec, Frames, @@ -80,8 +80,8 @@ class AudioClock : public Gtk::HBox Gtk::Menu *ops_menu; - Gtk::HBox smpte_packer_hbox; - Gtk::HBox smpte_packer; + Gtk::HBox timecode_packer_hbox; + Gtk::HBox timecode_packer; Gtk::HBox minsec_packer_hbox; Gtk::HBox minsec_packer; @@ -93,10 +93,10 @@ class AudioClock : public Gtk::HBox Gtk::HBox frames_packer; enum Field { - SMPTE_Hours, - SMPTE_Minutes, - SMPTE_Seconds, - SMPTE_Frames, + Timecode_Hours, + Timecode_Minutes, + Timecode_Seconds, + Timecode_Frames, MS_Hours, MS_Minutes, MS_Seconds, @@ -144,14 +144,14 @@ class AudioClock : public Gtk::HBox Gtk::Label* frames_upper_info_label; Gtk::Label* frames_lower_info_label; - Gtk::Label* smpte_upper_info_label; - Gtk::Label* smpte_lower_info_label; + Gtk::Label* timecode_upper_info_label; + Gtk::Label* timecode_lower_info_label; Gtk::Label* bbt_upper_info_label; Gtk::Label* bbt_lower_info_label; Gtk::VBox frames_info_box; - Gtk::VBox smpte_info_box; + Gtk::VBox timecode_info_box; Gtk::VBox bbt_info_box; Gtk::EventBox clock_base; @@ -189,15 +189,15 @@ class AudioClock : public Gtk::HBox bool field_focus_out_event (GdkEventFocus *, Field); bool drop_focus_handler (GdkEventFocus*); - void set_smpte (nframes_t, bool); + void set_timecode (nframes_t, bool); void set_bbt (nframes_t, bool); void set_minsec (nframes_t, bool); void set_frames (nframes_t, bool); nframes_t get_frames (Field,nframes_t pos = 0,int dir=1); - void smpte_sanitize_display(); - nframes_t smpte_frame_from_display () const; + void timecode_sanitize_display(); + nframes_t timecode_frame_from_display () const; nframes_t bbt_frame_from_display (nframes_t) const; nframes_t bbt_frame_duration_from_display (nframes_t) const; nframes_t minsec_frame_from_display () const; @@ -206,7 +206,7 @@ class AudioClock : public Gtk::HBox void build_ops_menu (); void setup_events (); - void smpte_offset_changed (); + void timecode_offset_changed (); void set_size_requests (); static const uint32_t field_length[(int)AudioFrames+1]; diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h index 56cd91f691..7cabe999e1 100644 --- a/gtk2_ardour/editing_syms.h +++ b/gtk2_ardour/editing_syms.h @@ -19,9 +19,9 @@ /* Changing this order will break the menu */ SNAPTYPE(SnapToCDFrame) -SNAPTYPE(SnapToSMPTEFrame) -SNAPTYPE(SnapToSMPTESeconds) -SNAPTYPE(SnapToSMPTEMinutes) +SNAPTYPE(SnapToTimecodeFrame) +SNAPTYPE(SnapToTimecodeSeconds) +SNAPTYPE(SnapToTimecodeMinutes) SNAPTYPE(SnapToSeconds) SNAPTYPE(SnapToMinutes) SNAPTYPE(SnapToAThirtysecondBeat) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 72997a9ad0..07ccff2ae1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -129,9 +129,9 @@ const double Editor::timebar_height = 15.0; static const gchar *_snap_type_strings[] = { N_("CD Frames"), - N_("SMPTE Frames"), - N_("SMPTE Seconds"), - N_("SMPTE Minutes"), + N_("Timecode Frames"), + N_("Timecode Seconds"), + N_("Timecode Minutes"), N_("Seconds"), N_("Minutes"), N_("Beats/32"), @@ -214,7 +214,7 @@ Editor::Editor () /* time display buttons */ : minsec_label (_("Mins:Secs")) , bbt_label (_("Bars:Beats")) - , smpte_label (_("Timecode")) + , timecode_label (_("Timecode")) , frame_label (_("Samples")) , tempo_label (_("Tempo")) , meter_label (_("Meter")) @@ -380,12 +380,12 @@ Editor::Editor () minsec_label.set_padding (5,0); minsec_label.hide (); minsec_label.set_no_show_all(); - smpte_label.set_name ("EditorTimeButton"); - smpte_label.set_size_request (-1, (int)timebar_height); - smpte_label.set_alignment (1.0, 0.5); - smpte_label.set_padding (5,0); - smpte_label.hide (); - smpte_label.set_no_show_all(); + timecode_label.set_name ("EditorTimeButton"); + timecode_label.set_size_request (-1, (int)timebar_height); + timecode_label.set_alignment (1.0, 0.5); + timecode_label.set_padding (5,0); + timecode_label.hide (); + timecode_label.set_no_show_all(); frame_label.set_name ("EditorTimeButton"); frame_label.set_size_request (-1, (int)timebar_height); frame_label.set_alignment (1.0, 0.5); @@ -1086,7 +1086,7 @@ Editor::connect_to_session (Session *t) session_connections.push_back (session->StateSaved.connect (mem_fun(*this, &Editor::update_title_s))); session_connections.push_back (session->AskAboutPlaylistDeletion.connect (mem_fun(*this, &Editor::playlist_deletion_dialog))); - session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte))); + session_connections.push_back (session->TimecodeOffsetChanged.connect (mem_fun(*this, &Editor::update_just_timecode))); session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed))); @@ -1108,7 +1108,7 @@ Editor::connect_to_session (Session *t) nudge_clock.set (pos, true, 0, AudioClock::BBT); } else { - nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::SMPTE); // default of 5 seconds + nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds } playhead_cursor->canvas_item.show (); @@ -2564,72 +2564,86 @@ Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark) } void -Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) +Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) { - nframes64_t before; - nframes64_t after; - - const nframes64_t one_second = session->frame_rate(); - const nframes64_t one_minute = session->frame_rate() * 60; - const nframes64_t one_smpte_second = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame()); - nframes64_t one_smpte_minute = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60); - nframes64_t presnap = start; + const nframes64_t one_timecode_second = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame()); + nframes64_t one_timecode_minute = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame() * 60); switch (snap_type) { - case SnapToCDFrame: - if (((direction == 0) && (start % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) { - start = (nframes64_t) ceil ((double) start / (one_second / 75)) * (one_second / 75); + case SnapToTimecodeFrame: + if (((direction == 0) && (fmod((double)start, (double)session->frames_per_timecode_frame()) > (session->frames_per_timecode_frame() / 2))) || (direction > 0)) { + start = (nframes64_t) (ceil ((double) start / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame()); } else { - start = (nframes64_t) floor ((double) start / (one_second / 75)) * (one_second / 75); - } - break; - - case SnapToSMPTEFrame: - if (((direction == 0) && (fmod((double)start, (double)session->frames_per_smpte_frame()) > (session->frames_per_smpte_frame() / 2))) || (direction > 0)) { - start = (nframes64_t) (ceil ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); - } else { - start = (nframes64_t) (floor ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); + start = (nframes64_t) (floor ((double) start / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame()); } break; - case SnapToSMPTESeconds: - if (session->smpte_offset_negative()) + case SnapToTimecodeSeconds: + if (session->timecode_offset_negative()) { - start += session->smpte_offset (); + start += session->timecode_offset (); } else { - start -= session->smpte_offset (); + start -= session->timecode_offset (); } - if (((direction == 0) && (start % one_smpte_second > one_smpte_second / 2)) || direction > 0) { - start = (nframes64_t) ceil ((double) start / one_smpte_second) * one_smpte_second; + if (((direction == 0) && (start % one_timecode_second > one_timecode_second / 2)) || direction > 0) { + start = (nframes64_t) ceil ((double) start / one_timecode_second) * one_timecode_second; } else { - start = (nframes64_t) floor ((double) start / one_smpte_second) * one_smpte_second; + start = (nframes64_t) floor ((double) start / one_timecode_second) * one_timecode_second; } - if (session->smpte_offset_negative()) + if (session->timecode_offset_negative()) { - start -= session->smpte_offset (); + start -= session->timecode_offset (); } else { - start += session->smpte_offset (); + start += session->timecode_offset (); } break; - case SnapToSMPTEMinutes: - if (session->smpte_offset_negative()) + case SnapToTimecodeMinutes: + if (session->timecode_offset_negative()) { - start += session->smpte_offset (); + start += session->timecode_offset (); } else { - start -= session->smpte_offset (); + start -= session->timecode_offset (); } - if (((direction == 0) && (start % one_smpte_minute > one_smpte_minute / 2)) || direction > 0) { - start = (nframes64_t) ceil ((double) start / one_smpte_minute) * one_smpte_minute; + if (((direction == 0) && (start % one_timecode_minute > one_timecode_minute / 2)) || direction > 0) { + start = (nframes64_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute; } else { - start = (nframes64_t) floor ((double) start / one_smpte_minute) * one_smpte_minute; + start = (nframes64_t) floor ((double) start / one_timecode_minute) * one_timecode_minute; } - if (session->smpte_offset_negative()) + if (session->timecode_offset_negative()) { - start -= session->smpte_offset (); + start -= session->timecode_offset (); + } else { + start += session->timecode_offset (); + } + break; + default: + fatal << "Editor::smpte_snap_to_internal() called with non-timecode snap type!" << endmsg; + /*NOTREACHED*/ + } +} + +void +Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) +{ + const nframes64_t one_second = session->frame_rate(); + const nframes64_t one_minute = session->frame_rate() * 60; + nframes64_t presnap = start; + nframes64_t before; + nframes64_t after; + + switch (snap_type) { + case SnapToTimecodeFrame: + case SnapToTimecodeSeconds: + case SnapToTimecodeMinutes: + return timecode_snap_to_internal (start, direction, for_mark); + + case SnapToCDFrame: + if (((direction == 0) && (start % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) { + start = (nframes64_t) ceil ((double) start / (one_second / 75)) * (one_second / 75); } else { - start += session->smpte_offset (); + start = (nframes64_t) floor ((double) start / (one_second / 75)) * (one_second / 75); } break; @@ -3463,12 +3477,12 @@ Editor::snap_type_selection_done () snaptype = SnapToRegionSync; } else if (choice == _("CD Frames")) { snaptype = SnapToCDFrame; - } else if (choice == _("SMPTE Frames")) { - snaptype = SnapToSMPTEFrame; - } else if (choice == _("SMPTE Seconds")) { - snaptype = SnapToSMPTESeconds; - } else if (choice == _("SMPTE Minutes")) { - snaptype = SnapToSMPTEMinutes; + } else if (choice == _("Timecode Frames")) { + snaptype = SnapToTimecodeFrame; + } else if (choice == _("Timecode Seconds")) { + snaptype = SnapToTimecodeSeconds; + } else if (choice == _("Timecode Minutes")) { + snaptype = SnapToTimecodeMinutes; } else if (choice == _("Seconds")) { snaptype = SnapToSeconds; } else if (choice == _("Minutes")) { @@ -3853,9 +3867,9 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position) break; case SnapToCDFrame: - case SnapToSMPTEFrame: - case SnapToSMPTESeconds: - case SnapToSMPTEMinutes: + case SnapToTimecodeFrame: + case SnapToTimecodeSeconds: + case SnapToTimecodeMinutes: case SnapToSeconds: case SnapToMinutes: case SnapToRegionStart: diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index c4f2d9f887..e4cb5ec57d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -642,7 +642,7 @@ class Editor : public PublicEditor ArdourCanvas::Group *minsec_group; ArdourCanvas::Pixbuf *logo_item; ArdourCanvas::Group *bbt_group; - ArdourCanvas::Group *smpte_group; + ArdourCanvas::Group *timecode_group; ArdourCanvas::Group *frame_group; ArdourCanvas::Group *tempo_group; ArdourCanvas::Group *meter_group; @@ -678,7 +678,7 @@ class Editor : public PublicEditor ArdourCanvas::Group* _region_motion_group; enum RulerType { - ruler_metric_smpte = 0, + ruler_metric_timecode = 0, ruler_metric_bbt = 1, ruler_metric_frames = 2, ruler_metric_minsec = 3, @@ -712,7 +712,7 @@ class Editor : public PublicEditor Gtk::Widget * ruler_grabbed_widget; void initialize_rulers (); - void update_just_smpte (); + void update_just_timecode (); void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers void update_fixed_rulers (); void update_tempo_based_rulers (); @@ -725,7 +725,7 @@ class Editor : public PublicEditor void store_ruler_visibility (); void restore_ruler_visibility (); - static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint); + static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint); @@ -744,20 +744,20 @@ class Editor : public PublicEditor gint minsec_nmarks; void set_minsec_ruler_scale (gdouble lower, gdouble upper); - enum SMPTERulerScale { - smpte_show_bits, - smpte_show_frames, - smpte_show_seconds, - smpte_show_minutes, - smpte_show_hours + enum TimecodeRulerScale { + timecode_show_bits, + timecode_show_frames, + timecode_show_seconds, + timecode_show_minutes, + timecode_show_hours }; - SMPTERulerScale smpte_ruler_scale; + TimecodeRulerScale timecode_ruler_scale; - nframes_t smpte_mark_interval; - gint smpte_mark_modulo; - gint smpte_nmarks; - void set_smpte_ruler_scale (gdouble lower, gdouble upper); + nframes_t timecode_mark_interval; + gint timecode_mark_modulo; + gint timecode_nmarks; + void set_timecode_ruler_scale (gdouble lower, gdouble upper); enum BBTRulerScale { bbt_over, @@ -779,17 +779,17 @@ class Editor : public PublicEditor uint32_t bbt_accent_modulo; void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper); - gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint); + gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint); Gtk::Widget *_ruler_separator; - GtkWidget *_smpte_ruler; + GtkWidget *_timecode_ruler; GtkWidget *_bbt_ruler; GtkWidget *_frames_ruler; GtkWidget *_minsec_ruler; - Gtk::Widget *smpte_ruler; + Gtk::Widget *timecode_ruler; Gtk::Widget *bbt_ruler; Gtk::Widget *frames_ruler; Gtk::Widget *minsec_ruler; @@ -810,7 +810,7 @@ class Editor : public PublicEditor Gtk::Label minsec_label; Gtk::Label bbt_label; - Gtk::Label smpte_label; + Gtk::Label timecode_label; Gtk::Label frame_label; Gtk::Label tempo_label; Gtk::Label meter_label; @@ -2000,6 +2000,7 @@ public: void select_prev_route (); void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false); + void timecode_snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false); RhythmFerret* rhythm_ferret; BundleManager* _bundle_manager; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 3a0045b6f7..f059c740fb 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -753,9 +753,9 @@ Editor::register_actions () RadioAction::Group snap_choice_group; ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-cd-frame"), _("Snap to CD Frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToCDFrame))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-frame"), _("Snap to SMPTE frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEFrame))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-seconds"), _("Snap to SMPTE seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTESeconds))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-minutes"), _("Snap to SMPTE minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEMinutes))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-frame"), _("Snap to Timecode frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeFrame))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-seconds"), _("Snap to Timecode seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeSeconds))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-minutes"), _("Snap to Timecode minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeMinutes))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirtyseconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAThirtysecondBeat))); @@ -782,7 +782,7 @@ Editor::register_actions () ruler_loop_punch_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_transport_marker))); ruler_bbt_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-bbt-ruler"), _("Bars & Beats"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_frames))); ruler_samples_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-samples-ruler"), _("Samples"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_bbt))); - ruler_timecode_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_smpte))); + ruler_timecode_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_timecode))); ruler_minsec_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-minsec-ruler"), _("Min:Sec"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_minsec))); /* set defaults here */ @@ -904,7 +904,7 @@ Editor::toggle_ruler_visibility (RulerType rt) } switch (rt) { - case ruler_metric_smpte: + case ruler_metric_timecode: action = "toggle-timecode-ruler"; break; case ruler_metric_bbt: @@ -1012,14 +1012,14 @@ Editor::snap_type_action (SnapType type) case Editing::SnapToCDFrame: action = "snap-to-cd-frame"; break; - case Editing::SnapToSMPTEFrame: - action = "snap-to-smpte-frame"; + case Editing::SnapToTimecodeFrame: + action = "snap-to-timecode-frame"; break; - case Editing::SnapToSMPTESeconds: - action = "snap-to-smpte-seconds"; + case Editing::SnapToTimecodeSeconds: + action = "snap-to-timecode-seconds"; break; - case Editing::SnapToSMPTEMinutes: - action = "snap-to-smpte-minutes"; + case Editing::SnapToTimecodeMinutes: + action = "snap-to-timecode-minutes"; break; case Editing::SnapToSeconds: action = "snap-to-seconds"; @@ -1085,15 +1085,15 @@ Editor::cycle_snap_choice() { switch (snap_type) { case Editing::SnapToCDFrame: - set_snap_to (Editing::SnapToSMPTEFrame); + set_snap_to (Editing::SnapToTimecodeFrame); break; - case Editing::SnapToSMPTEFrame: - set_snap_to (Editing::SnapToSMPTESeconds); + case Editing::SnapToTimecodeFrame: + set_snap_to (Editing::SnapToTimecodeSeconds); break; - case Editing::SnapToSMPTESeconds: - set_snap_to (Editing::SnapToSMPTEMinutes); + case Editing::SnapToTimecodeSeconds: + set_snap_to (Editing::SnapToTimecodeMinutes); break; - case Editing::SnapToSMPTEMinutes: + case Editing::SnapToTimecodeMinutes: set_snap_to (Editing::SnapToSeconds); break; case Editing::SnapToSeconds: @@ -1340,8 +1340,8 @@ Editor::parameter_changed (std::string p) update_punch_range_view (true); } else if (p == "punch-out") { update_punch_range_view (true); - } else if (p == "smpte-format") { - update_just_smpte (); + } else if (p == "timecode-format") { + update_just_timecode (); } else if (p == "xfades-visible") { update_xfade_visibility (); } else if (p == "show-region-fades") { @@ -1349,7 +1349,7 @@ Editor::parameter_changed (std::string p) } else if (p == "edit-mode") { edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode())); } else if (p == "subframes-per-frame") { - update_just_smpte (); + update_just_timecode (); } else if (p == "show-track-meters") { toggle_meter_updating(); } else if (p == "show-summary") { diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index a93cfdfb03..f4e5a7d03c 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1913,7 +1913,7 @@ void Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos) { char buf[128]; - SMPTE::Time smpte; + Timecode::Time timecode; BBT_Time bbt; int hours, mins; nframes64_t frame_rate; @@ -1937,9 +1937,9 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks); break; - case AudioClock::SMPTE: - session->smpte_time (frame, smpte); - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + case AudioClock::Timecode: + session->timecode_time (frame, timecode); + snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); break; case AudioClock::MinSec: @@ -1971,7 +1971,7 @@ void Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos) { char buf[128]; - SMPTE::Time smpte; + Timecode::Time timecode; BBT_Time sbbt; BBT_Time ebbt; int hours, mins; @@ -2018,9 +2018,9 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, ebbt.bars, ebbt.beats, ebbt.ticks); break; - case AudioClock::SMPTE: - session->smpte_duration (end - start, smpte); - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + case AudioClock::Timecode: + session->timecode_duration (end - start, timecode); + snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); break; case AudioClock::MinSec: diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 91cde8fcbb..0b3d01b7d8 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -618,7 +618,7 @@ EditorRegions::populate_row (boost::shared_ptr region, TreeModel::Row co char used_str[8]; int used; BBT_Time bbt; - SMPTE::Time smpte; + Timecode::Time timecode; bool missing_source = boost::dynamic_pointer_cast(region->source()); @@ -638,22 +638,22 @@ EditorRegions::populate_row (boost::shared_ptr region, TreeModel::Row co sprintf (used_str, "%4d" , used); switch (ARDOUR_UI::instance()->secondary_clock.mode ()) { - case AudioClock::SMPTE: - case AudioClock::Off: /* If the secondary clock is off, default to SMPTE */ - _session->smpte_time (region->position(), smpte); - sprintf (start_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); - _session->smpte_time (region->position() + region->length() - 1, smpte); - sprintf (end_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); - _session->smpte_time (region->length(), smpte); - sprintf (length_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); - _session->smpte_time (region->sync_position() + region->position(), smpte); - sprintf (sync_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + case AudioClock::Timecode: + case AudioClock::Off: /* If the secondary clock is off, default to Timecode */ + _session->timecode_time (region->position(), timecode); + sprintf (start_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + _session->timecode_time (region->position() + region->length() - 1, timecode); + sprintf (end_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + _session->timecode_time (region->length(), timecode); + sprintf (length_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + _session->timecode_time (region->sync_position() + region->position(), timecode); + sprintf (sync_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); if (audioRegion && !fades_in_seconds) { - _session->smpte_time (audioRegion->fade_in()->back()->when, smpte); - sprintf (fadein_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); - _session->smpte_time (audioRegion->fade_out()->back()->when, smpte); - sprintf (fadeout_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + _session->timecode_time (audioRegion->fade_in()->back()->when, timecode); + sprintf (fadein_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + _session->timecode_time (audioRegion->fade_out()->back()->when, timecode); + sprintf (fadeout_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } break; diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index f21c996598..e044487274 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -49,7 +49,7 @@ Editor *Editor::ruler_editor; /* the order here must match the "metric" enums in editor.h */ GtkCustomMetric Editor::ruler_metrics[4] = { - {1, Editor::_metric_get_smpte }, + {1, Editor::_metric_get_timecode }, {1, Editor::_metric_get_bbt }, {1, Editor::_metric_get_frames }, {1, Editor::_metric_get_minsec } @@ -74,14 +74,14 @@ Editor::initialize_rulers () minsec_ruler->hide (); minsec_ruler->set_no_show_all(); - _smpte_ruler = gtk_custom_hruler_new (); - smpte_ruler = Glib::wrap (_smpte_ruler); - smpte_ruler->set_name ("SMPTERuler"); - smpte_ruler->set_size_request (-1, (int)timebar_height); - gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_smpte_ruler), &ruler_metrics[ruler_metric_smpte]); - smpte_ruler->hide (); - smpte_ruler->set_no_show_all(); - smpte_nmarks = 0; + _timecode_ruler = gtk_custom_hruler_new (); + timecode_ruler = Glib::wrap (_timecode_ruler); + timecode_ruler->set_name ("TimecodeRuler"); + timecode_ruler->set_size_request (-1, (int)timebar_height); + gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_timecode_ruler), &ruler_metrics[ruler_metric_timecode]); + timecode_ruler->hide (); + timecode_ruler->set_no_show_all(); + timecode_nmarks = 0; _bbt_ruler = gtk_custom_hruler_new (); bbt_ruler = Glib::wrap (_bbt_ruler); @@ -127,34 +127,34 @@ Editor::initialize_rulers () ruler_lab_children.push_back (Element(minsec_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*minsec_ruler, PACK_SHRINK, PACK_START)); - ruler_lab_children.push_back (Element(smpte_label, PACK_SHRINK, PACK_START)); - ruler_children.insert (canvaspos, Element(*smpte_ruler, PACK_SHRINK, PACK_START)); + ruler_lab_children.push_back (Element(timecode_label, PACK_SHRINK, PACK_START)); + ruler_children.insert (canvaspos, Element(*timecode_ruler, PACK_SHRINK, PACK_START)); ruler_lab_children.push_back (Element(frame_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*frames_ruler, PACK_SHRINK, PACK_START)); ruler_lab_children.push_back (Element(bbt_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*bbt_ruler, PACK_SHRINK, PACK_START)); - smpte_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); + timecode_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); bbt_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); frames_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); minsec_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK); - smpte_ruler->signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_button_release)); + timecode_ruler->signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_button_release)); bbt_ruler->signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_button_release)); frames_ruler->signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_button_release)); minsec_ruler->signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_button_release)); - smpte_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); + timecode_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); bbt_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); frames_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); minsec_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); - smpte_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); + timecode_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); bbt_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); frames_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); minsec_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); - smpte_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll)); + timecode_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll)); bbt_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll)); frames_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll)); minsec_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll)); @@ -221,8 +221,8 @@ Editor::ruler_button_press (GdkEventButton* ev) //Gtk::Main::grab_add (*minsec_ruler); Widget * grab_widget = 0; - if (smpte_ruler->is_realized() && ev->window == smpte_ruler->get_window()->gobj()) { - grab_widget = smpte_ruler; + if (timecode_ruler->is_realized() && ev->window == timecode_ruler->get_window()->gobj()) { + grab_widget = timecode_ruler; } else if (bbt_ruler->is_realized() && ev->window == bbt_ruler->get_window()->gobj()) { grab_widget = bbt_ruler; } else if (frames_ruler->is_realized() && ev->window == frames_ruler->get_window()->gobj()) { @@ -430,7 +430,7 @@ Editor::store_ruler_visibility () { XMLNode* node = new XMLNode(X_("RulerVisibility")); - node->add_property (X_("smpte"), ruler_timecode_action->get_active() ? "yes": "no"); + node->add_property (X_("timecode"), ruler_timecode_action->get_active() ? "yes": "no"); node->add_property (X_("bbt"), ruler_bbt_action->get_active() ? "yes": "no"); node->add_property (X_("frames"), ruler_samples_action->get_active() ? "yes": "no"); node->add_property (X_("minsec"), ruler_minsec_action->get_active() ? "yes": "no"); @@ -454,7 +454,7 @@ Editor::restore_ruler_visibility () no_ruler_shown_update = true; if (node) { - if ((prop = node->property ("smpte")) != 0) { + if ((prop = node->property ("timecode")) != 0) { if (string_is_affirmative (prop->value())) { ruler_timecode_action->set_active (true); } else { @@ -568,11 +568,11 @@ Editor::update_ruler_visibility () if (ruler_timecode_action->get_active()) { visible_rulers++; - smpte_label.show (); - smpte_ruler->show (); + timecode_label.show (); + timecode_ruler->show (); } else { - smpte_label.hide (); - smpte_ruler->hide (); + timecode_label.hide (); + timecode_ruler->hide (); } if (ruler_samples_action->get_active()) { @@ -768,9 +768,9 @@ Editor::update_ruler_visibility () } void -Editor::update_just_smpte () +Editor::update_just_timecode () { - ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_just_smpte)); + ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_just_timecode)); if (session == 0) { return; @@ -779,7 +779,7 @@ Editor::update_just_smpte () nframes64_t rightmost_frame = leftmost_frame + current_page_frames(); if (ruler_timecode_action->get_active()) { - gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_smpte_ruler), leftmost_frame, rightmost_frame, + gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame, leftmost_frame, session->current_end_frame()); } } @@ -792,7 +792,7 @@ Editor::compute_fixed_ruler_scale () } if (ruler_timecode_action->get_active()) { - set_smpte_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames() ); + set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames() ); } if (ruler_minsec_action->get_active()) { @@ -809,7 +809,7 @@ Editor::update_fixed_rulers () return; } - ruler_metrics[ruler_metric_smpte].units_per_pixel = frames_per_unit; + ruler_metrics[ruler_metric_timecode].units_per_pixel = frames_per_unit; ruler_metrics[ruler_metric_frames].units_per_pixel = frames_per_unit; ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_unit; @@ -820,7 +820,7 @@ Editor::update_fixed_rulers () */ if (ruler_timecode_action->get_active()) { - gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_smpte_ruler), leftmost_frame, rightmost_frame, + gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame, leftmost_frame, session->current_end_frame()); } @@ -853,9 +853,9 @@ Editor::update_tempo_based_rulers () /* Mark generation */ gint -Editor::_metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars) +Editor::_metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars) { - return ruler_editor->metric_get_smpte (marks, lower, upper, maxchars); + return ruler_editor->metric_get_timecode (marks, lower, upper, maxchars); } gint @@ -877,7 +877,7 @@ Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble u } void -Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper) +Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper) { nframes64_t range; nframes64_t spacer; @@ -897,91 +897,91 @@ Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper) upper = upper + spacer; range = (nframes64_t) floor (upper - lower); - if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */ - smpte_ruler_scale = smpte_show_bits; - smpte_mark_modulo = 20; - smpte_nmarks = 2 + (2 * session->config.get_subframes_per_frame()); + if (range < (2 * session->frames_per_timecode_frame())) { /* 0 - 2 frames */ + timecode_ruler_scale = timecode_show_bits; + timecode_mark_modulo = 20; + timecode_nmarks = 2 + (2 * session->config.get_subframes_per_frame()); } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */ - smpte_ruler_scale = smpte_show_frames; - smpte_mark_modulo = 1; - smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); + timecode_ruler_scale = timecode_show_frames; + timecode_mark_modulo = 1; + timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame()); } else if (range <= (fr / 2)) { /* 0.25-0.5 second */ - smpte_ruler_scale = smpte_show_frames; - smpte_mark_modulo = 2; - smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); + timecode_ruler_scale = timecode_show_frames; + timecode_mark_modulo = 2; + timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame()); } else if (range <= fr) { /* 0.5-1 second */ - smpte_ruler_scale = smpte_show_frames; - smpte_mark_modulo = 5; - smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); + timecode_ruler_scale = timecode_show_frames; + timecode_mark_modulo = 5; + timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame()); } else if (range <= 2 * fr) { /* 1-2 seconds */ - smpte_ruler_scale = smpte_show_frames; - smpte_mark_modulo = 10; - smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); + timecode_ruler_scale = timecode_show_frames; + timecode_mark_modulo = 10; + timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame()); } else if (range <= 8 * fr) { /* 2-8 seconds */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 1; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 1; + timecode_nmarks = 2 + (range / fr); } else if (range <= 16 * fr) { /* 8-16 seconds */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 2; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 2; + timecode_nmarks = 2 + (range / fr); } else if (range <= 30 * fr) { /* 16-30 seconds */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 5; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 5; + timecode_nmarks = 2 + (range / fr); } else if (range <= 60 * fr) { /* 30-60 seconds */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 5; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 5; + timecode_nmarks = 2 + (range / fr); } else if (range <= 2 * 60 * fr) { /* 1-2 minutes */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 15; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 15; + timecode_nmarks = 2 + (range / fr); } else if (range <= 4 * 60 * fr) { /* 2-4 minutes */ - smpte_ruler_scale = smpte_show_seconds; - smpte_mark_modulo = 30; - smpte_nmarks = 2 + (range / fr); + timecode_ruler_scale = timecode_show_seconds; + timecode_mark_modulo = 30; + timecode_nmarks = 2 + (range / fr); } else if (range <= 10 * 60 * fr) { /* 4-10 minutes */ - smpte_ruler_scale = smpte_show_minutes; - smpte_mark_modulo = 2; - smpte_nmarks = 2 + 10; + timecode_ruler_scale = timecode_show_minutes; + timecode_mark_modulo = 2; + timecode_nmarks = 2 + 10; } else if (range <= 30 * 60 * fr) { /* 10-30 minutes */ - smpte_ruler_scale = smpte_show_minutes; - smpte_mark_modulo = 5; - smpte_nmarks = 2 + 30; + timecode_ruler_scale = timecode_show_minutes; + timecode_mark_modulo = 5; + timecode_nmarks = 2 + 30; } else if (range <= 60 * 60 * fr) { /* 30 minutes - 1hr */ - smpte_ruler_scale = smpte_show_minutes; - smpte_mark_modulo = 10; - smpte_nmarks = 2 + 60; + timecode_ruler_scale = timecode_show_minutes; + timecode_mark_modulo = 10; + timecode_nmarks = 2 + 60; } else if (range <= 4 * 60 * 60 * fr) { /* 1 - 4 hrs*/ - smpte_ruler_scale = smpte_show_minutes; - smpte_mark_modulo = 30; - smpte_nmarks = 2 + (60 * 4); + timecode_ruler_scale = timecode_show_minutes; + timecode_mark_modulo = 30; + timecode_nmarks = 2 + (60 * 4); } else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/ - smpte_ruler_scale = smpte_show_hours; - smpte_mark_modulo = 1; - smpte_nmarks = 2 + 8; + timecode_ruler_scale = timecode_show_hours; + timecode_mark_modulo = 1; + timecode_nmarks = 2 + 8; } else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/ - smpte_ruler_scale = smpte_show_hours; - smpte_mark_modulo = 1; - smpte_nmarks = 2 + 24; + timecode_ruler_scale = timecode_show_hours; + timecode_mark_modulo = 1; + timecode_nmarks = 2 + 24; } else { /* not possible if nframes64_t is a 32 bit quantity */ - smpte_ruler_scale = smpte_show_hours; - smpte_mark_modulo = 4; - smpte_nmarks = 2 + 24; + timecode_ruler_scale = timecode_show_hours; + timecode_mark_modulo = 4; + timecode_nmarks = 2 + 24; } } gint -Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/) +Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/) { nframes_t pos; nframes64_t spacer; - SMPTE::Time smpte; + Timecode::Time timecode; gchar buf[16]; gint n; @@ -997,22 +997,22 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u pos = (nframes_t) floor (lower); - *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * smpte_nmarks); - switch (smpte_ruler_scale) { - case smpte_show_bits: + *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * timecode_nmarks); + switch (timecode_ruler_scale) { + case timecode_show_bits: - // Find smpte time of this sample (pos) with subframe accuracy - session->sample_to_smpte(pos, smpte, true /* use_offset */, true /* use_subframes */ ); + // Find timecode time of this sample (pos) with subframe accuracy + session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ ); - for (n = 0; n < smpte_nmarks; n++) { - session->smpte_to_sample(smpte, pos, true /* use_offset */, true /* use_subframes */ ); - if ((smpte.subframes % smpte_mark_modulo) == 0) { - if (smpte.subframes == 0) { + for (n = 0; n < timecode_nmarks; n++) { + session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ ); + if ((timecode.subframes % timecode_mark_modulo) == 0) { + if (timecode.subframes == 0) { (*marks)[n].style = GtkCustomRulerMarkMajor; - snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } else { (*marks)[n].style = GtkCustomRulerMarkMinor; - snprintf (buf, sizeof(buf), ".%02u", smpte.subframes); + snprintf (buf, sizeof(buf), ".%02u", timecode.subframes); } } else { snprintf (buf, sizeof(buf)," "); @@ -1023,26 +1023,26 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u (*marks)[n].position = pos; // Increment subframes by one - SMPTE::increment_subframes( smpte, session->config.get_subframes_per_frame() ); + Timecode::increment_subframes( timecode, session->config.get_subframes_per_frame() ); } break; - case smpte_show_seconds: - // Find smpte time of this sample (pos) - session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); + case timecode_show_seconds: + // Find timecode time of this sample (pos) + session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); // Go to next whole second down - SMPTE::seconds_floor( smpte ); + Timecode::seconds_floor( timecode ); - for (n = 0; n < smpte_nmarks; n++) { - session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); - if ((smpte.seconds % smpte_mark_modulo) == 0) { - if (smpte.seconds == 0) { + for (n = 0; n < timecode_nmarks; n++) { + session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); + if ((timecode.seconds % timecode_mark_modulo) == 0) { + if (timecode.seconds == 0) { (*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].position = pos; } else { (*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].position = pos; } - snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; @@ -1050,24 +1050,24 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } (*marks)[n].label = g_strdup (buf); - SMPTE::increment_seconds( smpte, session->config.get_subframes_per_frame() ); + Timecode::increment_seconds( timecode, session->config.get_subframes_per_frame() ); } break; - case smpte_show_minutes: - // Find smpte time of this sample (pos) - session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); + case timecode_show_minutes: + // Find timecode time of this sample (pos) + session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); // Go to next whole minute down - SMPTE::minutes_floor( smpte ); + Timecode::minutes_floor( timecode ); - for (n = 0; n < smpte_nmarks; n++) { - session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); - if ((smpte.minutes % smpte_mark_modulo) == 0) { - if (smpte.minutes == 0) { + for (n = 0; n < timecode_nmarks; n++) { + session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); + if ((timecode.minutes % timecode_mark_modulo) == 0) { + if (timecode.minutes == 0) { (*marks)[n].style = GtkCustomRulerMarkMajor; } else { (*marks)[n].style = GtkCustomRulerMarkMinor; } - snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; @@ -1075,21 +1075,21 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; - SMPTE::increment_minutes( smpte, session->config.get_subframes_per_frame() ); + Timecode::increment_minutes( timecode, session->config.get_subframes_per_frame() ); } break; - case smpte_show_hours: - // Find smpte time of this sample (pos) - session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); + case timecode_show_hours: + // Find timecode time of this sample (pos) + session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); // Go to next whole hour down - SMPTE::hours_floor( smpte ); + Timecode::hours_floor( timecode ); - for (n = 0; n < smpte_nmarks; n++) { - session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); - if ((smpte.hours % smpte_mark_modulo) == 0) { + for (n = 0; n < timecode_nmarks; n++) { + session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); + if ((timecode.hours % timecode_mark_modulo) == 0) { (*marks)[n].style = GtkCustomRulerMarkMajor; - snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; @@ -1098,25 +1098,25 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; - SMPTE::increment_hours( smpte, session->config.get_subframes_per_frame() ); + Timecode::increment_hours( timecode, session->config.get_subframes_per_frame() ); } break; - case smpte_show_frames: - // Find smpte time of this sample (pos) - session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); + case timecode_show_frames: + // Find timecode time of this sample (pos) + session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); // Go to next whole frame down - SMPTE::frames_floor( smpte ); + Timecode::frames_floor( timecode ); - for (n = 0; n < smpte_nmarks; n++) { - session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); - if ((smpte.frames % smpte_mark_modulo) == 0) { - if (smpte.frames == 0) { + for (n = 0; n < timecode_nmarks; n++) { + session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); + if ((timecode.frames % timecode_mark_modulo) == 0) { + if (timecode.frames == 0) { (*marks)[n].style = GtkCustomRulerMarkMajor; } else { (*marks)[n].style = GtkCustomRulerMarkMinor; } (*marks)[n].position = pos; - snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; @@ -1124,13 +1124,13 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } (*marks)[n].label = g_strdup (buf); - SMPTE::increment( smpte, session->config.get_subframes_per_frame() ); + Timecode::increment( timecode, session->config.get_subframes_per_frame() ); } break; } - return smpte_nmarks; + return timecode_nmarks; } diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc index bec134a73c..4820a930ac 100644 --- a/gtk2_ardour/enums.cc +++ b/gtk2_ardour/enums.cc @@ -46,7 +46,7 @@ setup_gtk_ardour_enums () #define REGISTER_ENUM(e) i.push_back (e); s.push_back (#e) #define REGISTER_CLASS_ENUM(t,e) i.push_back (t::e); s.push_back (#e) - REGISTER_CLASS_ENUM (AudioClock, SMPTE); + REGISTER_CLASS_ENUM (AudioClock, Timecode); REGISTER_CLASS_ENUM (AudioClock, BBT); REGISTER_CLASS_ENUM (AudioClock, MinSec); REGISTER_CLASS_ENUM (AudioClock, Frames); diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc index 593f16ec58..2e9f20d120 100644 --- a/gtk2_ardour/export_format_dialog.cc +++ b/gtk2_ardour/export_format_dialog.cc @@ -711,7 +711,7 @@ ExportFormatDialog::update_silence_start_selection () { update_time (silence_start, silence_start_clock); AnyTime zero; - zero.type = AnyTime::SMPTE; + zero.type = AnyTime::Timecode; manager.select_silence_beginning (silence_start_checkbox.get_active() ? silence_start : zero); } @@ -720,7 +720,7 @@ ExportFormatDialog::update_silence_end_selection () { update_time (silence_end, silence_end_clock); AnyTime zero; - zero.type = AnyTime::SMPTE; + zero.type = AnyTime::Timecode; manager.select_silence_end (silence_end_checkbox.get_active() ? silence_end : zero); } @@ -730,11 +730,11 @@ ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & ti // TODO position clock.set (session->convert_to_frames_at (0, time), true); - AudioClock::Mode mode(AudioClock::SMPTE); + AudioClock::Mode mode(AudioClock::Timecode); switch (time.type) { - case AnyTime::SMPTE: - mode = AudioClock::SMPTE; + case AnyTime::Timecode: + mode = AudioClock::Timecode; break; case AnyTime::BBT: mode = AudioClock::BBT; @@ -760,9 +760,9 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock) nframes_t frames = clock.current_duration(); switch (clock.mode()) { - case AudioClock::SMPTE: - time.type = AnyTime::SMPTE; - session->smpte_time (frames, time.smpte); + case AudioClock::Timecode: + time.type = AnyTime::Timecode; + session->timecode_time (frames, time.timecode); break; case AudioClock::BBT: time.type = AnyTime::BBT; diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc index b11169b214..30515d45fd 100644 --- a/gtk2_ardour/export_timespan_selector.cc +++ b/gtk2_ardour/export_timespan_selector.cc @@ -67,7 +67,7 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi iter = time_format_list->append(); row = *iter; - row[time_format_cols.format] = ExportProfileManager::SMPTE; + row[time_format_cols.format] = ExportProfileManager::Timecode; row[time_format_cols.label] = X_("Timecode"); iter = time_format_list->append(); @@ -163,9 +163,9 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons end = bbt_str (end_frame); break; - case AudioClock::SMPTE: - start = smpte_str (start_frame); - end = smpte_str (end_frame); + case AudioClock::Timecode: + start = timecode_str (start_frame); + end = timecode_str (end_frame); break; case AudioClock::MinSec: @@ -222,16 +222,16 @@ ExportTimespanSelector::bbt_str (nframes_t frames) const } Glib::ustring -ExportTimespanSelector::smpte_str (nframes_t frames) const +ExportTimespanSelector::timecode_str (nframes_t frames) const { if (!session) { return "Error!"; } std::ostringstream oss; - SMPTE::Time time; + Timecode::Time time; - session->smpte_time (frames, time); + session->timecode_time (frames, time); oss << std::setfill('0') << std::right << std::setw(2) << diff --git a/gtk2_ardour/export_timespan_selector.h b/gtk2_ardour/export_timespan_selector.h index 72d5990422..ad57aac344 100644 --- a/gtk2_ardour/export_timespan_selector.h +++ b/gtk2_ardour/export_timespan_selector.h @@ -78,7 +78,7 @@ class ExportTimespanSelector : public Gtk::VBox { Glib::ustring construct_label (ARDOUR::Location const * location) const; Glib::ustring bbt_str (nframes_t frames) const; - Glib::ustring smpte_str (nframes_t frames) const; + Glib::ustring timecode_str (nframes_t frames) const; Glib::ustring ms_str (nframes_t frames) const; void update_range_name (Glib::ustring const & path, Glib::ustring const & new_text); diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 29051fe09a..6c2bd856c6 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -223,22 +223,22 @@ SessionOptionEditor::SessionOptionEditor (Session* s) add_option (_("Sync"), spf); ComboOption* smf = new ComboOption ( - "smpte-format", + "timecode-format", _("Timecode frames-per-second"), - mem_fun (*_session_config, &SessionConfiguration::get_smpte_format), - mem_fun (*_session_config, &SessionConfiguration::set_smpte_format) + mem_fun (*_session_config, &SessionConfiguration::get_timecode_format), + mem_fun (*_session_config, &SessionConfiguration::set_timecode_format) ); - smf->add (smpte_23976, _("23.976")); - smf->add (smpte_24, _("24")); - smf->add (smpte_24976, _("24.976")); - smf->add (smpte_25, _("25")); - smf->add (smpte_2997, _("29.97")); - smf->add (smpte_2997drop, _("29.97 drop")); - smf->add (smpte_30, _("30")); - smf->add (smpte_30drop, _("30 drop")); - smf->add (smpte_5994, _("59.94")); - smf->add (smpte_60, _("60")); + smf->add (timecode_23976, _("23.976")); + smf->add (timecode_24, _("24")); + smf->add (timecode_24976, _("24.976")); + smf->add (timecode_25, _("25")); + smf->add (timecode_2997, _("29.97")); + smf->add (timecode_2997drop, _("29.97 drop")); + smf->add (timecode_30, _("30")); + smf->add (timecode_30drop, _("30 drop")); + smf->add (timecode_5994, _("59.94")); + smf->add (timecode_60, _("60")); add_option (_("Sync"), smf); diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 7a7fad030f..d4c294ae29 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -166,7 +166,7 @@ SoundFileBox::SoundFileBox (bool persistent) table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL); length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock.mode()); - timecode_clock.set_mode (AudioClock::SMPTE); + timecode_clock.set_mode (AudioClock::Timecode); main_box.pack_start (table, false, false); diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index 9d2d9cc0de..396ac8358d 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -110,8 +110,8 @@ class ElementImporter /// The sample rate of the session from which we are importing nframes_t sample_rate; - /// Converts smpte time to a string - std::string smpte_to_string (SMPTE::Time & time) const; + /// Converts timecode time to a string + std::string timecode_to_string (Timecode::Time & time) const; /// Converts samples so that times match the sessions sample rate nframes_t rate_convert_samples (nframes_t samples) const; diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index b402550a64..47acacd387 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -108,7 +108,7 @@ class ExportProfileManager typedef std::list LocationList; enum TimeFormat { - SMPTE, + Timecode, BBT, MinSec, Frames, @@ -127,7 +127,7 @@ class ExportProfileManager boost::shared_ptr selection_range, boost::shared_ptr ranges) : timespans (new TimespanList ()), - time_format (SMPTE), + time_format (Timecode), session_range (session_range), selection_range (selection_range), diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index baf7343496..024b866730 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -54,7 +54,7 @@ #include "ardour/rc_configuration.h" #include "ardour/session_configuration.h" #include "ardour/location.h" -#include "ardour/smpte.h" +#include "ardour/timecode.h" #include "ardour/interpolation.h" class XMLTree; @@ -421,15 +421,15 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable nframes_t nominal_frame_rate() const { return _nominal_frame_rate; } nframes_t frames_per_hour() const { return _frames_per_hour; } - double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } - nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } + double frames_per_timecode_frame() const { return _frames_per_timecode_frame; } + nframes_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; } - MIDI::byte get_mtc_smpte_bits() const { - return mtc_smpte_bits; /* encoding of SMTPE type for MTC */ + MIDI::byte get_mtc_timecode_bits() const { + return mtc_timecode_bits; /* encoding of SMTPE type for MTC */ } - float smpte_frames_per_second() const; - bool smpte_drop_frames() const; + float timecode_frames_per_second() const; + bool timecode_drop_frames() const; /* Locations */ @@ -551,25 +551,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void sync_time_vars(); void bbt_time (nframes_t when, BBT_Time&); - void smpte_to_sample(SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_smpte(nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const; - void smpte_time (SMPTE::Time &); - void smpte_time (nframes_t when, SMPTE::Time&); - void smpte_time_subframes (nframes_t when, SMPTE::Time&); + void timecode_to_sample(Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_time (Timecode::Time &); + void timecode_time (nframes_t when, Timecode::Time&); + void timecode_time_subframes (nframes_t when, Timecode::Time&); - void smpte_duration (nframes_t, SMPTE::Time&) const; - void smpte_duration_string (char *, nframes_t) const; + void timecode_duration (nframes_t, Timecode::Time&) const; + void timecode_duration_string (char *, nframes_t) const; - void set_smpte_offset (nframes_t); - nframes_t smpte_offset () const { return _smpte_offset; } - void set_smpte_offset_negative (bool); - bool smpte_offset_negative () const { return _smpte_offset_negative; } + void set_timecode_offset (nframes_t); + nframes_t timecode_offset () const { return _timecode_offset; } + void set_timecode_offset_negative (bool); + bool timecode_offset_negative () const { return _timecode_offset_negative; } nframes_t convert_to_frames_at (nframes_t position, AnyTime const &); static sigc::signal StartTimeChanged; static sigc::signal EndTimeChanged; - static sigc::signal SMPTEOffsetChanged; + static sigc::signal TimecodeOffsetChanged; void request_slave_source (SlaveSource); bool synced_to_jack() const { return Config->get_slave_source() == JACK; } @@ -585,8 +585,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable TempoMap& tempo_map() { return *_tempo_map; } - /// signals the current transport position in frames, bbt and smpte time (in that order) - sigc::signal tick; + /// signals the current transport position in frames, bbt and timecode time (in that order) + sigc::signal tick; /* region info */ @@ -1331,25 +1331,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable MIDI::byte mmc_buffer[32]; MIDI::byte mtc_msg[16]; - MIDI::byte mtc_smpte_bits; /* encoding of SMTPE type for MTC */ + MIDI::byte mtc_timecode_bits; /* encoding of SMTPE type for MTC */ MIDI::byte midi_msg[16]; - nframes_t outbound_mtc_smpte_frame; - SMPTE::Time transmitting_smpte_time; + nframes_t outbound_mtc_timecode_frame; + Timecode::Time transmitting_timecode_time; int next_quarter_frame_to_send; - double _frames_per_smpte_frame; /* has to be floating point because of drop frame */ + double _frames_per_timecode_frame; /* has to be floating point because of drop frame */ nframes_t _frames_per_hour; - nframes_t _smpte_frames_per_hour; - nframes_t _smpte_offset; - bool _smpte_offset_negative; + nframes_t _timecode_frames_per_hour; + nframes_t _timecode_offset; + bool _timecode_offset_negative; /* cache the most-recently requested time conversions. This helps when we * have multiple clocks showing the same time (e.g. the transport frame) */ - bool last_smpte_valid; - nframes_t last_smpte_when; - SMPTE::Time last_smpte; + bool last_timecode_valid; + nframes_t last_timecode_when; + Timecode::Time last_timecode; - bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle + bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle int send_full_time_code(nframes_t nframes); int send_midi_time_code_for_cycle(nframes_t nframes); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 5330932b26..8c1dffc884 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -33,7 +33,7 @@ CONFIG_VARIABLE (bool, auto_input, "auto-input", true) CONFIG_VARIABLE (bool, punch_in, "punch-in", false) CONFIG_VARIABLE (bool, punch_out, "punch-out", false) CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100) -CONFIG_VARIABLE (SmpteFormat, smpte_format, "smpte-format", smpte_30) +CONFIG_VARIABLE (SmpteFormat, timecode_format, "timecode-format", timecode_30) CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand) CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US") CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US") diff --git a/libs/ardour/ardour/smpte.h b/libs/ardour/ardour/smpte.h deleted file mode 100644 index fa18a1eec4..0000000000 --- a/libs/ardour/ardour/smpte.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 2006 Paul Davis - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef __ardour_smpte_h__ -#define __ardour_smpte_h__ - -#include - -namespace SMPTE { - -enum Wrap { - NONE = 0, - FRAMES, - SECONDS, - MINUTES, - HOURS -}; - -/** SMPTE frame rate (in frames per second). - * - * This should be eliminated in favour of a float to support arbitrary rates. - */ -enum FPS { - MTC_24_FPS = 0, - MTC_25_FPS = 1, - MTC_30_FPS_DROP = 2, - MTC_30_FPS = 3 -}; - -struct Time { - bool negative; - uint32_t hours; - uint32_t minutes; - uint32_t seconds; - uint32_t frames; ///< SMPTE frames (not audio samples) - uint32_t subframes; ///< Typically unused - FPS rate; ///< Frame rate of this Time - static FPS default_rate; ///< Rate to use for default constructor - - Time(FPS a_rate = default_rate) { - negative = false; - hours = 0; - minutes = 0; - seconds = 0; - frames = 0; - subframes = 0; - rate = a_rate; - } -}; - -Wrap increment( Time& smpte ); -Wrap decrement( Time& smpte ); -Wrap increment_subframes( Time& smpte ); -Wrap decrement_subframes( Time& smpte ); -Wrap increment_seconds( Time& smpte ); -Wrap increment_minutes( Time& smpte ); -Wrap increment_hours( Time& smpte ); -void frames_floor( Time& smpte ); -void seconds_floor( Time& smpte ); -void minutes_floor( Time& smpte ); -void hours_floor( Time& smpte ); - -} // namespace SMPTE - -#endif // __ardour_smpte_h__ diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index f87bca665d..3e0f1844a6 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -40,7 +40,7 @@ public: virtual void tick( const nframes_t& transport_frames, const BBT_Time& transport_bbt, - const SMPTE::Time& transport_smpte) = 0; + const Timecode::Time& transport_timecode) = 0; virtual void set_session(Session& s); virtual void going_away() { _session = 0; } @@ -68,7 +68,7 @@ public: void tick( const nframes_t& transport_frames, const BBT_Time& transport_bbt, - const SMPTE::Time& transport_smpte); + const Timecode::Time& transport_timecode); void set_session(Session& s); void going_away() { _midi_port = 0; Ticker::going_away(); } diff --git a/libs/ardour/ardour/timecode.h b/libs/ardour/ardour/timecode.h new file mode 100644 index 0000000000..dd357ea33c --- /dev/null +++ b/libs/ardour/ardour/timecode.h @@ -0,0 +1,79 @@ +/* Copyright (C) 2006 Paul Davis + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef __ardour_timecode_h__ +#define __ardour_timecode_h__ + +#include + +namespace Timecode { + +enum Wrap { + NONE = 0, + FRAMES, + SECONDS, + MINUTES, + HOURS +}; + +/** Timecode frame rate (in frames per second). + * + * This should be eliminated in favour of a float to support arbitrary rates. + */ +enum FPS { + MTC_24_FPS = 0, + MTC_25_FPS = 1, + MTC_30_FPS_DROP = 2, + MTC_30_FPS = 3 +}; + +struct Time { + bool negative; + uint32_t hours; + uint32_t minutes; + uint32_t seconds; + uint32_t frames; ///< Timecode frames (not audio samples) + uint32_t subframes; ///< Typically unused + FPS rate; ///< Frame rate of this Time + static FPS default_rate; ///< Rate to use for default constructor + + Time(FPS a_rate = default_rate) { + negative = false; + hours = 0; + minutes = 0; + seconds = 0; + frames = 0; + subframes = 0; + rate = a_rate; + } +}; + +Wrap increment( Time& timecode ); +Wrap decrement( Time& timecode ); +Wrap increment_subframes( Time& timecode ); +Wrap decrement_subframes( Time& timecode ); +Wrap increment_seconds( Time& timecode ); +Wrap increment_minutes( Time& timecode ); +Wrap increment_hours( Time& timecode ); +void frames_floor( Time& timecode ); +void seconds_floor( Time& timecode ); +void minutes_floor( Time& timecode ); +void hours_floor( Time& timecode ); + +} // namespace Timecode + +#endif // __ardour_timecode_h__ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 38a0e6d625..1cc619424e 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -31,7 +31,7 @@ #include #include #include -#include "control_protocol/smpte.h" +#include "control_protocol/timecode.h" #include "pbd/id.h" #include @@ -184,21 +184,21 @@ namespace ARDOUR { }; enum SmpteFormat { - smpte_23976, - smpte_24, - smpte_24976, - smpte_25, - smpte_2997, - smpte_2997drop, - smpte_30, - smpte_30drop, - smpte_5994, - smpte_60 + timecode_23976, + timecode_24, + timecode_24976, + timecode_25, + timecode_2997, + timecode_2997drop, + timecode_30, + timecode_30drop, + timecode_5994, + timecode_60 }; struct AnyTime { enum Type { - SMPTE, + Timecode, BBT, Frames, Seconds @@ -206,7 +206,7 @@ namespace ARDOUR { Type type; - SMPTE::Time smpte; + Timecode::Time timecode; BBT_Time bbt; union { diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 661ddf139e..70b4a6bf20 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -2000,7 +2000,7 @@ AudioDiskstream::allocate_temporary_buffers () { /* make sure the wrap buffer is at least large enough to deal with the speeds up to 1.2, to allow for micro-variation - when slaving to MTC, SMPTE etc. + when slaving to MTC, Timecode etc. */ double sp = max (fabsf (_actual_speed), 1.2f); diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc index 19653f55c0..c9203435d5 100644 --- a/libs/ardour/audio_region_importer.cc +++ b/libs/ardour/audio_region_importer.cc @@ -127,7 +127,7 @@ string AudioRegionImporter::get_info () const { nframes_t length, position; - SMPTE::Time length_time, position_time; + Timecode::Time length_time, position_time; std::ostringstream oss; // Get sample positions @@ -136,15 +136,15 @@ AudioRegionImporter::get_info () const std::istringstream iss_position(xml_region.property ("position")->value()); iss_position >> position; - // Convert to smpte - session.sample_to_smpte(length, length_time, true, false); - session.sample_to_smpte(position, position_time, true, false); + // Convert to timecode + session.sample_to_timecode(length, length_time, true, false); + session.sample_to_timecode(position, position_time, true, false); // return info oss << _("Length: ") << - smpte_to_string(length_time) << + timecode_to_string(length_time) << _("\nPosition: ") << - smpte_to_string(position_time) << + timecode_to_string(position_time) << _("\nChannels: ") << xml_region.property ("channels")->value(); diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc index 4438985586..c02b841ea7 100644 --- a/libs/ardour/element_importer.cc +++ b/libs/ardour/element_importer.cc @@ -79,7 +79,7 @@ ElementImporter::cancel_move () } string -ElementImporter::smpte_to_string(SMPTE::Time & time) const +ElementImporter::timecode_to_string(Timecode::Time & time) const { std::ostringstream oss; oss << std::setfill('0') << std::right << diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 1ca26f8fae..e2ba2bd6a5 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -311,16 +311,16 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Session, InCleanup); REGISTER_BITS (_Session_StateOfTheState); - REGISTER_ENUM (smpte_23976); - REGISTER_ENUM (smpte_24); - REGISTER_ENUM (smpte_24976); - REGISTER_ENUM (smpte_25); - REGISTER_ENUM (smpte_2997); - REGISTER_ENUM (smpte_2997drop); - REGISTER_ENUM (smpte_30); - REGISTER_ENUM (smpte_30drop); - REGISTER_ENUM (smpte_5994); - REGISTER_ENUM (smpte_60); + REGISTER_ENUM (timecode_23976); + REGISTER_ENUM (timecode_24); + REGISTER_ENUM (timecode_24976); + REGISTER_ENUM (timecode_25); + REGISTER_ENUM (timecode_2997); + REGISTER_ENUM (timecode_2997drop); + REGISTER_ENUM (timecode_30); + REGISTER_ENUM (timecode_30drop); + REGISTER_ENUM (timecode_5994); + REGISTER_ENUM (timecode_60); REGISTER (_Session_SmpteFormat); REGISTER_CLASS_ENUM (Session, pullup_Plus4Plus1); @@ -423,7 +423,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (AutomationList, Curved); REGISTER (_AutomationList_InterpolationStyle); - REGISTER_CLASS_ENUM (AnyTime, SMPTE); + REGISTER_CLASS_ENUM (AnyTime, Timecode); REGISTER_CLASS_ENUM (AnyTime, BBT); REGISTER_CLASS_ENUM (AnyTime, Frames); REGISTER_CLASS_ENUM (AnyTime, Seconds); @@ -502,7 +502,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (ExportFormatBase, SRC_Linear); REGISTER (_ExportFormatBase_SRCQuality); - REGISTER_CLASS_ENUM (ExportProfileManager, SMPTE); + REGISTER_CLASS_ENUM (ExportProfileManager, Timecode); REGISTER_CLASS_ENUM (ExportProfileManager, BBT); REGISTER_CLASS_ENUM (ExportProfileManager, MinSec); REGISTER_CLASS_ENUM (ExportProfileManager, Frames); diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index 60a7732b58..e1e6776a1b 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -43,7 +43,7 @@ ExportFormatSpecification::Time & ExportFormatSpecification::Time::operator= (AnyTime const & other) { type = other.type; - smpte = other.smpte; + timecode = other.timecode; bbt = other.bbt; if (type == Frames) { @@ -73,11 +73,11 @@ ExportFormatSpecification::Time::get_state () node->add_property ("format", enum_2_string (type)); switch (type) { - case SMPTE: - node->add_property ("hours", to_string (smpte.hours, std::dec)); - node->add_property ("minutes", to_string (smpte.minutes, std::dec)); - node->add_property ("seconds", to_string (smpte.seconds, std::dec)); - node->add_property ("frames", to_string (smpte.frames, std::dec)); + case Timecode: + node->add_property ("hours", to_string (timecode.hours, std::dec)); + node->add_property ("minutes", to_string (timecode.minutes, std::dec)); + node->add_property ("seconds", to_string (timecode.seconds, std::dec)); + node->add_property ("frames", to_string (timecode.frames, std::dec)); break; case BBT: node->add_property ("bars", to_string (bbt.bars, std::dec)); @@ -107,21 +107,21 @@ ExportFormatSpecification::Time::set_state (const XMLNode & node) type = (Type) string_2_enum (prop->value(), Type); switch (type) { - case SMPTE: + case Timecode: if ((prop = node.property ("hours"))) { - smpte.hours = atoi (prop->value()); + timecode.hours = atoi (prop->value()); } if ((prop = node.property ("minutes"))) { - smpte.minutes = atoi (prop->value()); + timecode.minutes = atoi (prop->value()); } if ((prop = node.property ("seconds"))) { - smpte.seconds = atoi (prop->value()); + timecode.seconds = atoi (prop->value()); } if ((prop = node.property ("frames"))) { - smpte.frames = atoi (prop->value()); + timecode.frames = atoi (prop->value()); } break; @@ -191,8 +191,8 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const , _silence_beginning (s) , _silence_end (s) { - _silence_beginning.type = Time::SMPTE; - _silence_end.type = Time::SMPTE; + _silence_beginning.type = Time::Timecode; + _silence_end.type = Time::Timecode; set_state (state); } @@ -396,7 +396,7 @@ ExportFormatSpecification::set_state (const XMLNode & root) _silence_beginning.set_state (*child); } } else { - _silence_beginning.type = Time::SMPTE; + _silence_beginning.type = Time::Timecode; } } } @@ -416,7 +416,7 @@ ExportFormatSpecification::set_state (const XMLNode & root) _silence_end.set_state (*child); } } else { - _silence_end.type = Time::SMPTE; + _silence_end.type = Time::Timecode; } } } diff --git a/libs/ardour/location_importer.cc b/libs/ardour/location_importer.cc index fd74e802a7..6fb9f7b7db 100644 --- a/libs/ardour/location_importer.cc +++ b/libs/ardour/location_importer.cc @@ -105,7 +105,7 @@ string LocationImporter::get_info () const { nframes_t start, end; - SMPTE::Time start_time, end_time; + Timecode::Time start_time, end_time; // Get sample positions std::istringstream iss_start (xml_location.property ("start")->value()); @@ -113,17 +113,17 @@ LocationImporter::get_info () const std::istringstream iss_end (xml_location.property ("end")->value()); iss_end >> end; - // Convert to smpte - session.sample_to_smpte (start, start_time, true, false); - session.sample_to_smpte (end, end_time, true, false); + // Convert to timecode + session.sample_to_timecode (start, start_time, true, false); + session.sample_to_timecode (end, end_time, true, false); // return info std::ostringstream oss; if (start == end) { - oss << _("Location: ") << smpte_to_string (start_time); + oss << _("Location: ") << timecode_to_string (start_time); } else { - oss << _("Range\nstart: ") << smpte_to_string (start_time) << - _("\nend: ") << smpte_to_string (end_time); + oss << _("Range\nstart: ") << timecode_to_string (start_time) << + _("\nend: ") << timecode_to_string (end_time); } return oss.str(); diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index a97b8aa658..4034ef32be 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -44,7 +44,7 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) { can_notify_on_unknown_rate = true; - last_mtc_fps_byte = session.get_mtc_smpte_bits (); + last_mtc_fps_byte = session.get_mtc_timecode_bits (); rebind (p); reset (); @@ -76,7 +76,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/) nframes_t qtr; static cycles_t last_qtr = 0; - qtr = (long) (session.frames_per_smpte_frame() / 4); + qtr = (long) (session.frames_per_timecode_frame() / 4); mtc_frame += qtr; last_qtr = cnow; @@ -92,34 +92,34 @@ void MTC_Slave::update_mtc_time (const byte *msg, bool was_full) { nframes_t now = session.engine().frame_time(); - SMPTE::Time smpte; + Timecode::Time timecode; - smpte.hours = msg[3]; - smpte.minutes = msg[2]; - smpte.seconds = msg[1]; - smpte.frames = msg[0]; + timecode.hours = msg[3]; + timecode.minutes = msg[2]; + timecode.seconds = msg[1]; + timecode.frames = msg[0]; last_mtc_fps_byte = msg[4]; switch (msg[4]) { case MTC_24_FPS: - smpte.rate = 24; - smpte.drop = false; + timecode.rate = 24; + timecode.drop = false; can_notify_on_unknown_rate = true; break; case MTC_25_FPS: - smpte.rate = 25; - smpte.drop = false; + timecode.rate = 25; + timecode.drop = false; can_notify_on_unknown_rate = true; break; case MTC_30_FPS_DROP: - smpte.rate = 30; - smpte.drop = true; + timecode.rate = 30; + timecode.drop = true; can_notify_on_unknown_rate = true; break; case MTC_30_FPS: - smpte.rate = 30; - smpte.drop = false; + timecode.rate = 30; + timecode.drop = false; can_notify_on_unknown_rate = true; break; default: @@ -130,11 +130,11 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) << endmsg; can_notify_on_unknown_rate = false; } - smpte.rate = session.smpte_frames_per_second(); - smpte.drop = session.smpte_drop_frames(); + timecode.rate = session.timecode_frames_per_second(); + timecode.drop = session.timecode_drop_frames(); } - session.smpte_to_sample (smpte, mtc_frame, true, false); + session.timecode_to_sample (timecode, mtc_frame, true, false); if (was_full) { @@ -158,7 +158,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) Also compensate for audio latency. */ - mtc_frame += (long) (1.75 * session.frames_per_smpte_frame()) + session.worst_output_latency(); + mtc_frame += (long) (1.75 * session.frames_per_timecode_frame()) + session.worst_output_latency(); if (first_mtc_frame == 0) { first_mtc_frame = mtc_frame; @@ -338,7 +338,7 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos) ARDOUR::nframes_t MTC_Slave::resolution() const { - return (nframes_t) session.frames_per_smpte_frame(); + return (nframes_t) session.frames_per_timecode_frame(); } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index aef643efea..1b054fd6fb 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -104,7 +104,7 @@ sigc::signal Session::AskAboutPendingState; sigc::signal Session::AskAboutSampleRateMismatch; sigc::signal Session::SendFeedback; -sigc::signal Session::SMPTEOffsetChanged; +sigc::signal Session::TimecodeOffsetChanged; sigc::signal Session::StartTimeChanged; sigc::signal Session::EndTimeChanged; sigc::signal Session::AutoBindingOn; @@ -132,7 +132,7 @@ Session::Session (AudioEngine &eng, state_tree (0), _butler (new Butler (this)), post_transport_work((PostTransportWork)0), - _send_smpte_update (false), + _send_timecode_update (false), midi_thread (pthread_t (0)), midi_requests (128), // the size of this should match the midi request pool size diskstreams (new DiskstreamList), @@ -218,7 +218,7 @@ Session::Session (AudioEngine &eng, state_tree (0), _butler (new Butler (this)), post_transport_work((PostTransportWork)0), - _send_smpte_update (false), + _send_timecode_update (false), midi_thread (pthread_t (0)), midi_requests (16), diskstreams (new DiskstreamList), diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 716ade0075..b795d3fb59 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -340,7 +340,7 @@ Session::process_event (Event* ev) // cerr << "soft locate to " << ev->target_frame << endl; start_locate (ev->target_frame, false, true, false); } - _send_smpte_update = true; + _send_timecode_update = true; break; case Event::LocateRoll: @@ -351,7 +351,7 @@ Session::process_event (Event* ev) // cerr << "soft locate to+roll " << ev->target_frame << endl; start_locate (ev->target_frame, true, true, false); } - _send_smpte_update = true; + _send_timecode_update = true; break; case Event::LocateRollLocate: diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 25807687a8..f7ee8ef3c9 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -43,7 +43,7 @@ #include "ardour/audio_diskstream.h" #include "ardour/slave.h" #include "ardour/cycles.h" -#include "ardour/smpte.h" +#include "ardour/timecode.h" #include "i18n.h" @@ -469,7 +469,7 @@ Session::get_trace_midi_output(MIDI::Port *port) void Session::setup_midi_control () { - outbound_mtc_smpte_frame = 0; + outbound_mtc_timecode_frame = 0; next_quarter_frame_to_send = 0; /* setup the MMC buffer */ @@ -638,7 +638,7 @@ Session::mmc_step (MIDI::MachineControl &/*mmc*/, int steps) } double diff_secs = diff.tv_sec + (diff.tv_usec / 1000000.0); - double cur_speed = (((steps * 0.5) * smpte_frames_per_second()) / diff_secs) / smpte_frames_per_second(); + double cur_speed = (((steps * 0.5) * timecode_frames_per_second()) / diff_secs) / timecode_frames_per_second(); if (_transport_speed == 0 || cur_speed * _transport_speed < 0) { /* change direction */ @@ -691,17 +691,17 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) } nframes_t target_frame; - SMPTE::Time smpte; + Timecode::Time timecode; - smpte.hours = mmc_tc[0] & 0xf; - smpte.minutes = mmc_tc[1]; - smpte.seconds = mmc_tc[2]; - smpte.frames = mmc_tc[3]; - smpte.rate = smpte_frames_per_second(); - smpte.drop = smpte_drop_frames(); + timecode.hours = mmc_tc[0] & 0xf; + timecode.minutes = mmc_tc[1]; + timecode.seconds = mmc_tc[2]; + timecode.frames = mmc_tc[3]; + timecode.rate = timecode_frames_per_second(); + timecode.drop = timecode_drop_frames(); - // Also takes smpte offset into account: - smpte_to_sample( smpte, target_frame, true /* use_offset */, false /* use_subframes */ ); + // Also takes timecode offset into account: + timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ ); if (target_frame > max_frames) { target_frame = max_frames; @@ -773,7 +773,7 @@ Session::change_midi_ports () poke_midi_thread (); } -/** Send MTC Full Frame message (complete SMPTE time) for the start of this cycle. +/** Send MTC Full Frame message (complete Timecode time) for the start of this cycle. * This resets the MTC code, the next quarter frame message that is sent will be * the first one with the beginning of this cycle as the new start point. */ @@ -784,33 +784,33 @@ Session::send_full_time_code(nframes_t /*nframes*/) * that be useful? Does ardour do sub-block accurate locating? [DR] */ MIDI::byte msg[10]; - SMPTE::Time smpte; + Timecode::Time timecode; - _send_smpte_update = false; + _send_timecode_update = false; if (_mtc_port == 0 || !session_send_mtc) { return 0; } - // Get smpte time for this transport frame - sample_to_smpte(_transport_frame, smpte, true /* use_offset */, false /* no subframes */); + // Get timecode time for this transport frame + sample_to_timecode(_transport_frame, timecode, true /* use_offset */, false /* no subframes */); - transmitting_smpte_time = smpte; - outbound_mtc_smpte_frame = _transport_frame; + transmitting_timecode_time = timecode; + outbound_mtc_timecode_frame = _transport_frame; // I don't understand this bit yet.. [DR] - if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) { + if (((mtc_timecode_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_timecode_time.frames % 2)) { // start MTC quarter frame transmission on an even frame - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); - outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame; + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); + outbound_mtc_timecode_frame += (nframes_t) _frames_per_timecode_frame; } // Compensate for audio latency - outbound_mtc_smpte_frame += _worst_output_latency; + outbound_mtc_timecode_frame += _worst_output_latency; next_quarter_frame_to_send = 0; - // Sync slave to the same SMPTE time as we are on + // Sync slave to the same Timecode time as we are on msg[0] = 0xf0; msg[1] = 0x7f; msg[2] = 0x7f; @@ -818,12 +818,12 @@ Session::send_full_time_code(nframes_t /*nframes*/) msg[4] = 0x1; msg[9] = 0xf7; - msg[5] = mtc_smpte_bits | smpte.hours; - msg[6] = smpte.minutes; - msg[7] = smpte.seconds; - msg[8] = smpte.frames; + msg[5] = mtc_timecode_bits | timecode.hours; + msg[6] = timecode.minutes; + msg[7] = timecode.seconds; + msg[8] = timecode.frames; - cerr << "MTC: Sending full time code at " << outbound_mtc_smpte_frame << endl; + cerr << "MTC: Sending full time code at " << outbound_mtc_timecode_frame << endl; // Send message at offset 0, sent time is for the start of this cycle if (_mtc_port->midimsg (msg, sizeof (msg), 0)) { @@ -836,9 +836,9 @@ Session::send_full_time_code(nframes_t /*nframes*/) /** Send MTC (quarter-frame) messages for this cycle. * Must be called exactly once per cycle from the audio thread. Realtime safe. - * This function assumes the state of full SMPTE is sane, eg. the slave is + * This function assumes the state of full Timecode is sane, eg. the slave is * expecting quarter frame messages and has the right frame of reference (any - * full MTC SMPTE time messages that needed to be sent should have been sent + * full MTC Timecode time messages that needed to be sent should have been sent * earlier already this cycle by send_full_time_code) */ int @@ -847,57 +847,57 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) assert (next_quarter_frame_to_send >= 0); assert (next_quarter_frame_to_send <= 7); - if (_mtc_port == 0 || !session_send_mtc || transmitting_smpte_time.negative + if (_mtc_port == 0 || !session_send_mtc || transmitting_timecode_time.negative /*|| (next_quarter_frame_to_send < 0)*/ ) { // cerr << "(MTC) Not sending MTC\n"; return 0; } /* Duration of one quarter frame */ - nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2; + nframes_t quarter_frame_duration = ((long) _frames_per_timecode_frame) >> 2; - // cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_smpte_frame + // cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_timecode_frame // << " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl; // FIXME: this should always be true - //assert((outbound_mtc_smpte_frame + (next_quarter_frame_to_send * quarter_frame_duration)) + //assert((outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) // > _transport_frame); // Send quarter frames for this cycle - while (_transport_frame + nframes > (outbound_mtc_smpte_frame + + while (_transport_frame + nframes > (outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration))) { // cerr << "(MTC) Next frame to send: " << next_quarter_frame_to_send << endl; switch (next_quarter_frame_to_send) { case 0: - mtc_msg[1] = 0x00 | (transmitting_smpte_time.frames & 0xf); + mtc_msg[1] = 0x00 | (transmitting_timecode_time.frames & 0xf); break; case 1: - mtc_msg[1] = 0x10 | ((transmitting_smpte_time.frames & 0xf0) >> 4); + mtc_msg[1] = 0x10 | ((transmitting_timecode_time.frames & 0xf0) >> 4); break; case 2: - mtc_msg[1] = 0x20 | (transmitting_smpte_time.seconds & 0xf); + mtc_msg[1] = 0x20 | (transmitting_timecode_time.seconds & 0xf); break; case 3: - mtc_msg[1] = 0x30 | ((transmitting_smpte_time.seconds & 0xf0) >> 4); + mtc_msg[1] = 0x30 | ((transmitting_timecode_time.seconds & 0xf0) >> 4); break; case 4: - mtc_msg[1] = 0x40 | (transmitting_smpte_time.minutes & 0xf); + mtc_msg[1] = 0x40 | (transmitting_timecode_time.minutes & 0xf); break; case 5: - mtc_msg[1] = 0x50 | ((transmitting_smpte_time.minutes & 0xf0) >> 4); + mtc_msg[1] = 0x50 | ((transmitting_timecode_time.minutes & 0xf0) >> 4); break; case 6: - mtc_msg[1] = 0x60 | ((mtc_smpte_bits|transmitting_smpte_time.hours) & 0xf); + mtc_msg[1] = 0x60 | ((mtc_timecode_bits|transmitting_timecode_time.hours) & 0xf); break; case 7: - mtc_msg[1] = 0x70 | (((mtc_smpte_bits|transmitting_smpte_time.hours) & 0xf0) >> 4); + mtc_msg[1] = 0x70 | (((mtc_timecode_bits|transmitting_timecode_time.hours) & 0xf0) >> 4); break; } - const nframes_t msg_time = (outbound_mtc_smpte_frame + const nframes_t msg_time = (outbound_mtc_timecode_frame + (quarter_frame_duration * next_quarter_frame_to_send)); // This message must fall within this block or something is broken @@ -913,10 +913,10 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) return -1; } - /*cerr << "(MTC) SMPTE: " << transmitting_smpte_time.hours - << ":" << transmitting_smpte_time.minutes - << ":" << transmitting_smpte_time.seconds - << ":" << transmitting_smpte_time.frames + /*cerr << "(MTC) Timecode: " << transmitting_timecode_time.hours + << ":" << transmitting_timecode_time.minutes + << ":" << transmitting_timecode_time.seconds + << ":" << transmitting_timecode_time.frames << ", qfm = " << next_quarter_frame_to_send << ", stamp = " << out_stamp << ", delta = " << _transport_frame + out_stamp - last_time << endl;*/ @@ -927,14 +927,14 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) if (next_quarter_frame_to_send >= 8) { // Wrap quarter frame counter next_quarter_frame_to_send = 0; - // Increment smpte time twice - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); + // Increment timecode time twice + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); // Re-calculate timing of first quarter frame - //smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false ); - outbound_mtc_smpte_frame += 8 * quarter_frame_duration; + //timecode_to_sample( transmitting_timecode_time, outbound_mtc_timecode_frame, true /* use_offset */, false ); + outbound_mtc_timecode_frame += 8 * quarter_frame_duration; // Compensate for audio latency - outbound_mtc_smpte_frame += _worst_output_latency; + outbound_mtc_timecode_frame += _worst_output_latency; } } @@ -950,7 +950,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where) { using namespace MIDI; int nbytes = 4; - SMPTE::Time smpte; + Timecode::Time timecode; if (_mmc_port == 0 || !session_send_mmc) { // cerr << "Not delivering MMC " << _mmc_port << " - " << session_send_mmc << endl; @@ -963,15 +963,15 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where) switch (cmd) { case MachineControl::cmdLocate: - smpte_time_subframes (where, smpte); + timecode_time_subframes (where, timecode); mmc_buffer[nbytes++] = 0x6; // byte count mmc_buffer[nbytes++] = 0x1; // "TARGET" subcommand - mmc_buffer[nbytes++] = smpte.hours; - mmc_buffer[nbytes++] = smpte.minutes; - mmc_buffer[nbytes++] = smpte.seconds; - mmc_buffer[nbytes++] = smpte.frames; - mmc_buffer[nbytes++] = smpte.subframes; + mmc_buffer[nbytes++] = timecode.hours; + mmc_buffer[nbytes++] = timecode.minutes; + mmc_buffer[nbytes++] = timecode.seconds; + mmc_buffer[nbytes++] = timecode.frames; + mmc_buffer[nbytes++] = timecode.subframes; break; case MachineControl::cmdStop: diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 8b4d88b704..ea63e71307 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -76,9 +76,9 @@ Session::process (nframes_t nframes) nframes_t transport_frames = transport_frame(); BBT_Time transport_bbt; bbt_time(transport_frames, transport_bbt); - SMPTE::Time transport_smpte; - smpte_time(transport_frames, transport_smpte); - tick (transport_frames, transport_bbt, transport_smpte); /* EMIT SIGNAL */ + Timecode::Time transport_timecode; + timecode_time(transport_frames, transport_timecode); + tick (transport_frames, transport_bbt, transport_timecode); /* EMIT SIGNAL */ SendFeedback (); /* EMIT SIGNAL */ @@ -305,11 +305,11 @@ Session::process_with_events (nframes_t nframes) process_event (ev); } - /* Events caused a transport change, send an MTC Full Frame (SMPTE) message. + /* Events caused a transport change, send an MTC Full Frame (Timecode) message. * This is sent whether rolling or not, to give slaves an idea of ardour time * on locates (and allow slow slaves to position and prepare for rolling) */ - if (_send_smpte_update) { + if (_send_timecode_update) { send_full_time_code(nframes); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 4a5d974563..83cebbccbe 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -187,7 +187,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) pending_locate_flush = false; state_was_pending = false; set_next_event (); - outbound_mtc_smpte_frame = 0; + outbound_mtc_timecode_frame = 0; next_quarter_frame_to_send = -1; current_block_size = 0; solo_update_disabled = false; @@ -244,10 +244,10 @@ Session::first_stage_init (string fullpath, string snapshot_name) waiting_for_sync_offset = false; } - last_smpte_when = 0; - _smpte_offset = 0; - _smpte_offset_negative = true; - last_smpte_valid = false; + last_timecode_when = 0; + _timecode_offset = 0; + _timecode_offset_negative = true; + last_timecode_valid = false; sync_time_vars (); @@ -3103,7 +3103,7 @@ Session::config_changed (std::string p, bool ours) setup_raid_path (config.get_raid_path()); - } else if (p == "smpte-format") { + } else if (p == "timecode-format") { sync_time_vars (); diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index ae8d07e9ee..167d936f50 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -52,102 +52,102 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt) _tempo_map->bbt_time (when, bbt); } -/* SMPTE TIME */ +/* Timecode TIME */ float -Session::smpte_frames_per_second() const +Session::timecode_frames_per_second() const { - switch (config.get_smpte_format()) { - case smpte_23976: + switch (config.get_timecode_format()) { + case timecode_23976: return 23.976; break; - case smpte_24: + case timecode_24: return 24; break; - case smpte_24976: + case timecode_24976: return 24.976; break; - case smpte_25: + case timecode_25: return 25; break; - case smpte_2997: + case timecode_2997: return 29.97; break; - case smpte_2997drop: + case timecode_2997drop: return 29.97; break; - case smpte_30: + case timecode_30: return 30; break; - case smpte_30drop: + case timecode_30drop: return 30; break; - case smpte_5994: + case timecode_5994: return 59.94; break; - case smpte_60: + case timecode_60: return 60; break; default: - cerr << "Editor received unexpected smpte type" << endl; + cerr << "Editor received unexpected timecode type" << endl; } return 30.0; } bool -Session::smpte_drop_frames() const +Session::timecode_drop_frames() const { - switch (config.get_smpte_format()) { - case smpte_23976: + switch (config.get_timecode_format()) { + case timecode_23976: return false; break; - case smpte_24: + case timecode_24: return false; break; - case smpte_24976: + case timecode_24976: return false; break; - case smpte_25: + case timecode_25: return false; break; - case smpte_2997: + case timecode_2997: return false; break; - case smpte_2997drop: + case timecode_2997drop: return true; break; - case smpte_30: + case timecode_30: return false; break; - case smpte_30drop: + case timecode_30drop: return true; break; - case smpte_5994: + case timecode_5994: return false; break; - case smpte_60: + case timecode_60: return false; break; default: - cerr << "Editor received unexpected smpte type" << endl; + cerr << "Editor received unexpected timecode type" << endl; } return false; } @@ -155,59 +155,59 @@ void Session::sync_time_vars () { _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0))); - _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second(); - if (smpte_drop_frames()) { - _frames_per_hour = (long)(107892 * _frames_per_smpte_frame); + _frames_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second(); + if (timecode_drop_frames()) { + _frames_per_hour = (long)(107892 * _frames_per_timecode_frame); } else { - _frames_per_hour = (long)(3600 * rint(smpte_frames_per_second()) * _frames_per_smpte_frame); + _frames_per_hour = (long)(3600 * rint(timecode_frames_per_second()) * _frames_per_timecode_frame); } - _smpte_frames_per_hour = (nframes_t)rint(smpte_frames_per_second() * 3600.0); + _timecode_frames_per_hour = (nframes_t)rint(timecode_frames_per_second() * 3600.0); - last_smpte_valid = false; - // smpte type bits are the middle two in the upper nibble - switch ((int) ceil (smpte_frames_per_second())) { + last_timecode_valid = false; + // timecode type bits are the middle two in the upper nibble + switch ((int) ceil (timecode_frames_per_second())) { case 24: - mtc_smpte_bits = 0; + mtc_timecode_bits = 0; break; case 25: - mtc_smpte_bits = 0x20; + mtc_timecode_bits = 0x20; break; case 30: default: - if (smpte_drop_frames()) { - mtc_smpte_bits = 0x40; + if (timecode_drop_frames()) { + mtc_timecode_bits = 0x40; } else { - mtc_smpte_bits = 0x60; + mtc_timecode_bits = 0x60; } break; }; } void -Session::set_smpte_offset (nframes_t off) +Session::set_timecode_offset (nframes_t off) { - _smpte_offset = off; - last_smpte_valid = false; + _timecode_offset = off; + last_timecode_valid = false; - SMPTEOffsetChanged (); /* EMIT SIGNAL */ + TimecodeOffsetChanged (); /* EMIT SIGNAL */ } void -Session::set_smpte_offset_negative (bool neg) +Session::set_timecode_offset_negative (bool neg) { - _smpte_offset_negative = neg; - last_smpte_valid = false; + _timecode_offset_negative = neg; + last_timecode_valid = false; - SMPTEOffsetChanged (); /* EMIT SIGNAL */ + TimecodeOffsetChanged (); /* EMIT SIGNAL */ } void -Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const +Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes ) const { - if (smpte.drop) { + if (timecode.drop) { // The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997.... // framerate of NTSC color TV. The used frame rate of drop frame is 29.97, which drifts by about // 0.108 frame per hour, or about 1.3 frames per 12 hours. This is not perfect, but a lot better @@ -222,7 +222,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset // // In table form: // - // SMPTE value frames offset subframes offset seconds (rounded) 44100 sample (rounded) + // Timecode value frames offset subframes offset seconds (rounded) 44100 sample (rounded) // 0:00:00:00 0.0 0 0.000 0 (accurate) // 0:00:59:29 1.8 144 60.027 2647177 // 0:01:00:02 -0.2 -16 60.060 2648648 @@ -248,46 +248,46 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset // Per Sigmond // Samples inside time dividable by 10 minutes (real time accurate) - nframes_t base_samples = (nframes_t) (((smpte.hours * 107892) + ((smpte.minutes / 10) * 17982)) * _frames_per_smpte_frame); + nframes_t base_samples = (nframes_t) (((timecode.hours * 107892) + ((timecode.minutes / 10) * 17982)) * _frames_per_timecode_frame); // Samples inside time exceeding the nearest 10 minutes (always offset, see above) - long exceeding_df_minutes = smpte.minutes % 10; - long exceeding_df_seconds = (exceeding_df_minutes * 60) + smpte.seconds; - long exceeding_df_frames = (30 * exceeding_df_seconds) + smpte.frames - (2 * exceeding_df_minutes); - nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame); + long exceeding_df_minutes = timecode.minutes % 10; + long exceeding_df_seconds = (exceeding_df_minutes * 60) + timecode.seconds; + long exceeding_df_frames = (30 * exceeding_df_seconds) + timecode.frames - (2 * exceeding_df_minutes); + nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_timecode_frame); sample = base_samples + exceeding_samples; } else { /* Non drop is easy.. just note the use of - rint(smpte.rate) * _frames_per_smpte_frame - (frames per SMPTE second), which is larger than - frame_rate() in the non-integer SMPTE rate case. + rint(timecode.rate) * _frames_per_timecode_frame + (frames per Timecode second), which is larger than + frame_rate() in the non-integer Timecode rate case. */ - sample = (nframes_t)rint((((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * (rint(smpte.rate) * _frames_per_smpte_frame)) + (smpte.frames * _frames_per_smpte_frame)); + sample = (nframes_t)rint((((timecode.hours * 60 * 60) + (timecode.minutes * 60) + timecode.seconds) * (rint(timecode.rate) * _frames_per_timecode_frame)) + (timecode.frames * _frames_per_timecode_frame)); } if (use_subframes) { - sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame()); + sample += (long) (((double)timecode.subframes * _frames_per_timecode_frame) / config.get_subframes_per_frame()); } if (use_offset) { - if (smpte_offset_negative()) { - if (sample >= smpte_offset()) { - sample -= smpte_offset(); + if (timecode_offset_negative()) { + if (sample >= timecode_offset()) { + sample -= timecode_offset(); } else { /* Prevent song-time from becoming negative */ sample = 0; } } else { - if (smpte.negative) { - if (sample <= smpte_offset()) { - sample = smpte_offset() - sample; + if (timecode.negative) { + if (sample <= timecode_offset()) { + sample = timecode_offset() - sample; } else { sample = 0; } } else { - sample += smpte_offset(); + sample += timecode_offset(); } } } @@ -296,152 +296,152 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset void -Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const +Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const { nframes_t offset_sample; if (!use_offset) { offset_sample = sample; - smpte.negative = false; + timecode.negative = false; } else { - if (_smpte_offset_negative) { - offset_sample = sample + _smpte_offset; - smpte.negative = false; + if (_timecode_offset_negative) { + offset_sample = sample + _timecode_offset; + timecode.negative = false; } else { - if (sample < _smpte_offset) { - offset_sample = (_smpte_offset - sample); - smpte.negative = true; + if (sample < _timecode_offset) { + offset_sample = (_timecode_offset - sample); + timecode.negative = true; } else { - offset_sample = sample - _smpte_offset; - smpte.negative = false; + offset_sample = sample - _timecode_offset; + timecode.negative = false; } } } - double smpte_frames_left_exact; - double smpte_frames_fraction; - unsigned long smpte_frames_left; + double timecode_frames_left_exact; + double timecode_frames_fraction; + unsigned long timecode_frames_left; // Extract whole hours. Do this to prevent rounding errors with // high sample numbers in the calculations that follow. - smpte.hours = offset_sample / _frames_per_hour; + timecode.hours = offset_sample / _frames_per_hour; offset_sample = offset_sample % _frames_per_hour; - // Calculate exact number of (exceeding) smpte frames and fractional frames - smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame; - smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact ); - smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame()); + // Calculate exact number of (exceeding) timecode frames and fractional frames + timecode_frames_left_exact = (double) offset_sample / _frames_per_timecode_frame; + timecode_frames_fraction = timecode_frames_left_exact - floor( timecode_frames_left_exact ); + timecode.subframes = (long) rint(timecode_frames_fraction * config.get_subframes_per_frame()); // XXX Not sure if this is necessary anymore... - if (smpte.subframes == config.get_subframes_per_frame()) { + if (timecode.subframes == config.get_subframes_per_frame()) { // This can happen with 24 fps (and 29.97 fps ?) - smpte_frames_left_exact = ceil( smpte_frames_left_exact ); - smpte.subframes = 0; + timecode_frames_left_exact = ceil( timecode_frames_left_exact ); + timecode.subframes = 0; } // Extract hour-exceeding frames for minute, second and frame calculations - smpte_frames_left = ((long) floor( smpte_frames_left_exact )); + timecode_frames_left = ((long) floor( timecode_frames_left_exact )); - if (smpte_drop_frames()) { - // See long explanation in smpte_to_sample()... + if (timecode_drop_frames()) { + // See long explanation in timecode_to_sample()... // Number of 10 minute chunks - smpte.minutes = (smpte_frames_left / 17982) * 10; // exactly 17982 frames in 10 minutes + timecode.minutes = (timecode_frames_left / 17982) * 10; // exactly 17982 frames in 10 minutes // frames exceeding the nearest 10 minute barrier - long exceeding_df_frames = smpte_frames_left % 17982; + long exceeding_df_frames = timecode_frames_left % 17982; // Find minutes exceeding the nearest 10 minute barrier if (exceeding_df_frames >= 1800) { // nothing to do if we are inside the first minute (0-1799) exceeding_df_frames -= 1800; // take away first minute (different number of frames than the others) long extra_minutes_minus_1 = exceeding_df_frames / 1798; // how many minutes after the first one exceeding_df_frames -= extra_minutes_minus_1 * 1798; // take away the (extra) minutes just found - smpte.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes + timecode.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes } // Adjust frame numbering for dropped frames (frame 0 and 1 skipped at start of every minute except every 10th) - if (smpte.minutes % 10) { + if (timecode.minutes % 10) { // Every minute except every 10th if (exceeding_df_frames < 28) { // First second, frames 0 and 1 are skipped - smpte.seconds = 0; - smpte.frames = exceeding_df_frames + 2; + timecode.seconds = 0; + timecode.frames = exceeding_df_frames + 2; } else { // All other seconds, all 30 frames are counted exceeding_df_frames -= 28; - smpte.seconds = (exceeding_df_frames / 30) + 1; - smpte.frames = exceeding_df_frames % 30; + timecode.seconds = (exceeding_df_frames / 30) + 1; + timecode.frames = exceeding_df_frames % 30; } } else { // Every 10th minute, all 30 frames counted in all seconds - smpte.seconds = exceeding_df_frames / 30; - smpte.frames = exceeding_df_frames % 30; + timecode.seconds = exceeding_df_frames / 30; + timecode.frames = exceeding_df_frames % 30; } } else { // Non drop is easy - smpte.minutes = smpte_frames_left / ((long) rint (smpte_frames_per_second ()) * 60); - smpte_frames_left = smpte_frames_left % ((long) rint (smpte_frames_per_second ()) * 60); - smpte.seconds = smpte_frames_left / (long) rint(smpte_frames_per_second ()); - smpte.frames = smpte_frames_left % (long) rint(smpte_frames_per_second ()); + timecode.minutes = timecode_frames_left / ((long) rint (timecode_frames_per_second ()) * 60); + timecode_frames_left = timecode_frames_left % ((long) rint (timecode_frames_per_second ()) * 60); + timecode.seconds = timecode_frames_left / (long) rint(timecode_frames_per_second ()); + timecode.frames = timecode_frames_left % (long) rint(timecode_frames_per_second ()); } if (!use_subframes) { - smpte.subframes = 0; + timecode.subframes = 0; } /* set frame rate and drop frame */ - smpte.rate = smpte_frames_per_second (); - smpte.drop = smpte_drop_frames(); + timecode.rate = timecode_frames_per_second (); + timecode.drop = timecode_drop_frames(); } void -Session::smpte_time (nframes_t when, SMPTE::Time& smpte) +Session::timecode_time (nframes_t when, Timecode::Time& timecode) { - if (last_smpte_valid && when == last_smpte_when) { - smpte = last_smpte; + if (last_timecode_valid && when == last_timecode_when) { + timecode = last_timecode; return; } - sample_to_smpte( when, smpte, true /* use_offset */, false /* use_subframes */ ); + sample_to_timecode( when, timecode, true /* use_offset */, false /* use_subframes */ ); - last_smpte_when = when; - last_smpte = smpte; - last_smpte_valid = true; + last_timecode_when = when; + last_timecode = timecode; + last_timecode_valid = true; } void -Session::smpte_time_subframes (nframes_t when, SMPTE::Time& smpte) +Session::timecode_time_subframes (nframes_t when, Timecode::Time& timecode) { - if (last_smpte_valid && when == last_smpte_when) { - smpte = last_smpte; + if (last_timecode_valid && when == last_timecode_when) { + timecode = last_timecode; return; } - sample_to_smpte( when, smpte, true /* use_offset */, true /* use_subframes */ ); + sample_to_timecode( when, timecode, true /* use_offset */, true /* use_subframes */ ); - last_smpte_when = when; - last_smpte = smpte; - last_smpte_valid = true; + last_timecode_when = when; + last_timecode = timecode; + last_timecode_valid = true; } void -Session::smpte_duration (nframes_t when, SMPTE::Time& smpte) const +Session::timecode_duration (nframes_t when, Timecode::Time& timecode) const { - sample_to_smpte( when, smpte, false /* use_offset */, true /* use_subframes */ ); + sample_to_timecode( when, timecode, false /* use_offset */, true /* use_subframes */ ); } void -Session::smpte_duration_string (char* buf, nframes_t when) const +Session::timecode_duration_string (char* buf, nframes_t when) const { - SMPTE::Time smpte; + Timecode::Time timecode; - smpte_duration (when, smpte); - snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + timecode_duration (when, timecode); + snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } void -Session::smpte_time (SMPTE::Time &t) +Session::timecode_time (Timecode::Time &t) { - smpte_time (_transport_frame, t); + timecode_time (_transport_frame, t); } int @@ -520,15 +520,15 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/, #ifdef HAVE_JACK_VIDEO_SUPPORT //poke audio video ratio so Ardour can track Video Sync - pos->audio_frames_per_video_frame = frame_rate() / smpte_frames_per_second(); + pos->audio_frames_per_video_frame = frame_rate() / timecode_frames_per_second(); pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio); #endif #if 0 - /* SMPTE info */ + /* Timecode info */ - t.smpte_offset = _smpte_offset; - t.smpte_frame_rate = smpte_frames_per_second(); + t.timecode_offset = _timecode_offset; + t.timecode_frame_rate = timecode_frames_per_second(); if (_transport_speed) { @@ -574,19 +574,19 @@ Session::convert_to_frames_at (nframes_t /*position*/, AnyTime const & any) return _tempo_map->frame_time ( any.bbt); break; - case AnyTime::SMPTE: + case AnyTime::Timecode: /* XXX need to handle negative values */ - secs = any.smpte.hours * 60 * 60; - secs += any.smpte.minutes * 60; - secs += any.smpte.seconds; - secs += any.smpte.frames / smpte_frames_per_second(); - if (_smpte_offset_negative) + secs = any.timecode.hours * 60 * 60; + secs += any.timecode.minutes * 60; + secs += any.timecode.seconds; + secs += any.timecode.frames / timecode_frames_per_second(); + if (_timecode_offset_negative) { - return (nframes_t) floor (secs * frame_rate()) - _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) - _timecode_offset; } else { - return (nframes_t) floor (secs * frame_rate()) + _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) + _timecode_offset; } break; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index a4e4a81c95..b5c203189f 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -681,11 +681,11 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w return; } - // Update SMPTE time + // Update Timecode time // [DR] FIXME: find out exactly where this should go below _transport_frame = target_frame; - smpte_time(_transport_frame, transmitting_smpte_time); - outbound_mtc_smpte_frame = _transport_frame; + timecode_time(_transport_frame, transmitting_timecode_time); + outbound_mtc_timecode_frame = _transport_frame; next_quarter_frame_to_send = 0; if (_transport_speed && (!with_loop || loop_changing)) { @@ -785,7 +785,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w loop_changing = false; - _send_smpte_update = true; + _send_timecode_update = true; Located (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 19f5ed195d..97e44ebf7b 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -103,7 +103,7 @@ void MidiClockTicker::transport_state_changed() send_stop_event(0); } - tick(position, *((ARDOUR::BBT_Time *) 0), *((SMPTE::Time *)0)); + tick(position, *((ARDOUR::BBT_Time *) 0), *((Timecode::Time *)0)); } void MidiClockTicker::position_changed(nframes_t position) @@ -133,7 +133,7 @@ void MidiClockTicker::transport_looped() _last_tick = loop_location->start() - elapsed_since_last_tick; } -void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /*transport_bbt*/, const SMPTE::Time& /*transport_smpt*/) +void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /*transport_bbt*/, const Timecode::Time& /*transport_smpt*/) { #ifdef WITH_JACK_MIDI if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f) diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 2eda08acf7..c0ead577d7 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -270,25 +270,25 @@ BasicUI::locked () } nframes_t -BasicUI::smpte_frames_per_hour () +BasicUI::timecode_frames_per_hour () { - return session->smpte_frames_per_hour (); + return session->timecode_frames_per_hour (); } void -BasicUI::smpte_time (nframes_t where, SMPTE::Time& smpte) +BasicUI::timecode_time (nframes_t where, Timecode::Time& timecode) { - session->smpte_time (where, *((SMPTE::Time *) &smpte)); + session->timecode_time (where, *((Timecode::Time *) &timecode)); } void -BasicUI::smpte_to_sample (SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes) const +BasicUI::timecode_to_sample (Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const { - session->smpte_to_sample (*((SMPTE::Time*)&smpte), sample, use_offset, use_subframes); + session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes); } void -BasicUI::sample_to_smpte (nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const +BasicUI::sample_to_timecode (nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const { - session->sample_to_smpte (sample, *((SMPTE::Time*)&smpte), use_offset, use_subframes); + session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes); } diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index 279d1c6394..c907b6f301 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -24,7 +24,7 @@ #include #include -#include +#include namespace ARDOUR { class Session; @@ -72,11 +72,11 @@ class BasicUI { void rec_enable_toggle (); void toggle_all_rec_enables (); - jack_nframes_t smpte_frames_per_hour (); + jack_nframes_t timecode_frames_per_hour (); - void smpte_time (jack_nframes_t where, SMPTE::Time&); - void smpte_to_sample (SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_smpte (jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const; + void timecode_time (jack_nframes_t where, Timecode::Time&); + void timecode_to_sample (Timecode::Time& timecode, jack_nframes_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode (jack_nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; protected: BasicUI (); diff --git a/libs/surfaces/control_protocol/control_protocol/smpte.h b/libs/surfaces/control_protocol/control_protocol/smpte.h deleted file mode 100644 index 7493ccf85f..0000000000 --- a/libs/surfaces/control_protocol/control_protocol/smpte.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2006 Paul Davis - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __ardour_smpte_h__ -#define __ardour_smpte_h__ - -#include - -namespace SMPTE { - -enum Wrap { - NONE = 0, - FRAMES, - SECONDS, - MINUTES, - HOURS -}; - -struct Time { - bool negative; - uint32_t hours; - uint32_t minutes; - uint32_t seconds; - uint32_t frames; ///< SMPTE frames (not audio samples) - uint32_t subframes; ///< Typically unused - float rate; ///< Frame rate of this Time - static float default_rate;///< Rate to use for default constructor - bool drop; ///< Whether this Time uses dropframe SMPTE - - Time(float a_rate = default_rate) { - negative = false; - hours = 0; - minutes = 0; - seconds = 0; - frames = 0; - subframes = 0; - rate = a_rate; - } -}; - -Wrap increment( Time& smpte, uint32_t ); -Wrap decrement( Time& smpte, uint32_t ); -Wrap increment_subframes( Time& smpte, uint32_t ); -Wrap decrement_subframes( Time& smpte, uint32_t ); -Wrap increment_seconds( Time& smpte, uint32_t ); -Wrap increment_minutes( Time& smpte, uint32_t ); -Wrap increment_hours( Time& smpte, uint32_t ); -void frames_floor( Time& smpte ); -void seconds_floor( Time& smpte ); -void minutes_floor( Time& smpte ); -void hours_floor( Time& smpte ); - -} // namespace SMPTE - -#endif // __ardour_smpte_h__ diff --git a/libs/surfaces/control_protocol/control_protocol/timecode.h b/libs/surfaces/control_protocol/control_protocol/timecode.h new file mode 100644 index 0000000000..f30234b248 --- /dev/null +++ b/libs/surfaces/control_protocol/control_protocol/timecode.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2006 Paul Davis + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __ardour_timecode_h__ +#define __ardour_timecode_h__ + +#include + +namespace Timecode { + +enum Wrap { + NONE = 0, + FRAMES, + SECONDS, + MINUTES, + HOURS +}; + +struct Time { + bool negative; + uint32_t hours; + uint32_t minutes; + uint32_t seconds; + uint32_t frames; ///< Timecode frames (not audio samples) + uint32_t subframes; ///< Typically unused + float rate; ///< Frame rate of this Time + static float default_rate;///< Rate to use for default constructor + bool drop; ///< Whether this Time uses dropframe Timecode + + Time(float a_rate = default_rate) { + negative = false; + hours = 0; + minutes = 0; + seconds = 0; + frames = 0; + subframes = 0; + rate = a_rate; + } +}; + +Wrap increment( Time& timecode, uint32_t ); +Wrap decrement( Time& timecode, uint32_t ); +Wrap increment_subframes( Time& timecode, uint32_t ); +Wrap decrement_subframes( Time& timecode, uint32_t ); +Wrap increment_seconds( Time& timecode, uint32_t ); +Wrap increment_minutes( Time& timecode, uint32_t ); +Wrap increment_hours( Time& timecode, uint32_t ); +void frames_floor( Time& timecode ); +void seconds_floor( Time& timecode ); +void minutes_floor( Time& timecode ); +void hours_floor( Time& timecode ); + +} // namespace Timecode + +#endif // __ardour_timecode_h__ diff --git a/libs/surfaces/control_protocol/smpte.cc b/libs/surfaces/control_protocol/smpte.cc index 969c3385bc..555dc86d38 100644 --- a/libs/surfaces/control_protocol/smpte.cc +++ b/libs/surfaces/control_protocol/smpte.cc @@ -16,186 +16,186 @@ 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define SMPTE_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours) -#define SMPTE_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes)) +#define Timecode_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours) +#define Timecode_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes)) -#include "control_protocol/smpte.h" +#include "control_protocol/timecode.h" #include "ardour/rc_configuration.h" -namespace SMPTE { +namespace Timecode { float Time::default_rate = 30.0; -/** Increment @a smpte by exactly one frame (keep subframes value). +/** Increment @a timecode by exactly one frame (keep subframes value). * Realtime safe. * @return true if seconds wrap. */ Wrap -increment( Time& smpte, uint32_t subframes_per_frame ) +increment( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; - if (smpte.negative) { - if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) { + if (timecode.negative) { + if (Timecode_IS_AROUND_ZERO(timecode) && timecode.subframes) { // We have a zero transition involving only subframes - smpte.subframes = subframes_per_frame - smpte.subframes; - smpte.negative = false; + timecode.subframes = subframes_per_frame - timecode.subframes; + timecode.negative = false; return SECONDS; } - smpte.negative = false; - wrap = decrement( smpte, subframes_per_frame ); - if (!SMPTE_IS_ZERO( smpte )) { - smpte.negative = true; + timecode.negative = false; + wrap = decrement( timecode, subframes_per_frame ); + if (!Timecode_IS_ZERO( timecode )) { + timecode.negative = true; } return wrap; } - switch ((int)ceil(smpte.rate)) { + switch ((int)ceil(timecode.rate)) { case 24: - if (smpte.frames == 23) { - smpte.frames = 0; + if (timecode.frames == 23) { + timecode.frames = 0; wrap = SECONDS; } break; case 25: - if (smpte.frames == 24) { - smpte.frames = 0; + if (timecode.frames == 24) { + timecode.frames = 0; wrap = SECONDS; } break; case 30: - if (smpte.drop) { - if (smpte.frames == 29) { - if ( ((smpte.minutes + 1) % 10) && (smpte.seconds == 59) ) { - smpte.frames = 2; + if (timecode.drop) { + if (timecode.frames == 29) { + if ( ((timecode.minutes + 1) % 10) && (timecode.seconds == 59) ) { + timecode.frames = 2; } else { - smpte.frames = 0; + timecode.frames = 0; } wrap = SECONDS; } } else { - if (smpte.frames == 29) { - smpte.frames = 0; + if (timecode.frames == 29) { + timecode.frames = 0; wrap = SECONDS; } } break; case 60: - if (smpte.frames == 59) { - smpte.frames = 0; + if (timecode.frames == 59) { + timecode.frames = 0; wrap = SECONDS; } break; } if (wrap == SECONDS) { - if (smpte.seconds == 59) { - smpte.seconds = 0; + if (timecode.seconds == 59) { + timecode.seconds = 0; wrap = MINUTES; - if (smpte.minutes == 59) { - smpte.minutes = 0; + if (timecode.minutes == 59) { + timecode.minutes = 0; wrap = HOURS; - smpte.hours++; + timecode.hours++; } else { - smpte.minutes++; + timecode.minutes++; } } else { - smpte.seconds++; + timecode.seconds++; } } else { - smpte.frames++; + timecode.frames++; } return wrap; } -/** Decrement @a smpte by exactly one frame (keep subframes value) +/** Decrement @a timecode by exactly one frame (keep subframes value) * Realtime safe. * @return true if seconds wrap. */ Wrap -decrement( Time& smpte, uint32_t subframes_per_frame ) +decrement( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; - if (smpte.negative || SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; - wrap = increment( smpte, subframes_per_frame ); - smpte.negative = true; + if (timecode.negative || Timecode_IS_ZERO(timecode)) { + timecode.negative = false; + wrap = increment( timecode, subframes_per_frame ); + timecode.negative = true; return wrap; - } else if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) { + } else if (Timecode_IS_AROUND_ZERO(timecode) && timecode.subframes) { // We have a zero transition involving only subframes - smpte.subframes = subframes_per_frame - smpte.subframes; - smpte.negative = true; + timecode.subframes = subframes_per_frame - timecode.subframes; + timecode.negative = true; return SECONDS; } - switch ((int)ceil(smpte.rate)) { + switch ((int)ceil(timecode.rate)) { case 24: - if (smpte.frames == 0) { - smpte.frames = 23; + if (timecode.frames == 0) { + timecode.frames = 23; wrap = SECONDS; } break; case 25: - if (smpte.frames == 0) { - smpte.frames = 24; + if (timecode.frames == 0) { + timecode.frames = 24; wrap = SECONDS; } break; case 30: - if (smpte.drop) { - if ((smpte.minutes % 10) && (smpte.seconds == 0)) { - if (smpte.frames <= 2) { - smpte.frames = 29; + if (timecode.drop) { + if ((timecode.minutes % 10) && (timecode.seconds == 0)) { + if (timecode.frames <= 2) { + timecode.frames = 29; wrap = SECONDS; } - } else if (smpte.frames == 0) { - smpte.frames = 29; + } else if (timecode.frames == 0) { + timecode.frames = 29; wrap = SECONDS; } } else { - if (smpte.frames == 0) { - smpte.frames = 29; + if (timecode.frames == 0) { + timecode.frames = 29; wrap = SECONDS; } } break; case 60: - if (smpte.frames == 0) { - smpte.frames = 59; + if (timecode.frames == 0) { + timecode.frames = 59; wrap = SECONDS; } break; } if (wrap == SECONDS) { - if (smpte.seconds == 0) { - smpte.seconds = 59; + if (timecode.seconds == 0) { + timecode.seconds = 59; wrap = MINUTES; - if (smpte.minutes == 0) { - smpte.minutes = 59; + if (timecode.minutes == 0) { + timecode.minutes = 59; wrap = HOURS; - smpte.hours--; + timecode.hours--; } else { - smpte.minutes--; + timecode.minutes--; } } else { - smpte.seconds--; + timecode.seconds--; } } else { - smpte.frames--; + timecode.frames--; } - if (SMPTE_IS_ZERO( smpte )) { - smpte.negative = false; + if (Timecode_IS_ZERO( timecode )) { + timecode.negative = false; } return wrap; @@ -204,68 +204,68 @@ decrement( Time& smpte, uint32_t subframes_per_frame ) /** Go to lowest absolute subframe value in this frame (set to 0 :-) ) */ void -frames_floor( Time& smpte ) +frames_floor( Time& timecode ) { - smpte.subframes = 0; - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + timecode.subframes = 0; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } } -/** Increment @a smpte by one subframe */ +/** Increment @a timecode by one subframe */ Wrap -increment_subframes( Time& smpte, uint32_t subframes_per_frame ) +increment_subframes( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; - if (smpte.negative) { - smpte.negative = false; - wrap = decrement_subframes( smpte, subframes_per_frame ); - if (!SMPTE_IS_ZERO(smpte)) { - smpte.negative = true; + if (timecode.negative) { + timecode.negative = false; + wrap = decrement_subframes( timecode, subframes_per_frame ); + if (!Timecode_IS_ZERO(timecode)) { + timecode.negative = true; } return wrap; } - smpte.subframes++; - if (smpte.subframes >= subframes_per_frame) { - smpte.subframes = 0; - increment( smpte, subframes_per_frame ); + timecode.subframes++; + if (timecode.subframes >= subframes_per_frame) { + timecode.subframes = 0; + increment( timecode, subframes_per_frame ); return FRAMES; } return NONE; } -/** Decrement @a smpte by one subframe */ +/** Decrement @a timecode by one subframe */ Wrap -decrement_subframes( Time& smpte, uint32_t subframes_per_frame ) +decrement_subframes( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; - if (smpte.negative) { - smpte.negative = false; - wrap = increment_subframes( smpte, subframes_per_frame ); - smpte.negative = true; + if (timecode.negative) { + timecode.negative = false; + wrap = increment_subframes( timecode, subframes_per_frame ); + timecode.negative = true; return wrap; } - if (smpte.subframes <= 0) { - smpte.subframes = 0; - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = true; - smpte.subframes = 1; + if (timecode.subframes <= 0) { + timecode.subframes = 0; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = true; + timecode.subframes = 1; return FRAMES; } else { - decrement( smpte, subframes_per_frame ); - smpte.subframes = 79; + decrement( timecode, subframes_per_frame ); + timecode.subframes = 79; return FRAMES; } } else { - smpte.subframes--; - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + timecode.subframes--; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } return NONE; } @@ -274,40 +274,40 @@ decrement_subframes( Time& smpte, uint32_t subframes_per_frame ) /** Go to next whole second (frames == 0 or frames == 2) */ Wrap -increment_seconds( Time& smpte, uint32_t subframes_per_frame ) +increment_seconds( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; // Clear subframes - frames_floor( smpte ); + frames_floor( timecode ); - if (smpte.negative) { + if (timecode.negative) { // Wrap second if on second boundary - wrap = increment(smpte, subframes_per_frame); + wrap = increment(timecode, subframes_per_frame); // Go to lowest absolute frame value - seconds_floor( smpte ); - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + seconds_floor( timecode ); + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } } else { // Go to highest possible frame in this second - switch ((int)ceil(smpte.rate)) { + switch ((int)ceil(timecode.rate)) { case 24: - smpte.frames = 23; + timecode.frames = 23; break; case 25: - smpte.frames = 24; + timecode.frames = 24; break; case 30: - smpte.frames = 29; + timecode.frames = 29; break; case 60: - smpte.frames = 59; + timecode.frames = 59; break; } // Increment by one frame - wrap = increment( smpte, subframes_per_frame ); + wrap = increment( timecode, subframes_per_frame ); } return wrap; @@ -317,55 +317,55 @@ increment_seconds( Time& smpte, uint32_t subframes_per_frame ) /** Go to lowest (absolute) frame value in this second * Doesn't care about positive/negative */ void -seconds_floor( Time& smpte ) +seconds_floor( Time& timecode ) { // Clear subframes - frames_floor( smpte ); + frames_floor( timecode ); // Go to lowest possible frame in this second - switch ((int)ceil(smpte.rate)) { + switch ((int)ceil(timecode.rate)) { case 24: case 25: case 30: case 60: - if (!(smpte.drop)) { - smpte.frames = 0; + if (!(timecode.drop)) { + timecode.frames = 0; } else { - if ((smpte.minutes % 10) && (smpte.seconds == 0)) { - smpte.frames = 2; + if ((timecode.minutes % 10) && (timecode.seconds == 0)) { + timecode.frames = 2; } else { - smpte.frames = 0; + timecode.frames = 0; } } break; } - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } } /** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */ Wrap -increment_minutes( Time& smpte, uint32_t subframes_per_frame ) +increment_minutes( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; // Clear subframes - frames_floor( smpte ); + frames_floor( timecode ); - if (smpte.negative) { + if (timecode.negative) { // Wrap if on minute boundary - wrap = increment_seconds( smpte, subframes_per_frame ); + wrap = increment_seconds( timecode, subframes_per_frame ); // Go to lowest possible value in this minute - minutes_floor( smpte ); + minutes_floor( timecode ); } else { // Go to highest possible second - smpte.seconds = 59; + timecode.seconds = 59; // Wrap minute by incrementing second - wrap = increment_seconds( smpte, subframes_per_frame ); + wrap = increment_seconds( timecode, subframes_per_frame ); } return wrap; @@ -374,36 +374,36 @@ increment_minutes( Time& smpte, uint32_t subframes_per_frame ) /** Go to lowest absolute value in this minute */ void -minutes_floor( Time& smpte ) +minutes_floor( Time& timecode ) { // Go to lowest possible second - smpte.seconds = 0; + timecode.seconds = 0; // Go to lowest possible frame - seconds_floor( smpte ); + seconds_floor( timecode ); - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } } /** Go to next whole hour (minute = 0, second = 0, frame = 0) */ Wrap -increment_hours( Time& smpte, uint32_t subframes_per_frame ) +increment_hours( Time& timecode, uint32_t subframes_per_frame ) { Wrap wrap = NONE; // Clear subframes - frames_floor(smpte); + frames_floor(timecode); - if (smpte.negative) { + if (timecode.negative) { // Wrap if on hour boundary - wrap = increment_minutes( smpte, subframes_per_frame ); + wrap = increment_minutes( timecode, subframes_per_frame ); // Go to lowest possible value in this hour - hours_floor( smpte ); + hours_floor( timecode ); } else { - smpte.minutes = 59; - wrap = increment_minutes( smpte, subframes_per_frame ); + timecode.minutes = 59; + wrap = increment_minutes( timecode, subframes_per_frame ); } return wrap; @@ -412,17 +412,17 @@ increment_hours( Time& smpte, uint32_t subframes_per_frame ) /** Go to lowest absolute value in this hour */ void -hours_floor( Time& smpte ) +hours_floor( Time& timecode ) { - smpte.minutes = 0; - smpte.seconds = 0; - smpte.frames = 0; - smpte.subframes = 0; + timecode.minutes = 0; + timecode.seconds = 0; + timecode.frames = 0; + timecode.subframes = 0; - if (SMPTE_IS_ZERO(smpte)) { - smpte.negative = false; + if (Timecode_IS_ZERO(timecode)) { + timecode.negative = false; } } -} // namespace SMPTE +} // namespace Timecode diff --git a/libs/surfaces/mackie/bcf_surface_generated.cc b/libs/surfaces/mackie/bcf_surface_generated.cc index f1d8d7ab7b..8d68313b7b 100644 --- a/libs/surfaces/mackie/bcf_surface_generated.cc +++ b/libs/surfaces/mackie/bcf_surface_generated.cc @@ -492,10 +492,10 @@ void Mackie::BcfSurface::init_controls() group->add( *button ); group = groups["display"]; - button = new Button ( 53, 1, "smpte_beats", *group ); + button = new Button ( 53, 1, "timecode_beats", *group ); buttons[0x35] = button; controls.push_back( button ); - controls_by_name["smpte_beats"] = button; + controls_by_name["timecode_beats"] = button; group->add( *button ); group = groups["none"]; @@ -903,10 +903,10 @@ void Mackie::BcfSurface::init_controls() group->add( *button ); group = groups["none"]; - led = new Led ( 113, 1, "smpte", *group ); + led = new Led ( 113, 1, "timecode", *group ); leds[0x71] = led; controls.push_back( led ); - controls_by_name["smpte"] = led; + controls_by_name["timecode"] = led; group->add( *led ); group = groups["none"]; @@ -1048,10 +1048,10 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b } break; - case 0x9035: // smpte_beats + case 0x9035: // timecode_beats switch ( bs ) { - case press: ls = mbh.smpte_beats_press( button ); break; - case release: ls = mbh.smpte_beats_release( button ); break; + case press: ls = mbh.timecode_beats_press( button ); break; + case release: ls = mbh.timecode_beats_release( button ); break; case neither: break; } break; diff --git a/libs/surfaces/mackie/mackie_button_handler.cc b/libs/surfaces/mackie/mackie_button_handler.cc index 2db07beabd..04f2e8e20b 100644 --- a/libs/surfaces/mackie/mackie_button_handler.cc +++ b/libs/surfaces/mackie/mackie_button_handler.cc @@ -150,12 +150,12 @@ LedState MackieButtonHandler::name_value_release( Button & button ) return default_button_release( button ); } -LedState MackieButtonHandler::smpte_beats_press( Button & button ) +LedState MackieButtonHandler::timecode_beats_press( Button & button ) { return default_button_press( button ); } -LedState MackieButtonHandler::smpte_beats_release( Button & button ) +LedState MackieButtonHandler::timecode_beats_release( Button & button ) { return default_button_release( button ); } diff --git a/libs/surfaces/mackie/mackie_button_handler.h b/libs/surfaces/mackie/mackie_button_handler.h index 2e8bc649be..a41c7778cc 100644 --- a/libs/surfaces/mackie/mackie_button_handler.h +++ b/libs/surfaces/mackie/mackie_button_handler.h @@ -59,8 +59,8 @@ public: virtual LedState name_value_press( Button & ); virtual LedState name_value_release( Button & ); - virtual LedState smpte_beats_press( Button & ); - virtual LedState smpte_beats_release( Button & ); + virtual LedState timecode_beats_press( Button & ); + virtual LedState timecode_beats_release( Button & ); virtual LedState F1_press( Button & ); virtual LedState F1_release( Button & ); diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index cc33585b62..1a147b84bf 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -316,7 +316,7 @@ void MackieControlProtocol::switch_banks( int initial ) void MackieControlProtocol::zero_all() { - // TODO turn off SMPTE displays + // TODO turn off Timecode displays // zero all strips for ( Surface::Strips::iterator it = surface().strips.begin(); it != surface().strips.end(); ++it ) @@ -484,16 +484,16 @@ void MackieControlProtocol::update_led( Mackie::Button & button, Mackie::LedStat } } -void MackieControlProtocol::update_smpte_beats_led() +void MackieControlProtocol::update_timecode_beats_led() { switch ( _timecode_type ) { case ARDOUR::AnyTime::BBT: update_global_led( "beats", on ); - update_global_led( "smpte", off ); + update_global_led( "timecode", off ); break; - case ARDOUR::AnyTime::SMPTE: - update_global_led( "smpte", on ); + case ARDOUR::AnyTime::Timecode: + update_global_led( "timecode", on ); update_global_led( "beats", off ); break; default: @@ -557,7 +557,7 @@ void MackieControlProtocol::update_surface() // update global buttons and displays notify_record_state_changed(); notify_transport_state_changed(); - update_smpte_beats_led(); + update_timecode_beats_led(); } } @@ -1146,19 +1146,19 @@ string MackieControlProtocol::format_bbt_timecode( nframes_t now_frame ) return os.str(); } -string MackieControlProtocol::format_smpte_timecode( nframes_t now_frame ) +string MackieControlProtocol::format_timecode_timecode( nframes_t now_frame ) { - SMPTE::Time smpte; - session->smpte_time( now_frame, smpte ); + Timecode::Time timecode; + session->timecode_time( now_frame, timecode ); // According to the Logic docs // digits: 888/88/88/888 - // SMPTE mode: Hours/Minutes/Seconds/Frames + // Timecode mode: Hours/Minutes/Seconds/Frames ostringstream os; - os << setw(3) << setfill('0') << smpte.hours; - os << setw(2) << setfill('0') << smpte.minutes; - os << setw(2) << setfill('0') << smpte.seconds; - os << setw(3) << setfill('0') << smpte.frames; + os << setw(3) << setfill('0') << timecode.hours; + os << setw(2) << setfill('0') << timecode.minutes; + os << setw(2) << setfill('0') << timecode.seconds; + os << setw(3) << setfill('0') << timecode.frames; return os.str(); } @@ -1176,8 +1176,8 @@ void MackieControlProtocol::update_timecode_display() case ARDOUR::AnyTime::BBT: timecode = format_bbt_timecode( current_frame ); break; - case ARDOUR::AnyTime::SMPTE: - timecode = format_smpte_timecode( current_frame ); + case ARDOUR::AnyTime::Timecode: + timecode = format_timecode_timecode( current_frame ); break; default: ostringstream os; @@ -1712,14 +1712,14 @@ LedState MackieControlProtocol::save_release (Button &) return off; } -LedState MackieControlProtocol::smpte_beats_press (Button &) +LedState MackieControlProtocol::timecode_beats_press (Button &) { switch ( _timecode_type ) { case ARDOUR::AnyTime::BBT: - _timecode_type = ARDOUR::AnyTime::SMPTE; + _timecode_type = ARDOUR::AnyTime::Timecode; break; - case ARDOUR::AnyTime::SMPTE: + case ARDOUR::AnyTime::Timecode: _timecode_type = ARDOUR::AnyTime::BBT; break; default: @@ -1727,11 +1727,11 @@ LedState MackieControlProtocol::smpte_beats_press (Button &) os << "Unknown Anytime::Type " << _timecode_type; throw runtime_error( os.str() ); } - update_smpte_beats_led(); + update_timecode_beats_led(); return on; } -LedState MackieControlProtocol::smpte_beats_release( Button & ) +LedState MackieControlProtocol::timecode_beats_release( Button & ) { return off; } diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 12aea1c0ae..b77be7d230 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -121,9 +121,9 @@ class MackieControlProtocol void notify_parameter_changed( std::string const & ); void notify_solo_active_changed( bool ); - /// Turn smpte on and beats off, or vice versa, depending + /// Turn timecode on and beats off, or vice versa, depending /// on state of _timecode_type - void update_smpte_beats_led(); + void update_timecode_beats_led(); /// this is called to generate the midi to send in response to a button press. void update_led( Mackie::Button & button, Mackie::LedState ); @@ -197,8 +197,8 @@ class MackieControlProtocol virtual Mackie::LedState save_press( Mackie::Button & ); virtual Mackie::LedState save_release( Mackie::Button & ); - virtual Mackie::LedState smpte_beats_press( Mackie::Button & ); - virtual Mackie::LedState smpte_beats_release( Mackie::Button & ); + virtual Mackie::LedState timecode_beats_press( Mackie::Button & ); + virtual Mackie::LedState timecode_beats_release( Mackie::Button & ); // jog wheel states virtual Mackie::LedState zoom_press( Mackie::Button & ); @@ -295,7 +295,7 @@ class MackieControlProtocol void update_timecode_display(); std::string format_bbt_timecode( nframes_t now_frame ); - std::string format_smpte_timecode( nframes_t now_frame ); + std::string format_timecode_timecode( nframes_t now_frame ); /** notification that the port is about to start it's init sequence. @@ -365,7 +365,7 @@ class MackieControlProtocol // last written timecode string std::string _timecode_last; - // Which timecode are we displaying? BBT or SMPTE + // Which timecode are we displaying? BBT or Timecode ARDOUR::AnyTime::Type _timecode_type; }; diff --git a/libs/surfaces/mackie/mackie_surface_generated.cc b/libs/surfaces/mackie/mackie_surface_generated.cc index f284a05142..f991d2a972 100644 --- a/libs/surfaces/mackie/mackie_surface_generated.cc +++ b/libs/surfaces/mackie/mackie_surface_generated.cc @@ -538,10 +538,10 @@ void Mackie::MackieSurface::init_controls() group->add( *button ); group = groups["display"]; - button = new Button ( 53, 1, "smpte_beats", *group ); + button = new Button ( 53, 1, "timecode_beats", *group ); buttons[0x35] = button; controls.push_back( button ); - controls_by_name["smpte_beats"] = button; + controls_by_name["timecode_beats"] = button; group->add( *button ); group = groups["none"]; @@ -949,10 +949,10 @@ void Mackie::MackieSurface::init_controls() group->add( *button ); group = groups["none"]; - led = new Led ( 113, 1, "smpte", *group ); + led = new Led ( 113, 1, "timecode", *group ); leds[0x71] = led; controls.push_back( led ); - controls_by_name["smpte"] = led; + controls_by_name["timecode"] = led; group->add( *led ); group = groups["none"]; @@ -1094,10 +1094,10 @@ void Mackie::MackieSurface::handle_button( MackieButtonHandler & mbh, ButtonStat } break; - case 0x9035: // smpte_beats + case 0x9035: // timecode_beats switch ( bs ) { - case press: ls = mbh.smpte_beats_press( button ); break; - case release: ls = mbh.smpte_beats_release( button ); break; + case press: ls = mbh.timecode_beats_press( button ); break; + case release: ls = mbh.timecode_beats_release( button ); break; case neither: break; } break; diff --git a/libs/surfaces/tranzport/show.cc b/libs/surfaces/tranzport/show.cc index 30f4de3b57..2df6191ead 100644 --- a/libs/surfaces/tranzport/show.cc +++ b/libs/surfaces/tranzport/show.cc @@ -353,29 +353,29 @@ TranzportControlProtocol::show_transport_time () } void -TranzportControlProtocol::show_smpte (nframes_t where) +TranzportControlProtocol::show_timecode (nframes_t where) { if ((where != last_where) || lcd_isdamaged(1,9,10)) { char buf[5]; - SMPTE::Time smpte; + Timecode::Time timecode; - session->smpte_time (where, smpte); + session->timecode_time (where, timecode); - if (smpte.negative) { - sprintf (buf, "-%02" PRIu32 ":", smpte.hours); + if (timecode.negative) { + sprintf (buf, "-%02" PRIu32 ":", timecode.hours); } else { - sprintf (buf, " %02" PRIu32 ":", smpte.hours); + sprintf (buf, " %02" PRIu32 ":", timecode.hours); } print (1, 8, buf); - sprintf (buf, "%02" PRIu32 ":", smpte.minutes); + sprintf (buf, "%02" PRIu32 ":", timecode.minutes); print (1, 12, buf); - sprintf (buf, "%02" PRIu32 ":", smpte.seconds); + sprintf (buf, "%02" PRIu32 ":", timecode.seconds); print (1, 15, buf); - sprintf (buf, "%02" PRIu32, smpte.frames); + sprintf (buf, "%02" PRIu32, timecode.frames); print_noretry (1, 18, buf); last_where = where; diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h index 929cca3e2b..6d231dd778 100644 --- a/libs/surfaces/tranzport/tranzport_control_protocol.h +++ b/libs/surfaces/tranzport/tranzport_control_protocol.h @@ -308,7 +308,7 @@ private: void show_track_gain (); void show_transport_time (); void show_bbt (nframes_t where); - void show_smpte (nframes_t where); + void show_timecode (nframes_t where); void show_wheel_mode (); void show_gain (); void show_pan (); -- cgit v1.2.3