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, char 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 == 'p' && pdelta) {
426 when = (when > offset) ? when - offset : offset - when;
427 } else if (offset && which == 's' && sdelta) {
428 when = (when > offset) ? when - offset : offset - when;
431 if (which == 'p' && pdelta && !last_pdelta) {
432 set_widget_name("TransportClockDisplayDelta");
434 } else if (which == 'p' && !pdelta && last_pdelta) {
435 set_widget_name("TransportClockDisplay");
437 } else if (which == 's' && sdelta && !last_sdelta) {
438 set_widget_name("SecondaryClockDisplayDelta");
440 } else if (which == 's' && !sdelta && last_sdelta) {
441 set_widget_name("SecondaryClockDisplay");
447 set_smpte (when, force);
451 set_bbt (when, force);
455 set_minsec (when, force);
459 set_frames (when, force);
470 AudioClock::smpte_offset_changed ()
477 current = current_duration();
479 current = current_time ();
489 AudioClock::set_frames (nframes_t when, bool force)
492 snprintf (buf, sizeof (buf), "%u", when);
493 audio_frames_label.set_text (buf);
495 if (frames_upper_info_label) {
496 nframes_t rate = session->frame_rate();
498 if (fmod (rate, 1000.0) == 0.000) {
499 sprintf (buf, "%uK", rate/1000);
501 sprintf (buf, "%.3fK", rate/1000.0f);
504 if (frames_upper_info_label->get_text() != buf) {
505 frames_upper_info_label->set_text (buf);
508 float vid_pullup = Config->get_video_pullup();
510 if (vid_pullup == 0.0) {
511 if (frames_lower_info_label->get_text () != _("none")) {
512 frames_lower_info_label->set_text(_("none"));
515 sprintf (buf, "%-6.4f", vid_pullup);
516 if (frames_lower_info_label->get_text() != buf) {
517 frames_lower_info_label->set_text (buf);
524 AudioClock::set_minsec (nframes_t when, bool force)
533 hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
534 left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
535 mins = (int) floor (left / (session->frame_rate() * 60.0f));
536 left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
537 secs = left / (float) session->frame_rate();
539 if (force || hrs != ms_last_hrs) {
540 sprintf (buf, "%02d", hrs);
541 ms_hours_label.set_text (buf);
545 if (force || mins != ms_last_mins) {
546 sprintf (buf, "%02d", mins);
547 ms_minutes_label.set_text (buf);
551 if (force || secs != ms_last_secs) {
552 sprintf (buf, "%06.3f", secs);
553 ms_seconds_label.set_text (buf);
559 AudioClock::set_smpte (nframes_t when, bool force)
565 session->smpte_duration (when, smpte);
567 session->smpte_time (when, smpte);
570 if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
571 if (smpte.negative) {
572 sprintf (buf, "-%02" PRIu32, smpte.hours);
574 sprintf (buf, " %02" PRIu32, smpte.hours);
576 hours_label.set_text (buf);
577 last_hrs = smpte.hours;
578 last_negative = smpte.negative;
581 if (force || smpte.minutes != last_mins) {
582 sprintf (buf, "%02" PRIu32, smpte.minutes);
583 minutes_label.set_text (buf);
584 last_mins = smpte.minutes;
587 if (force || smpte.seconds != last_secs) {
588 sprintf (buf, "%02" PRIu32, smpte.seconds);
589 seconds_label.set_text (buf);
590 last_secs = smpte.seconds;
593 if (force || smpte.frames != last_frames) {
594 sprintf (buf, "%02" PRIu32, smpte.frames);
595 frames_label.set_text (buf);
596 last_frames = smpte.frames;
599 if (smpte_upper_info_label) {
600 double smpte_frames = session->smpte_frames_per_second();
602 if ( fmod(smpte_frames, 1.0) == 0.0) {
603 sprintf (buf, "%u", int (smpte_frames));
605 sprintf (buf, "%.2f", smpte_frames);
608 if (smpte_upper_info_label->get_text() != buf) {
609 smpte_upper_info_label->set_text (buf);
612 if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
613 if (session->smpte_drop_frames()) {
616 sprintf (buf, "NDF");
619 // there is no drop frame alternative
623 if (smpte_lower_info_label->get_text() != buf) {
624 smpte_lower_info_label->set_text (buf);
630 AudioClock::set_bbt (nframes_t when, bool force)
635 session->tempo_map().bbt_time (when, bbt);
637 /* handle a common case */
639 if (is_duration && when == 0) {
645 sprintf (buf, "%03" PRIu32, bbt.bars);
646 bars_label.set_text (buf);
647 sprintf (buf, "%02" PRIu32, bbt.beats);
648 beats_label.set_text (buf);
649 sprintf (buf, "%04" PRIu32, bbt.ticks);
650 ticks_label.set_text (buf);
652 if (bbt_upper_info_label) {
655 if (bbt_reference_time < 0) {
658 pos = bbt_reference_time;
661 TempoMap::Metric m (session->tempo_map().metric_at (pos));
663 sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
664 if (bbt_lower_info_label->get_text() != buf) {
665 bbt_lower_info_label->set_text (buf);
667 sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
668 if (bbt_upper_info_label->get_text() != buf) {
669 bbt_upper_info_label->set_text (buf);
675 AudioClock::set_session (Session *s)
682 XMLNode* node = session->extra_xml (X_("ClockModes"));
683 AudioClock::Mode amode;
686 if ((prop = node->property (_name)) != 0) {
687 amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
692 set (last_when, true);
701 hours_ebox.grab_focus ();
705 bars_ebox.grab_focus ();
709 ms_hours_ebox.grab_focus ();
713 frames_ebox.grab_focus ();
723 AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
725 /* all key activity is handled on key release */
730 AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
735 bool move_on = false;
739 label = &hours_label;
742 label = &minutes_label;
745 label = &seconds_label;
748 label = &frames_label;
752 label = &audio_frames_label;
756 label = &ms_hours_label;
759 label = &ms_minutes_label;
762 label = &ms_seconds_label;
769 label = &beats_label;
772 label = &ticks_label;
778 switch (ev->keyval) {
822 if (_mode == MinSec && field == MS_Seconds) {
836 clock_base.grab_focus ();
845 if (key_entry_state == 0) {
847 /* initialize with a fresh new string */
849 if (field != AudioFrames) {
850 for (uint32_t xn = 0; xn < field_length[field] - 1; ++xn) {
859 string existing = label->get_text();
860 if (existing.length() >= field_length[field]) {
861 new_text = existing.substr (1, field_length[field] - 1);
863 new_text = existing.substr (0, field_length[field] - 1);
867 new_text += new_char;
868 label->set_text (new_text);
872 if (key_entry_state == field_length[field]) {
878 if (key_entry_state) {
885 // Check SMPTE fields for sanity (may also adjust fields)
886 smpte_sanitize_display();
891 // Bars should never be, unless this clock is for a duration
892 if (atoi(bars_label.get_text()) == 0 && !is_duration) {
893 bars_label.set_text("001");
895 // beats should never be 0, unless this clock is for a duration
896 if (atoi(beats_label.get_text()) == 0 && !is_duration) {
897 beats_label.set_text("01");
904 ValueChanged(); /* EMIT_SIGNAL */
907 /* move on to the next field.
915 minutes_ebox.grab_focus ();
918 seconds_ebox.grab_focus ();
921 frames_ebox.grab_focus ();
924 clock_base.grab_focus ();
929 clock_base.grab_focus ();
935 ms_minutes_ebox.grab_focus ();
938 ms_seconds_ebox.grab_focus ();
941 clock_base.grab_focus ();
947 beats_ebox.grab_focus ();
950 ticks_ebox.grab_focus ();
953 clock_base.grab_focus ();
966 AudioClock::field_focus_in_event (GdkEventFocus *ev, Field field)
970 Keyboard::magic_widget_grab_focus ();
974 hours_ebox.set_flags (Gtk::HAS_FOCUS);
975 hours_ebox.set_state (Gtk::STATE_ACTIVE);
978 minutes_ebox.set_flags (Gtk::HAS_FOCUS);
979 minutes_ebox.set_state (Gtk::STATE_ACTIVE);
982 seconds_ebox.set_flags (Gtk::HAS_FOCUS);
983 seconds_ebox.set_state (Gtk::STATE_ACTIVE);
986 frames_ebox.set_flags (Gtk::HAS_FOCUS);
987 frames_ebox.set_state (Gtk::STATE_ACTIVE);
991 audio_frames_ebox.set_flags (Gtk::HAS_FOCUS);
992 audio_frames_ebox.set_state (Gtk::STATE_ACTIVE);
996 ms_hours_ebox.set_flags (Gtk::HAS_FOCUS);
997 ms_hours_ebox.set_state (Gtk::STATE_ACTIVE);
1000 ms_minutes_ebox.set_flags (Gtk::HAS_FOCUS);
1001 ms_minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1004 ms_seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1005 ms_seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1008 bars_ebox.set_flags (Gtk::HAS_FOCUS);
1009 bars_ebox.set_state (Gtk::STATE_ACTIVE);
1012 beats_ebox.set_flags (Gtk::HAS_FOCUS);
1013 beats_ebox.set_state (Gtk::STATE_ACTIVE);
1016 ticks_ebox.set_flags (Gtk::HAS_FOCUS);
1017 ticks_ebox.set_state (Gtk::STATE_ACTIVE);
1025 AudioClock::field_focus_out_event (GdkEventFocus *ev, Field field)
1030 hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1031 hours_ebox.set_state (Gtk::STATE_NORMAL);
1034 minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1035 minutes_ebox.set_state (Gtk::STATE_NORMAL);
1038 seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1039 seconds_ebox.set_state (Gtk::STATE_NORMAL);
1042 frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1043 frames_ebox.set_state (Gtk::STATE_NORMAL);
1047 audio_frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1048 audio_frames_ebox.set_state (Gtk::STATE_NORMAL);
1052 ms_hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1053 ms_hours_ebox.set_state (Gtk::STATE_NORMAL);
1056 ms_minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1057 ms_minutes_ebox.set_state (Gtk::STATE_NORMAL);
1060 ms_seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1061 ms_seconds_ebox.set_state (Gtk::STATE_NORMAL);
1065 bars_ebox.unset_flags (Gtk::HAS_FOCUS);
1066 bars_ebox.set_state (Gtk::STATE_NORMAL);
1069 beats_ebox.unset_flags (Gtk::HAS_FOCUS);
1070 beats_ebox.set_state (Gtk::STATE_NORMAL);
1073 ticks_ebox.unset_flags (Gtk::HAS_FOCUS);
1074 ticks_ebox.set_state (Gtk::STATE_NORMAL);
1078 Keyboard::magic_widget_drop_focus ();
1084 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
1087 gdk_pointer_ungrab (GDK_CURRENT_TIME);
1089 if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
1090 // we actually dragged so return without setting editing focus, or we shift clicked
1096 if (ops_menu == 0) {
1099 ops_menu->popup (1, ev->time);
1103 if (Keyboard::is_context_menu_event (ev)) {
1104 if (ops_menu == 0) {
1107 ops_menu->popup (1, ev->time);
1111 switch (ev->button) {
1115 hours_ebox.grab_focus();
1118 minutes_ebox.grab_focus();
1121 seconds_ebox.grab_focus();
1124 frames_ebox.grab_focus();
1128 audio_frames_ebox.grab_focus();
1132 ms_hours_ebox.grab_focus();
1135 ms_minutes_ebox.grab_focus();
1138 ms_seconds_ebox.grab_focus();
1142 bars_ebox.grab_focus ();
1145 beats_ebox.grab_focus ();
1148 ticks_ebox.grab_focus ();
1161 AudioClock::field_button_press_event (GdkEventButton *ev, Field field)
1163 if (session == 0) return false;
1165 nframes_t frames = 0;
1167 switch (ev->button) {
1169 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1171 ValueChanged (); /* EMIT_SIGNAL */
1174 /* make absolutely sure that the pointer is grabbed */
1175 gdk_pointer_grab(ev->window,false ,
1176 GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
1177 NULL,NULL,ev->time);
1180 drag_start_y = ev->y;
1185 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1187 ValueChanged (); /* EMIT_SIGNAL */
1192 /* used for context sensitive menu */
1205 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
1211 nframes_t frames = 0;
1213 switch (ev->direction) {
1216 frames = get_frames (field);
1218 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1221 set (current_time() + frames, true);
1222 ValueChanged (); /* EMIT_SIGNAL */
1226 case GDK_SCROLL_DOWN:
1227 frames = get_frames (field);
1229 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1233 if ((double)current_time() - (double)frames < 0.0) {
1236 set (current_time() - frames, true);
1239 ValueChanged (); /* EMIT_SIGNAL */
1252 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
1254 if (session == 0 || !dragging) {
1258 float pixel_frame_scale_factor = 0.2f;
1261 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1262 pixel_frame_scale_factor = 0.1f;
1266 if (Keyboard::modifier_state_contains (ev->state,
1267 Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
1269 pixel_frame_scale_factor = 0.025f;
1272 double y_delta = ev->y - drag_y;
1274 drag_accum += y_delta*pixel_frame_scale_factor;
1278 if (trunc(drag_accum) != 0) {
1283 dir = (drag_accum < 0 ? 1:-1);
1284 pos = current_time();
1285 frames = get_frames (field,pos,dir);
1287 if (frames != 0 && frames * drag_accum < current_time()) {
1289 set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land
1297 ValueChanged(); /* EMIT_SIGNAL */
1306 AudioClock::get_frames (Field field,nframes_t pos,int dir)
1309 nframes_t frames = 0;
1313 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1316 frames = (nframes_t) floor (60.0 * session->frame_rate());
1319 frames = session->frame_rate();
1322 frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
1330 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1333 frames = (nframes_t) floor (60.0 * session->frame_rate());
1336 frames = session->frame_rate();
1343 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1349 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1355 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1363 AudioClock::current_time (nframes_t pos) const
1369 ret = smpte_frame_from_display ();
1372 ret = bbt_frame_from_display (pos);
1376 ret = minsec_frame_from_display ();
1380 ret = audio_frame_from_display ();
1391 AudioClock::current_duration (nframes_t pos) const
1397 ret = smpte_frame_from_display ();
1400 ret = bbt_frame_duration_from_display (pos);
1404 ret = minsec_frame_from_display ();
1408 ret = audio_frame_from_display ();
1419 AudioClock::smpte_sanitize_display()
1421 // Check SMPTE fields for sanity, possibly adjusting values
1422 if (atoi(minutes_label.get_text()) > 59) {
1423 minutes_label.set_text("59");
1426 if (atoi(seconds_label.get_text()) > 59) {
1427 seconds_label.set_text("59");
1430 switch ((long)rint(session->smpte_frames_per_second())) {
1432 if (atoi(frames_label.get_text()) > 23) {
1433 frames_label.set_text("23");
1437 if (atoi(frames_label.get_text()) > 24) {
1438 frames_label.set_text("24");
1442 if (atoi(frames_label.get_text()) > 29) {
1443 frames_label.set_text("29");
1450 if (session->smpte_drop_frames()) {
1451 if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
1452 frames_label.set_text("02");
1458 AudioClock::smpte_frame_from_display () const
1467 smpte.hours = atoi (hours_label.get_text());
1468 smpte.minutes = atoi (minutes_label.get_text());
1469 smpte.seconds = atoi (seconds_label.get_text());
1470 smpte.frames = atoi (frames_label.get_text());
1471 smpte.rate = session->smpte_frames_per_second();
1472 smpte.drop= session->smpte_drop_frames();
1474 session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
1478 #define SMPTE_SAMPLE_TEST_1
1479 #define SMPTE_SAMPLE_TEST_2
1480 #define SMPTE_SAMPLE_TEST_3
1481 #define SMPTE_SAMPLE_TEST_4
1482 #define SMPTE_SAMPLE_TEST_5
1483 #define SMPTE_SAMPLE_TEST_6
1484 #define SMPTE_SAMPLE_TEST_7
1486 // Testcode for smpte<->sample conversions (P.S.)
1489 nframes_t oldsample = 0;
1491 nframes_t sample_increment;
1493 sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
1495 #ifdef SMPTE_SAMPLE_TEST_1
1496 // Test 1: use_offset = false, use_subframes = false
1497 cout << "use_offset = false, use_subframes = false" << endl;
1498 for (int i = 0; i < 108003; i++) {
1499 session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
1500 session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
1502 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1503 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1504 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1505 cout << "sample: " << sample1 << endl;
1506 cout << "sample: " << sample1 << " -> ";
1507 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1511 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1512 cout << "ERROR: smpte2 not equal smpte1" << endl;
1513 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1514 cout << "sample: " << sample1 << endl;
1515 cout << "sample: " << sample1 << " -> ";
1516 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1519 oldsample = sample1;
1520 session->smpte_increment( smpte1 );
1523 cout << "sample_increment: " << sample_increment << endl;
1524 cout << "sample: " << sample1 << " -> ";
1525 cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1528 #ifdef SMPTE_SAMPLE_TEST_2
1529 // Test 2: use_offset = true, use_subframes = false
1530 cout << "use_offset = true, use_subframes = false" << endl;
1536 smpte1.subframes = 0;
1537 sample1 = oldsample = 0;
1539 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1540 cout << "Starting at sample: " << sample1 << " -> ";
1541 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1543 for (int i = 0; i < 108003; i++) {
1544 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1545 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1547 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1548 // cout << "sample: " << sample1 << endl;
1549 // cout << "sample: " << sample1 << " -> ";
1550 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1552 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1553 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1554 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1555 cout << "sample: " << sample1 << endl;
1556 cout << "sample: " << sample1 << " -> ";
1557 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1561 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1562 cout << "ERROR: smpte2 not equal smpte1" << endl;
1563 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1564 cout << "sample: " << sample1 << endl;
1565 cout << "sample: " << sample1 << " -> ";
1566 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1569 oldsample = sample1;
1570 session->smpte_increment( smpte1 );
1573 cout << "sample_increment: " << sample_increment << endl;
1574 cout << "sample: " << sample1 << " -> ";
1575 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1578 #ifdef SMPTE_SAMPLE_TEST_3
1579 // Test 3: use_offset = true, use_subframes = false, decrement
1580 cout << "use_offset = true, use_subframes = false, decrement" << endl;
1582 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1583 cout << "Starting at sample: " << sample1 << " -> ";
1584 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1586 for (int i = 0; i < 108003; i++) {
1587 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1588 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1590 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1591 // cout << "sample: " << sample1 << endl;
1592 // cout << "sample: " << sample1 << " -> ";
1593 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1595 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1596 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1597 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1598 cout << "sample: " << sample1 << endl;
1599 cout << "sample: " << sample1 << " -> ";
1600 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1604 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1605 cout << "ERROR: smpte2 not equal smpte1" << endl;
1606 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1607 cout << "sample: " << sample1 << endl;
1608 cout << "sample: " << sample1 << " -> ";
1609 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1612 oldsample = sample1;
1613 session->smpte_decrement( smpte1 );
1616 cout << "sample_decrement: " << sample_increment << endl;
1617 cout << "sample: " << sample1 << " -> ";
1618 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1622 #ifdef SMPTE_SAMPLE_TEST_4
1623 // Test 4: use_offset = true, use_subframes = true
1624 cout << "use_offset = true, use_subframes = true" << endl;
1626 for (long sub = 5; sub < 80; sub += 5) {
1631 smpte1.subframes = 0;
1632 sample1 = oldsample = (sample_increment * sub) / 80;
1634 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
1636 cout << "starting at sample: " << sample1 << " -> ";
1637 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1639 for (int i = 0; i < 108003; i++) {
1640 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1641 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1643 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1644 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1645 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1646 cout << "sample: " << sample1 << endl;
1647 cout << "sample: " << sample1 << " -> ";
1648 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1652 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1653 cout << "ERROR: smpte2 not equal smpte1" << endl;
1654 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1655 cout << "sample: " << sample1 << endl;
1656 cout << "sample: " << sample1 << " -> ";
1657 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1660 oldsample = sample1;
1661 session->smpte_increment( smpte1 );
1664 cout << "sample_increment: " << sample_increment << endl;
1665 cout << "sample: " << sample1 << " -> ";
1666 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1668 for (int i = 0; i < 108003; i++) {
1669 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1670 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1672 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1673 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1674 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1675 cout << "sample: " << sample1 << endl;
1676 cout << "sample: " << sample1 << " -> ";
1677 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1681 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1682 cout << "ERROR: smpte2 not equal smpte1" << endl;
1683 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1684 cout << "sample: " << sample1 << endl;
1685 cout << "sample: " << sample1 << " -> ";
1686 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1689 oldsample = sample1;
1690 session->smpte_decrement( smpte1 );
1693 cout << "sample_decrement: " << sample_increment << endl;
1694 cout << "sample: " << sample1 << " -> ";
1695 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1700 #ifdef SMPTE_SAMPLE_TEST_5
1701 // Test 5: use_offset = true, use_subframes = false, increment seconds
1702 cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
1708 smpte1.subframes = 0;
1709 sample1 = oldsample = 0;
1710 sample_increment = session->frame_rate();
1712 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1713 cout << "Starting at sample: " << sample1 << " -> ";
1714 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1716 for (int i = 0; i < 3600; i++) {
1717 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1718 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1720 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1721 // cout << "sample: " << sample1 << endl;
1722 // cout << "sample: " << sample1 << " -> ";
1723 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1725 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1727 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1731 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1732 cout << "ERROR: smpte2 not equal smpte1" << endl;
1733 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1734 cout << "sample: " << sample1 << endl;
1735 cout << "sample: " << sample1 << " -> ";
1736 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1739 oldsample = sample1;
1740 session->smpte_increment_seconds( smpte1 );
1743 cout << "sample_increment: " << sample_increment << endl;
1744 cout << "sample: " << sample1 << " -> ";
1745 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1749 #ifdef SMPTE_SAMPLE_TEST_6
1750 // Test 6: use_offset = true, use_subframes = false, increment minutes
1751 cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
1757 smpte1.subframes = 0;
1758 sample1 = oldsample = 0;
1759 sample_increment = session->frame_rate() * 60;
1761 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1762 cout << "Starting at sample: " << sample1 << " -> ";
1763 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1765 for (int i = 0; i < 60; i++) {
1766 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1767 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1769 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1770 // cout << "sample: " << sample1 << endl;
1771 // cout << "sample: " << sample1 << " -> ";
1772 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1774 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1776 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1780 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1781 cout << "ERROR: smpte2 not equal smpte1" << endl;
1782 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1783 cout << "sample: " << sample1 << endl;
1784 cout << "sample: " << sample1 << " -> ";
1785 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1788 oldsample = sample1;
1789 session->smpte_increment_minutes( smpte1 );
1792 cout << "sample_increment: " << sample_increment << endl;
1793 cout << "sample: " << sample1 << " -> ";
1794 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1797 #ifdef SMPTE_SAMPLE_TEST_7
1798 // Test 7: use_offset = true, use_subframes = false, increment hours
1799 cout << "use_offset = true, use_subframes = false, increment hours" << endl;
1805 smpte1.subframes = 0;
1806 sample1 = oldsample = 0;
1807 sample_increment = session->frame_rate() * 60 * 60;
1809 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1810 cout << "Starting at sample: " << sample1 << " -> ";
1811 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1813 for (int i = 0; i < 10; i++) {
1814 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1815 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1817 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1818 // cout << "sample: " << sample1 << endl;
1819 // cout << "sample: " << sample1 << " -> ";
1820 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1822 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1824 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1828 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1829 cout << "ERROR: smpte2 not equal smpte1" << endl;
1830 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1831 cout << "sample: " << sample1 << endl;
1832 cout << "sample: " << sample1 << " -> ";
1833 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1836 oldsample = sample1;
1837 session->smpte_increment_hours( smpte1 );
1840 cout << "sample_increment: " << sample_increment << endl;
1841 cout << "sample: " << sample1 << " -> ";
1842 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1851 AudioClock::minsec_frame_from_display () const
1857 int hrs = atoi (ms_hours_label.get_text());
1858 int mins = atoi (ms_minutes_label.get_text());
1859 float secs = atof (ms_seconds_label.get_text());
1861 nframes_t sr = session->frame_rate();
1863 return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
1867 AudioClock::bbt_frame_from_display (nframes_t pos) const
1870 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1875 any.type = AnyTime::BBT;
1877 any.bbt.bars = atoi (bars_label.get_text());
1878 any.bbt.beats = atoi (beats_label.get_text());
1879 any.bbt.ticks = atoi (ticks_label.get_text());
1881 nframes_t ret = session->convert_to_frames_at (pos, any);
1888 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
1891 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1898 bbt.bars = atoi (bars_label.get_text());
1899 bbt.beats = atoi (beats_label.get_text());
1900 bbt.ticks = atoi (ticks_label.get_text());
1902 return session->tempo_map().bbt_duration_at(pos,bbt,1);
1906 AudioClock::audio_frame_from_display () const
1908 return (nframes_t) atoi (audio_frames_label.get_text());
1912 AudioClock::build_ops_menu ()
1914 using namespace Menu_Helpers;
1915 ops_menu = new Menu;
1916 MenuList& ops_items = ops_menu->items();
1917 ops_menu->set_name ("ArdourContextMenu");
1919 if (!Profile->get_sae()) {
1920 ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
1922 ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
1923 ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
1924 ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
1925 ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
1929 AudioClock::set_mode (Mode m)
1931 /* slightly tricky: this is called from within the ARDOUR_UI
1932 constructor by some of its clock members. at that time
1933 the instance pointer is unset, so we have to be careful.
1934 the main idea is to drop keyboard focus in case we had
1935 started editing the clock and then we switch clock mode.
1938 clock_base.grab_focus ();
1944 clock_base.remove ();
1950 clock_base.add (smpte_packer_hbox);
1954 clock_base.add (bbt_packer_hbox);
1958 clock_base.add (minsec_packer_hbox);
1962 clock_base.add (frames_packer_hbox);
1966 clock_base.add (off_hbox);
1970 set_size_requests ();
1972 set (last_when, true);
1973 clock_base.show_all ();
1974 key_entry_state = 0;
1976 if (!is_transient) {
1977 ModeChanged (); /* EMIT SIGNAL */
1982 AudioClock::set_size_requests ()
1984 /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
1988 Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
1989 Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
1990 Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
1991 Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
1995 Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
1996 Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
1997 Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
2001 Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
2002 Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
2003 Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
2007 Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
2011 Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);
2018 AudioClock::set_bbt_reference (nframes64_t pos)
2020 bbt_reference_time = pos;