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
This commit is contained in:
Paul Davis 2009-10-26 14:38:58 +00:00
parent 5dd8dc0db3
commit fa5aeb7892
52 changed files with 1231 additions and 1216 deletions

View file

@ -316,9 +316,9 @@
</menu> </menu>
<menu name='SnapTo' action='SnapTo'> <menu name='SnapTo' action='SnapTo'>
<menuitem action='snap-to-cd-frame'/> <menuitem action='snap-to-cd-frame'/>
<menuitem action='snap-to-smpte-frame'/> <menuitem action='snap-to-timecode-frame'/>
<menuitem action='snap-to-smpte-seconds'/> <menuitem action='snap-to-timecode-seconds'/>
<menuitem action='snap-to-smpte-minutes'/> <menuitem action='snap-to-timecode-minutes'/>
<menuitem action='snap-to-seconds'/> <menuitem action='snap-to-seconds'/>
<menuitem action='snap-to-minutes'/> <menuitem action='snap-to-minutes'/>
<menuitem action='snap-to-thirtyseconds'/> <menuitem action='snap-to-thirtyseconds'/>

View file

@ -382,7 +382,7 @@ ARDOUR_UI::post_engine ()
primary_clock.set_mode (AudioClock::BBT); primary_clock.set_mode (AudioClock::BBT);
secondary_clock.set_mode (AudioClock::MinSec); secondary_clock.set_mode (AudioClock::MinSec);
} else { } else {
primary_clock.set_mode (AudioClock::SMPTE); primary_clock.set_mode (AudioClock::Timecode);
secondary_clock.set_mode (AudioClock::BBT); secondary_clock.set_mode (AudioClock::BBT);
} }

View file

@ -416,7 +416,7 @@ ARDOUR_UI::parameter_changed (std::string p)
shuttle_units_button.set_label(_("ST")); shuttle_units_button.set_label(_("ST"));
break; break;
} }
} else if (p == "video-pullup" || p == "smpte-format") { } else if (p == "video-pullup" || p == "timecode-format") {
if (session) { if (session) {
primary_clock.set (session->audible_frame(), true); primary_clock.set (session->audible_frame(), true);
secondary_clock.set (session->audible_frame(), true); secondary_clock.set (session->audible_frame(), true);

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,7 @@ class AudioClock : public Gtk::HBox
{ {
public: public:
enum Mode { enum Mode {
SMPTE, Timecode,
BBT, BBT,
MinSec, MinSec,
Frames, Frames,
@ -80,8 +80,8 @@ class AudioClock : public Gtk::HBox
Gtk::Menu *ops_menu; Gtk::Menu *ops_menu;
Gtk::HBox smpte_packer_hbox; Gtk::HBox timecode_packer_hbox;
Gtk::HBox smpte_packer; Gtk::HBox timecode_packer;
Gtk::HBox minsec_packer_hbox; Gtk::HBox minsec_packer_hbox;
Gtk::HBox minsec_packer; Gtk::HBox minsec_packer;
@ -93,10 +93,10 @@ class AudioClock : public Gtk::HBox
Gtk::HBox frames_packer; Gtk::HBox frames_packer;
enum Field { enum Field {
SMPTE_Hours, Timecode_Hours,
SMPTE_Minutes, Timecode_Minutes,
SMPTE_Seconds, Timecode_Seconds,
SMPTE_Frames, Timecode_Frames,
MS_Hours, MS_Hours,
MS_Minutes, MS_Minutes,
MS_Seconds, MS_Seconds,
@ -144,14 +144,14 @@ class AudioClock : public Gtk::HBox
Gtk::Label* frames_upper_info_label; Gtk::Label* frames_upper_info_label;
Gtk::Label* frames_lower_info_label; Gtk::Label* frames_lower_info_label;
Gtk::Label* smpte_upper_info_label; Gtk::Label* timecode_upper_info_label;
Gtk::Label* smpte_lower_info_label; Gtk::Label* timecode_lower_info_label;
Gtk::Label* bbt_upper_info_label; Gtk::Label* bbt_upper_info_label;
Gtk::Label* bbt_lower_info_label; Gtk::Label* bbt_lower_info_label;
Gtk::VBox frames_info_box; Gtk::VBox frames_info_box;
Gtk::VBox smpte_info_box; Gtk::VBox timecode_info_box;
Gtk::VBox bbt_info_box; Gtk::VBox bbt_info_box;
Gtk::EventBox clock_base; Gtk::EventBox clock_base;
@ -189,15 +189,15 @@ class AudioClock : public Gtk::HBox
bool field_focus_out_event (GdkEventFocus *, Field); bool field_focus_out_event (GdkEventFocus *, Field);
bool drop_focus_handler (GdkEventFocus*); 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_bbt (nframes_t, bool);
void set_minsec (nframes_t, bool); void set_minsec (nframes_t, bool);
void set_frames (nframes_t, bool); void set_frames (nframes_t, bool);
nframes_t get_frames (Field,nframes_t pos = 0,int dir=1); nframes_t get_frames (Field,nframes_t pos = 0,int dir=1);
void smpte_sanitize_display(); void timecode_sanitize_display();
nframes_t smpte_frame_from_display () const; nframes_t timecode_frame_from_display () const;
nframes_t bbt_frame_from_display (nframes_t) const; nframes_t bbt_frame_from_display (nframes_t) const;
nframes_t bbt_frame_duration_from_display (nframes_t) const; nframes_t bbt_frame_duration_from_display (nframes_t) const;
nframes_t minsec_frame_from_display () const; nframes_t minsec_frame_from_display () const;
@ -206,7 +206,7 @@ class AudioClock : public Gtk::HBox
void build_ops_menu (); void build_ops_menu ();
void setup_events (); void setup_events ();
void smpte_offset_changed (); void timecode_offset_changed ();
void set_size_requests (); void set_size_requests ();
static const uint32_t field_length[(int)AudioFrames+1]; static const uint32_t field_length[(int)AudioFrames+1];

View file

@ -19,9 +19,9 @@
/* Changing this order will break the menu */ /* Changing this order will break the menu */
SNAPTYPE(SnapToCDFrame) SNAPTYPE(SnapToCDFrame)
SNAPTYPE(SnapToSMPTEFrame) SNAPTYPE(SnapToTimecodeFrame)
SNAPTYPE(SnapToSMPTESeconds) SNAPTYPE(SnapToTimecodeSeconds)
SNAPTYPE(SnapToSMPTEMinutes) SNAPTYPE(SnapToTimecodeMinutes)
SNAPTYPE(SnapToSeconds) SNAPTYPE(SnapToSeconds)
SNAPTYPE(SnapToMinutes) SNAPTYPE(SnapToMinutes)
SNAPTYPE(SnapToAThirtysecondBeat) SNAPTYPE(SnapToAThirtysecondBeat)

View file

@ -129,9 +129,9 @@ const double Editor::timebar_height = 15.0;
static const gchar *_snap_type_strings[] = { static const gchar *_snap_type_strings[] = {
N_("CD Frames"), N_("CD Frames"),
N_("SMPTE Frames"), N_("Timecode Frames"),
N_("SMPTE Seconds"), N_("Timecode Seconds"),
N_("SMPTE Minutes"), N_("Timecode Minutes"),
N_("Seconds"), N_("Seconds"),
N_("Minutes"), N_("Minutes"),
N_("Beats/32"), N_("Beats/32"),
@ -214,7 +214,7 @@ Editor::Editor ()
/* time display buttons */ /* time display buttons */
: minsec_label (_("Mins:Secs")) : minsec_label (_("Mins:Secs"))
, bbt_label (_("Bars:Beats")) , bbt_label (_("Bars:Beats"))
, smpte_label (_("Timecode")) , timecode_label (_("Timecode"))
, frame_label (_("Samples")) , frame_label (_("Samples"))
, tempo_label (_("Tempo")) , tempo_label (_("Tempo"))
, meter_label (_("Meter")) , meter_label (_("Meter"))
@ -380,12 +380,12 @@ Editor::Editor ()
minsec_label.set_padding (5,0); minsec_label.set_padding (5,0);
minsec_label.hide (); minsec_label.hide ();
minsec_label.set_no_show_all(); minsec_label.set_no_show_all();
smpte_label.set_name ("EditorTimeButton"); timecode_label.set_name ("EditorTimeButton");
smpte_label.set_size_request (-1, (int)timebar_height); timecode_label.set_size_request (-1, (int)timebar_height);
smpte_label.set_alignment (1.0, 0.5); timecode_label.set_alignment (1.0, 0.5);
smpte_label.set_padding (5,0); timecode_label.set_padding (5,0);
smpte_label.hide (); timecode_label.hide ();
smpte_label.set_no_show_all(); timecode_label.set_no_show_all();
frame_label.set_name ("EditorTimeButton"); frame_label.set_name ("EditorTimeButton");
frame_label.set_size_request (-1, (int)timebar_height); frame_label.set_size_request (-1, (int)timebar_height);
frame_label.set_alignment (1.0, 0.5); 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->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->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))); 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); nudge_clock.set (pos, true, 0, AudioClock::BBT);
} else { } 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 (); playhead_cursor->canvas_item.show ();
@ -2563,19 +2563,82 @@ Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
snap_to_internal (start, direction, for_mark); snap_to_internal (start, direction, for_mark);
} }
void
Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
{
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 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 / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame());
}
break;
case SnapToTimecodeSeconds:
if (session->timecode_offset_negative())
{
start += session->timecode_offset ();
} else {
start -= session->timecode_offset ();
}
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_timecode_second) * one_timecode_second;
}
if (session->timecode_offset_negative())
{
start -= session->timecode_offset ();
} else {
start += session->timecode_offset ();
}
break;
case SnapToTimecodeMinutes:
if (session->timecode_offset_negative())
{
start += session->timecode_offset ();
} else {
start -= session->timecode_offset ();
}
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_timecode_minute) * one_timecode_minute;
}
if (session->timecode_offset_negative())
{
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 void
Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) 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 before;
nframes64_t after; 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;
switch (snap_type) { switch (snap_type) {
case SnapToTimecodeFrame:
case SnapToTimecodeSeconds:
case SnapToTimecodeMinutes:
return timecode_snap_to_internal (start, direction, for_mark);
case SnapToCDFrame: case SnapToCDFrame:
if (((direction == 0) && (start % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) { 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); start = (nframes64_t) ceil ((double) start / (one_second / 75)) * (one_second / 75);
@ -2584,55 +2647,6 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
} }
break; 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());
}
break;
case SnapToSMPTESeconds:
if (session->smpte_offset_negative())
{
start += session->smpte_offset ();
} else {
start -= session->smpte_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;
} else {
start = (nframes64_t) floor ((double) start / one_smpte_second) * one_smpte_second;
}
if (session->smpte_offset_negative())
{
start -= session->smpte_offset ();
} else {
start += session->smpte_offset ();
}
break;
case SnapToSMPTEMinutes:
if (session->smpte_offset_negative())
{
start += session->smpte_offset ();
} else {
start -= session->smpte_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;
} else {
start = (nframes64_t) floor ((double) start / one_smpte_minute) * one_smpte_minute;
}
if (session->smpte_offset_negative())
{
start -= session->smpte_offset ();
} else {
start += session->smpte_offset ();
}
break;
case SnapToSeconds: case SnapToSeconds:
if (((direction == 0) && (start % one_second > one_second / 2)) || (direction > 0)) { if (((direction == 0) && (start % one_second > one_second / 2)) || (direction > 0)) {
start = (nframes64_t) ceil ((double) start / one_second) * one_second; start = (nframes64_t) ceil ((double) start / one_second) * one_second;
@ -3463,12 +3477,12 @@ Editor::snap_type_selection_done ()
snaptype = SnapToRegionSync; snaptype = SnapToRegionSync;
} else if (choice == _("CD Frames")) { } else if (choice == _("CD Frames")) {
snaptype = SnapToCDFrame; snaptype = SnapToCDFrame;
} else if (choice == _("SMPTE Frames")) { } else if (choice == _("Timecode Frames")) {
snaptype = SnapToSMPTEFrame; snaptype = SnapToTimecodeFrame;
} else if (choice == _("SMPTE Seconds")) { } else if (choice == _("Timecode Seconds")) {
snaptype = SnapToSMPTESeconds; snaptype = SnapToTimecodeSeconds;
} else if (choice == _("SMPTE Minutes")) { } else if (choice == _("Timecode Minutes")) {
snaptype = SnapToSMPTEMinutes; snaptype = SnapToTimecodeMinutes;
} else if (choice == _("Seconds")) { } else if (choice == _("Seconds")) {
snaptype = SnapToSeconds; snaptype = SnapToSeconds;
} else if (choice == _("Minutes")) { } else if (choice == _("Minutes")) {
@ -3853,9 +3867,9 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position)
break; break;
case SnapToCDFrame: case SnapToCDFrame:
case SnapToSMPTEFrame: case SnapToTimecodeFrame:
case SnapToSMPTESeconds: case SnapToTimecodeSeconds:
case SnapToSMPTEMinutes: case SnapToTimecodeMinutes:
case SnapToSeconds: case SnapToSeconds:
case SnapToMinutes: case SnapToMinutes:
case SnapToRegionStart: case SnapToRegionStart:

View file

@ -642,7 +642,7 @@ class Editor : public PublicEditor
ArdourCanvas::Group *minsec_group; ArdourCanvas::Group *minsec_group;
ArdourCanvas::Pixbuf *logo_item; ArdourCanvas::Pixbuf *logo_item;
ArdourCanvas::Group *bbt_group; ArdourCanvas::Group *bbt_group;
ArdourCanvas::Group *smpte_group; ArdourCanvas::Group *timecode_group;
ArdourCanvas::Group *frame_group; ArdourCanvas::Group *frame_group;
ArdourCanvas::Group *tempo_group; ArdourCanvas::Group *tempo_group;
ArdourCanvas::Group *meter_group; ArdourCanvas::Group *meter_group;
@ -678,7 +678,7 @@ class Editor : public PublicEditor
ArdourCanvas::Group* _region_motion_group; ArdourCanvas::Group* _region_motion_group;
enum RulerType { enum RulerType {
ruler_metric_smpte = 0, ruler_metric_timecode = 0,
ruler_metric_bbt = 1, ruler_metric_bbt = 1,
ruler_metric_frames = 2, ruler_metric_frames = 2,
ruler_metric_minsec = 3, ruler_metric_minsec = 3,
@ -712,7 +712,7 @@ class Editor : public PublicEditor
Gtk::Widget * ruler_grabbed_widget; Gtk::Widget * ruler_grabbed_widget;
void initialize_rulers (); void initialize_rulers ();
void update_just_smpte (); void update_just_timecode ();
void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
void update_fixed_rulers (); void update_fixed_rulers ();
void update_tempo_based_rulers (); void update_tempo_based_rulers ();
@ -725,7 +725,7 @@ class Editor : public PublicEditor
void store_ruler_visibility (); void store_ruler_visibility ();
void restore_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_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
@ -744,20 +744,20 @@ class Editor : public PublicEditor
gint minsec_nmarks; gint minsec_nmarks;
void set_minsec_ruler_scale (gdouble lower, gdouble upper); void set_minsec_ruler_scale (gdouble lower, gdouble upper);
enum SMPTERulerScale { enum TimecodeRulerScale {
smpte_show_bits, timecode_show_bits,
smpte_show_frames, timecode_show_frames,
smpte_show_seconds, timecode_show_seconds,
smpte_show_minutes, timecode_show_minutes,
smpte_show_hours timecode_show_hours
}; };
SMPTERulerScale smpte_ruler_scale; TimecodeRulerScale timecode_ruler_scale;
nframes_t smpte_mark_interval; nframes_t timecode_mark_interval;
gint smpte_mark_modulo; gint timecode_mark_modulo;
gint smpte_nmarks; gint timecode_nmarks;
void set_smpte_ruler_scale (gdouble lower, gdouble upper); void set_timecode_ruler_scale (gdouble lower, gdouble upper);
enum BBTRulerScale { enum BBTRulerScale {
bbt_over, bbt_over,
@ -779,17 +779,17 @@ class Editor : public PublicEditor
uint32_t bbt_accent_modulo; uint32_t bbt_accent_modulo;
void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper); 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_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
Gtk::Widget *_ruler_separator; Gtk::Widget *_ruler_separator;
GtkWidget *_smpte_ruler; GtkWidget *_timecode_ruler;
GtkWidget *_bbt_ruler; GtkWidget *_bbt_ruler;
GtkWidget *_frames_ruler; GtkWidget *_frames_ruler;
GtkWidget *_minsec_ruler; GtkWidget *_minsec_ruler;
Gtk::Widget *smpte_ruler; Gtk::Widget *timecode_ruler;
Gtk::Widget *bbt_ruler; Gtk::Widget *bbt_ruler;
Gtk::Widget *frames_ruler; Gtk::Widget *frames_ruler;
Gtk::Widget *minsec_ruler; Gtk::Widget *minsec_ruler;
@ -810,7 +810,7 @@ class Editor : public PublicEditor
Gtk::Label minsec_label; Gtk::Label minsec_label;
Gtk::Label bbt_label; Gtk::Label bbt_label;
Gtk::Label smpte_label; Gtk::Label timecode_label;
Gtk::Label frame_label; Gtk::Label frame_label;
Gtk::Label tempo_label; Gtk::Label tempo_label;
Gtk::Label meter_label; Gtk::Label meter_label;
@ -2000,6 +2000,7 @@ public:
void select_prev_route (); void select_prev_route ();
void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false); 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; RhythmFerret* rhythm_ferret;
BundleManager* _bundle_manager; BundleManager* _bundle_manager;

View file

@ -753,9 +753,9 @@ Editor::register_actions ()
RadioAction::Group snap_choice_group; 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-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-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-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-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-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-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-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-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))); 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<ToggleAction>::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_loop_punch_action = Glib::RefPtr<ToggleAction>::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<ToggleAction>::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_bbt_action = Glib::RefPtr<ToggleAction>::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<ToggleAction>::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_samples_action = Glib::RefPtr<ToggleAction>::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<ToggleAction>::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<ToggleAction>::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<ToggleAction>::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))); ruler_minsec_action = Glib::RefPtr<ToggleAction>::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 */ /* set defaults here */
@ -904,7 +904,7 @@ Editor::toggle_ruler_visibility (RulerType rt)
} }
switch (rt) { switch (rt) {
case ruler_metric_smpte: case ruler_metric_timecode:
action = "toggle-timecode-ruler"; action = "toggle-timecode-ruler";
break; break;
case ruler_metric_bbt: case ruler_metric_bbt:
@ -1012,14 +1012,14 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToCDFrame: case Editing::SnapToCDFrame:
action = "snap-to-cd-frame"; action = "snap-to-cd-frame";
break; break;
case Editing::SnapToSMPTEFrame: case Editing::SnapToTimecodeFrame:
action = "snap-to-smpte-frame"; action = "snap-to-timecode-frame";
break; break;
case Editing::SnapToSMPTESeconds: case Editing::SnapToTimecodeSeconds:
action = "snap-to-smpte-seconds"; action = "snap-to-timecode-seconds";
break; break;
case Editing::SnapToSMPTEMinutes: case Editing::SnapToTimecodeMinutes:
action = "snap-to-smpte-minutes"; action = "snap-to-timecode-minutes";
break; break;
case Editing::SnapToSeconds: case Editing::SnapToSeconds:
action = "snap-to-seconds"; action = "snap-to-seconds";
@ -1085,15 +1085,15 @@ Editor::cycle_snap_choice()
{ {
switch (snap_type) { switch (snap_type) {
case Editing::SnapToCDFrame: case Editing::SnapToCDFrame:
set_snap_to (Editing::SnapToSMPTEFrame); set_snap_to (Editing::SnapToTimecodeFrame);
break; break;
case Editing::SnapToSMPTEFrame: case Editing::SnapToTimecodeFrame:
set_snap_to (Editing::SnapToSMPTESeconds); set_snap_to (Editing::SnapToTimecodeSeconds);
break; break;
case Editing::SnapToSMPTESeconds: case Editing::SnapToTimecodeSeconds:
set_snap_to (Editing::SnapToSMPTEMinutes); set_snap_to (Editing::SnapToTimecodeMinutes);
break; break;
case Editing::SnapToSMPTEMinutes: case Editing::SnapToTimecodeMinutes:
set_snap_to (Editing::SnapToSeconds); set_snap_to (Editing::SnapToSeconds);
break; break;
case Editing::SnapToSeconds: case Editing::SnapToSeconds:
@ -1340,8 +1340,8 @@ Editor::parameter_changed (std::string p)
update_punch_range_view (true); update_punch_range_view (true);
} else if (p == "punch-out") { } else if (p == "punch-out") {
update_punch_range_view (true); update_punch_range_view (true);
} else if (p == "smpte-format") { } else if (p == "timecode-format") {
update_just_smpte (); update_just_timecode ();
} else if (p == "xfades-visible") { } else if (p == "xfades-visible") {
update_xfade_visibility (); update_xfade_visibility ();
} else if (p == "show-region-fades") { } else if (p == "show-region-fades") {
@ -1349,7 +1349,7 @@ Editor::parameter_changed (std::string p)
} else if (p == "edit-mode") { } else if (p == "edit-mode") {
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode())); edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
} else if (p == "subframes-per-frame") { } else if (p == "subframes-per-frame") {
update_just_smpte (); update_just_timecode ();
} else if (p == "show-track-meters") { } else if (p == "show-track-meters") {
toggle_meter_updating(); toggle_meter_updating();
} else if (p == "show-summary") { } else if (p == "show-summary") {

View file

@ -1913,7 +1913,7 @@ void
Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos) Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos)
{ {
char buf[128]; char buf[128];
SMPTE::Time smpte; Timecode::Time timecode;
BBT_Time bbt; BBT_Time bbt;
int hours, mins; int hours, mins;
nframes64_t frame_rate; 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); snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
break; break;
case AudioClock::SMPTE: case AudioClock::Timecode:
session->smpte_time (frame, smpte); session->timecode_time (frame, timecode);
snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
break; break;
case AudioClock::MinSec: 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) Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos)
{ {
char buf[128]; char buf[128];
SMPTE::Time smpte; Timecode::Time timecode;
BBT_Time sbbt; BBT_Time sbbt;
BBT_Time ebbt; BBT_Time ebbt;
int hours, mins; 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); snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, ebbt.bars, ebbt.beats, ebbt.ticks);
break; break;
case AudioClock::SMPTE: case AudioClock::Timecode:
session->smpte_duration (end - start, smpte); session->timecode_duration (end - start, timecode);
snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
break; break;
case AudioClock::MinSec: case AudioClock::MinSec:

View file

@ -618,7 +618,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
char used_str[8]; char used_str[8];
int used; int used;
BBT_Time bbt; BBT_Time bbt;
SMPTE::Time smpte; Timecode::Time timecode;
bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source()); bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source());
@ -638,22 +638,22 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
sprintf (used_str, "%4d" , used); sprintf (used_str, "%4d" , used);
switch (ARDOUR_UI::instance()->secondary_clock.mode ()) { switch (ARDOUR_UI::instance()->secondary_clock.mode ()) {
case AudioClock::SMPTE: case AudioClock::Timecode:
case AudioClock::Off: /* If the secondary clock is off, default to SMPTE */ case AudioClock::Off: /* If the secondary clock is off, default to Timecode */
_session->smpte_time (region->position(), smpte); _session->timecode_time (region->position(), timecode);
sprintf (start_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (start_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
_session->smpte_time (region->position() + region->length() - 1, smpte); _session->timecode_time (region->position() + region->length() - 1, timecode);
sprintf (end_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (end_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
_session->smpte_time (region->length(), smpte); _session->timecode_time (region->length(), timecode);
sprintf (length_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (length_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
_session->smpte_time (region->sync_position() + region->position(), smpte); _session->timecode_time (region->sync_position() + region->position(), timecode);
sprintf (sync_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (sync_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
if (audioRegion && !fades_in_seconds) { if (audioRegion && !fades_in_seconds) {
_session->smpte_time (audioRegion->fade_in()->back()->when, smpte); _session->timecode_time (audioRegion->fade_in()->back()->when, timecode);
sprintf (fadein_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (fadein_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
_session->smpte_time (audioRegion->fade_out()->back()->when, smpte); _session->timecode_time (audioRegion->fade_out()->back()->when, timecode);
sprintf (fadeout_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); sprintf (fadeout_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
} }
break; break;

View file

@ -49,7 +49,7 @@ Editor *Editor::ruler_editor;
/* the order here must match the "metric" enums in editor.h */ /* the order here must match the "metric" enums in editor.h */
GtkCustomMetric Editor::ruler_metrics[4] = { GtkCustomMetric Editor::ruler_metrics[4] = {
{1, Editor::_metric_get_smpte }, {1, Editor::_metric_get_timecode },
{1, Editor::_metric_get_bbt }, {1, Editor::_metric_get_bbt },
{1, Editor::_metric_get_frames }, {1, Editor::_metric_get_frames },
{1, Editor::_metric_get_minsec } {1, Editor::_metric_get_minsec }
@ -74,14 +74,14 @@ Editor::initialize_rulers ()
minsec_ruler->hide (); minsec_ruler->hide ();
minsec_ruler->set_no_show_all(); minsec_ruler->set_no_show_all();
_smpte_ruler = gtk_custom_hruler_new (); _timecode_ruler = gtk_custom_hruler_new ();
smpte_ruler = Glib::wrap (_smpte_ruler); timecode_ruler = Glib::wrap (_timecode_ruler);
smpte_ruler->set_name ("SMPTERuler"); timecode_ruler->set_name ("TimecodeRuler");
smpte_ruler->set_size_request (-1, (int)timebar_height); timecode_ruler->set_size_request (-1, (int)timebar_height);
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_smpte_ruler), &ruler_metrics[ruler_metric_smpte]); gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_timecode_ruler), &ruler_metrics[ruler_metric_timecode]);
smpte_ruler->hide (); timecode_ruler->hide ();
smpte_ruler->set_no_show_all(); timecode_ruler->set_no_show_all();
smpte_nmarks = 0; timecode_nmarks = 0;
_bbt_ruler = gtk_custom_hruler_new (); _bbt_ruler = gtk_custom_hruler_new ();
bbt_ruler = Glib::wrap (_bbt_ruler); 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_lab_children.push_back (Element(minsec_label, PACK_SHRINK, PACK_START));
ruler_children.insert (canvaspos, Element(*minsec_ruler, 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_lab_children.push_back (Element(timecode_label, PACK_SHRINK, PACK_START));
ruler_children.insert (canvaspos, Element(*smpte_ruler, 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_lab_children.push_back (Element(frame_label, PACK_SHRINK, PACK_START));
ruler_children.insert (canvaspos, Element(*frames_ruler, 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_lab_children.push_back (Element(bbt_label, PACK_SHRINK, PACK_START));
ruler_children.insert (canvaspos, Element(*bbt_ruler, 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); 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); 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); 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)); 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)); 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)); 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)); 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)); 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)); 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)); 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)); 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)); 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)); bbt_ruler->signal_scroll_event().connect (mem_fun(*this, &Editor::ruler_scroll));
frames_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)); 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); //Gtk::Main::grab_add (*minsec_ruler);
Widget * grab_widget = 0; Widget * grab_widget = 0;
if (smpte_ruler->is_realized() && ev->window == smpte_ruler->get_window()->gobj()) { if (timecode_ruler->is_realized() && ev->window == timecode_ruler->get_window()->gobj()) {
grab_widget = smpte_ruler; grab_widget = timecode_ruler;
} else if (bbt_ruler->is_realized() && ev->window == bbt_ruler->get_window()->gobj()) { } else if (bbt_ruler->is_realized() && ev->window == bbt_ruler->get_window()->gobj()) {
grab_widget = bbt_ruler; grab_widget = bbt_ruler;
} else if (frames_ruler->is_realized() && ev->window == frames_ruler->get_window()->gobj()) { } 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")); 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_("bbt"), ruler_bbt_action->get_active() ? "yes": "no");
node->add_property (X_("frames"), ruler_samples_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"); 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; no_ruler_shown_update = true;
if (node) { if (node) {
if ((prop = node->property ("smpte")) != 0) { if ((prop = node->property ("timecode")) != 0) {
if (string_is_affirmative (prop->value())) { if (string_is_affirmative (prop->value())) {
ruler_timecode_action->set_active (true); ruler_timecode_action->set_active (true);
} else { } else {
@ -568,11 +568,11 @@ Editor::update_ruler_visibility ()
if (ruler_timecode_action->get_active()) { if (ruler_timecode_action->get_active()) {
visible_rulers++; visible_rulers++;
smpte_label.show (); timecode_label.show ();
smpte_ruler->show (); timecode_ruler->show ();
} else { } else {
smpte_label.hide (); timecode_label.hide ();
smpte_ruler->hide (); timecode_ruler->hide ();
} }
if (ruler_samples_action->get_active()) { if (ruler_samples_action->get_active()) {
@ -768,9 +768,9 @@ Editor::update_ruler_visibility ()
} }
void 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) { if (session == 0) {
return; return;
@ -779,7 +779,7 @@ Editor::update_just_smpte ()
nframes64_t rightmost_frame = leftmost_frame + current_page_frames(); nframes64_t rightmost_frame = leftmost_frame + current_page_frames();
if (ruler_timecode_action->get_active()) { 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()); leftmost_frame, session->current_end_frame());
} }
} }
@ -792,7 +792,7 @@ Editor::compute_fixed_ruler_scale ()
} }
if (ruler_timecode_action->get_active()) { 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()) { if (ruler_minsec_action->get_active()) {
@ -809,7 +809,7 @@ Editor::update_fixed_rulers ()
return; 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_frames].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_minsec].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()) { 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()); leftmost_frame, session->current_end_frame());
} }
@ -853,9 +853,9 @@ Editor::update_tempo_based_rulers ()
/* Mark generation */ /* Mark generation */
gint 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 gint
@ -877,7 +877,7 @@ Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble u
} }
void void
Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper) Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper)
{ {
nframes64_t range; nframes64_t range;
nframes64_t spacer; nframes64_t spacer;
@ -897,91 +897,91 @@ Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper)
upper = upper + spacer; upper = upper + spacer;
range = (nframes64_t) floor (upper - lower); range = (nframes64_t) floor (upper - lower);
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */ if (range < (2 * session->frames_per_timecode_frame())) { /* 0 - 2 frames */
smpte_ruler_scale = smpte_show_bits; timecode_ruler_scale = timecode_show_bits;
smpte_mark_modulo = 20; timecode_mark_modulo = 20;
smpte_nmarks = 2 + (2 * session->config.get_subframes_per_frame()); timecode_nmarks = 2 + (2 * session->config.get_subframes_per_frame());
} else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */ } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
smpte_ruler_scale = smpte_show_frames; timecode_ruler_scale = timecode_show_frames;
smpte_mark_modulo = 1; timecode_mark_modulo = 1;
smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
} else if (range <= (fr / 2)) { /* 0.25-0.5 second */ } else if (range <= (fr / 2)) { /* 0.25-0.5 second */
smpte_ruler_scale = smpte_show_frames; timecode_ruler_scale = timecode_show_frames;
smpte_mark_modulo = 2; timecode_mark_modulo = 2;
smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
} else if (range <= fr) { /* 0.5-1 second */ } else if (range <= fr) { /* 0.5-1 second */
smpte_ruler_scale = smpte_show_frames; timecode_ruler_scale = timecode_show_frames;
smpte_mark_modulo = 5; timecode_mark_modulo = 5;
smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
} else if (range <= 2 * fr) { /* 1-2 seconds */ } else if (range <= 2 * fr) { /* 1-2 seconds */
smpte_ruler_scale = smpte_show_frames; timecode_ruler_scale = timecode_show_frames;
smpte_mark_modulo = 10; timecode_mark_modulo = 10;
smpte_nmarks = 2 + (range / (nframes64_t)session->frames_per_smpte_frame()); timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
} else if (range <= 8 * fr) { /* 2-8 seconds */ } else if (range <= 8 * fr) { /* 2-8 seconds */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 1; timecode_mark_modulo = 1;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 16 * fr) { /* 8-16 seconds */ } else if (range <= 16 * fr) { /* 8-16 seconds */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 2; timecode_mark_modulo = 2;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 30 * fr) { /* 16-30 seconds */ } else if (range <= 30 * fr) { /* 16-30 seconds */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 5; timecode_mark_modulo = 5;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 60 * fr) { /* 30-60 seconds */ } else if (range <= 60 * fr) { /* 30-60 seconds */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 5; timecode_mark_modulo = 5;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 2 * 60 * fr) { /* 1-2 minutes */ } else if (range <= 2 * 60 * fr) { /* 1-2 minutes */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 15; timecode_mark_modulo = 15;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 4 * 60 * fr) { /* 2-4 minutes */ } else if (range <= 4 * 60 * fr) { /* 2-4 minutes */
smpte_ruler_scale = smpte_show_seconds; timecode_ruler_scale = timecode_show_seconds;
smpte_mark_modulo = 30; timecode_mark_modulo = 30;
smpte_nmarks = 2 + (range / fr); timecode_nmarks = 2 + (range / fr);
} else if (range <= 10 * 60 * fr) { /* 4-10 minutes */ } else if (range <= 10 * 60 * fr) { /* 4-10 minutes */
smpte_ruler_scale = smpte_show_minutes; timecode_ruler_scale = timecode_show_minutes;
smpte_mark_modulo = 2; timecode_mark_modulo = 2;
smpte_nmarks = 2 + 10; timecode_nmarks = 2 + 10;
} else if (range <= 30 * 60 * fr) { /* 10-30 minutes */ } else if (range <= 30 * 60 * fr) { /* 10-30 minutes */
smpte_ruler_scale = smpte_show_minutes; timecode_ruler_scale = timecode_show_minutes;
smpte_mark_modulo = 5; timecode_mark_modulo = 5;
smpte_nmarks = 2 + 30; timecode_nmarks = 2 + 30;
} else if (range <= 60 * 60 * fr) { /* 30 minutes - 1hr */ } else if (range <= 60 * 60 * fr) { /* 30 minutes - 1hr */
smpte_ruler_scale = smpte_show_minutes; timecode_ruler_scale = timecode_show_minutes;
smpte_mark_modulo = 10; timecode_mark_modulo = 10;
smpte_nmarks = 2 + 60; timecode_nmarks = 2 + 60;
} else if (range <= 4 * 60 * 60 * fr) { /* 1 - 4 hrs*/ } else if (range <= 4 * 60 * 60 * fr) { /* 1 - 4 hrs*/
smpte_ruler_scale = smpte_show_minutes; timecode_ruler_scale = timecode_show_minutes;
smpte_mark_modulo = 30; timecode_mark_modulo = 30;
smpte_nmarks = 2 + (60 * 4); timecode_nmarks = 2 + (60 * 4);
} else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/ } else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/
smpte_ruler_scale = smpte_show_hours; timecode_ruler_scale = timecode_show_hours;
smpte_mark_modulo = 1; timecode_mark_modulo = 1;
smpte_nmarks = 2 + 8; timecode_nmarks = 2 + 8;
} else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/ } else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/
smpte_ruler_scale = smpte_show_hours; timecode_ruler_scale = timecode_show_hours;
smpte_mark_modulo = 1; timecode_mark_modulo = 1;
smpte_nmarks = 2 + 24; timecode_nmarks = 2 + 24;
} else { } else {
/* not possible if nframes64_t is a 32 bit quantity */ /* not possible if nframes64_t is a 32 bit quantity */
smpte_ruler_scale = smpte_show_hours; timecode_ruler_scale = timecode_show_hours;
smpte_mark_modulo = 4; timecode_mark_modulo = 4;
smpte_nmarks = 2 + 24; timecode_nmarks = 2 + 24;
} }
} }
gint 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; nframes_t pos;
nframes64_t spacer; nframes64_t spacer;
SMPTE::Time smpte; Timecode::Time timecode;
gchar buf[16]; gchar buf[16];
gint n; gint n;
@ -997,22 +997,22 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u
pos = (nframes_t) floor (lower); pos = (nframes_t) floor (lower);
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * smpte_nmarks); *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * timecode_nmarks);
switch (smpte_ruler_scale) { switch (timecode_ruler_scale) {
case smpte_show_bits: case timecode_show_bits:
// Find smpte time of this sample (pos) with subframe accuracy // Find timecode time of this sample (pos) with subframe accuracy
session->sample_to_smpte(pos, smpte, true /* use_offset */, true /* use_subframes */ ); session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
for (n = 0; n < smpte_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
session->smpte_to_sample(smpte, pos, true /* use_offset */, true /* use_subframes */ ); session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
if ((smpte.subframes % smpte_mark_modulo) == 0) { if ((timecode.subframes % timecode_mark_modulo) == 0) {
if (smpte.subframes == 0) { if (timecode.subframes == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*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 { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
snprintf (buf, sizeof(buf), ".%02u", smpte.subframes); snprintf (buf, sizeof(buf), ".%02u", timecode.subframes);
} }
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
@ -1023,26 +1023,26 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u
(*marks)[n].position = pos; (*marks)[n].position = pos;
// Increment subframes by one // 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; break;
case smpte_show_seconds: case timecode_show_seconds:
// Find smpte time of this sample (pos) // Find timecode time of this sample (pos)
session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole second down // Go to next whole second down
SMPTE::seconds_floor( smpte ); Timecode::seconds_floor( timecode );
for (n = 0; n < smpte_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((smpte.seconds % smpte_mark_modulo) == 0) { if ((timecode.seconds % timecode_mark_modulo) == 0) {
if (smpte.seconds == 0) { if (timecode.seconds == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
(*marks)[n].position = pos; (*marks)[n].position = pos;
} else { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
(*marks)[n].position = pos; (*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 { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;
@ -1050,24 +1050,24 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u
} }
(*marks)[n].label = g_strdup (buf); (*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; break;
case smpte_show_minutes: case timecode_show_minutes:
// Find smpte time of this sample (pos) // Find timecode time of this sample (pos)
session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole minute down // Go to next whole minute down
SMPTE::minutes_floor( smpte ); Timecode::minutes_floor( timecode );
for (n = 0; n < smpte_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((smpte.minutes % smpte_mark_modulo) == 0) { if ((timecode.minutes % timecode_mark_modulo) == 0) {
if (smpte.minutes == 0) { if (timecode.minutes == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
} else { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*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 { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*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].label = g_strdup (buf);
(*marks)[n].position = pos; (*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; break;
case smpte_show_hours: case timecode_show_hours:
// Find smpte time of this sample (pos) // Find timecode time of this sample (pos)
session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole hour down // Go to next whole hour down
SMPTE::hours_floor( smpte ); Timecode::hours_floor( timecode );
for (n = 0; n < smpte_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((smpte.hours % smpte_mark_modulo) == 0) { if ((timecode.hours % timecode_mark_modulo) == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*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 { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*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].label = g_strdup (buf);
(*marks)[n].position = pos; (*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; break;
case smpte_show_frames: case timecode_show_frames:
// Find smpte time of this sample (pos) // Find timecode time of this sample (pos)
session->sample_to_smpte(pos, smpte, true /* use_offset */, false /* use_subframes */ ); session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
// Go to next whole frame down // Go to next whole frame down
SMPTE::frames_floor( smpte ); Timecode::frames_floor( timecode );
for (n = 0; n < smpte_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((smpte.frames % smpte_mark_modulo) == 0) { if ((timecode.frames % timecode_mark_modulo) == 0) {
if (smpte.frames == 0) { if (timecode.frames == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
} else { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
} }
(*marks)[n].position = pos; (*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 { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;
@ -1124,13 +1124,13 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u
} }
(*marks)[n].label = g_strdup (buf); (*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; break;
} }
return smpte_nmarks; return timecode_nmarks;
} }

View file

@ -46,7 +46,7 @@ setup_gtk_ardour_enums ()
#define REGISTER_ENUM(e) i.push_back (e); s.push_back (#e) #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) #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, BBT);
REGISTER_CLASS_ENUM (AudioClock, MinSec); REGISTER_CLASS_ENUM (AudioClock, MinSec);
REGISTER_CLASS_ENUM (AudioClock, Frames); REGISTER_CLASS_ENUM (AudioClock, Frames);

View file

@ -711,7 +711,7 @@ ExportFormatDialog::update_silence_start_selection ()
{ {
update_time (silence_start, silence_start_clock); update_time (silence_start, silence_start_clock);
AnyTime zero; AnyTime zero;
zero.type = AnyTime::SMPTE; zero.type = AnyTime::Timecode;
manager.select_silence_beginning (silence_start_checkbox.get_active() ? silence_start : zero); 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); update_time (silence_end, silence_end_clock);
AnyTime zero; AnyTime zero;
zero.type = AnyTime::SMPTE; zero.type = AnyTime::Timecode;
manager.select_silence_end (silence_end_checkbox.get_active() ? silence_end : zero); 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 // TODO position
clock.set (session->convert_to_frames_at (0, time), true); clock.set (session->convert_to_frames_at (0, time), true);
AudioClock::Mode mode(AudioClock::SMPTE); AudioClock::Mode mode(AudioClock::Timecode);
switch (time.type) { switch (time.type) {
case AnyTime::SMPTE: case AnyTime::Timecode:
mode = AudioClock::SMPTE; mode = AudioClock::Timecode;
break; break;
case AnyTime::BBT: case AnyTime::BBT:
mode = AudioClock::BBT; mode = AudioClock::BBT;
@ -760,9 +760,9 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
nframes_t frames = clock.current_duration(); nframes_t frames = clock.current_duration();
switch (clock.mode()) { switch (clock.mode()) {
case AudioClock::SMPTE: case AudioClock::Timecode:
time.type = AnyTime::SMPTE; time.type = AnyTime::Timecode;
session->smpte_time (frames, time.smpte); session->timecode_time (frames, time.timecode);
break; break;
case AudioClock::BBT: case AudioClock::BBT:
time.type = AnyTime::BBT; time.type = AnyTime::BBT;

View file

@ -67,7 +67,7 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi
iter = time_format_list->append(); iter = time_format_list->append();
row = *iter; row = *iter;
row[time_format_cols.format] = ExportProfileManager::SMPTE; row[time_format_cols.format] = ExportProfileManager::Timecode;
row[time_format_cols.label] = X_("Timecode"); row[time_format_cols.label] = X_("Timecode");
iter = time_format_list->append(); iter = time_format_list->append();
@ -163,9 +163,9 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons
end = bbt_str (end_frame); end = bbt_str (end_frame);
break; break;
case AudioClock::SMPTE: case AudioClock::Timecode:
start = smpte_str (start_frame); start = timecode_str (start_frame);
end = smpte_str (end_frame); end = timecode_str (end_frame);
break; break;
case AudioClock::MinSec: case AudioClock::MinSec:
@ -222,16 +222,16 @@ ExportTimespanSelector::bbt_str (nframes_t frames) const
} }
Glib::ustring Glib::ustring
ExportTimespanSelector::smpte_str (nframes_t frames) const ExportTimespanSelector::timecode_str (nframes_t frames) const
{ {
if (!session) { if (!session) {
return "Error!"; return "Error!";
} }
std::ostringstream oss; 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 << oss << std::setfill('0') << std::right <<
std::setw(2) << std::setw(2) <<

View file

@ -78,7 +78,7 @@ class ExportTimespanSelector : public Gtk::VBox {
Glib::ustring construct_label (ARDOUR::Location const * location) const; Glib::ustring construct_label (ARDOUR::Location const * location) const;
Glib::ustring bbt_str (nframes_t frames) 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; Glib::ustring ms_str (nframes_t frames) const;
void update_range_name (Glib::ustring const & path, Glib::ustring const & new_text); void update_range_name (Glib::ustring const & path, Glib::ustring const & new_text);

View file

@ -223,22 +223,22 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
add_option (_("Sync"), spf); add_option (_("Sync"), spf);
ComboOption<SmpteFormat>* smf = new ComboOption<SmpteFormat> ( ComboOption<SmpteFormat>* smf = new ComboOption<SmpteFormat> (
"smpte-format", "timecode-format",
_("Timecode frames-per-second"), _("Timecode frames-per-second"),
mem_fun (*_session_config, &SessionConfiguration::get_smpte_format), mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
mem_fun (*_session_config, &SessionConfiguration::set_smpte_format) mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
); );
smf->add (smpte_23976, _("23.976")); smf->add (timecode_23976, _("23.976"));
smf->add (smpte_24, _("24")); smf->add (timecode_24, _("24"));
smf->add (smpte_24976, _("24.976")); smf->add (timecode_24976, _("24.976"));
smf->add (smpte_25, _("25")); smf->add (timecode_25, _("25"));
smf->add (smpte_2997, _("29.97")); smf->add (timecode_2997, _("29.97"));
smf->add (smpte_2997drop, _("29.97 drop")); smf->add (timecode_2997drop, _("29.97 drop"));
smf->add (smpte_30, _("30")); smf->add (timecode_30, _("30"));
smf->add (smpte_30drop, _("30 drop")); smf->add (timecode_30drop, _("30 drop"));
smf->add (smpte_5994, _("59.94")); smf->add (timecode_5994, _("59.94"));
smf->add (smpte_60, _("60")); smf->add (timecode_60, _("60"));
add_option (_("Sync"), smf); add_option (_("Sync"), smf);

View file

@ -166,7 +166,7 @@ SoundFileBox::SoundFileBox (bool persistent)
table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL); table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL);
length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock.mode()); 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); main_box.pack_start (table, false, false);

View file

@ -110,8 +110,8 @@ class ElementImporter
/// The sample rate of the session from which we are importing /// The sample rate of the session from which we are importing
nframes_t sample_rate; nframes_t sample_rate;
/// Converts smpte time to a string /// Converts timecode time to a string
std::string smpte_to_string (SMPTE::Time & time) const; std::string timecode_to_string (Timecode::Time & time) const;
/// Converts samples so that times match the sessions sample rate /// Converts samples so that times match the sessions sample rate
nframes_t rate_convert_samples (nframes_t samples) const; nframes_t rate_convert_samples (nframes_t samples) const;

View file

@ -108,7 +108,7 @@ class ExportProfileManager
typedef std::list<Location *> LocationList; typedef std::list<Location *> LocationList;
enum TimeFormat { enum TimeFormat {
SMPTE, Timecode,
BBT, BBT,
MinSec, MinSec,
Frames, Frames,
@ -127,7 +127,7 @@ class ExportProfileManager
boost::shared_ptr<Location> selection_range, boost::shared_ptr<Location> selection_range,
boost::shared_ptr<LocationList> ranges) : boost::shared_ptr<LocationList> ranges) :
timespans (new TimespanList ()), timespans (new TimespanList ()),
time_format (SMPTE), time_format (Timecode),
session_range (session_range), session_range (session_range),
selection_range (selection_range), selection_range (selection_range),

View file

@ -54,7 +54,7 @@
#include "ardour/rc_configuration.h" #include "ardour/rc_configuration.h"
#include "ardour/session_configuration.h" #include "ardour/session_configuration.h"
#include "ardour/location.h" #include "ardour/location.h"
#include "ardour/smpte.h" #include "ardour/timecode.h"
#include "ardour/interpolation.h" #include "ardour/interpolation.h"
class XMLTree; 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 nominal_frame_rate() const { return _nominal_frame_rate; }
nframes_t frames_per_hour() const { return _frames_per_hour; } nframes_t frames_per_hour() const { return _frames_per_hour; }
double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } double frames_per_timecode_frame() const { return _frames_per_timecode_frame; }
nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } nframes_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; }
MIDI::byte get_mtc_smpte_bits() const { MIDI::byte get_mtc_timecode_bits() const {
return mtc_smpte_bits; /* encoding of SMTPE type for MTC */ return mtc_timecode_bits; /* encoding of SMTPE type for MTC */
} }
float smpte_frames_per_second() const; float timecode_frames_per_second() const;
bool smpte_drop_frames() const; bool timecode_drop_frames() const;
/* Locations */ /* Locations */
@ -551,25 +551,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void sync_time_vars(); void sync_time_vars();
void bbt_time (nframes_t when, BBT_Time&); 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 timecode_to_sample(Timecode::Time& timecode, 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 sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
void smpte_time (SMPTE::Time &); void timecode_time (Timecode::Time &);
void smpte_time (nframes_t when, SMPTE::Time&); void timecode_time (nframes_t when, Timecode::Time&);
void smpte_time_subframes (nframes_t when, SMPTE::Time&); void timecode_time_subframes (nframes_t when, Timecode::Time&);
void smpte_duration (nframes_t, SMPTE::Time&) const; void timecode_duration (nframes_t, Timecode::Time&) const;
void smpte_duration_string (char *, nframes_t) const; void timecode_duration_string (char *, nframes_t) const;
void set_smpte_offset (nframes_t); void set_timecode_offset (nframes_t);
nframes_t smpte_offset () const { return _smpte_offset; } nframes_t timecode_offset () const { return _timecode_offset; }
void set_smpte_offset_negative (bool); void set_timecode_offset_negative (bool);
bool smpte_offset_negative () const { return _smpte_offset_negative; } bool timecode_offset_negative () const { return _timecode_offset_negative; }
nframes_t convert_to_frames_at (nframes_t position, AnyTime const &); nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
static sigc::signal<void> StartTimeChanged; static sigc::signal<void> StartTimeChanged;
static sigc::signal<void> EndTimeChanged; static sigc::signal<void> EndTimeChanged;
static sigc::signal<void> SMPTEOffsetChanged; static sigc::signal<void> TimecodeOffsetChanged;
void request_slave_source (SlaveSource); void request_slave_source (SlaveSource);
bool synced_to_jack() const { return Config->get_slave_source() == JACK; } 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; } TempoMap& tempo_map() { return *_tempo_map; }
/// signals the current transport position in frames, bbt and smpte time (in that order) /// signals the current transport position in frames, bbt and timecode time (in that order)
sigc::signal<void, const nframes_t&, const BBT_Time&, const SMPTE::Time&> tick; sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick;
/* region info */ /* region info */
@ -1331,25 +1331,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
MIDI::byte mmc_buffer[32]; MIDI::byte mmc_buffer[32];
MIDI::byte mtc_msg[16]; 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]; MIDI::byte midi_msg[16];
nframes_t outbound_mtc_smpte_frame; nframes_t outbound_mtc_timecode_frame;
SMPTE::Time transmitting_smpte_time; Timecode::Time transmitting_timecode_time;
int next_quarter_frame_to_send; 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 _frames_per_hour;
nframes_t _smpte_frames_per_hour; nframes_t _timecode_frames_per_hour;
nframes_t _smpte_offset; nframes_t _timecode_offset;
bool _smpte_offset_negative; bool _timecode_offset_negative;
/* cache the most-recently requested time conversions. This helps when we /* cache the most-recently requested time conversions. This helps when we
* have multiple clocks showing the same time (e.g. the transport frame) */ * have multiple clocks showing the same time (e.g. the transport frame) */
bool last_smpte_valid; bool last_timecode_valid;
nframes_t last_smpte_when; nframes_t last_timecode_when;
SMPTE::Time last_smpte; 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_full_time_code(nframes_t nframes);
int send_midi_time_code_for_cycle(nframes_t nframes); int send_midi_time_code_for_cycle(nframes_t nframes);

View file

@ -33,7 +33,7 @@ CONFIG_VARIABLE (bool, auto_input, "auto-input", true)
CONFIG_VARIABLE (bool, punch_in, "punch-in", false) CONFIG_VARIABLE (bool, punch_in, "punch-in", false)
CONFIG_VARIABLE (bool, punch_out, "punch-out", false) CONFIG_VARIABLE (bool, punch_out, "punch-out", false)
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100) 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_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_country_code, "bwf-country-code", "US")
CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US") CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US")

View file

@ -40,7 +40,7 @@ public:
virtual void tick( virtual void tick(
const nframes_t& transport_frames, const nframes_t& transport_frames,
const BBT_Time& transport_bbt, 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 set_session(Session& s);
virtual void going_away() { _session = 0; } virtual void going_away() { _session = 0; }
@ -68,7 +68,7 @@ public:
void tick( void tick(
const nframes_t& transport_frames, const nframes_t& transport_frames,
const BBT_Time& transport_bbt, const BBT_Time& transport_bbt,
const SMPTE::Time& transport_smpte); const Timecode::Time& transport_timecode);
void set_session(Session& s); void set_session(Session& s);
void going_away() { _midi_port = 0; Ticker::going_away(); } void going_away() { _midi_port = 0; Ticker::going_away(); }

View file

@ -15,12 +15,12 @@
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef __ardour_smpte_h__ #ifndef __ardour_timecode_h__
#define __ardour_smpte_h__ #define __ardour_timecode_h__
#include <inttypes.h> #include <inttypes.h>
namespace SMPTE { namespace Timecode {
enum Wrap { enum Wrap {
NONE = 0, NONE = 0,
@ -30,7 +30,7 @@ enum Wrap {
HOURS HOURS
}; };
/** SMPTE frame rate (in frames per second). /** Timecode frame rate (in frames per second).
* *
* This should be eliminated in favour of a float to support arbitrary rates. * This should be eliminated in favour of a float to support arbitrary rates.
*/ */
@ -46,7 +46,7 @@ struct Time {
uint32_t hours; uint32_t hours;
uint32_t minutes; uint32_t minutes;
uint32_t seconds; uint32_t seconds;
uint32_t frames; ///< SMPTE frames (not audio samples) uint32_t frames; ///< Timecode frames (not audio samples)
uint32_t subframes; ///< Typically unused uint32_t subframes; ///< Typically unused
FPS rate; ///< Frame rate of this Time FPS rate; ///< Frame rate of this Time
static FPS default_rate; ///< Rate to use for default constructor static FPS default_rate; ///< Rate to use for default constructor
@ -62,18 +62,18 @@ struct Time {
} }
}; };
Wrap increment( Time& smpte ); Wrap increment( Time& timecode );
Wrap decrement( Time& smpte ); Wrap decrement( Time& timecode );
Wrap increment_subframes( Time& smpte ); Wrap increment_subframes( Time& timecode );
Wrap decrement_subframes( Time& smpte ); Wrap decrement_subframes( Time& timecode );
Wrap increment_seconds( Time& smpte ); Wrap increment_seconds( Time& timecode );
Wrap increment_minutes( Time& smpte ); Wrap increment_minutes( Time& timecode );
Wrap increment_hours( Time& smpte ); Wrap increment_hours( Time& timecode );
void frames_floor( Time& smpte ); void frames_floor( Time& timecode );
void seconds_floor( Time& smpte ); void seconds_floor( Time& timecode );
void minutes_floor( Time& smpte ); void minutes_floor( Time& timecode );
void hours_floor( Time& smpte ); void hours_floor( Time& timecode );
} // namespace SMPTE } // namespace Timecode
#endif // __ardour_smpte_h__ #endif // __ardour_timecode_h__

View file

@ -31,7 +31,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <jack/types.h> #include <jack/types.h>
#include <jack/midiport.h> #include <jack/midiport.h>
#include "control_protocol/smpte.h" #include "control_protocol/timecode.h"
#include "pbd/id.h" #include "pbd/id.h"
#include <map> #include <map>
@ -184,21 +184,21 @@ namespace ARDOUR {
}; };
enum SmpteFormat { enum SmpteFormat {
smpte_23976, timecode_23976,
smpte_24, timecode_24,
smpte_24976, timecode_24976,
smpte_25, timecode_25,
smpte_2997, timecode_2997,
smpte_2997drop, timecode_2997drop,
smpte_30, timecode_30,
smpte_30drop, timecode_30drop,
smpte_5994, timecode_5994,
smpte_60 timecode_60
}; };
struct AnyTime { struct AnyTime {
enum Type { enum Type {
SMPTE, Timecode,
BBT, BBT,
Frames, Frames,
Seconds Seconds
@ -206,7 +206,7 @@ namespace ARDOUR {
Type type; Type type;
SMPTE::Time smpte; Timecode::Time timecode;
BBT_Time bbt; BBT_Time bbt;
union { union {

View file

@ -2000,7 +2000,7 @@ AudioDiskstream::allocate_temporary_buffers ()
{ {
/* make sure the wrap buffer is at least large enough to deal /* make sure the wrap buffer is at least large enough to deal
with the speeds up to 1.2, to allow for micro-variation 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); double sp = max (fabsf (_actual_speed), 1.2f);

View file

@ -127,7 +127,7 @@ string
AudioRegionImporter::get_info () const AudioRegionImporter::get_info () const
{ {
nframes_t length, position; nframes_t length, position;
SMPTE::Time length_time, position_time; Timecode::Time length_time, position_time;
std::ostringstream oss; std::ostringstream oss;
// Get sample positions // Get sample positions
@ -136,15 +136,15 @@ AudioRegionImporter::get_info () const
std::istringstream iss_position(xml_region.property ("position")->value()); std::istringstream iss_position(xml_region.property ("position")->value());
iss_position >> position; iss_position >> position;
// Convert to smpte // Convert to timecode
session.sample_to_smpte(length, length_time, true, false); session.sample_to_timecode(length, length_time, true, false);
session.sample_to_smpte(position, position_time, true, false); session.sample_to_timecode(position, position_time, true, false);
// return info // return info
oss << _("Length: ") << oss << _("Length: ") <<
smpte_to_string(length_time) << timecode_to_string(length_time) <<
_("\nPosition: ") << _("\nPosition: ") <<
smpte_to_string(position_time) << timecode_to_string(position_time) <<
_("\nChannels: ") << _("\nChannels: ") <<
xml_region.property ("channels")->value(); xml_region.property ("channels")->value();

View file

@ -79,7 +79,7 @@ ElementImporter::cancel_move ()
} }
string string
ElementImporter::smpte_to_string(SMPTE::Time & time) const ElementImporter::timecode_to_string(Timecode::Time & time) const
{ {
std::ostringstream oss; std::ostringstream oss;
oss << std::setfill('0') << std::right << oss << std::setfill('0') << std::right <<

View file

@ -311,16 +311,16 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Session, InCleanup); REGISTER_CLASS_ENUM (Session, InCleanup);
REGISTER_BITS (_Session_StateOfTheState); REGISTER_BITS (_Session_StateOfTheState);
REGISTER_ENUM (smpte_23976); REGISTER_ENUM (timecode_23976);
REGISTER_ENUM (smpte_24); REGISTER_ENUM (timecode_24);
REGISTER_ENUM (smpte_24976); REGISTER_ENUM (timecode_24976);
REGISTER_ENUM (smpte_25); REGISTER_ENUM (timecode_25);
REGISTER_ENUM (smpte_2997); REGISTER_ENUM (timecode_2997);
REGISTER_ENUM (smpte_2997drop); REGISTER_ENUM (timecode_2997drop);
REGISTER_ENUM (smpte_30); REGISTER_ENUM (timecode_30);
REGISTER_ENUM (smpte_30drop); REGISTER_ENUM (timecode_30drop);
REGISTER_ENUM (smpte_5994); REGISTER_ENUM (timecode_5994);
REGISTER_ENUM (smpte_60); REGISTER_ENUM (timecode_60);
REGISTER (_Session_SmpteFormat); REGISTER (_Session_SmpteFormat);
REGISTER_CLASS_ENUM (Session, pullup_Plus4Plus1); REGISTER_CLASS_ENUM (Session, pullup_Plus4Plus1);
@ -423,7 +423,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (AutomationList, Curved); REGISTER_CLASS_ENUM (AutomationList, Curved);
REGISTER (_AutomationList_InterpolationStyle); REGISTER (_AutomationList_InterpolationStyle);
REGISTER_CLASS_ENUM (AnyTime, SMPTE); REGISTER_CLASS_ENUM (AnyTime, Timecode);
REGISTER_CLASS_ENUM (AnyTime, BBT); REGISTER_CLASS_ENUM (AnyTime, BBT);
REGISTER_CLASS_ENUM (AnyTime, Frames); REGISTER_CLASS_ENUM (AnyTime, Frames);
REGISTER_CLASS_ENUM (AnyTime, Seconds); REGISTER_CLASS_ENUM (AnyTime, Seconds);
@ -502,7 +502,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (ExportFormatBase, SRC_Linear); REGISTER_CLASS_ENUM (ExportFormatBase, SRC_Linear);
REGISTER (_ExportFormatBase_SRCQuality); REGISTER (_ExportFormatBase_SRCQuality);
REGISTER_CLASS_ENUM (ExportProfileManager, SMPTE); REGISTER_CLASS_ENUM (ExportProfileManager, Timecode);
REGISTER_CLASS_ENUM (ExportProfileManager, BBT); REGISTER_CLASS_ENUM (ExportProfileManager, BBT);
REGISTER_CLASS_ENUM (ExportProfileManager, MinSec); REGISTER_CLASS_ENUM (ExportProfileManager, MinSec);
REGISTER_CLASS_ENUM (ExportProfileManager, Frames); REGISTER_CLASS_ENUM (ExportProfileManager, Frames);

View file

@ -43,7 +43,7 @@ ExportFormatSpecification::Time &
ExportFormatSpecification::Time::operator= (AnyTime const & other) ExportFormatSpecification::Time::operator= (AnyTime const & other)
{ {
type = other.type; type = other.type;
smpte = other.smpte; timecode = other.timecode;
bbt = other.bbt; bbt = other.bbt;
if (type == Frames) { if (type == Frames) {
@ -73,11 +73,11 @@ ExportFormatSpecification::Time::get_state ()
node->add_property ("format", enum_2_string (type)); node->add_property ("format", enum_2_string (type));
switch (type) { switch (type) {
case SMPTE: case Timecode:
node->add_property ("hours", to_string (smpte.hours, std::dec)); node->add_property ("hours", to_string (timecode.hours, std::dec));
node->add_property ("minutes", to_string (smpte.minutes, std::dec)); node->add_property ("minutes", to_string (timecode.minutes, std::dec));
node->add_property ("seconds", to_string (smpte.seconds, std::dec)); node->add_property ("seconds", to_string (timecode.seconds, std::dec));
node->add_property ("frames", to_string (smpte.frames, std::dec)); node->add_property ("frames", to_string (timecode.frames, std::dec));
break; break;
case BBT: case BBT:
node->add_property ("bars", to_string (bbt.bars, std::dec)); 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); type = (Type) string_2_enum (prop->value(), Type);
switch (type) { switch (type) {
case SMPTE: case Timecode:
if ((prop = node.property ("hours"))) { if ((prop = node.property ("hours"))) {
smpte.hours = atoi (prop->value()); timecode.hours = atoi (prop->value());
} }
if ((prop = node.property ("minutes"))) { if ((prop = node.property ("minutes"))) {
smpte.minutes = atoi (prop->value()); timecode.minutes = atoi (prop->value());
} }
if ((prop = node.property ("seconds"))) { if ((prop = node.property ("seconds"))) {
smpte.seconds = atoi (prop->value()); timecode.seconds = atoi (prop->value());
} }
if ((prop = node.property ("frames"))) { if ((prop = node.property ("frames"))) {
smpte.frames = atoi (prop->value()); timecode.frames = atoi (prop->value());
} }
break; break;
@ -191,8 +191,8 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const
, _silence_beginning (s) , _silence_beginning (s)
, _silence_end (s) , _silence_end (s)
{ {
_silence_beginning.type = Time::SMPTE; _silence_beginning.type = Time::Timecode;
_silence_end.type = Time::SMPTE; _silence_end.type = Time::Timecode;
set_state (state); set_state (state);
} }
@ -396,7 +396,7 @@ ExportFormatSpecification::set_state (const XMLNode & root)
_silence_beginning.set_state (*child); _silence_beginning.set_state (*child);
} }
} else { } 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); _silence_end.set_state (*child);
} }
} else { } else {
_silence_end.type = Time::SMPTE; _silence_end.type = Time::Timecode;
} }
} }
} }

View file

@ -105,7 +105,7 @@ string
LocationImporter::get_info () const LocationImporter::get_info () const
{ {
nframes_t start, end; nframes_t start, end;
SMPTE::Time start_time, end_time; Timecode::Time start_time, end_time;
// Get sample positions // Get sample positions
std::istringstream iss_start (xml_location.property ("start")->value()); 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()); std::istringstream iss_end (xml_location.property ("end")->value());
iss_end >> end; iss_end >> end;
// Convert to smpte // Convert to timecode
session.sample_to_smpte (start, start_time, true, false); session.sample_to_timecode (start, start_time, true, false);
session.sample_to_smpte (end, end_time, true, false); session.sample_to_timecode (end, end_time, true, false);
// return info // return info
std::ostringstream oss; std::ostringstream oss;
if (start == end) { if (start == end) {
oss << _("Location: ") << smpte_to_string (start_time); oss << _("Location: ") << timecode_to_string (start_time);
} else { } else {
oss << _("Range\nstart: ") << smpte_to_string (start_time) << oss << _("Range\nstart: ") << timecode_to_string (start_time) <<
_("\nend: ") << smpte_to_string (end_time); _("\nend: ") << timecode_to_string (end_time);
} }
return oss.str(); return oss.str();

View file

@ -44,7 +44,7 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
{ {
can_notify_on_unknown_rate = true; 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); rebind (p);
reset (); reset ();
@ -76,7 +76,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/)
nframes_t qtr; nframes_t qtr;
static cycles_t last_qtr = 0; 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; mtc_frame += qtr;
last_qtr = cnow; last_qtr = cnow;
@ -92,34 +92,34 @@ void
MTC_Slave::update_mtc_time (const byte *msg, bool was_full) MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
{ {
nframes_t now = session.engine().frame_time(); nframes_t now = session.engine().frame_time();
SMPTE::Time smpte; Timecode::Time timecode;
smpte.hours = msg[3]; timecode.hours = msg[3];
smpte.minutes = msg[2]; timecode.minutes = msg[2];
smpte.seconds = msg[1]; timecode.seconds = msg[1];
smpte.frames = msg[0]; timecode.frames = msg[0];
last_mtc_fps_byte = msg[4]; last_mtc_fps_byte = msg[4];
switch (msg[4]) { switch (msg[4]) {
case MTC_24_FPS: case MTC_24_FPS:
smpte.rate = 24; timecode.rate = 24;
smpte.drop = false; timecode.drop = false;
can_notify_on_unknown_rate = true; can_notify_on_unknown_rate = true;
break; break;
case MTC_25_FPS: case MTC_25_FPS:
smpte.rate = 25; timecode.rate = 25;
smpte.drop = false; timecode.drop = false;
can_notify_on_unknown_rate = true; can_notify_on_unknown_rate = true;
break; break;
case MTC_30_FPS_DROP: case MTC_30_FPS_DROP:
smpte.rate = 30; timecode.rate = 30;
smpte.drop = true; timecode.drop = true;
can_notify_on_unknown_rate = true; can_notify_on_unknown_rate = true;
break; break;
case MTC_30_FPS: case MTC_30_FPS:
smpte.rate = 30; timecode.rate = 30;
smpte.drop = false; timecode.drop = false;
can_notify_on_unknown_rate = true; can_notify_on_unknown_rate = true;
break; break;
default: default:
@ -130,11 +130,11 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
<< endmsg; << endmsg;
can_notify_on_unknown_rate = false; can_notify_on_unknown_rate = false;
} }
smpte.rate = session.smpte_frames_per_second(); timecode.rate = session.timecode_frames_per_second();
smpte.drop = session.smpte_drop_frames(); 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) { if (was_full) {
@ -158,7 +158,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
Also compensate for audio latency. 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) { if (first_mtc_frame == 0) {
first_mtc_frame = mtc_frame; first_mtc_frame = mtc_frame;
@ -338,7 +338,7 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos)
ARDOUR::nframes_t ARDOUR::nframes_t
MTC_Slave::resolution() const MTC_Slave::resolution() const
{ {
return (nframes_t) session.frames_per_smpte_frame(); return (nframes_t) session.frames_per_timecode_frame();
} }
void void

View file

@ -104,7 +104,7 @@ sigc::signal<int> Session::AskAboutPendingState;
sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch; sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch;
sigc::signal<void> Session::SendFeedback; sigc::signal<void> Session::SendFeedback;
sigc::signal<void> Session::SMPTEOffsetChanged; sigc::signal<void> Session::TimecodeOffsetChanged;
sigc::signal<void> Session::StartTimeChanged; sigc::signal<void> Session::StartTimeChanged;
sigc::signal<void> Session::EndTimeChanged; sigc::signal<void> Session::EndTimeChanged;
sigc::signal<void> Session::AutoBindingOn; sigc::signal<void> Session::AutoBindingOn;
@ -132,7 +132,7 @@ Session::Session (AudioEngine &eng,
state_tree (0), state_tree (0),
_butler (new Butler (this)), _butler (new Butler (this)),
post_transport_work((PostTransportWork)0), post_transport_work((PostTransportWork)0),
_send_smpte_update (false), _send_timecode_update (false),
midi_thread (pthread_t (0)), midi_thread (pthread_t (0)),
midi_requests (128), // the size of this should match the midi request pool size midi_requests (128), // the size of this should match the midi request pool size
diskstreams (new DiskstreamList), diskstreams (new DiskstreamList),
@ -218,7 +218,7 @@ Session::Session (AudioEngine &eng,
state_tree (0), state_tree (0),
_butler (new Butler (this)), _butler (new Butler (this)),
post_transport_work((PostTransportWork)0), post_transport_work((PostTransportWork)0),
_send_smpte_update (false), _send_timecode_update (false),
midi_thread (pthread_t (0)), midi_thread (pthread_t (0)),
midi_requests (16), midi_requests (16),
diskstreams (new DiskstreamList), diskstreams (new DiskstreamList),

View file

@ -340,7 +340,7 @@ Session::process_event (Event* ev)
// cerr << "soft locate to " << ev->target_frame << endl; // cerr << "soft locate to " << ev->target_frame << endl;
start_locate (ev->target_frame, false, true, false); start_locate (ev->target_frame, false, true, false);
} }
_send_smpte_update = true; _send_timecode_update = true;
break; break;
case Event::LocateRoll: case Event::LocateRoll:
@ -351,7 +351,7 @@ Session::process_event (Event* ev)
// cerr << "soft locate to+roll " << ev->target_frame << endl; // cerr << "soft locate to+roll " << ev->target_frame << endl;
start_locate (ev->target_frame, true, true, false); start_locate (ev->target_frame, true, true, false);
} }
_send_smpte_update = true; _send_timecode_update = true;
break; break;
case Event::LocateRollLocate: case Event::LocateRollLocate:

View file

@ -43,7 +43,7 @@
#include "ardour/audio_diskstream.h" #include "ardour/audio_diskstream.h"
#include "ardour/slave.h" #include "ardour/slave.h"
#include "ardour/cycles.h" #include "ardour/cycles.h"
#include "ardour/smpte.h" #include "ardour/timecode.h"
#include "i18n.h" #include "i18n.h"
@ -469,7 +469,7 @@ Session::get_trace_midi_output(MIDI::Port *port)
void void
Session::setup_midi_control () Session::setup_midi_control ()
{ {
outbound_mtc_smpte_frame = 0; outbound_mtc_timecode_frame = 0;
next_quarter_frame_to_send = 0; next_quarter_frame_to_send = 0;
/* setup the MMC buffer */ /* 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 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) { if (_transport_speed == 0 || cur_speed * _transport_speed < 0) {
/* change direction */ /* change direction */
@ -691,17 +691,17 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
} }
nframes_t target_frame; nframes_t target_frame;
SMPTE::Time smpte; Timecode::Time timecode;
smpte.hours = mmc_tc[0] & 0xf; timecode.hours = mmc_tc[0] & 0xf;
smpte.minutes = mmc_tc[1]; timecode.minutes = mmc_tc[1];
smpte.seconds = mmc_tc[2]; timecode.seconds = mmc_tc[2];
smpte.frames = mmc_tc[3]; timecode.frames = mmc_tc[3];
smpte.rate = smpte_frames_per_second(); timecode.rate = timecode_frames_per_second();
smpte.drop = smpte_drop_frames(); timecode.drop = timecode_drop_frames();
// Also takes smpte offset into account: // Also takes timecode offset into account:
smpte_to_sample( smpte, target_frame, true /* use_offset */, false /* use_subframes */ ); timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ );
if (target_frame > max_frames) { if (target_frame > max_frames) {
target_frame = max_frames; target_frame = max_frames;
@ -773,7 +773,7 @@ Session::change_midi_ports ()
poke_midi_thread (); 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 * 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. * 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] */ * that be useful? Does ardour do sub-block accurate locating? [DR] */
MIDI::byte msg[10]; 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) { if (_mtc_port == 0 || !session_send_mtc) {
return 0; return 0;
} }
// Get smpte time for this transport frame // Get timecode time for this transport frame
sample_to_smpte(_transport_frame, smpte, true /* use_offset */, false /* no subframes */); sample_to_timecode(_transport_frame, timecode, true /* use_offset */, false /* no subframes */);
transmitting_smpte_time = smpte; transmitting_timecode_time = timecode;
outbound_mtc_smpte_frame = _transport_frame; outbound_mtc_timecode_frame = _transport_frame;
// I don't understand this bit yet.. [DR] // 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 // start MTC quarter frame transmission on an even frame
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() );
outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame; outbound_mtc_timecode_frame += (nframes_t) _frames_per_timecode_frame;
} }
// Compensate for audio latency // Compensate for audio latency
outbound_mtc_smpte_frame += _worst_output_latency; outbound_mtc_timecode_frame += _worst_output_latency;
next_quarter_frame_to_send = 0; 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[0] = 0xf0;
msg[1] = 0x7f; msg[1] = 0x7f;
msg[2] = 0x7f; msg[2] = 0x7f;
@ -818,12 +818,12 @@ Session::send_full_time_code(nframes_t /*nframes*/)
msg[4] = 0x1; msg[4] = 0x1;
msg[9] = 0xf7; msg[9] = 0xf7;
msg[5] = mtc_smpte_bits | smpte.hours; msg[5] = mtc_timecode_bits | timecode.hours;
msg[6] = smpte.minutes; msg[6] = timecode.minutes;
msg[7] = smpte.seconds; msg[7] = timecode.seconds;
msg[8] = smpte.frames; 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 // Send message at offset 0, sent time is for the start of this cycle
if (_mtc_port->midimsg (msg, sizeof (msg), 0)) { 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. /** Send MTC (quarter-frame) messages for this cycle.
* Must be called exactly once per cycle from the audio thread. Realtime safe. * 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 * 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) * earlier already this cycle by send_full_time_code)
*/ */
int 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 >= 0);
assert (next_quarter_frame_to_send <= 7); 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)*/ ) { /*|| (next_quarter_frame_to_send < 0)*/ ) {
// cerr << "(MTC) Not sending MTC\n"; // cerr << "(MTC) Not sending MTC\n";
return 0; return 0;
} }
/* Duration of one quarter frame */ /* 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; // << " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl;
// FIXME: this should always be true // 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); // > _transport_frame);
// Send quarter frames for this cycle // 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))) { (next_quarter_frame_to_send * quarter_frame_duration))) {
// cerr << "(MTC) Next frame to send: " << next_quarter_frame_to_send << endl; // cerr << "(MTC) Next frame to send: " << next_quarter_frame_to_send << endl;
switch (next_quarter_frame_to_send) { switch (next_quarter_frame_to_send) {
case 0: case 0:
mtc_msg[1] = 0x00 | (transmitting_smpte_time.frames & 0xf); mtc_msg[1] = 0x00 | (transmitting_timecode_time.frames & 0xf);
break; break;
case 1: case 1:
mtc_msg[1] = 0x10 | ((transmitting_smpte_time.frames & 0xf0) >> 4); mtc_msg[1] = 0x10 | ((transmitting_timecode_time.frames & 0xf0) >> 4);
break; break;
case 2: case 2:
mtc_msg[1] = 0x20 | (transmitting_smpte_time.seconds & 0xf); mtc_msg[1] = 0x20 | (transmitting_timecode_time.seconds & 0xf);
break; break;
case 3: case 3:
mtc_msg[1] = 0x30 | ((transmitting_smpte_time.seconds & 0xf0) >> 4); mtc_msg[1] = 0x30 | ((transmitting_timecode_time.seconds & 0xf0) >> 4);
break; break;
case 4: case 4:
mtc_msg[1] = 0x40 | (transmitting_smpte_time.minutes & 0xf); mtc_msg[1] = 0x40 | (transmitting_timecode_time.minutes & 0xf);
break; break;
case 5: case 5:
mtc_msg[1] = 0x50 | ((transmitting_smpte_time.minutes & 0xf0) >> 4); mtc_msg[1] = 0x50 | ((transmitting_timecode_time.minutes & 0xf0) >> 4);
break; break;
case 6: 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; break;
case 7: 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; 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)); + (quarter_frame_duration * next_quarter_frame_to_send));
// This message must fall within this block or something is broken // 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; return -1;
} }
/*cerr << "(MTC) SMPTE: " << transmitting_smpte_time.hours /*cerr << "(MTC) Timecode: " << transmitting_timecode_time.hours
<< ":" << transmitting_smpte_time.minutes << ":" << transmitting_timecode_time.minutes
<< ":" << transmitting_smpte_time.seconds << ":" << transmitting_timecode_time.seconds
<< ":" << transmitting_smpte_time.frames << ":" << transmitting_timecode_time.frames
<< ", qfm = " << next_quarter_frame_to_send << ", qfm = " << next_quarter_frame_to_send
<< ", stamp = " << out_stamp << ", stamp = " << out_stamp
<< ", delta = " << _transport_frame + out_stamp - last_time << endl;*/ << ", 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) { if (next_quarter_frame_to_send >= 8) {
// Wrap quarter frame counter // Wrap quarter frame counter
next_quarter_frame_to_send = 0; next_quarter_frame_to_send = 0;
// Increment smpte time twice // Increment timecode time twice
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() );
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() );
// Re-calculate timing of first quarter frame // Re-calculate timing of first quarter frame
//smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false ); //timecode_to_sample( transmitting_timecode_time, outbound_mtc_timecode_frame, true /* use_offset */, false );
outbound_mtc_smpte_frame += 8 * quarter_frame_duration; outbound_mtc_timecode_frame += 8 * quarter_frame_duration;
// Compensate for audio latency // 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; using namespace MIDI;
int nbytes = 4; int nbytes = 4;
SMPTE::Time smpte; Timecode::Time timecode;
if (_mmc_port == 0 || !session_send_mmc) { if (_mmc_port == 0 || !session_send_mmc) {
// cerr << "Not delivering MMC " << _mmc_port << " - " << session_send_mmc << endl; // 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) { switch (cmd) {
case MachineControl::cmdLocate: case MachineControl::cmdLocate:
smpte_time_subframes (where, smpte); timecode_time_subframes (where, timecode);
mmc_buffer[nbytes++] = 0x6; // byte count mmc_buffer[nbytes++] = 0x6; // byte count
mmc_buffer[nbytes++] = 0x1; // "TARGET" subcommand mmc_buffer[nbytes++] = 0x1; // "TARGET" subcommand
mmc_buffer[nbytes++] = smpte.hours; mmc_buffer[nbytes++] = timecode.hours;
mmc_buffer[nbytes++] = smpte.minutes; mmc_buffer[nbytes++] = timecode.minutes;
mmc_buffer[nbytes++] = smpte.seconds; mmc_buffer[nbytes++] = timecode.seconds;
mmc_buffer[nbytes++] = smpte.frames; mmc_buffer[nbytes++] = timecode.frames;
mmc_buffer[nbytes++] = smpte.subframes; mmc_buffer[nbytes++] = timecode.subframes;
break; break;
case MachineControl::cmdStop: case MachineControl::cmdStop:

View file

@ -76,9 +76,9 @@ Session::process (nframes_t nframes)
nframes_t transport_frames = transport_frame(); nframes_t transport_frames = transport_frame();
BBT_Time transport_bbt; BBT_Time transport_bbt;
bbt_time(transport_frames, transport_bbt); bbt_time(transport_frames, transport_bbt);
SMPTE::Time transport_smpte; Timecode::Time transport_timecode;
smpte_time(transport_frames, transport_smpte); timecode_time(transport_frames, transport_timecode);
tick (transport_frames, transport_bbt, transport_smpte); /* EMIT SIGNAL */ tick (transport_frames, transport_bbt, transport_timecode); /* EMIT SIGNAL */
SendFeedback (); /* EMIT SIGNAL */ SendFeedback (); /* EMIT SIGNAL */
@ -305,11 +305,11 @@ Session::process_with_events (nframes_t nframes)
process_event (ev); 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 * 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) * 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); send_full_time_code(nframes);
} }

View file

@ -187,7 +187,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
pending_locate_flush = false; pending_locate_flush = false;
state_was_pending = false; state_was_pending = false;
set_next_event (); set_next_event ();
outbound_mtc_smpte_frame = 0; outbound_mtc_timecode_frame = 0;
next_quarter_frame_to_send = -1; next_quarter_frame_to_send = -1;
current_block_size = 0; current_block_size = 0;
solo_update_disabled = false; solo_update_disabled = false;
@ -244,10 +244,10 @@ Session::first_stage_init (string fullpath, string snapshot_name)
waiting_for_sync_offset = false; waiting_for_sync_offset = false;
} }
last_smpte_when = 0; last_timecode_when = 0;
_smpte_offset = 0; _timecode_offset = 0;
_smpte_offset_negative = true; _timecode_offset_negative = true;
last_smpte_valid = false; last_timecode_valid = false;
sync_time_vars (); sync_time_vars ();
@ -3103,7 +3103,7 @@ Session::config_changed (std::string p, bool ours)
setup_raid_path (config.get_raid_path()); setup_raid_path (config.get_raid_path());
} else if (p == "smpte-format") { } else if (p == "timecode-format") {
sync_time_vars (); sync_time_vars ();

View file

@ -52,102 +52,102 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt)
_tempo_map->bbt_time (when, bbt); _tempo_map->bbt_time (when, bbt);
} }
/* SMPTE TIME */ /* Timecode TIME */
float float
Session::smpte_frames_per_second() const Session::timecode_frames_per_second() const
{ {
switch (config.get_smpte_format()) { switch (config.get_timecode_format()) {
case smpte_23976: case timecode_23976:
return 23.976; return 23.976;
break; break;
case smpte_24: case timecode_24:
return 24; return 24;
break; break;
case smpte_24976: case timecode_24976:
return 24.976; return 24.976;
break; break;
case smpte_25: case timecode_25:
return 25; return 25;
break; break;
case smpte_2997: case timecode_2997:
return 29.97; return 29.97;
break; break;
case smpte_2997drop: case timecode_2997drop:
return 29.97; return 29.97;
break; break;
case smpte_30: case timecode_30:
return 30; return 30;
break; break;
case smpte_30drop: case timecode_30drop:
return 30; return 30;
break; break;
case smpte_5994: case timecode_5994:
return 59.94; return 59.94;
break; break;
case smpte_60: case timecode_60:
return 60; return 60;
break; break;
default: default:
cerr << "Editor received unexpected smpte type" << endl; cerr << "Editor received unexpected timecode type" << endl;
} }
return 30.0; return 30.0;
} }
bool bool
Session::smpte_drop_frames() const Session::timecode_drop_frames() const
{ {
switch (config.get_smpte_format()) { switch (config.get_timecode_format()) {
case smpte_23976: case timecode_23976:
return false; return false;
break; break;
case smpte_24: case timecode_24:
return false; return false;
break; break;
case smpte_24976: case timecode_24976:
return false; return false;
break; break;
case smpte_25: case timecode_25:
return false; return false;
break; break;
case smpte_2997: case timecode_2997:
return false; return false;
break; break;
case smpte_2997drop: case timecode_2997drop:
return true; return true;
break; break;
case smpte_30: case timecode_30:
return false; return false;
break; break;
case smpte_30drop: case timecode_30drop:
return true; return true;
break; break;
case smpte_5994: case timecode_5994:
return false; return false;
break; break;
case smpte_60: case timecode_60:
return false; return false;
break; break;
default: default:
cerr << "Editor received unexpected smpte type" << endl; cerr << "Editor received unexpected timecode type" << endl;
} }
return false; return false;
} }
@ -155,59 +155,59 @@ void
Session::sync_time_vars () Session::sync_time_vars ()
{ {
_current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0))); _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(); _frames_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second();
if (smpte_drop_frames()) { if (timecode_drop_frames()) {
_frames_per_hour = (long)(107892 * _frames_per_smpte_frame); _frames_per_hour = (long)(107892 * _frames_per_timecode_frame);
} else { } 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; last_timecode_valid = false;
// smpte type bits are the middle two in the upper nibble // timecode type bits are the middle two in the upper nibble
switch ((int) ceil (smpte_frames_per_second())) { switch ((int) ceil (timecode_frames_per_second())) {
case 24: case 24:
mtc_smpte_bits = 0; mtc_timecode_bits = 0;
break; break;
case 25: case 25:
mtc_smpte_bits = 0x20; mtc_timecode_bits = 0x20;
break; break;
case 30: case 30:
default: default:
if (smpte_drop_frames()) { if (timecode_drop_frames()) {
mtc_smpte_bits = 0x40; mtc_timecode_bits = 0x40;
} else { } else {
mtc_smpte_bits = 0x60; mtc_timecode_bits = 0x60;
} }
break; break;
}; };
} }
void void
Session::set_smpte_offset (nframes_t off) Session::set_timecode_offset (nframes_t off)
{ {
_smpte_offset = off; _timecode_offset = off;
last_smpte_valid = false; last_timecode_valid = false;
SMPTEOffsetChanged (); /* EMIT SIGNAL */ TimecodeOffsetChanged (); /* EMIT SIGNAL */
} }
void void
Session::set_smpte_offset_negative (bool neg) Session::set_timecode_offset_negative (bool neg)
{ {
_smpte_offset_negative = neg; _timecode_offset_negative = neg;
last_smpte_valid = false; last_timecode_valid = false;
SMPTEOffsetChanged (); /* EMIT SIGNAL */ TimecodeOffsetChanged (); /* EMIT SIGNAL */
} }
void 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.... // 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 // 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 // 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: // 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:00:00 0.0 0 0.000 0 (accurate)
// 0:00:59:29 1.8 144 60.027 2647177 // 0:00:59:29 1.8 144 60.027 2647177
// 0:01:00:02 -0.2 -16 60.060 2648648 // 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 <per@sigmond.no> // Per Sigmond <per@sigmond.no>
// Samples inside time dividable by 10 minutes (real time accurate) // 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) // Samples inside time exceeding the nearest 10 minutes (always offset, see above)
long exceeding_df_minutes = smpte.minutes % 10; long exceeding_df_minutes = timecode.minutes % 10;
long exceeding_df_seconds = (exceeding_df_minutes * 60) + smpte.seconds; long exceeding_df_seconds = (exceeding_df_minutes * 60) + timecode.seconds;
long exceeding_df_frames = (30 * exceeding_df_seconds) + smpte.frames - (2 * exceeding_df_minutes); 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_smpte_frame); nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_timecode_frame);
sample = base_samples + exceeding_samples; sample = base_samples + exceeding_samples;
} else { } else {
/* /*
Non drop is easy.. just note the use of Non drop is easy.. just note the use of
rint(smpte.rate) * _frames_per_smpte_frame rint(timecode.rate) * _frames_per_timecode_frame
(frames per SMPTE second), which is larger than (frames per Timecode second), which is larger than
frame_rate() in the non-integer SMPTE rate case. 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) { 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 (use_offset) {
if (smpte_offset_negative()) { if (timecode_offset_negative()) {
if (sample >= smpte_offset()) { if (sample >= timecode_offset()) {
sample -= smpte_offset(); sample -= timecode_offset();
} else { } else {
/* Prevent song-time from becoming negative */ /* Prevent song-time from becoming negative */
sample = 0; sample = 0;
} }
} else { } else {
if (smpte.negative) { if (timecode.negative) {
if (sample <= smpte_offset()) { if (sample <= timecode_offset()) {
sample = smpte_offset() - sample; sample = timecode_offset() - sample;
} else { } else {
sample = 0; sample = 0;
} }
} else { } 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 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; nframes_t offset_sample;
if (!use_offset) { if (!use_offset) {
offset_sample = sample; offset_sample = sample;
smpte.negative = false; timecode.negative = false;
} else { } else {
if (_smpte_offset_negative) { if (_timecode_offset_negative) {
offset_sample = sample + _smpte_offset; offset_sample = sample + _timecode_offset;
smpte.negative = false; timecode.negative = false;
} else { } else {
if (sample < _smpte_offset) { if (sample < _timecode_offset) {
offset_sample = (_smpte_offset - sample); offset_sample = (_timecode_offset - sample);
smpte.negative = true; timecode.negative = true;
} else { } else {
offset_sample = sample - _smpte_offset; offset_sample = sample - _timecode_offset;
smpte.negative = false; timecode.negative = false;
} }
} }
} }
double smpte_frames_left_exact; double timecode_frames_left_exact;
double smpte_frames_fraction; double timecode_frames_fraction;
unsigned long smpte_frames_left; unsigned long timecode_frames_left;
// Extract whole hours. Do this to prevent rounding errors with // Extract whole hours. Do this to prevent rounding errors with
// high sample numbers in the calculations that follow. // 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; offset_sample = offset_sample % _frames_per_hour;
// Calculate exact number of (exceeding) smpte frames and fractional frames // Calculate exact number of (exceeding) timecode frames and fractional frames
smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame; timecode_frames_left_exact = (double) offset_sample / _frames_per_timecode_frame;
smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact ); timecode_frames_fraction = timecode_frames_left_exact - floor( timecode_frames_left_exact );
smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame()); timecode.subframes = (long) rint(timecode_frames_fraction * config.get_subframes_per_frame());
// XXX Not sure if this is necessary anymore... // 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 ?) // This can happen with 24 fps (and 29.97 fps ?)
smpte_frames_left_exact = ceil( smpte_frames_left_exact ); timecode_frames_left_exact = ceil( timecode_frames_left_exact );
smpte.subframes = 0; timecode.subframes = 0;
} }
// Extract hour-exceeding frames for minute, second and frame calculations // 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()) { if (timecode_drop_frames()) {
// See long explanation in smpte_to_sample()... // See long explanation in timecode_to_sample()...
// Number of 10 minute chunks // 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 // 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 // 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) 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) 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 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 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) // 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 // Every minute except every 10th
if (exceeding_df_frames < 28) { if (exceeding_df_frames < 28) {
// First second, frames 0 and 1 are skipped // First second, frames 0 and 1 are skipped
smpte.seconds = 0; timecode.seconds = 0;
smpte.frames = exceeding_df_frames + 2; timecode.frames = exceeding_df_frames + 2;
} else { } else {
// All other seconds, all 30 frames are counted // All other seconds, all 30 frames are counted
exceeding_df_frames -= 28; exceeding_df_frames -= 28;
smpte.seconds = (exceeding_df_frames / 30) + 1; timecode.seconds = (exceeding_df_frames / 30) + 1;
smpte.frames = exceeding_df_frames % 30; timecode.frames = exceeding_df_frames % 30;
} }
} else { } else {
// Every 10th minute, all 30 frames counted in all seconds // Every 10th minute, all 30 frames counted in all seconds
smpte.seconds = exceeding_df_frames / 30; timecode.seconds = exceeding_df_frames / 30;
smpte.frames = exceeding_df_frames % 30; timecode.frames = exceeding_df_frames % 30;
} }
} else { } else {
// Non drop is easy // Non drop is easy
smpte.minutes = smpte_frames_left / ((long) rint (smpte_frames_per_second ()) * 60); timecode.minutes = timecode_frames_left / ((long) rint (timecode_frames_per_second ()) * 60);
smpte_frames_left = smpte_frames_left % ((long) rint (smpte_frames_per_second ()) * 60); timecode_frames_left = timecode_frames_left % ((long) rint (timecode_frames_per_second ()) * 60);
smpte.seconds = smpte_frames_left / (long) rint(smpte_frames_per_second ()); timecode.seconds = timecode_frames_left / (long) rint(timecode_frames_per_second ());
smpte.frames = smpte_frames_left % (long) rint(smpte_frames_per_second ()); timecode.frames = timecode_frames_left % (long) rint(timecode_frames_per_second ());
} }
if (!use_subframes) { if (!use_subframes) {
smpte.subframes = 0; timecode.subframes = 0;
} }
/* set frame rate and drop frame */ /* set frame rate and drop frame */
smpte.rate = smpte_frames_per_second (); timecode.rate = timecode_frames_per_second ();
smpte.drop = smpte_drop_frames(); timecode.drop = timecode_drop_frames();
} }
void 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) { if (last_timecode_valid && when == last_timecode_when) {
smpte = last_smpte; timecode = last_timecode;
return; 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_timecode_when = when;
last_smpte = smpte; last_timecode = timecode;
last_smpte_valid = true; last_timecode_valid = true;
} }
void 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) { if (last_timecode_valid && when == last_timecode_when) {
smpte = last_smpte; timecode = last_timecode;
return; 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_timecode_when = when;
last_smpte = smpte; last_timecode = timecode;
last_smpte_valid = true; last_timecode_valid = true;
} }
void 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 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); timecode_duration (when, timecode);
snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
} }
void void
Session::smpte_time (SMPTE::Time &t) Session::timecode_time (Timecode::Time &t)
{ {
smpte_time (_transport_frame, t); timecode_time (_transport_frame, t);
} }
int int
@ -520,15 +520,15 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/,
#ifdef HAVE_JACK_VIDEO_SUPPORT #ifdef HAVE_JACK_VIDEO_SUPPORT
//poke audio video ratio so Ardour can track Video Sync //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); pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio);
#endif #endif
#if 0 #if 0
/* SMPTE info */ /* Timecode info */
t.smpte_offset = _smpte_offset; t.timecode_offset = _timecode_offset;
t.smpte_frame_rate = smpte_frames_per_second(); t.timecode_frame_rate = timecode_frames_per_second();
if (_transport_speed) { 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); return _tempo_map->frame_time ( any.bbt);
break; break;
case AnyTime::SMPTE: case AnyTime::Timecode:
/* XXX need to handle negative values */ /* XXX need to handle negative values */
secs = any.smpte.hours * 60 * 60; secs = any.timecode.hours * 60 * 60;
secs += any.smpte.minutes * 60; secs += any.timecode.minutes * 60;
secs += any.smpte.seconds; secs += any.timecode.seconds;
secs += any.smpte.frames / smpte_frames_per_second(); secs += any.timecode.frames / timecode_frames_per_second();
if (_smpte_offset_negative) if (_timecode_offset_negative)
{ {
return (nframes_t) floor (secs * frame_rate()) - _smpte_offset; return (nframes_t) floor (secs * frame_rate()) - _timecode_offset;
} }
else else
{ {
return (nframes_t) floor (secs * frame_rate()) + _smpte_offset; return (nframes_t) floor (secs * frame_rate()) + _timecode_offset;
} }
break; break;

View file

@ -681,11 +681,11 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
return; return;
} }
// Update SMPTE time // Update Timecode time
// [DR] FIXME: find out exactly where this should go below // [DR] FIXME: find out exactly where this should go below
_transport_frame = target_frame; _transport_frame = target_frame;
smpte_time(_transport_frame, transmitting_smpte_time); timecode_time(_transport_frame, transmitting_timecode_time);
outbound_mtc_smpte_frame = _transport_frame; outbound_mtc_timecode_frame = _transport_frame;
next_quarter_frame_to_send = 0; next_quarter_frame_to_send = 0;
if (_transport_speed && (!with_loop || loop_changing)) { 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; loop_changing = false;
_send_smpte_update = true; _send_timecode_update = true;
Located (); /* EMIT SIGNAL */ Located (); /* EMIT SIGNAL */
} }

View file

@ -103,7 +103,7 @@ void MidiClockTicker::transport_state_changed()
send_stop_event(0); 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) void MidiClockTicker::position_changed(nframes_t position)
@ -133,7 +133,7 @@ void MidiClockTicker::transport_looped()
_last_tick = loop_location->start() - elapsed_since_last_tick; _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 #ifdef WITH_JACK_MIDI
if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f) if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f)

View file

@ -270,25 +270,25 @@ BasicUI::locked ()
} }
nframes_t 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 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 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 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);
} }

View file

@ -24,7 +24,7 @@
#include <string> #include <string>
#include <jack/types.h> #include <jack/types.h>
#include <control_protocol/smpte.h> #include <control_protocol/timecode.h>
namespace ARDOUR { namespace ARDOUR {
class Session; class Session;
@ -72,11 +72,11 @@ class BasicUI {
void rec_enable_toggle (); void rec_enable_toggle ();
void toggle_all_rec_enables (); 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 timecode_time (jack_nframes_t where, Timecode::Time&);
void smpte_to_sample (SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const; void timecode_to_sample (Timecode::Time& timecode, 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 sample_to_timecode (jack_nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
protected: protected:
BasicUI (); BasicUI ();

View file

@ -16,12 +16,12 @@
675 Mass Ave, Cambridge, MA 02139, USA. 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __ardour_smpte_h__ #ifndef __ardour_timecode_h__
#define __ardour_smpte_h__ #define __ardour_timecode_h__
#include <inttypes.h> #include <inttypes.h>
namespace SMPTE { namespace Timecode {
enum Wrap { enum Wrap {
NONE = 0, NONE = 0,
@ -36,11 +36,11 @@ struct Time {
uint32_t hours; uint32_t hours;
uint32_t minutes; uint32_t minutes;
uint32_t seconds; uint32_t seconds;
uint32_t frames; ///< SMPTE frames (not audio samples) uint32_t frames; ///< Timecode frames (not audio samples)
uint32_t subframes; ///< Typically unused uint32_t subframes; ///< Typically unused
float rate; ///< Frame rate of this Time float rate; ///< Frame rate of this Time
static float default_rate;///< Rate to use for default constructor static float default_rate;///< Rate to use for default constructor
bool drop; ///< Whether this Time uses dropframe SMPTE bool drop; ///< Whether this Time uses dropframe Timecode
Time(float a_rate = default_rate) { Time(float a_rate = default_rate) {
negative = false; negative = false;
@ -53,18 +53,18 @@ struct Time {
} }
}; };
Wrap increment( Time& smpte, uint32_t ); Wrap increment( Time& timecode, uint32_t );
Wrap decrement( Time& smpte, uint32_t ); Wrap decrement( Time& timecode, uint32_t );
Wrap increment_subframes( Time& smpte, uint32_t ); Wrap increment_subframes( Time& timecode, uint32_t );
Wrap decrement_subframes( Time& smpte, uint32_t ); Wrap decrement_subframes( Time& timecode, uint32_t );
Wrap increment_seconds( Time& smpte, uint32_t ); Wrap increment_seconds( Time& timecode, uint32_t );
Wrap increment_minutes( Time& smpte, uint32_t ); Wrap increment_minutes( Time& timecode, uint32_t );
Wrap increment_hours( Time& smpte, uint32_t ); Wrap increment_hours( Time& timecode, uint32_t );
void frames_floor( Time& smpte ); void frames_floor( Time& timecode );
void seconds_floor( Time& smpte ); void seconds_floor( Time& timecode );
void minutes_floor( Time& smpte ); void minutes_floor( Time& timecode );
void hours_floor( Time& smpte ); void hours_floor( Time& timecode );
} // namespace SMPTE } // namespace Timecode
#endif // __ardour_smpte_h__ #endif // __ardour_timecode_h__

View file

@ -16,186 +16,186 @@
675 Mass Ave, Cambridge, MA 02139, USA. 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define SMPTE_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours) #define Timecode_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_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" #include "ardour/rc_configuration.h"
namespace SMPTE { namespace Timecode {
float Time::default_rate = 30.0; 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. * Realtime safe.
* @return true if seconds wrap. * @return true if seconds wrap.
*/ */
Wrap Wrap
increment( Time& smpte, uint32_t subframes_per_frame ) increment( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
if (smpte.negative) { if (timecode.negative) {
if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) { if (Timecode_IS_AROUND_ZERO(timecode) && timecode.subframes) {
// We have a zero transition involving only subframes // We have a zero transition involving only subframes
smpte.subframes = subframes_per_frame - smpte.subframes; timecode.subframes = subframes_per_frame - timecode.subframes;
smpte.negative = false; timecode.negative = false;
return SECONDS; return SECONDS;
} }
smpte.negative = false; timecode.negative = false;
wrap = decrement( smpte, subframes_per_frame ); wrap = decrement( timecode, subframes_per_frame );
if (!SMPTE_IS_ZERO( smpte )) { if (!Timecode_IS_ZERO( timecode )) {
smpte.negative = true; timecode.negative = true;
} }
return wrap; return wrap;
} }
switch ((int)ceil(smpte.rate)) { switch ((int)ceil(timecode.rate)) {
case 24: case 24:
if (smpte.frames == 23) { if (timecode.frames == 23) {
smpte.frames = 0; timecode.frames = 0;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
case 25: case 25:
if (smpte.frames == 24) { if (timecode.frames == 24) {
smpte.frames = 0; timecode.frames = 0;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
case 30: case 30:
if (smpte.drop) { if (timecode.drop) {
if (smpte.frames == 29) { if (timecode.frames == 29) {
if ( ((smpte.minutes + 1) % 10) && (smpte.seconds == 59) ) { if ( ((timecode.minutes + 1) % 10) && (timecode.seconds == 59) ) {
smpte.frames = 2; timecode.frames = 2;
} }
else { else {
smpte.frames = 0; timecode.frames = 0;
} }
wrap = SECONDS; wrap = SECONDS;
} }
} else { } else {
if (smpte.frames == 29) { if (timecode.frames == 29) {
smpte.frames = 0; timecode.frames = 0;
wrap = SECONDS; wrap = SECONDS;
} }
} }
break; break;
case 60: case 60:
if (smpte.frames == 59) { if (timecode.frames == 59) {
smpte.frames = 0; timecode.frames = 0;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
} }
if (wrap == SECONDS) { if (wrap == SECONDS) {
if (smpte.seconds == 59) { if (timecode.seconds == 59) {
smpte.seconds = 0; timecode.seconds = 0;
wrap = MINUTES; wrap = MINUTES;
if (smpte.minutes == 59) { if (timecode.minutes == 59) {
smpte.minutes = 0; timecode.minutes = 0;
wrap = HOURS; wrap = HOURS;
smpte.hours++; timecode.hours++;
} else { } else {
smpte.minutes++; timecode.minutes++;
} }
} else { } else {
smpte.seconds++; timecode.seconds++;
} }
} else { } else {
smpte.frames++; timecode.frames++;
} }
return wrap; return wrap;
} }
/** Decrement @a smpte by exactly one frame (keep subframes value) /** Decrement @a timecode by exactly one frame (keep subframes value)
* Realtime safe. * Realtime safe.
* @return true if seconds wrap. */ * @return true if seconds wrap. */
Wrap Wrap
decrement( Time& smpte, uint32_t subframes_per_frame ) decrement( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
if (smpte.negative || SMPTE_IS_ZERO(smpte)) { if (timecode.negative || Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
wrap = increment( smpte, subframes_per_frame ); wrap = increment( timecode, subframes_per_frame );
smpte.negative = true; timecode.negative = true;
return wrap; 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 // We have a zero transition involving only subframes
smpte.subframes = subframes_per_frame - smpte.subframes; timecode.subframes = subframes_per_frame - timecode.subframes;
smpte.negative = true; timecode.negative = true;
return SECONDS; return SECONDS;
} }
switch ((int)ceil(smpte.rate)) { switch ((int)ceil(timecode.rate)) {
case 24: case 24:
if (smpte.frames == 0) { if (timecode.frames == 0) {
smpte.frames = 23; timecode.frames = 23;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
case 25: case 25:
if (smpte.frames == 0) { if (timecode.frames == 0) {
smpte.frames = 24; timecode.frames = 24;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
case 30: case 30:
if (smpte.drop) { if (timecode.drop) {
if ((smpte.minutes % 10) && (smpte.seconds == 0)) { if ((timecode.minutes % 10) && (timecode.seconds == 0)) {
if (smpte.frames <= 2) { if (timecode.frames <= 2) {
smpte.frames = 29; timecode.frames = 29;
wrap = SECONDS; wrap = SECONDS;
} }
} else if (smpte.frames == 0) { } else if (timecode.frames == 0) {
smpte.frames = 29; timecode.frames = 29;
wrap = SECONDS; wrap = SECONDS;
} }
} else { } else {
if (smpte.frames == 0) { if (timecode.frames == 0) {
smpte.frames = 29; timecode.frames = 29;
wrap = SECONDS; wrap = SECONDS;
} }
} }
break; break;
case 60: case 60:
if (smpte.frames == 0) { if (timecode.frames == 0) {
smpte.frames = 59; timecode.frames = 59;
wrap = SECONDS; wrap = SECONDS;
} }
break; break;
} }
if (wrap == SECONDS) { if (wrap == SECONDS) {
if (smpte.seconds == 0) { if (timecode.seconds == 0) {
smpte.seconds = 59; timecode.seconds = 59;
wrap = MINUTES; wrap = MINUTES;
if (smpte.minutes == 0) { if (timecode.minutes == 0) {
smpte.minutes = 59; timecode.minutes = 59;
wrap = HOURS; wrap = HOURS;
smpte.hours--; timecode.hours--;
} }
else { else {
smpte.minutes--; timecode.minutes--;
} }
} else { } else {
smpte.seconds--; timecode.seconds--;
} }
} else { } else {
smpte.frames--; timecode.frames--;
} }
if (SMPTE_IS_ZERO( smpte )) { if (Timecode_IS_ZERO( timecode )) {
smpte.negative = false; timecode.negative = false;
} }
return wrap; 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 :-) ) */ /** Go to lowest absolute subframe value in this frame (set to 0 :-) ) */
void void
frames_floor( Time& smpte ) frames_floor( Time& timecode )
{ {
smpte.subframes = 0; timecode.subframes = 0;
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
} }
/** Increment @a smpte by one subframe */ /** Increment @a timecode by one subframe */
Wrap Wrap
increment_subframes( Time& smpte, uint32_t subframes_per_frame ) increment_subframes( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
if (smpte.negative) { if (timecode.negative) {
smpte.negative = false; timecode.negative = false;
wrap = decrement_subframes( smpte, subframes_per_frame ); wrap = decrement_subframes( timecode, subframes_per_frame );
if (!SMPTE_IS_ZERO(smpte)) { if (!Timecode_IS_ZERO(timecode)) {
smpte.negative = true; timecode.negative = true;
} }
return wrap; return wrap;
} }
smpte.subframes++; timecode.subframes++;
if (smpte.subframes >= subframes_per_frame) { if (timecode.subframes >= subframes_per_frame) {
smpte.subframes = 0; timecode.subframes = 0;
increment( smpte, subframes_per_frame ); increment( timecode, subframes_per_frame );
return FRAMES; return FRAMES;
} }
return NONE; return NONE;
} }
/** Decrement @a smpte by one subframe */ /** Decrement @a timecode by one subframe */
Wrap Wrap
decrement_subframes( Time& smpte, uint32_t subframes_per_frame ) decrement_subframes( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
if (smpte.negative) { if (timecode.negative) {
smpte.negative = false; timecode.negative = false;
wrap = increment_subframes( smpte, subframes_per_frame ); wrap = increment_subframes( timecode, subframes_per_frame );
smpte.negative = true; timecode.negative = true;
return wrap; return wrap;
} }
if (smpte.subframes <= 0) { if (timecode.subframes <= 0) {
smpte.subframes = 0; timecode.subframes = 0;
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = true; timecode.negative = true;
smpte.subframes = 1; timecode.subframes = 1;
return FRAMES; return FRAMES;
} else { } else {
decrement( smpte, subframes_per_frame ); decrement( timecode, subframes_per_frame );
smpte.subframes = 79; timecode.subframes = 79;
return FRAMES; return FRAMES;
} }
} else { } else {
smpte.subframes--; timecode.subframes--;
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
return NONE; 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) */ /** Go to next whole second (frames == 0 or frames == 2) */
Wrap Wrap
increment_seconds( Time& smpte, uint32_t subframes_per_frame ) increment_seconds( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
// Clear subframes // Clear subframes
frames_floor( smpte ); frames_floor( timecode );
if (smpte.negative) { if (timecode.negative) {
// Wrap second if on second boundary // Wrap second if on second boundary
wrap = increment(smpte, subframes_per_frame); wrap = increment(timecode, subframes_per_frame);
// Go to lowest absolute frame value // Go to lowest absolute frame value
seconds_floor( smpte ); seconds_floor( timecode );
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
} else { } else {
// Go to highest possible frame in this second // Go to highest possible frame in this second
switch ((int)ceil(smpte.rate)) { switch ((int)ceil(timecode.rate)) {
case 24: case 24:
smpte.frames = 23; timecode.frames = 23;
break; break;
case 25: case 25:
smpte.frames = 24; timecode.frames = 24;
break; break;
case 30: case 30:
smpte.frames = 29; timecode.frames = 29;
break; break;
case 60: case 60:
smpte.frames = 59; timecode.frames = 59;
break; break;
} }
// Increment by one frame // Increment by one frame
wrap = increment( smpte, subframes_per_frame ); wrap = increment( timecode, subframes_per_frame );
} }
return wrap; return wrap;
@ -317,55 +317,55 @@ increment_seconds( Time& smpte, uint32_t subframes_per_frame )
/** Go to lowest (absolute) frame value in this second /** Go to lowest (absolute) frame value in this second
* Doesn't care about positive/negative */ * Doesn't care about positive/negative */
void void
seconds_floor( Time& smpte ) seconds_floor( Time& timecode )
{ {
// Clear subframes // Clear subframes
frames_floor( smpte ); frames_floor( timecode );
// Go to lowest possible frame in this second // Go to lowest possible frame in this second
switch ((int)ceil(smpte.rate)) { switch ((int)ceil(timecode.rate)) {
case 24: case 24:
case 25: case 25:
case 30: case 30:
case 60: case 60:
if (!(smpte.drop)) { if (!(timecode.drop)) {
smpte.frames = 0; timecode.frames = 0;
} else { } else {
if ((smpte.minutes % 10) && (smpte.seconds == 0)) { if ((timecode.minutes % 10) && (timecode.seconds == 0)) {
smpte.frames = 2; timecode.frames = 2;
} else { } else {
smpte.frames = 0; timecode.frames = 0;
} }
} }
break; break;
} }
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
} }
/** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */ /** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
Wrap Wrap
increment_minutes( Time& smpte, uint32_t subframes_per_frame ) increment_minutes( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
// Clear subframes // Clear subframes
frames_floor( smpte ); frames_floor( timecode );
if (smpte.negative) { if (timecode.negative) {
// Wrap if on minute boundary // 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 // Go to lowest possible value in this minute
minutes_floor( smpte ); minutes_floor( timecode );
} else { } else {
// Go to highest possible second // Go to highest possible second
smpte.seconds = 59; timecode.seconds = 59;
// Wrap minute by incrementing second // Wrap minute by incrementing second
wrap = increment_seconds( smpte, subframes_per_frame ); wrap = increment_seconds( timecode, subframes_per_frame );
} }
return wrap; return wrap;
@ -374,36 +374,36 @@ increment_minutes( Time& smpte, uint32_t subframes_per_frame )
/** Go to lowest absolute value in this minute */ /** Go to lowest absolute value in this minute */
void void
minutes_floor( Time& smpte ) minutes_floor( Time& timecode )
{ {
// Go to lowest possible second // Go to lowest possible second
smpte.seconds = 0; timecode.seconds = 0;
// Go to lowest possible frame // Go to lowest possible frame
seconds_floor( smpte ); seconds_floor( timecode );
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
} }
/** Go to next whole hour (minute = 0, second = 0, frame = 0) */ /** Go to next whole hour (minute = 0, second = 0, frame = 0) */
Wrap Wrap
increment_hours( Time& smpte, uint32_t subframes_per_frame ) increment_hours( Time& timecode, uint32_t subframes_per_frame )
{ {
Wrap wrap = NONE; Wrap wrap = NONE;
// Clear subframes // Clear subframes
frames_floor(smpte); frames_floor(timecode);
if (smpte.negative) { if (timecode.negative) {
// Wrap if on hour boundary // 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 // Go to lowest possible value in this hour
hours_floor( smpte ); hours_floor( timecode );
} else { } else {
smpte.minutes = 59; timecode.minutes = 59;
wrap = increment_minutes( smpte, subframes_per_frame ); wrap = increment_minutes( timecode, subframes_per_frame );
} }
return wrap; return wrap;
@ -412,17 +412,17 @@ increment_hours( Time& smpte, uint32_t subframes_per_frame )
/** Go to lowest absolute value in this hour */ /** Go to lowest absolute value in this hour */
void void
hours_floor( Time& smpte ) hours_floor( Time& timecode )
{ {
smpte.minutes = 0; timecode.minutes = 0;
smpte.seconds = 0; timecode.seconds = 0;
smpte.frames = 0; timecode.frames = 0;
smpte.subframes = 0; timecode.subframes = 0;
if (SMPTE_IS_ZERO(smpte)) { if (Timecode_IS_ZERO(timecode)) {
smpte.negative = false; timecode.negative = false;
} }
} }
} // namespace SMPTE } // namespace Timecode

View file

@ -492,10 +492,10 @@ void Mackie::BcfSurface::init_controls()
group->add( *button ); group->add( *button );
group = groups["display"]; group = groups["display"];
button = new Button ( 53, 1, "smpte_beats", *group ); button = new Button ( 53, 1, "timecode_beats", *group );
buttons[0x35] = button; buttons[0x35] = button;
controls.push_back( button ); controls.push_back( button );
controls_by_name["smpte_beats"] = button; controls_by_name["timecode_beats"] = button;
group->add( *button ); group->add( *button );
group = groups["none"]; group = groups["none"];
@ -903,10 +903,10 @@ void Mackie::BcfSurface::init_controls()
group->add( *button ); group->add( *button );
group = groups["none"]; group = groups["none"];
led = new Led ( 113, 1, "smpte", *group ); led = new Led ( 113, 1, "timecode", *group );
leds[0x71] = led; leds[0x71] = led;
controls.push_back( led ); controls.push_back( led );
controls_by_name["smpte"] = led; controls_by_name["timecode"] = led;
group->add( *led ); group->add( *led );
group = groups["none"]; group = groups["none"];
@ -1048,10 +1048,10 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
} }
break; break;
case 0x9035: // smpte_beats case 0x9035: // timecode_beats
switch ( bs ) { switch ( bs ) {
case press: ls = mbh.smpte_beats_press( button ); break; case press: ls = mbh.timecode_beats_press( button ); break;
case release: ls = mbh.smpte_beats_release( button ); break; case release: ls = mbh.timecode_beats_release( button ); break;
case neither: break; case neither: break;
} }
break; break;

View file

@ -150,12 +150,12 @@ LedState MackieButtonHandler::name_value_release( Button & button )
return default_button_release( 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 ); return default_button_press( button );
} }
LedState MackieButtonHandler::smpte_beats_release( Button & button ) LedState MackieButtonHandler::timecode_beats_release( Button & button )
{ {
return default_button_release( button ); return default_button_release( button );
} }

View file

@ -59,8 +59,8 @@ public:
virtual LedState name_value_press( Button & ); virtual LedState name_value_press( Button & );
virtual LedState name_value_release( Button & ); virtual LedState name_value_release( Button & );
virtual LedState smpte_beats_press( Button & ); virtual LedState timecode_beats_press( Button & );
virtual LedState smpte_beats_release( Button & ); virtual LedState timecode_beats_release( Button & );
virtual LedState F1_press( Button & ); virtual LedState F1_press( Button & );
virtual LedState F1_release( Button & ); virtual LedState F1_release( Button & );

View file

@ -316,7 +316,7 @@ void MackieControlProtocol::switch_banks( int initial )
void MackieControlProtocol::zero_all() void MackieControlProtocol::zero_all()
{ {
// TODO turn off SMPTE displays // TODO turn off Timecode displays
// zero all strips // zero all strips
for ( Surface::Strips::iterator it = surface().strips.begin(); it != surface().strips.end(); ++it ) 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 ) switch ( _timecode_type )
{ {
case ARDOUR::AnyTime::BBT: case ARDOUR::AnyTime::BBT:
update_global_led( "beats", on ); update_global_led( "beats", on );
update_global_led( "smpte", off ); update_global_led( "timecode", off );
break; break;
case ARDOUR::AnyTime::SMPTE: case ARDOUR::AnyTime::Timecode:
update_global_led( "smpte", on ); update_global_led( "timecode", on );
update_global_led( "beats", off ); update_global_led( "beats", off );
break; break;
default: default:
@ -557,7 +557,7 @@ void MackieControlProtocol::update_surface()
// update global buttons and displays // update global buttons and displays
notify_record_state_changed(); notify_record_state_changed();
notify_transport_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(); return os.str();
} }
string MackieControlProtocol::format_smpte_timecode( nframes_t now_frame ) string MackieControlProtocol::format_timecode_timecode( nframes_t now_frame )
{ {
SMPTE::Time smpte; Timecode::Time timecode;
session->smpte_time( now_frame, smpte ); session->timecode_time( now_frame, timecode );
// According to the Logic docs // According to the Logic docs
// digits: 888/88/88/888 // digits: 888/88/88/888
// SMPTE mode: Hours/Minutes/Seconds/Frames // Timecode mode: Hours/Minutes/Seconds/Frames
ostringstream os; ostringstream os;
os << setw(3) << setfill('0') << smpte.hours; os << setw(3) << setfill('0') << timecode.hours;
os << setw(2) << setfill('0') << smpte.minutes; os << setw(2) << setfill('0') << timecode.minutes;
os << setw(2) << setfill('0') << smpte.seconds; os << setw(2) << setfill('0') << timecode.seconds;
os << setw(3) << setfill('0') << smpte.frames; os << setw(3) << setfill('0') << timecode.frames;
return os.str(); return os.str();
} }
@ -1176,8 +1176,8 @@ void MackieControlProtocol::update_timecode_display()
case ARDOUR::AnyTime::BBT: case ARDOUR::AnyTime::BBT:
timecode = format_bbt_timecode( current_frame ); timecode = format_bbt_timecode( current_frame );
break; break;
case ARDOUR::AnyTime::SMPTE: case ARDOUR::AnyTime::Timecode:
timecode = format_smpte_timecode( current_frame ); timecode = format_timecode_timecode( current_frame );
break; break;
default: default:
ostringstream os; ostringstream os;
@ -1712,14 +1712,14 @@ LedState MackieControlProtocol::save_release (Button &)
return off; return off;
} }
LedState MackieControlProtocol::smpte_beats_press (Button &) LedState MackieControlProtocol::timecode_beats_press (Button &)
{ {
switch ( _timecode_type ) switch ( _timecode_type )
{ {
case ARDOUR::AnyTime::BBT: case ARDOUR::AnyTime::BBT:
_timecode_type = ARDOUR::AnyTime::SMPTE; _timecode_type = ARDOUR::AnyTime::Timecode;
break; break;
case ARDOUR::AnyTime::SMPTE: case ARDOUR::AnyTime::Timecode:
_timecode_type = ARDOUR::AnyTime::BBT; _timecode_type = ARDOUR::AnyTime::BBT;
break; break;
default: default:
@ -1727,11 +1727,11 @@ LedState MackieControlProtocol::smpte_beats_press (Button &)
os << "Unknown Anytime::Type " << _timecode_type; os << "Unknown Anytime::Type " << _timecode_type;
throw runtime_error( os.str() ); throw runtime_error( os.str() );
} }
update_smpte_beats_led(); update_timecode_beats_led();
return on; return on;
} }
LedState MackieControlProtocol::smpte_beats_release( Button & ) LedState MackieControlProtocol::timecode_beats_release( Button & )
{ {
return off; return off;
} }

View file

@ -121,9 +121,9 @@ class MackieControlProtocol
void notify_parameter_changed( std::string const & ); void notify_parameter_changed( std::string const & );
void notify_solo_active_changed( bool ); 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 /// 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. /// this is called to generate the midi to send in response to a button press.
void update_led( Mackie::Button & button, Mackie::LedState ); 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_press( Mackie::Button & );
virtual Mackie::LedState save_release( Mackie::Button & ); virtual Mackie::LedState save_release( Mackie::Button & );
virtual Mackie::LedState smpte_beats_press( Mackie::Button & ); virtual Mackie::LedState timecode_beats_press( Mackie::Button & );
virtual Mackie::LedState smpte_beats_release( Mackie::Button & ); virtual Mackie::LedState timecode_beats_release( Mackie::Button & );
// jog wheel states // jog wheel states
virtual Mackie::LedState zoom_press( Mackie::Button & ); virtual Mackie::LedState zoom_press( Mackie::Button & );
@ -295,7 +295,7 @@ class MackieControlProtocol
void update_timecode_display(); void update_timecode_display();
std::string format_bbt_timecode( nframes_t now_frame ); 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. notification that the port is about to start it's init sequence.
@ -365,7 +365,7 @@ class MackieControlProtocol
// last written timecode string // last written timecode string
std::string _timecode_last; 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; ARDOUR::AnyTime::Type _timecode_type;
}; };

View file

@ -538,10 +538,10 @@ void Mackie::MackieSurface::init_controls()
group->add( *button ); group->add( *button );
group = groups["display"]; group = groups["display"];
button = new Button ( 53, 1, "smpte_beats", *group ); button = new Button ( 53, 1, "timecode_beats", *group );
buttons[0x35] = button; buttons[0x35] = button;
controls.push_back( button ); controls.push_back( button );
controls_by_name["smpte_beats"] = button; controls_by_name["timecode_beats"] = button;
group->add( *button ); group->add( *button );
group = groups["none"]; group = groups["none"];
@ -949,10 +949,10 @@ void Mackie::MackieSurface::init_controls()
group->add( *button ); group->add( *button );
group = groups["none"]; group = groups["none"];
led = new Led ( 113, 1, "smpte", *group ); led = new Led ( 113, 1, "timecode", *group );
leds[0x71] = led; leds[0x71] = led;
controls.push_back( led ); controls.push_back( led );
controls_by_name["smpte"] = led; controls_by_name["timecode"] = led;
group->add( *led ); group->add( *led );
group = groups["none"]; group = groups["none"];
@ -1094,10 +1094,10 @@ void Mackie::MackieSurface::handle_button( MackieButtonHandler & mbh, ButtonStat
} }
break; break;
case 0x9035: // smpte_beats case 0x9035: // timecode_beats
switch ( bs ) { switch ( bs ) {
case press: ls = mbh.smpte_beats_press( button ); break; case press: ls = mbh.timecode_beats_press( button ); break;
case release: ls = mbh.smpte_beats_release( button ); break; case release: ls = mbh.timecode_beats_release( button ); break;
case neither: break; case neither: break;
} }
break; break;

View file

@ -353,29 +353,29 @@ TranzportControlProtocol::show_transport_time ()
} }
void void
TranzportControlProtocol::show_smpte (nframes_t where) TranzportControlProtocol::show_timecode (nframes_t where)
{ {
if ((where != last_where) || lcd_isdamaged(1,9,10)) { if ((where != last_where) || lcd_isdamaged(1,9,10)) {
char buf[5]; char buf[5];
SMPTE::Time smpte; Timecode::Time timecode;
session->smpte_time (where, smpte); session->timecode_time (where, timecode);
if (smpte.negative) { if (timecode.negative) {
sprintf (buf, "-%02" PRIu32 ":", smpte.hours); sprintf (buf, "-%02" PRIu32 ":", timecode.hours);
} else { } else {
sprintf (buf, " %02" PRIu32 ":", smpte.hours); sprintf (buf, " %02" PRIu32 ":", timecode.hours);
} }
print (1, 8, buf); print (1, 8, buf);
sprintf (buf, "%02" PRIu32 ":", smpte.minutes); sprintf (buf, "%02" PRIu32 ":", timecode.minutes);
print (1, 12, buf); print (1, 12, buf);
sprintf (buf, "%02" PRIu32 ":", smpte.seconds); sprintf (buf, "%02" PRIu32 ":", timecode.seconds);
print (1, 15, buf); print (1, 15, buf);
sprintf (buf, "%02" PRIu32, smpte.frames); sprintf (buf, "%02" PRIu32, timecode.frames);
print_noretry (1, 18, buf); print_noretry (1, 18, buf);
last_where = where; last_where = where;

View file

@ -308,7 +308,7 @@ private:
void show_track_gain (); void show_track_gain ();
void show_transport_time (); void show_transport_time ();
void show_bbt (nframes_t where); void show_bbt (nframes_t where);
void show_smpte (nframes_t where); void show_timecode (nframes_t where);
void show_wheel_mode (); void show_wheel_mode ();
void show_gain (); void show_gain ();
void show_pan (); void show_pan ();