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),
87 bbt_reference_time = -1;
90 frames_upper_info_label = manage (new Label);
91 frames_lower_info_label = manage (new Label);
92 smpte_upper_info_label = manage (new Label);
93 smpte_lower_info_label = manage (new Label);
94 bbt_upper_info_label = manage (new Label);
95 bbt_lower_info_label = manage (new Label);
97 frames_upper_info_label->set_name ("AudioClockFramesUpperInfo");
98 frames_lower_info_label->set_name ("AudioClockFramesLowerInfo");
99 smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo");
100 smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo");
101 bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo");
102 bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo");
104 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0);
105 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0);
107 Gtkmm2ext::set_size_request_to_display_given_text(*bbt_upper_info_label, "88|88",0,0);
108 Gtkmm2ext::set_size_request_to_display_given_text(*bbt_lower_info_label, "888.88",0,0);
110 frames_info_box.pack_start (*frames_upper_info_label, true, true);
111 frames_info_box.pack_start (*frames_lower_info_label, true, true);
112 smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
113 smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
114 bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
115 bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
118 frames_upper_info_label = 0;
119 frames_lower_info_label = 0;
120 smpte_upper_info_label = 0;
121 smpte_lower_info_label = 0;
122 bbt_upper_info_label = 0;
123 bbt_lower_info_label = 0;
126 audio_frames_ebox.add (audio_frames_label);
128 frames_packer.set_homogeneous (false);
129 frames_packer.set_border_width (2);
130 frames_packer.pack_start (audio_frames_ebox, false, false);
133 frames_packer.pack_start (frames_info_box, false, false, 5);
136 frames_packer_hbox.pack_start (frames_packer, true, false);
138 hours_ebox.add (hours_label);
139 minutes_ebox.add (minutes_label);
140 seconds_ebox.add (seconds_label);
141 frames_ebox.add (frames_label);
142 bars_ebox.add (bars_label);
143 beats_ebox.add (beats_label);
144 ticks_ebox.add (ticks_label);
145 ms_hours_ebox.add (ms_hours_label);
146 ms_minutes_ebox.add (ms_minutes_label);
147 ms_seconds_ebox.add (ms_seconds_label);
149 smpte_packer.set_homogeneous (false);
150 smpte_packer.set_border_width (2);
151 smpte_packer.pack_start (hours_ebox, false, false);
152 smpte_packer.pack_start (colon1, false, false);
153 smpte_packer.pack_start (minutes_ebox, false, false);
154 smpte_packer.pack_start (colon2, false, false);
155 smpte_packer.pack_start (seconds_ebox, false, false);
156 smpte_packer.pack_start (colon3, false, false);
157 smpte_packer.pack_start (frames_ebox, false, false);
160 smpte_packer.pack_start (smpte_info_box, false, false, 5);
163 smpte_packer_hbox.pack_start (smpte_packer, true, false);
165 bbt_packer.set_homogeneous (false);
166 bbt_packer.set_border_width (2);
167 bbt_packer.pack_start (bars_ebox, false, false);
168 bbt_packer.pack_start (b1, false, false);
169 bbt_packer.pack_start (beats_ebox, false, false);
170 bbt_packer.pack_start (b2, false, false);
171 bbt_packer.pack_start (ticks_ebox, false, false);
174 bbt_packer.pack_start (bbt_info_box, false, false, 5);
177 bbt_packer_hbox.pack_start (bbt_packer, true, false);
179 minsec_packer.set_homogeneous (false);
180 minsec_packer.set_border_width (2);
181 minsec_packer.pack_start (ms_hours_ebox, false, false);
182 minsec_packer.pack_start (colon4, false, false);
183 minsec_packer.pack_start (ms_minutes_ebox, false, false);
184 minsec_packer.pack_start (colon5, false, false);
185 minsec_packer.pack_start (ms_seconds_ebox, false, false);
187 minsec_packer_hbox.pack_start (minsec_packer, true, false);
189 clock_frame.set_shadow_type (Gtk::SHADOW_IN);
190 clock_frame.set_name ("BaseFrame");
192 clock_frame.add (clock_base);
194 set_widget_name (widget_name);
196 _mode = BBT; /* lie to force mode switch */
199 pack_start (clock_frame, true, true);
201 /* the clock base handles button releases for menu popup regardless of
202 editable status. if the clock is editable, the clock base is where
203 we pass focus to after leaving the last editable "field", which
204 will then shutdown editing till the user starts it up again.
206 it does this because the focus out event on the field disables
207 keyboard event handling, and we don't connect anything up to
208 notice focus in on the clock base. hence, keyboard event handling
212 clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
213 clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
215 Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
221 set (last_when, true);
224 clocks.push_back (this);
229 AudioClock::set_widget_name (string name)
231 Widget::set_name (name);
233 clock_base.set_name (name);
235 audio_frames_label.set_name (name);
236 hours_label.set_name (name);
237 minutes_label.set_name (name);
238 seconds_label.set_name (name);
239 frames_label.set_name (name);
240 bars_label.set_name (name);
241 beats_label.set_name (name);
242 ticks_label.set_name (name);
243 ms_hours_label.set_name (name);
244 ms_minutes_label.set_name (name);
245 ms_seconds_label.set_name (name);
246 hours_ebox.set_name (name);
247 minutes_ebox.set_name (name);
248 seconds_ebox.set_name (name);
249 frames_ebox.set_name (name);
250 audio_frames_ebox.set_name (name);
251 bars_ebox.set_name (name);
252 beats_ebox.set_name (name);
253 ticks_ebox.set_name (name);
254 ms_hours_ebox.set_name (name);
255 ms_minutes_ebox.set_name (name);
256 ms_seconds_ebox.set_name (name);
258 colon1.set_name (name);
259 colon2.set_name (name);
260 colon3.set_name (name);
261 colon4.set_name (name);
262 colon5.set_name (name);
270 AudioClock::setup_events ()
272 clock_base.set_flags (Gtk::CAN_FOCUS);
274 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);
275 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);
276 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);
277 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);
278 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);
279 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);
280 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);
281 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);
282 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);
283 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);
284 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);
286 hours_ebox.set_flags (Gtk::CAN_FOCUS);
287 minutes_ebox.set_flags (Gtk::CAN_FOCUS);
288 seconds_ebox.set_flags (Gtk::CAN_FOCUS);
289 frames_ebox.set_flags (Gtk::CAN_FOCUS);
290 audio_frames_ebox.set_flags (Gtk::CAN_FOCUS);
291 bars_ebox.set_flags (Gtk::CAN_FOCUS);
292 beats_ebox.set_flags (Gtk::CAN_FOCUS);
293 ticks_ebox.set_flags (Gtk::CAN_FOCUS);
294 ms_hours_ebox.set_flags (Gtk::CAN_FOCUS);
295 ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS);
296 ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS);
298 hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours));
299 minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes));
300 seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds));
301 frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames));
302 audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
303 bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
304 beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
305 ticks_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
306 ms_hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
307 ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
308 ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
310 hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours));
311 minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes));
312 seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds));
313 frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames));
314 audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
315 bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars));
316 beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats));
317 ticks_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
318 ms_hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
319 ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
320 ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
322 hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours));
323 minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes));
324 seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds));
325 frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames));
326 audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
327 bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars));
328 beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats));
329 ticks_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
330 ms_hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
331 ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
332 ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
334 hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours));
335 minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes));
336 seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds));
337 frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames));
338 audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
339 bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
340 beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
341 ticks_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
342 ms_hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
343 ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
344 ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
346 hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours));
347 minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes));
348 seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds));
349 frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames));
350 audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
351 bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars));
352 beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats));
353 ticks_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
354 ms_hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
355 ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
356 ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
358 hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours));
359 minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes));
360 seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds));
361 frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames));
362 audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
363 bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars));
364 beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats));
365 ticks_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
366 ms_hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
367 ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
368 ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
370 hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours));
371 minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes));
372 seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds));
373 frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames));
374 audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
375 bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
376 beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
377 ticks_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
378 ms_hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
379 ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
380 ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
382 hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours));
383 minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes));
384 seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds));
385 frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames));
386 audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
387 bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
388 beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
389 ticks_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
390 ms_hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
391 ms_minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
392 ms_seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
394 clock_base.signal_focus_in_event().connect (mem_fun (*this, &AudioClock::drop_focus_handler));
398 AudioClock::drop_focus_handler (GdkEventFocus* ignored)
400 Keyboard::magic_widget_drop_focus ();
405 AudioClock::on_realize ()
409 /* styles are not available until the widgets are bound to a window */
411 set_size_requests ();
415 AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
418 if ((!force && !is_visible()) || session == 0) {
422 if (when == last_when && !offset && !force) {
426 bool pdelta = Config->get_primary_clock_delta_edit_cursor();
427 bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
429 if (offset && which == 'p' && pdelta) {
430 when = (when > offset) ? when - offset : offset - when;
431 } else if (offset && which == 's' && sdelta) {
432 when = (when > offset) ? when - offset : offset - when;
435 if (which == 'p' && pdelta && !last_pdelta) {
436 set_widget_name("TransportClockDisplayDelta");
438 } else if (which == 'p' && !pdelta && last_pdelta) {
439 set_widget_name("TransportClockDisplay");
441 } else if (which == 's' && sdelta && !last_sdelta) {
442 set_widget_name("SecondaryClockDisplayDelta");
444 } else if (which == 's' && !sdelta && last_sdelta) {
445 set_widget_name("SecondaryClockDisplay");
451 set_smpte (when, force);
455 set_bbt (when, force);
459 set_minsec (when, force);
463 set_frames (when, force);
474 AudioClock::smpte_offset_changed ()
481 current = current_duration();
483 current = current_time ();
493 AudioClock::set_frames (nframes_t when, bool force)
496 snprintf (buf, sizeof (buf), "%u", when);
497 audio_frames_label.set_text (buf);
499 if (frames_upper_info_label) {
500 nframes_t rate = session->frame_rate();
502 if (fmod (rate, 1000.0) == 0.000) {
503 sprintf (buf, "%uK", rate/1000);
505 sprintf (buf, "%.3fK", rate/1000.0f);
508 if (frames_upper_info_label->get_text() != buf) {
509 frames_upper_info_label->set_text (buf);
512 float vid_pullup = Config->get_video_pullup();
514 if (vid_pullup == 0.0) {
515 if (frames_lower_info_label->get_text () != _("none")) {
516 frames_lower_info_label->set_text(_("none"));
519 sprintf (buf, "%-6.4f", vid_pullup);
520 if (frames_lower_info_label->get_text() != buf) {
521 frames_lower_info_label->set_text (buf);
528 AudioClock::set_minsec (nframes_t when, bool force)
537 hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
538 left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
539 mins = (int) floor (left / (session->frame_rate() * 60.0f));
540 left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
541 secs = left / (float) session->frame_rate();
543 if (force || hrs != ms_last_hrs) {
544 sprintf (buf, "%02d", hrs);
545 ms_hours_label.set_text (buf);
549 if (force || mins != ms_last_mins) {
550 sprintf (buf, "%02d", mins);
551 ms_minutes_label.set_text (buf);
555 if (force || secs != ms_last_secs) {
556 sprintf (buf, "%06.3f", secs);
557 ms_seconds_label.set_text (buf);
563 AudioClock::set_smpte (nframes_t when, bool force)
569 session->smpte_duration (when, smpte);
571 session->smpte_time (when, smpte);
574 if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
575 if (smpte.negative) {
576 sprintf (buf, "-%02" PRIu32, smpte.hours);
578 sprintf (buf, " %02" PRIu32, smpte.hours);
580 hours_label.set_text (buf);
581 last_hrs = smpte.hours;
582 last_negative = smpte.negative;
585 if (force || smpte.minutes != last_mins) {
586 sprintf (buf, "%02" PRIu32, smpte.minutes);
587 minutes_label.set_text (buf);
588 last_mins = smpte.minutes;
591 if (force || smpte.seconds != last_secs) {
592 sprintf (buf, "%02" PRIu32, smpte.seconds);
593 seconds_label.set_text (buf);
594 last_secs = smpte.seconds;
597 if (force || smpte.frames != last_frames) {
598 sprintf (buf, "%02" PRIu32, smpte.frames);
599 frames_label.set_text (buf);
600 last_frames = smpte.frames;
603 if (smpte_upper_info_label) {
604 double smpte_frames = session->smpte_frames_per_second();
606 if ( fmod(smpte_frames, 1.0) == 0.0) {
607 sprintf (buf, "%u", int (smpte_frames));
609 sprintf (buf, "%.2f", smpte_frames);
612 if (smpte_upper_info_label->get_text() != buf) {
613 smpte_upper_info_label->set_text (buf);
616 if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
617 if (session->smpte_drop_frames()) {
620 sprintf (buf, "NDF");
623 // there is no drop frame alternative
627 if (smpte_lower_info_label->get_text() != buf) {
628 smpte_lower_info_label->set_text (buf);
634 AudioClock::set_bbt (nframes_t when, bool force)
639 session->tempo_map().bbt_time (when, bbt);
641 /* handle a common case */
643 if (is_duration && when == 0) {
649 sprintf (buf, "%03" PRIu32, bbt.bars);
650 if (force || bars_label.get_text () != buf) {
651 bars_label.set_text (buf);
653 sprintf (buf, "%02" PRIu32, bbt.beats);
654 if (force || beats_label.get_text () != buf) {
655 beats_label.set_text (buf);
657 sprintf (buf, "%04" PRIu32, bbt.ticks);
658 if (force || ticks_label.get_text () != buf) {
659 ticks_label.set_text (buf);
662 if (bbt_upper_info_label) {
665 if (bbt_reference_time < 0) {
668 pos = bbt_reference_time;
671 TempoMap::Metric m (session->tempo_map().metric_at (pos));
673 sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
674 if (bbt_lower_info_label->get_text() != buf) {
675 bbt_lower_info_label->set_text (buf);
677 sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
678 if (bbt_upper_info_label->get_text() != buf) {
679 bbt_upper_info_label->set_text (buf);
685 AudioClock::set_session (Session *s)
692 XMLNode* node = session->extra_xml (X_("ClockModes"));
693 AudioClock::Mode amode;
696 if ((prop = node->property (_name)) != 0) {
697 amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
702 set (last_when, true);
711 hours_ebox.grab_focus ();
715 bars_ebox.grab_focus ();
719 ms_hours_ebox.grab_focus ();
723 frames_ebox.grab_focus ();
733 AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
735 /* all key activity is handled on key release */
740 AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
745 bool move_on = false;
749 label = &hours_label;
752 label = &minutes_label;
755 label = &seconds_label;
758 label = &frames_label;
762 label = &audio_frames_label;
766 label = &ms_hours_label;
769 label = &ms_minutes_label;
772 label = &ms_seconds_label;
779 label = &beats_label;
782 label = &ticks_label;
788 switch (ev->keyval) {
832 if (_mode == MinSec && field == MS_Seconds) {
847 clock_base.grab_focus ();
848 ChangeAborted(); /* EMIT SIGNAL */
857 if (key_entry_state == 0) {
859 /* initialize with a fresh new string */
861 if (field != AudioFrames) {
862 for (uint32_t xn = 0; xn < field_length[field] - 1; ++xn) {
871 string existing = label->get_text();
872 if (existing.length() >= field_length[field]) {
873 new_text = existing.substr (1, field_length[field] - 1);
875 new_text = existing.substr (0, field_length[field] - 1);
879 new_text += new_char;
880 label->set_text (new_text);
884 if (key_entry_state == field_length[field]) {
890 if (key_entry_state) {
897 // Check SMPTE fields for sanity (may also adjust fields)
898 smpte_sanitize_display();
903 // Bars should never be, unless this clock is for a duration
904 if (atoi(bars_label.get_text()) == 0 && !is_duration) {
905 bars_label.set_text("001");
907 // beats should never be 0, unless this clock is for a duration
908 if (atoi(beats_label.get_text()) == 0 && !is_duration) {
909 beats_label.set_text("01");
916 ValueChanged(); /* EMIT_SIGNAL */
919 /* move on to the next field.
927 minutes_ebox.grab_focus ();
930 seconds_ebox.grab_focus ();
933 frames_ebox.grab_focus ();
936 clock_base.grab_focus ();
941 clock_base.grab_focus ();
947 ms_minutes_ebox.grab_focus ();
950 ms_seconds_ebox.grab_focus ();
953 clock_base.grab_focus ();
959 beats_ebox.grab_focus ();
962 ticks_ebox.grab_focus ();
965 clock_base.grab_focus ();
974 //if user hit Enter, lose focus
975 switch (ev->keyval) {
978 clock_base.grab_focus ();
985 AudioClock::field_focus_in_event (GdkEventFocus *ev, Field field)
989 Keyboard::magic_widget_grab_focus ();
993 hours_ebox.set_flags (Gtk::HAS_FOCUS);
994 hours_ebox.set_state (Gtk::STATE_ACTIVE);
997 minutes_ebox.set_flags (Gtk::HAS_FOCUS);
998 minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1001 seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1002 seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1005 frames_ebox.set_flags (Gtk::HAS_FOCUS);
1006 frames_ebox.set_state (Gtk::STATE_ACTIVE);
1010 audio_frames_ebox.set_flags (Gtk::HAS_FOCUS);
1011 audio_frames_ebox.set_state (Gtk::STATE_ACTIVE);
1015 ms_hours_ebox.set_flags (Gtk::HAS_FOCUS);
1016 ms_hours_ebox.set_state (Gtk::STATE_ACTIVE);
1019 ms_minutes_ebox.set_flags (Gtk::HAS_FOCUS);
1020 ms_minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1023 ms_seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1024 ms_seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1027 bars_ebox.set_flags (Gtk::HAS_FOCUS);
1028 bars_ebox.set_state (Gtk::STATE_ACTIVE);
1031 beats_ebox.set_flags (Gtk::HAS_FOCUS);
1032 beats_ebox.set_state (Gtk::STATE_ACTIVE);
1035 ticks_ebox.set_flags (Gtk::HAS_FOCUS);
1036 ticks_ebox.set_state (Gtk::STATE_ACTIVE);
1044 AudioClock::field_focus_out_event (GdkEventFocus *ev, Field field)
1049 hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1050 hours_ebox.set_state (Gtk::STATE_NORMAL);
1053 minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1054 minutes_ebox.set_state (Gtk::STATE_NORMAL);
1057 seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1058 seconds_ebox.set_state (Gtk::STATE_NORMAL);
1061 frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1062 frames_ebox.set_state (Gtk::STATE_NORMAL);
1066 audio_frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1067 audio_frames_ebox.set_state (Gtk::STATE_NORMAL);
1071 ms_hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1072 ms_hours_ebox.set_state (Gtk::STATE_NORMAL);
1075 ms_minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1076 ms_minutes_ebox.set_state (Gtk::STATE_NORMAL);
1079 ms_seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1080 ms_seconds_ebox.set_state (Gtk::STATE_NORMAL);
1084 bars_ebox.unset_flags (Gtk::HAS_FOCUS);
1085 bars_ebox.set_state (Gtk::STATE_NORMAL);
1088 beats_ebox.unset_flags (Gtk::HAS_FOCUS);
1089 beats_ebox.set_state (Gtk::STATE_NORMAL);
1092 ticks_ebox.unset_flags (Gtk::HAS_FOCUS);
1093 ticks_ebox.set_state (Gtk::STATE_NORMAL);
1097 Keyboard::magic_widget_drop_focus ();
1103 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
1106 gdk_pointer_ungrab (GDK_CURRENT_TIME);
1108 if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
1109 // we actually dragged so return without setting editing focus, or we shift clicked
1115 if (ops_menu == 0) {
1118 ops_menu->popup (1, ev->time);
1122 if (Keyboard::is_context_menu_event (ev)) {
1123 if (ops_menu == 0) {
1126 ops_menu->popup (1, ev->time);
1130 switch (ev->button) {
1134 hours_ebox.grab_focus();
1137 minutes_ebox.grab_focus();
1140 seconds_ebox.grab_focus();
1143 frames_ebox.grab_focus();
1147 audio_frames_ebox.grab_focus();
1151 ms_hours_ebox.grab_focus();
1154 ms_minutes_ebox.grab_focus();
1157 ms_seconds_ebox.grab_focus();
1161 bars_ebox.grab_focus ();
1164 beats_ebox.grab_focus ();
1167 ticks_ebox.grab_focus ();
1180 AudioClock::field_button_press_event (GdkEventButton *ev, Field field)
1182 if (session == 0) return false;
1184 nframes_t frames = 0;
1186 switch (ev->button) {
1188 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1190 ValueChanged (); /* EMIT_SIGNAL */
1193 /* make absolutely sure that the pointer is grabbed */
1194 gdk_pointer_grab(ev->window,false ,
1195 GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
1196 NULL,NULL,ev->time);
1199 drag_start_y = ev->y;
1204 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1206 ValueChanged (); /* EMIT_SIGNAL */
1211 /* used for context sensitive menu */
1224 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
1230 nframes_t frames = 0;
1232 switch (ev->direction) {
1235 frames = get_frames (field);
1237 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1240 set (current_time() + frames, true);
1241 ValueChanged (); /* EMIT_SIGNAL */
1245 case GDK_SCROLL_DOWN:
1246 frames = get_frames (field);
1248 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1252 if ((double)current_time() - (double)frames < 0.0) {
1255 set (current_time() - frames, true);
1258 ValueChanged (); /* EMIT_SIGNAL */
1271 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
1273 if (session == 0 || !dragging) {
1277 float pixel_frame_scale_factor = 0.2f;
1280 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1281 pixel_frame_scale_factor = 0.1f;
1285 if (Keyboard::modifier_state_contains (ev->state,
1286 Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
1288 pixel_frame_scale_factor = 0.025f;
1291 double y_delta = ev->y - drag_y;
1293 drag_accum += y_delta*pixel_frame_scale_factor;
1297 if (trunc(drag_accum) != 0) {
1302 dir = (drag_accum < 0 ? 1:-1);
1303 pos = current_time();
1304 frames = get_frames (field,pos,dir);
1306 if (frames != 0 && frames * drag_accum < current_time()) {
1308 set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land
1316 ValueChanged(); /* EMIT_SIGNAL */
1325 AudioClock::get_frames (Field field,nframes_t pos,int dir)
1328 nframes_t frames = 0;
1332 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1335 frames = (nframes_t) floor (60.0 * session->frame_rate());
1338 frames = session->frame_rate();
1341 frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
1349 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1352 frames = (nframes_t) floor (60.0 * session->frame_rate());
1355 frames = session->frame_rate();
1362 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1368 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1374 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1382 AudioClock::current_time (nframes_t pos) const
1388 ret = smpte_frame_from_display ();
1391 ret = bbt_frame_from_display (pos);
1395 ret = minsec_frame_from_display ();
1399 ret = audio_frame_from_display ();
1410 AudioClock::current_duration (nframes_t pos) const
1416 ret = smpte_frame_from_display ();
1419 ret = bbt_frame_duration_from_display (pos);
1423 ret = minsec_frame_from_display ();
1427 ret = audio_frame_from_display ();
1438 AudioClock::smpte_sanitize_display()
1440 // Check SMPTE fields for sanity, possibly adjusting values
1441 if (atoi(minutes_label.get_text()) > 59) {
1442 minutes_label.set_text("59");
1445 if (atoi(seconds_label.get_text()) > 59) {
1446 seconds_label.set_text("59");
1449 switch ((long)rint(session->smpte_frames_per_second())) {
1451 if (atoi(frames_label.get_text()) > 23) {
1452 frames_label.set_text("23");
1456 if (atoi(frames_label.get_text()) > 24) {
1457 frames_label.set_text("24");
1461 if (atoi(frames_label.get_text()) > 29) {
1462 frames_label.set_text("29");
1469 if (session->smpte_drop_frames()) {
1470 if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
1471 frames_label.set_text("02");
1477 AudioClock::smpte_frame_from_display () const
1486 smpte.hours = atoi (hours_label.get_text());
1487 smpte.minutes = atoi (minutes_label.get_text());
1488 smpte.seconds = atoi (seconds_label.get_text());
1489 smpte.frames = atoi (frames_label.get_text());
1490 smpte.rate = session->smpte_frames_per_second();
1491 smpte.drop= session->smpte_drop_frames();
1493 session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
1497 #define SMPTE_SAMPLE_TEST_1
1498 #define SMPTE_SAMPLE_TEST_2
1499 #define SMPTE_SAMPLE_TEST_3
1500 #define SMPTE_SAMPLE_TEST_4
1501 #define SMPTE_SAMPLE_TEST_5
1502 #define SMPTE_SAMPLE_TEST_6
1503 #define SMPTE_SAMPLE_TEST_7
1505 // Testcode for smpte<->sample conversions (P.S.)
1508 nframes_t oldsample = 0;
1510 nframes_t sample_increment;
1512 sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
1514 #ifdef SMPTE_SAMPLE_TEST_1
1515 // Test 1: use_offset = false, use_subframes = false
1516 cout << "use_offset = false, use_subframes = false" << endl;
1517 for (int i = 0; i < 108003; i++) {
1518 session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
1519 session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
1521 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1522 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1523 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1524 cout << "sample: " << sample1 << endl;
1525 cout << "sample: " << sample1 << " -> ";
1526 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1530 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1531 cout << "ERROR: smpte2 not equal smpte1" << endl;
1532 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1533 cout << "sample: " << sample1 << endl;
1534 cout << "sample: " << sample1 << " -> ";
1535 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1538 oldsample = sample1;
1539 session->smpte_increment( smpte1 );
1542 cout << "sample_increment: " << sample_increment << endl;
1543 cout << "sample: " << sample1 << " -> ";
1544 cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1547 #ifdef SMPTE_SAMPLE_TEST_2
1548 // Test 2: use_offset = true, use_subframes = false
1549 cout << "use_offset = true, use_subframes = false" << endl;
1555 smpte1.subframes = 0;
1556 sample1 = oldsample = 0;
1558 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1559 cout << "Starting at sample: " << sample1 << " -> ";
1560 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1562 for (int i = 0; i < 108003; i++) {
1563 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1564 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1566 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1567 // cout << "sample: " << sample1 << endl;
1568 // cout << "sample: " << sample1 << " -> ";
1569 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1571 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1572 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1573 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1574 cout << "sample: " << sample1 << endl;
1575 cout << "sample: " << sample1 << " -> ";
1576 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1580 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1581 cout << "ERROR: smpte2 not equal smpte1" << endl;
1582 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1583 cout << "sample: " << sample1 << endl;
1584 cout << "sample: " << sample1 << " -> ";
1585 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1588 oldsample = sample1;
1589 session->smpte_increment( smpte1 );
1592 cout << "sample_increment: " << sample_increment << endl;
1593 cout << "sample: " << sample1 << " -> ";
1594 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1597 #ifdef SMPTE_SAMPLE_TEST_3
1598 // Test 3: use_offset = true, use_subframes = false, decrement
1599 cout << "use_offset = true, use_subframes = false, decrement" << endl;
1601 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1602 cout << "Starting at sample: " << sample1 << " -> ";
1603 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1605 for (int i = 0; i < 108003; i++) {
1606 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1607 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1609 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1610 // cout << "sample: " << sample1 << endl;
1611 // cout << "sample: " << sample1 << " -> ";
1612 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1614 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1615 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1616 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1617 cout << "sample: " << sample1 << endl;
1618 cout << "sample: " << sample1 << " -> ";
1619 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1623 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1624 cout << "ERROR: smpte2 not equal smpte1" << endl;
1625 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1626 cout << "sample: " << sample1 << endl;
1627 cout << "sample: " << sample1 << " -> ";
1628 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1631 oldsample = sample1;
1632 session->smpte_decrement( smpte1 );
1635 cout << "sample_decrement: " << sample_increment << endl;
1636 cout << "sample: " << sample1 << " -> ";
1637 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1641 #ifdef SMPTE_SAMPLE_TEST_4
1642 // Test 4: use_offset = true, use_subframes = true
1643 cout << "use_offset = true, use_subframes = true" << endl;
1645 for (long sub = 5; sub < 80; sub += 5) {
1650 smpte1.subframes = 0;
1651 sample1 = oldsample = (sample_increment * sub) / 80;
1653 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
1655 cout << "starting at sample: " << sample1 << " -> ";
1656 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1658 for (int i = 0; i < 108003; i++) {
1659 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1660 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1662 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1663 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1664 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1665 cout << "sample: " << sample1 << endl;
1666 cout << "sample: " << sample1 << " -> ";
1667 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1671 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1672 cout << "ERROR: smpte2 not equal smpte1" << endl;
1673 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1674 cout << "sample: " << sample1 << endl;
1675 cout << "sample: " << sample1 << " -> ";
1676 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1679 oldsample = sample1;
1680 session->smpte_increment( smpte1 );
1683 cout << "sample_increment: " << sample_increment << endl;
1684 cout << "sample: " << sample1 << " -> ";
1685 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1687 for (int i = 0; i < 108003; i++) {
1688 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1689 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1691 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1692 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1693 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1694 cout << "sample: " << sample1 << endl;
1695 cout << "sample: " << sample1 << " -> ";
1696 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1700 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1701 cout << "ERROR: smpte2 not equal smpte1" << endl;
1702 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1703 cout << "sample: " << sample1 << endl;
1704 cout << "sample: " << sample1 << " -> ";
1705 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1708 oldsample = sample1;
1709 session->smpte_decrement( smpte1 );
1712 cout << "sample_decrement: " << sample_increment << endl;
1713 cout << "sample: " << sample1 << " -> ";
1714 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1719 #ifdef SMPTE_SAMPLE_TEST_5
1720 // Test 5: use_offset = true, use_subframes = false, increment seconds
1721 cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
1727 smpte1.subframes = 0;
1728 sample1 = oldsample = 0;
1729 sample_increment = session->frame_rate();
1731 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1732 cout << "Starting at sample: " << sample1 << " -> ";
1733 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1735 for (int i = 0; i < 3600; i++) {
1736 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1737 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1739 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1740 // cout << "sample: " << sample1 << endl;
1741 // cout << "sample: " << sample1 << " -> ";
1742 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1744 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1746 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1750 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1751 cout << "ERROR: smpte2 not equal smpte1" << endl;
1752 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1753 cout << "sample: " << sample1 << endl;
1754 cout << "sample: " << sample1 << " -> ";
1755 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1758 oldsample = sample1;
1759 session->smpte_increment_seconds( smpte1 );
1762 cout << "sample_increment: " << sample_increment << endl;
1763 cout << "sample: " << sample1 << " -> ";
1764 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1768 #ifdef SMPTE_SAMPLE_TEST_6
1769 // Test 6: use_offset = true, use_subframes = false, increment minutes
1770 cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
1776 smpte1.subframes = 0;
1777 sample1 = oldsample = 0;
1778 sample_increment = session->frame_rate() * 60;
1780 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1781 cout << "Starting at sample: " << sample1 << " -> ";
1782 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1784 for (int i = 0; i < 60; i++) {
1785 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1786 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1788 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1789 // cout << "sample: " << sample1 << endl;
1790 // cout << "sample: " << sample1 << " -> ";
1791 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1793 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1795 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1799 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1800 cout << "ERROR: smpte2 not equal smpte1" << endl;
1801 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1802 cout << "sample: " << sample1 << endl;
1803 cout << "sample: " << sample1 << " -> ";
1804 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1807 oldsample = sample1;
1808 session->smpte_increment_minutes( smpte1 );
1811 cout << "sample_increment: " << sample_increment << endl;
1812 cout << "sample: " << sample1 << " -> ";
1813 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1816 #ifdef SMPTE_SAMPLE_TEST_7
1817 // Test 7: use_offset = true, use_subframes = false, increment hours
1818 cout << "use_offset = true, use_subframes = false, increment hours" << endl;
1824 smpte1.subframes = 0;
1825 sample1 = oldsample = 0;
1826 sample_increment = session->frame_rate() * 60 * 60;
1828 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1829 cout << "Starting at sample: " << sample1 << " -> ";
1830 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1832 for (int i = 0; i < 10; i++) {
1833 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1834 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1836 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1837 // cout << "sample: " << sample1 << endl;
1838 // cout << "sample: " << sample1 << " -> ";
1839 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1841 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1843 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1847 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1848 cout << "ERROR: smpte2 not equal smpte1" << endl;
1849 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1850 cout << "sample: " << sample1 << endl;
1851 cout << "sample: " << sample1 << " -> ";
1852 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1855 oldsample = sample1;
1856 session->smpte_increment_hours( smpte1 );
1859 cout << "sample_increment: " << sample_increment << endl;
1860 cout << "sample: " << sample1 << " -> ";
1861 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1870 AudioClock::minsec_frame_from_display () const
1876 int hrs = atoi (ms_hours_label.get_text());
1877 int mins = atoi (ms_minutes_label.get_text());
1878 float secs = atof (ms_seconds_label.get_text());
1880 nframes_t sr = session->frame_rate();
1882 return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
1886 AudioClock::bbt_frame_from_display (nframes_t pos) const
1889 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1894 any.type = AnyTime::BBT;
1896 any.bbt.bars = atoi (bars_label.get_text());
1897 any.bbt.beats = atoi (beats_label.get_text());
1898 any.bbt.ticks = atoi (ticks_label.get_text());
1900 nframes_t ret = session->convert_to_frames_at (pos, any);
1907 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
1910 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1917 bbt.bars = atoi (bars_label.get_text());
1918 bbt.beats = atoi (beats_label.get_text());
1919 bbt.ticks = atoi (ticks_label.get_text());
1921 return session->tempo_map().bbt_duration_at(pos,bbt,1);
1925 AudioClock::audio_frame_from_display () const
1927 return (nframes_t) atoi (audio_frames_label.get_text());
1931 AudioClock::build_ops_menu ()
1933 using namespace Menu_Helpers;
1934 ops_menu = new Menu;
1935 MenuList& ops_items = ops_menu->items();
1936 ops_menu->set_name ("ArdourContextMenu");
1938 if (!Profile->get_sae()) {
1939 ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
1941 ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
1942 ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
1943 ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
1944 ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
1948 AudioClock::set_mode (Mode m)
1950 /* slightly tricky: this is called from within the ARDOUR_UI
1951 constructor by some of its clock members. at that time
1952 the instance pointer is unset, so we have to be careful.
1953 the main idea is to drop keyboard focus in case we had
1954 started editing the clock and then we switch clock mode.
1957 clock_base.grab_focus ();
1963 clock_base.remove ();
1969 clock_base.add (smpte_packer_hbox);
1973 clock_base.add (bbt_packer_hbox);
1977 clock_base.add (minsec_packer_hbox);
1981 clock_base.add (frames_packer_hbox);
1985 clock_base.add (off_hbox);
1989 set_size_requests ();
1991 set (last_when, true);
1992 clock_base.show_all ();
1993 key_entry_state = 0;
1995 if (!is_transient) {
1996 ModeChanged (); /* EMIT SIGNAL */
1997 mode_changed (); /* EMIT SIGNAL */
2002 AudioClock::set_size_requests ()
2004 /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
2008 Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
2009 Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
2010 Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
2011 Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
2015 Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
2016 Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
2017 Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
2021 Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
2022 Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
2023 Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
2027 Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
2031 Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);
2038 AudioClock::set_bbt_reference (nframes64_t pos)
2040 bbt_reference_time = pos;