2 Copyright (C) 1999 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <cstdio> // for sprintf
23 #include <pbd/convert.h>
24 #include <pbd/enumwriter.h>
26 #include <gtkmm2ext/utils.h>
28 #include <ardour/ardour.h>
29 #include <ardour/session.h>
30 #include <ardour/tempo.h>
31 #include <ardour/profile.h>
32 #include <sigc++/bind.h>
34 #include "ardour_ui.h"
35 #include "audio_clock.h"
40 using namespace ARDOUR;
49 sigc::signal<void> AudioClock::ModeChanged;
50 vector<AudioClock*> AudioClock::clocks;
52 const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
54 2, /* SMPTE_Minutes */
55 2, /* SMPTE_Seconds */
66 AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info)
68 is_transient (transient),
69 is_duration (duration),
70 editable (allow_edit),
86 bbt_reference_time = -1;
89 frames_upper_info_label = manage (new Label);
90 frames_lower_info_label = manage (new Label);
91 smpte_upper_info_label = manage (new Label);
92 smpte_lower_info_label = manage (new Label);
93 bbt_upper_info_label = manage (new Label);
94 bbt_lower_info_label = manage (new Label);
96 frames_upper_info_label->set_name ("AudioClockFramesUpperInfo");
97 frames_lower_info_label->set_name ("AudioClockFramesLowerInfo");
98 smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo");
99 smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo");
100 bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo");
101 bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo");
103 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0);
104 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0);
106 frames_info_box.pack_start (*frames_upper_info_label, true, true);
107 frames_info_box.pack_start (*frames_lower_info_label, true, true);
108 smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
109 smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
110 bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
111 bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
114 frames_upper_info_label = 0;
115 frames_lower_info_label = 0;
116 smpte_upper_info_label = 0;
117 smpte_lower_info_label = 0;
118 bbt_upper_info_label = 0;
119 bbt_lower_info_label = 0;
122 audio_frames_ebox.add (audio_frames_label);
124 frames_packer.set_homogeneous (false);
125 frames_packer.set_border_width (2);
126 frames_packer.pack_start (audio_frames_ebox, false, false);
129 frames_packer.pack_start (frames_info_box, false, false, 5);
132 frames_packer_hbox.pack_start (frames_packer, true, false);
134 hours_ebox.add (hours_label);
135 minutes_ebox.add (minutes_label);
136 seconds_ebox.add (seconds_label);
137 frames_ebox.add (frames_label);
138 bars_ebox.add (bars_label);
139 beats_ebox.add (beats_label);
140 ticks_ebox.add (ticks_label);
141 ms_hours_ebox.add (ms_hours_label);
142 ms_minutes_ebox.add (ms_minutes_label);
143 ms_seconds_ebox.add (ms_seconds_label);
145 smpte_packer.set_homogeneous (false);
146 smpte_packer.set_border_width (2);
147 smpte_packer.pack_start (hours_ebox, false, false);
148 smpte_packer.pack_start (colon1, false, false);
149 smpte_packer.pack_start (minutes_ebox, false, false);
150 smpte_packer.pack_start (colon2, false, false);
151 smpte_packer.pack_start (seconds_ebox, false, false);
152 smpte_packer.pack_start (colon3, false, false);
153 smpte_packer.pack_start (frames_ebox, false, false);
156 smpte_packer.pack_start (smpte_info_box, false, false, 5);
159 smpte_packer_hbox.pack_start (smpte_packer, true, false);
161 bbt_packer.set_homogeneous (false);
162 bbt_packer.set_border_width (2);
163 bbt_packer.pack_start (bars_ebox, false, false);
164 bbt_packer.pack_start (b1, false, false);
165 bbt_packer.pack_start (beats_ebox, false, false);
166 bbt_packer.pack_start (b2, false, false);
167 bbt_packer.pack_start (ticks_ebox, false, false);
170 bbt_packer.pack_start (bbt_info_box, false, false, 5);
173 bbt_packer_hbox.pack_start (bbt_packer, true, false);
175 minsec_packer.set_homogeneous (false);
176 minsec_packer.set_border_width (2);
177 minsec_packer.pack_start (ms_hours_ebox, false, false);
178 minsec_packer.pack_start (colon4, false, false);
179 minsec_packer.pack_start (ms_minutes_ebox, false, false);
180 minsec_packer.pack_start (colon5, false, false);
181 minsec_packer.pack_start (ms_seconds_ebox, false, false);
183 minsec_packer_hbox.pack_start (minsec_packer, true, false);
185 clock_frame.set_shadow_type (Gtk::SHADOW_IN);
186 clock_frame.set_name ("BaseFrame");
188 clock_frame.add (clock_base);
190 set_widget_name (widget_name);
192 _mode = BBT; /* lie to force mode switch */
195 pack_start (clock_frame, true, true);
197 /* the clock base handles button releases for menu popup regardless of
198 editable status. if the clock is editable, the clock base is where
199 we pass focus to after leaving the last editable "field", which
200 will then shutdown editing till the user starts it up again.
202 it does this because the focus out event on the field disables
203 keyboard event handling, and we don't connect anything up to
204 notice focus in on the clock base. hence, keyboard event handling
208 clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
209 clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
211 Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
217 set (last_when, true);
220 clocks.push_back (this);
225 AudioClock::set_widget_name (string name)
227 Widget::set_name (name);
229 clock_base.set_name (name);
231 audio_frames_label.set_name (name);
232 hours_label.set_name (name);
233 minutes_label.set_name (name);
234 seconds_label.set_name (name);
235 frames_label.set_name (name);
236 bars_label.set_name (name);
237 beats_label.set_name (name);
238 ticks_label.set_name (name);
239 ms_hours_label.set_name (name);
240 ms_minutes_label.set_name (name);
241 ms_seconds_label.set_name (name);
242 hours_ebox.set_name (name);
243 minutes_ebox.set_name (name);
244 seconds_ebox.set_name (name);
245 frames_ebox.set_name (name);
246 audio_frames_ebox.set_name (name);
247 bars_ebox.set_name (name);
248 beats_ebox.set_name (name);
249 ticks_ebox.set_name (name);
250 ms_hours_ebox.set_name (name);
251 ms_minutes_ebox.set_name (name);
252 ms_seconds_ebox.set_name (name);
254 colon1.set_name (name);
255 colon2.set_name (name);
256 colon3.set_name (name);
257 colon4.set_name (name);
258 colon5.set_name (name);
266 AudioClock::setup_events ()
268 clock_base.set_flags (Gtk::CAN_FOCUS);
270 hours_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
271 minutes_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
272 seconds_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
273 frames_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
274 bars_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
275 beats_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
276 ticks_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
277 ms_hours_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
278 ms_minutes_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
279 ms_seconds_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
280 audio_frames_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
282 hours_ebox.set_flags (Gtk::CAN_FOCUS);
283 minutes_ebox.set_flags (Gtk::CAN_FOCUS);
284 seconds_ebox.set_flags (Gtk::CAN_FOCUS);
285 frames_ebox.set_flags (Gtk::CAN_FOCUS);
286 audio_frames_ebox.set_flags (Gtk::CAN_FOCUS);
287 bars_ebox.set_flags (Gtk::CAN_FOCUS);
288 beats_ebox.set_flags (Gtk::CAN_FOCUS);
289 ticks_ebox.set_flags (Gtk::CAN_FOCUS);
290 ms_hours_ebox.set_flags (Gtk::CAN_FOCUS);
291 ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS);
292 ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS);
294 hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours));
295 minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes));
296 seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds));
297 frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames));
298 audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
299 bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
300 beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
301 ticks_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
302 ms_hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
303 ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
304 ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
306 hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours));
307 minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes));
308 seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds));
309 frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames));
310 audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
311 bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars));
312 beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats));
313 ticks_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
314 ms_hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
315 ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
316 ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
318 hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours));
319 minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes));
320 seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds));
321 frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames));
322 audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
323 bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars));
324 beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats));
325 ticks_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
326 ms_hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
327 ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
328 ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
330 hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours));
331 minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes));
332 seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds));
333 frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames));
334 audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
335 bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
336 beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
337 ticks_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
338 ms_hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
339 ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
340 ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
342 hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours));
343 minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes));
344 seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds));
345 frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames));
346 audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
347 bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars));
348 beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats));
349 ticks_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
350 ms_hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
351 ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
352 ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
354 hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours));
355 minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes));
356 seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds));
357 frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames));
358 audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
359 bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars));
360 beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats));
361 ticks_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
362 ms_hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
363 ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
364 ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
366 hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours));
367 minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes));
368 seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds));
369 frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames));
370 audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
371 bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
372 beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
373 ticks_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
374 ms_hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
375 ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
376 ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
378 hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours));
379 minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes));
380 seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds));
381 frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames));
382 audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
383 bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
384 beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
385 ticks_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
386 ms_hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
387 ms_minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
388 ms_seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
390 clock_base.signal_focus_in_event().connect (mem_fun (*this, &AudioClock::drop_focus_handler));
394 AudioClock::drop_focus_handler (GdkEventFocus* ignored)
396 Keyboard::magic_widget_drop_focus ();
401 AudioClock::on_realize ()
405 /* styles are not available until the widgets are bound to a window */
407 set_size_requests ();
411 AudioClock::set (nframes_t when, bool force, nframes_t offset, int which)
414 if ((!force && !is_visible()) || session == 0) {
418 if (when == last_when && !offset && !force) {
422 bool pdelta = Config->get_primary_clock_delta_edit_cursor();
423 bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
425 if (offset && which == 1 && pdelta) {
426 when = (when > offset) ? when - offset : offset - when;
427 } else if (offset && which == 2 && sdelta) {
428 when = (when > offset) ? when - offset : offset - when;
431 if (which == 1 && pdelta && !last_pdelta) {
432 cout << "set_widget_name() called" << endl;
433 set_widget_name("TransportClockDisplayDelta");
435 } else if (which == 1 && !pdelta && last_pdelta) {
436 set_widget_name("TransportClockDisplay");
438 } else if (which == 2 && sdelta && !last_sdelta) {
439 set_widget_name("SecondaryClockDisplayDelta");
441 } else if (which == 2 && !sdelta && last_sdelta) {
442 set_widget_name("SecondaryClockDisplay");
448 set_smpte (when, force);
452 set_bbt (when, force);
456 set_minsec (when, force);
460 set_frames (when, force);
471 AudioClock::smpte_offset_changed ()
478 current = current_duration();
480 current = current_time ();
490 AudioClock::set_frames (nframes_t when, bool force)
493 snprintf (buf, sizeof (buf), "%u", when);
494 audio_frames_label.set_text (buf);
496 if (frames_upper_info_label) {
497 nframes_t rate = session->frame_rate();
499 if (fmod (rate, 1000.0) == 0.000) {
500 sprintf (buf, "%uK", rate/1000);
502 sprintf (buf, "%.3fK", rate/1000.0f);
505 if (frames_upper_info_label->get_text() != buf) {
506 frames_upper_info_label->set_text (buf);
509 float vid_pullup = Config->get_video_pullup();
511 if (vid_pullup == 0.0) {
512 if (frames_lower_info_label->get_text () != _("none")) {
513 frames_lower_info_label->set_text(_("none"));
516 sprintf (buf, "%-6.4f", vid_pullup);
517 if (frames_lower_info_label->get_text() != buf) {
518 frames_lower_info_label->set_text (buf);
525 AudioClock::set_minsec (nframes_t when, bool force)
534 hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
535 left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
536 mins = (int) floor (left / (session->frame_rate() * 60.0f));
537 left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
538 secs = left / (float) session->frame_rate();
540 if (force || hrs != ms_last_hrs) {
541 sprintf (buf, "%02d", hrs);
542 ms_hours_label.set_text (buf);
546 if (force || mins != ms_last_mins) {
547 sprintf (buf, "%02d", mins);
548 ms_minutes_label.set_text (buf);
552 if (force || secs != ms_last_secs) {
553 sprintf (buf, "%06.3f", secs);
554 ms_seconds_label.set_text (buf);
560 AudioClock::set_smpte (nframes_t when, bool force)
566 session->smpte_duration (when, smpte);
568 session->smpte_time (when, smpte);
571 if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
572 if (smpte.negative) {
573 sprintf (buf, "-%02" PRIu32, smpte.hours);
575 sprintf (buf, " %02" PRIu32, smpte.hours);
577 hours_label.set_text (buf);
578 last_hrs = smpte.hours;
579 last_negative = smpte.negative;
582 if (force || smpte.minutes != last_mins) {
583 sprintf (buf, "%02" PRIu32, smpte.minutes);
584 minutes_label.set_text (buf);
585 last_mins = smpte.minutes;
588 if (force || smpte.seconds != last_secs) {
589 sprintf (buf, "%02" PRIu32, smpte.seconds);
590 seconds_label.set_text (buf);
591 last_secs = smpte.seconds;
594 if (force || smpte.frames != last_frames) {
595 sprintf (buf, "%02" PRIu32, smpte.frames);
596 frames_label.set_text (buf);
597 last_frames = smpte.frames;
600 if (smpte_upper_info_label) {
601 double smpte_frames = session->smpte_frames_per_second();
603 if ( fmod(smpte_frames, 1.0) == 0.0) {
604 sprintf (buf, "%u", int (smpte_frames));
606 sprintf (buf, "%.2f", smpte_frames);
609 if (smpte_upper_info_label->get_text() != buf) {
610 smpte_upper_info_label->set_text (buf);
613 if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
614 if (session->smpte_drop_frames()) {
617 sprintf (buf, "NDF");
620 // there is no drop frame alternative
624 if (smpte_lower_info_label->get_text() != buf) {
625 smpte_lower_info_label->set_text (buf);
631 AudioClock::set_bbt (nframes_t when, bool force)
636 session->tempo_map().bbt_time (when, bbt);
638 /* handle a common case */
640 if (is_duration && when == 0) {
646 sprintf (buf, "%03" PRIu32, bbt.bars);
647 bars_label.set_text (buf);
648 sprintf (buf, "%02" PRIu32, bbt.beats);
649 beats_label.set_text (buf);
650 sprintf (buf, "%04" PRIu32, bbt.ticks);
651 ticks_label.set_text (buf);
653 if (bbt_upper_info_label) {
656 if (bbt_reference_time < 0) {
659 pos = bbt_reference_time;
662 TempoMap::Metric m (session->tempo_map().metric_at (pos));
664 sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
665 if (bbt_lower_info_label->get_text() != buf) {
666 bbt_lower_info_label->set_text (buf);
668 sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
669 if (bbt_upper_info_label->get_text() != buf) {
670 bbt_upper_info_label->set_text (buf);
676 AudioClock::set_session (Session *s)
683 XMLNode* node = session->extra_xml (X_("ClockModes"));
684 AudioClock::Mode amode;
687 if ((prop = node->property (_name)) != 0) {
688 amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
693 set (last_when, true);
702 hours_ebox.grab_focus ();
706 bars_ebox.grab_focus ();
710 ms_hours_ebox.grab_focus ();
714 frames_ebox.grab_focus ();
724 AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
726 /* all key activity is handled on key release */
731 AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
736 bool move_on = false;
740 label = &hours_label;
743 label = &minutes_label;
746 label = &seconds_label;
749 label = &frames_label;
753 label = &audio_frames_label;
757 label = &ms_hours_label;
760 label = &ms_minutes_label;
763 label = &ms_seconds_label;
770 label = &beats_label;
773 label = &ticks_label;
779 switch (ev->keyval) {
823 if (_mode == MinSec && field == MS_Seconds) {
837 clock_base.grab_focus ();
846 if (key_entry_state == 0) {
848 /* initialize with a fresh new string */
850 if (field != AudioFrames) {
851 for (uint32_t xn = 0; xn < field_length[field] - 1; ++xn) {
860 string existing = label->get_text();
861 if (existing.length() >= field_length[field]) {
862 new_text = existing.substr (1, field_length[field] - 1);
864 new_text = existing.substr (0, field_length[field] - 1);
868 new_text += new_char;
869 label->set_text (new_text);
873 if (key_entry_state == field_length[field]) {
879 if (key_entry_state) {
886 // Check SMPTE fields for sanity (may also adjust fields)
887 smpte_sanitize_display();
892 // Bars should never be, unless this clock is for a duration
893 if (atoi(bars_label.get_text()) == 0 && !is_duration) {
894 bars_label.set_text("001");
896 // beats should never be 0, unless this clock is for a duration
897 if (atoi(beats_label.get_text()) == 0 && !is_duration) {
898 beats_label.set_text("01");
905 ValueChanged(); /* EMIT_SIGNAL */
908 /* move on to the next field.
916 minutes_ebox.grab_focus ();
919 seconds_ebox.grab_focus ();
922 frames_ebox.grab_focus ();
925 clock_base.grab_focus ();
930 clock_base.grab_focus ();
936 ms_minutes_ebox.grab_focus ();
939 ms_seconds_ebox.grab_focus ();
942 clock_base.grab_focus ();
948 beats_ebox.grab_focus ();
951 ticks_ebox.grab_focus ();
954 clock_base.grab_focus ();
967 AudioClock::field_focus_in_event (GdkEventFocus *ev, Field field)
971 Keyboard::magic_widget_grab_focus ();
975 hours_ebox.set_flags (Gtk::HAS_FOCUS);
976 hours_ebox.set_state (Gtk::STATE_ACTIVE);
979 minutes_ebox.set_flags (Gtk::HAS_FOCUS);
980 minutes_ebox.set_state (Gtk::STATE_ACTIVE);
983 seconds_ebox.set_flags (Gtk::HAS_FOCUS);
984 seconds_ebox.set_state (Gtk::STATE_ACTIVE);
987 frames_ebox.set_flags (Gtk::HAS_FOCUS);
988 frames_ebox.set_state (Gtk::STATE_ACTIVE);
992 audio_frames_ebox.set_flags (Gtk::HAS_FOCUS);
993 audio_frames_ebox.set_state (Gtk::STATE_ACTIVE);
997 ms_hours_ebox.set_flags (Gtk::HAS_FOCUS);
998 ms_hours_ebox.set_state (Gtk::STATE_ACTIVE);
1001 ms_minutes_ebox.set_flags (Gtk::HAS_FOCUS);
1002 ms_minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1005 ms_seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1006 ms_seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1009 bars_ebox.set_flags (Gtk::HAS_FOCUS);
1010 bars_ebox.set_state (Gtk::STATE_ACTIVE);
1013 beats_ebox.set_flags (Gtk::HAS_FOCUS);
1014 beats_ebox.set_state (Gtk::STATE_ACTIVE);
1017 ticks_ebox.set_flags (Gtk::HAS_FOCUS);
1018 ticks_ebox.set_state (Gtk::STATE_ACTIVE);
1026 AudioClock::field_focus_out_event (GdkEventFocus *ev, Field field)
1031 hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1032 hours_ebox.set_state (Gtk::STATE_NORMAL);
1035 minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1036 minutes_ebox.set_state (Gtk::STATE_NORMAL);
1039 seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1040 seconds_ebox.set_state (Gtk::STATE_NORMAL);
1043 frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1044 frames_ebox.set_state (Gtk::STATE_NORMAL);
1048 audio_frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1049 audio_frames_ebox.set_state (Gtk::STATE_NORMAL);
1053 ms_hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1054 ms_hours_ebox.set_state (Gtk::STATE_NORMAL);
1057 ms_minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1058 ms_minutes_ebox.set_state (Gtk::STATE_NORMAL);
1061 ms_seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1062 ms_seconds_ebox.set_state (Gtk::STATE_NORMAL);
1066 bars_ebox.unset_flags (Gtk::HAS_FOCUS);
1067 bars_ebox.set_state (Gtk::STATE_NORMAL);
1070 beats_ebox.unset_flags (Gtk::HAS_FOCUS);
1071 beats_ebox.set_state (Gtk::STATE_NORMAL);
1074 ticks_ebox.unset_flags (Gtk::HAS_FOCUS);
1075 ticks_ebox.set_state (Gtk::STATE_NORMAL);
1079 Keyboard::magic_widget_drop_focus ();
1085 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
1088 gdk_pointer_ungrab (GDK_CURRENT_TIME);
1090 if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
1091 // we actually dragged so return without setting editing focus, or we shift clicked
1097 if (ops_menu == 0) {
1100 ops_menu->popup (1, ev->time);
1104 if (Keyboard::is_context_menu_event (ev)) {
1105 if (ops_menu == 0) {
1108 ops_menu->popup (1, ev->time);
1112 switch (ev->button) {
1116 hours_ebox.grab_focus();
1119 minutes_ebox.grab_focus();
1122 seconds_ebox.grab_focus();
1125 frames_ebox.grab_focus();
1129 audio_frames_ebox.grab_focus();
1133 ms_hours_ebox.grab_focus();
1136 ms_minutes_ebox.grab_focus();
1139 ms_seconds_ebox.grab_focus();
1143 bars_ebox.grab_focus ();
1146 beats_ebox.grab_focus ();
1149 ticks_ebox.grab_focus ();
1162 AudioClock::field_button_press_event (GdkEventButton *ev, Field field)
1164 if (session == 0) return false;
1166 nframes_t frames = 0;
1168 switch (ev->button) {
1170 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1172 ValueChanged (); /* EMIT_SIGNAL */
1175 /* make absolutely sure that the pointer is grabbed */
1176 gdk_pointer_grab(ev->window,false ,
1177 GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
1178 NULL,NULL,ev->time);
1181 drag_start_y = ev->y;
1186 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1188 ValueChanged (); /* EMIT_SIGNAL */
1193 /* used for context sensitive menu */
1206 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
1212 nframes_t frames = 0;
1214 switch (ev->direction) {
1217 frames = get_frames (field);
1219 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1222 set (current_time() + frames, true);
1223 ValueChanged (); /* EMIT_SIGNAL */
1227 case GDK_SCROLL_DOWN:
1228 frames = get_frames (field);
1230 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1234 if ((double)current_time() - (double)frames < 0.0) {
1237 set (current_time() - frames, true);
1240 ValueChanged (); /* EMIT_SIGNAL */
1253 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
1255 if (session == 0 || !dragging) {
1259 float pixel_frame_scale_factor = 0.2f;
1262 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1263 pixel_frame_scale_factor = 0.1f;
1267 if (Keyboard::modifier_state_contains (ev->state,
1268 Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
1270 pixel_frame_scale_factor = 0.025f;
1273 double y_delta = ev->y - drag_y;
1275 drag_accum += y_delta*pixel_frame_scale_factor;
1279 if (trunc(drag_accum) != 0) {
1284 dir = (drag_accum < 0 ? 1:-1);
1285 pos = current_time();
1286 frames = get_frames (field,pos,dir);
1288 if (frames != 0 && frames * drag_accum < current_time()) {
1290 set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land
1298 ValueChanged(); /* EMIT_SIGNAL */
1307 AudioClock::get_frames (Field field,nframes_t pos,int dir)
1310 nframes_t frames = 0;
1314 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1317 frames = (nframes_t) floor (60.0 * session->frame_rate());
1320 frames = session->frame_rate();
1323 frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
1331 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1334 frames = (nframes_t) floor (60.0 * session->frame_rate());
1337 frames = session->frame_rate();
1344 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1350 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1356 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1364 AudioClock::current_time (nframes_t pos) const
1370 ret = smpte_frame_from_display ();
1373 ret = bbt_frame_from_display (pos);
1377 ret = minsec_frame_from_display ();
1381 ret = audio_frame_from_display ();
1392 AudioClock::current_duration (nframes_t pos) const
1398 ret = smpte_frame_from_display ();
1401 ret = bbt_frame_duration_from_display (pos);
1405 ret = minsec_frame_from_display ();
1409 ret = audio_frame_from_display ();
1420 AudioClock::smpte_sanitize_display()
1422 // Check SMPTE fields for sanity, possibly adjusting values
1423 if (atoi(minutes_label.get_text()) > 59) {
1424 minutes_label.set_text("59");
1427 if (atoi(seconds_label.get_text()) > 59) {
1428 seconds_label.set_text("59");
1431 switch ((long)rint(session->smpte_frames_per_second())) {
1433 if (atoi(frames_label.get_text()) > 23) {
1434 frames_label.set_text("23");
1438 if (atoi(frames_label.get_text()) > 24) {
1439 frames_label.set_text("24");
1443 if (atoi(frames_label.get_text()) > 29) {
1444 frames_label.set_text("29");
1451 if (session->smpte_drop_frames()) {
1452 if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
1453 frames_label.set_text("02");
1459 AudioClock::smpte_frame_from_display () const
1468 smpte.hours = atoi (hours_label.get_text());
1469 smpte.minutes = atoi (minutes_label.get_text());
1470 smpte.seconds = atoi (seconds_label.get_text());
1471 smpte.frames = atoi (frames_label.get_text());
1472 smpte.rate = session->smpte_frames_per_second();
1473 smpte.drop= session->smpte_drop_frames();
1475 session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
1479 #define SMPTE_SAMPLE_TEST_1
1480 #define SMPTE_SAMPLE_TEST_2
1481 #define SMPTE_SAMPLE_TEST_3
1482 #define SMPTE_SAMPLE_TEST_4
1483 #define SMPTE_SAMPLE_TEST_5
1484 #define SMPTE_SAMPLE_TEST_6
1485 #define SMPTE_SAMPLE_TEST_7
1487 // Testcode for smpte<->sample conversions (P.S.)
1490 nframes_t oldsample = 0;
1492 nframes_t sample_increment;
1494 sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
1496 #ifdef SMPTE_SAMPLE_TEST_1
1497 // Test 1: use_offset = false, use_subframes = false
1498 cout << "use_offset = false, use_subframes = false" << endl;
1499 for (int i = 0; i < 108003; i++) {
1500 session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
1501 session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
1503 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1504 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1505 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1506 cout << "sample: " << sample1 << endl;
1507 cout << "sample: " << sample1 << " -> ";
1508 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1512 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1513 cout << "ERROR: smpte2 not equal smpte1" << endl;
1514 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1515 cout << "sample: " << sample1 << endl;
1516 cout << "sample: " << sample1 << " -> ";
1517 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1520 oldsample = sample1;
1521 session->smpte_increment( smpte1 );
1524 cout << "sample_increment: " << sample_increment << endl;
1525 cout << "sample: " << sample1 << " -> ";
1526 cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1529 #ifdef SMPTE_SAMPLE_TEST_2
1530 // Test 2: use_offset = true, use_subframes = false
1531 cout << "use_offset = true, use_subframes = false" << endl;
1537 smpte1.subframes = 0;
1538 sample1 = oldsample = 0;
1540 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1541 cout << "Starting at sample: " << sample1 << " -> ";
1542 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1544 for (int i = 0; i < 108003; i++) {
1545 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1546 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1548 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1549 // cout << "sample: " << sample1 << endl;
1550 // cout << "sample: " << sample1 << " -> ";
1551 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1553 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1554 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1555 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1556 cout << "sample: " << sample1 << endl;
1557 cout << "sample: " << sample1 << " -> ";
1558 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1562 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1563 cout << "ERROR: smpte2 not equal smpte1" << endl;
1564 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1565 cout << "sample: " << sample1 << endl;
1566 cout << "sample: " << sample1 << " -> ";
1567 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1570 oldsample = sample1;
1571 session->smpte_increment( smpte1 );
1574 cout << "sample_increment: " << sample_increment << endl;
1575 cout << "sample: " << sample1 << " -> ";
1576 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1579 #ifdef SMPTE_SAMPLE_TEST_3
1580 // Test 3: use_offset = true, use_subframes = false, decrement
1581 cout << "use_offset = true, use_subframes = false, decrement" << endl;
1583 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1584 cout << "Starting at sample: " << sample1 << " -> ";
1585 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1587 for (int i = 0; i < 108003; i++) {
1588 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1589 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1591 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1592 // cout << "sample: " << sample1 << endl;
1593 // cout << "sample: " << sample1 << " -> ";
1594 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1596 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1597 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1598 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1599 cout << "sample: " << sample1 << endl;
1600 cout << "sample: " << sample1 << " -> ";
1601 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1605 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1606 cout << "ERROR: smpte2 not equal smpte1" << endl;
1607 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1608 cout << "sample: " << sample1 << endl;
1609 cout << "sample: " << sample1 << " -> ";
1610 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1613 oldsample = sample1;
1614 session->smpte_decrement( smpte1 );
1617 cout << "sample_decrement: " << sample_increment << endl;
1618 cout << "sample: " << sample1 << " -> ";
1619 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1623 #ifdef SMPTE_SAMPLE_TEST_4
1624 // Test 4: use_offset = true, use_subframes = true
1625 cout << "use_offset = true, use_subframes = true" << endl;
1627 for (long sub = 5; sub < 80; sub += 5) {
1632 smpte1.subframes = 0;
1633 sample1 = oldsample = (sample_increment * sub) / 80;
1635 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
1637 cout << "starting at sample: " << sample1 << " -> ";
1638 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1640 for (int i = 0; i < 108003; i++) {
1641 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1642 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1644 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1645 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1646 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1647 cout << "sample: " << sample1 << endl;
1648 cout << "sample: " << sample1 << " -> ";
1649 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1653 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1654 cout << "ERROR: smpte2 not equal smpte1" << endl;
1655 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1656 cout << "sample: " << sample1 << endl;
1657 cout << "sample: " << sample1 << " -> ";
1658 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1661 oldsample = sample1;
1662 session->smpte_increment( smpte1 );
1665 cout << "sample_increment: " << sample_increment << endl;
1666 cout << "sample: " << sample1 << " -> ";
1667 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1669 for (int i = 0; i < 108003; i++) {
1670 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1671 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1673 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1674 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1675 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1676 cout << "sample: " << sample1 << endl;
1677 cout << "sample: " << sample1 << " -> ";
1678 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1682 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1683 cout << "ERROR: smpte2 not equal smpte1" << endl;
1684 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1685 cout << "sample: " << sample1 << endl;
1686 cout << "sample: " << sample1 << " -> ";
1687 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1690 oldsample = sample1;
1691 session->smpte_decrement( smpte1 );
1694 cout << "sample_decrement: " << sample_increment << endl;
1695 cout << "sample: " << sample1 << " -> ";
1696 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1701 #ifdef SMPTE_SAMPLE_TEST_5
1702 // Test 5: use_offset = true, use_subframes = false, increment seconds
1703 cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
1709 smpte1.subframes = 0;
1710 sample1 = oldsample = 0;
1711 sample_increment = session->frame_rate();
1713 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1714 cout << "Starting at sample: " << sample1 << " -> ";
1715 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1717 for (int i = 0; i < 3600; i++) {
1718 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1719 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1721 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1722 // cout << "sample: " << sample1 << endl;
1723 // cout << "sample: " << sample1 << " -> ";
1724 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1726 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1728 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1732 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1733 cout << "ERROR: smpte2 not equal smpte1" << endl;
1734 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1735 cout << "sample: " << sample1 << endl;
1736 cout << "sample: " << sample1 << " -> ";
1737 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1740 oldsample = sample1;
1741 session->smpte_increment_seconds( smpte1 );
1744 cout << "sample_increment: " << sample_increment << endl;
1745 cout << "sample: " << sample1 << " -> ";
1746 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1750 #ifdef SMPTE_SAMPLE_TEST_6
1751 // Test 6: use_offset = true, use_subframes = false, increment minutes
1752 cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
1758 smpte1.subframes = 0;
1759 sample1 = oldsample = 0;
1760 sample_increment = session->frame_rate() * 60;
1762 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1763 cout << "Starting at sample: " << sample1 << " -> ";
1764 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1766 for (int i = 0; i < 60; i++) {
1767 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1768 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1770 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1771 // cout << "sample: " << sample1 << endl;
1772 // cout << "sample: " << sample1 << " -> ";
1773 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1775 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1777 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1781 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1782 cout << "ERROR: smpte2 not equal smpte1" << endl;
1783 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1784 cout << "sample: " << sample1 << endl;
1785 cout << "sample: " << sample1 << " -> ";
1786 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1789 oldsample = sample1;
1790 session->smpte_increment_minutes( smpte1 );
1793 cout << "sample_increment: " << sample_increment << endl;
1794 cout << "sample: " << sample1 << " -> ";
1795 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1798 #ifdef SMPTE_SAMPLE_TEST_7
1799 // Test 7: use_offset = true, use_subframes = false, increment hours
1800 cout << "use_offset = true, use_subframes = false, increment hours" << endl;
1806 smpte1.subframes = 0;
1807 sample1 = oldsample = 0;
1808 sample_increment = session->frame_rate() * 60 * 60;
1810 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1811 cout << "Starting at sample: " << sample1 << " -> ";
1812 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1814 for (int i = 0; i < 10; i++) {
1815 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1816 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1818 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1819 // cout << "sample: " << sample1 << endl;
1820 // cout << "sample: " << sample1 << " -> ";
1821 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1823 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1825 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1829 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1830 cout << "ERROR: smpte2 not equal smpte1" << endl;
1831 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1832 cout << "sample: " << sample1 << endl;
1833 cout << "sample: " << sample1 << " -> ";
1834 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1837 oldsample = sample1;
1838 session->smpte_increment_hours( smpte1 );
1841 cout << "sample_increment: " << sample_increment << endl;
1842 cout << "sample: " << sample1 << " -> ";
1843 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1852 AudioClock::minsec_frame_from_display () const
1858 int hrs = atoi (ms_hours_label.get_text());
1859 int mins = atoi (ms_minutes_label.get_text());
1860 float secs = atof (ms_seconds_label.get_text());
1862 nframes_t sr = session->frame_rate();
1864 return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
1868 AudioClock::bbt_frame_from_display (nframes_t pos) const
1871 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1876 any.type = AnyTime::BBT;
1878 any.bbt.bars = atoi (bars_label.get_text());
1879 any.bbt.beats = atoi (beats_label.get_text());
1880 any.bbt.ticks = atoi (ticks_label.get_text());
1882 nframes_t ret = session->convert_to_frames_at (pos, any);
1889 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
1892 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1899 bbt.bars = atoi (bars_label.get_text());
1900 bbt.beats = atoi (beats_label.get_text());
1901 bbt.ticks = atoi (ticks_label.get_text());
1903 return session->tempo_map().bbt_duration_at(pos,bbt,1);
1907 AudioClock::audio_frame_from_display () const
1909 return (nframes_t) atoi (audio_frames_label.get_text());
1913 AudioClock::build_ops_menu ()
1915 using namespace Menu_Helpers;
1916 ops_menu = new Menu;
1917 MenuList& ops_items = ops_menu->items();
1918 ops_menu->set_name ("ArdourContextMenu");
1920 if (!Profile->get_sae()) {
1921 ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
1923 ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
1924 ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
1925 ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
1926 ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
1930 AudioClock::set_mode (Mode m)
1932 /* slightly tricky: this is called from within the ARDOUR_UI
1933 constructor by some of its clock members. at that time
1934 the instance pointer is unset, so we have to be careful.
1935 the main idea is to drop keyboard focus in case we had
1936 started editing the clock and then we switch clock mode.
1939 clock_base.grab_focus ();
1945 clock_base.remove ();
1951 clock_base.add (smpte_packer_hbox);
1955 clock_base.add (bbt_packer_hbox);
1959 clock_base.add (minsec_packer_hbox);
1963 clock_base.add (frames_packer_hbox);
1967 clock_base.add (off_hbox);
1971 set_size_requests ();
1973 set (last_when, true);
1974 clock_base.show_all ();
1975 key_entry_state = 0;
1977 if (!is_transient) {
1978 ModeChanged (); /* EMIT SIGNAL */
1983 AudioClock::set_size_requests ()
1985 /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
1989 Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
1990 Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
1991 Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
1992 Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
1996 Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
1997 Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
1998 Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
2002 Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
2003 Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
2004 Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
2008 Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
2012 Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);
2019 AudioClock::set_bbt_reference (nframes64_t pos)
2021 bbt_reference_time = pos;