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 Gtkmm2ext::set_size_request_to_display_given_text(*bbt_upper_info_label, "88|88",0,0);
107 Gtkmm2ext::set_size_request_to_display_given_text(*bbt_lower_info_label, "888.88",0,0);
109 frames_info_box.pack_start (*frames_upper_info_label, true, true);
110 frames_info_box.pack_start (*frames_lower_info_label, true, true);
111 smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
112 smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
113 bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
114 bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
117 frames_upper_info_label = 0;
118 frames_lower_info_label = 0;
119 smpte_upper_info_label = 0;
120 smpte_lower_info_label = 0;
121 bbt_upper_info_label = 0;
122 bbt_lower_info_label = 0;
125 audio_frames_ebox.add (audio_frames_label);
127 frames_packer.set_homogeneous (false);
128 frames_packer.set_border_width (2);
129 frames_packer.pack_start (audio_frames_ebox, false, false);
132 frames_packer.pack_start (frames_info_box, false, false, 5);
135 frames_packer_hbox.pack_start (frames_packer, true, false);
137 hours_ebox.add (hours_label);
138 minutes_ebox.add (minutes_label);
139 seconds_ebox.add (seconds_label);
140 frames_ebox.add (frames_label);
141 bars_ebox.add (bars_label);
142 beats_ebox.add (beats_label);
143 ticks_ebox.add (ticks_label);
144 ms_hours_ebox.add (ms_hours_label);
145 ms_minutes_ebox.add (ms_minutes_label);
146 ms_seconds_ebox.add (ms_seconds_label);
148 smpte_packer.set_homogeneous (false);
149 smpte_packer.set_border_width (2);
150 smpte_packer.pack_start (hours_ebox, false, false);
151 smpte_packer.pack_start (colon1, false, false);
152 smpte_packer.pack_start (minutes_ebox, false, false);
153 smpte_packer.pack_start (colon2, false, false);
154 smpte_packer.pack_start (seconds_ebox, false, false);
155 smpte_packer.pack_start (colon3, false, false);
156 smpte_packer.pack_start (frames_ebox, false, false);
159 smpte_packer.pack_start (smpte_info_box, false, false, 5);
162 smpte_packer_hbox.pack_start (smpte_packer, true, false);
164 bbt_packer.set_homogeneous (false);
165 bbt_packer.set_border_width (2);
166 bbt_packer.pack_start (bars_ebox, false, false);
167 bbt_packer.pack_start (b1, false, false);
168 bbt_packer.pack_start (beats_ebox, false, false);
169 bbt_packer.pack_start (b2, false, false);
170 bbt_packer.pack_start (ticks_ebox, false, false);
173 bbt_packer.pack_start (bbt_info_box, false, false, 5);
176 bbt_packer_hbox.pack_start (bbt_packer, true, false);
178 minsec_packer.set_homogeneous (false);
179 minsec_packer.set_border_width (2);
180 minsec_packer.pack_start (ms_hours_ebox, false, false);
181 minsec_packer.pack_start (colon4, false, false);
182 minsec_packer.pack_start (ms_minutes_ebox, false, false);
183 minsec_packer.pack_start (colon5, false, false);
184 minsec_packer.pack_start (ms_seconds_ebox, false, false);
186 minsec_packer_hbox.pack_start (minsec_packer, true, false);
188 clock_frame.set_shadow_type (Gtk::SHADOW_IN);
189 clock_frame.set_name ("BaseFrame");
191 clock_frame.add (clock_base);
193 set_widget_name (widget_name);
195 _mode = BBT; /* lie to force mode switch */
198 pack_start (clock_frame, true, true);
200 /* the clock base handles button releases for menu popup regardless of
201 editable status. if the clock is editable, the clock base is where
202 we pass focus to after leaving the last editable "field", which
203 will then shutdown editing till the user starts it up again.
205 it does this because the focus out event on the field disables
206 keyboard event handling, and we don't connect anything up to
207 notice focus in on the clock base. hence, keyboard event handling
211 clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
212 clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
214 Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
220 set (last_when, true);
223 clocks.push_back (this);
228 AudioClock::set_widget_name (string name)
230 Widget::set_name (name);
232 clock_base.set_name (name);
234 audio_frames_label.set_name (name);
235 hours_label.set_name (name);
236 minutes_label.set_name (name);
237 seconds_label.set_name (name);
238 frames_label.set_name (name);
239 bars_label.set_name (name);
240 beats_label.set_name (name);
241 ticks_label.set_name (name);
242 ms_hours_label.set_name (name);
243 ms_minutes_label.set_name (name);
244 ms_seconds_label.set_name (name);
245 hours_ebox.set_name (name);
246 minutes_ebox.set_name (name);
247 seconds_ebox.set_name (name);
248 frames_ebox.set_name (name);
249 audio_frames_ebox.set_name (name);
250 bars_ebox.set_name (name);
251 beats_ebox.set_name (name);
252 ticks_ebox.set_name (name);
253 ms_hours_ebox.set_name (name);
254 ms_minutes_ebox.set_name (name);
255 ms_seconds_ebox.set_name (name);
257 colon1.set_name (name);
258 colon2.set_name (name);
259 colon3.set_name (name);
260 colon4.set_name (name);
261 colon5.set_name (name);
269 AudioClock::setup_events ()
271 clock_base.set_flags (Gtk::CAN_FOCUS);
273 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);
274 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);
275 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);
276 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);
277 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);
278 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);
279 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);
280 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);
281 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);
282 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);
283 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);
285 hours_ebox.set_flags (Gtk::CAN_FOCUS);
286 minutes_ebox.set_flags (Gtk::CAN_FOCUS);
287 seconds_ebox.set_flags (Gtk::CAN_FOCUS);
288 frames_ebox.set_flags (Gtk::CAN_FOCUS);
289 audio_frames_ebox.set_flags (Gtk::CAN_FOCUS);
290 bars_ebox.set_flags (Gtk::CAN_FOCUS);
291 beats_ebox.set_flags (Gtk::CAN_FOCUS);
292 ticks_ebox.set_flags (Gtk::CAN_FOCUS);
293 ms_hours_ebox.set_flags (Gtk::CAN_FOCUS);
294 ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS);
295 ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS);
297 hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours));
298 minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes));
299 seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds));
300 frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames));
301 audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
302 bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
303 beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
304 ticks_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
305 ms_hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
306 ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
307 ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
309 hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours));
310 minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes));
311 seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds));
312 frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames));
313 audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
314 bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars));
315 beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats));
316 ticks_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
317 ms_hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
318 ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
319 ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
321 hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours));
322 minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes));
323 seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds));
324 frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames));
325 audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
326 bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars));
327 beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats));
328 ticks_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
329 ms_hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
330 ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
331 ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
333 hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours));
334 minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes));
335 seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds));
336 frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames));
337 audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
338 bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
339 beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
340 ticks_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
341 ms_hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
342 ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
343 ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
345 hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours));
346 minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes));
347 seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds));
348 frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames));
349 audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
350 bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars));
351 beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats));
352 ticks_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
353 ms_hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
354 ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
355 ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
357 hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours));
358 minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes));
359 seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds));
360 frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames));
361 audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
362 bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars));
363 beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats));
364 ticks_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
365 ms_hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
366 ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
367 ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
369 hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours));
370 minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes));
371 seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds));
372 frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames));
373 audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
374 bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
375 beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
376 ticks_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
377 ms_hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
378 ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
379 ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
381 hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours));
382 minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes));
383 seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds));
384 frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames));
385 audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
386 bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
387 beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
388 ticks_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
389 ms_hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
390 ms_minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
391 ms_seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
393 clock_base.signal_focus_in_event().connect (mem_fun (*this, &AudioClock::drop_focus_handler));
397 AudioClock::drop_focus_handler (GdkEventFocus* ignored)
399 Keyboard::magic_widget_drop_focus ();
404 AudioClock::on_realize ()
408 /* styles are not available until the widgets are bound to a window */
410 set_size_requests ();
414 AudioClock::set (nframes_t when, bool force, nframes_t offset, int which)
417 if ((!force && !is_visible()) || session == 0) {
421 if (when == last_when && !offset && !force) {
425 bool pdelta = Config->get_primary_clock_delta_edit_cursor();
426 bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
428 if (offset && which == 1 && pdelta) {
429 when = (when > offset) ? when - offset : offset - when;
430 } else if (offset && which == 2 && sdelta) {
431 when = (when > offset) ? when - offset : offset - when;
434 if (which == 1 && pdelta && !last_pdelta) {
435 set_widget_name("TransportClockDisplayDelta");
437 } else if (which == 1 && !pdelta && last_pdelta) {
438 set_widget_name("TransportClockDisplay");
440 } else if (which == 2 && sdelta && !last_sdelta) {
441 set_widget_name("SecondaryClockDisplayDelta");
443 } else if (which == 2 && !sdelta && last_sdelta) {
444 set_widget_name("SecondaryClockDisplay");
450 set_smpte (when, force);
454 set_bbt (when, force);
458 set_minsec (when, force);
462 set_frames (when, force);
473 AudioClock::smpte_offset_changed ()
480 current = current_duration();
482 current = current_time ();
492 AudioClock::set_frames (nframes_t when, bool force)
495 snprintf (buf, sizeof (buf), "%u", when);
496 audio_frames_label.set_text (buf);
498 if (frames_upper_info_label) {
499 nframes_t rate = session->frame_rate();
501 if (fmod (rate, 1000.0) == 0.000) {
502 sprintf (buf, "%uK", rate/1000);
504 sprintf (buf, "%.3fK", rate/1000.0f);
507 if (frames_upper_info_label->get_text() != buf) {
508 frames_upper_info_label->set_text (buf);
511 float vid_pullup = Config->get_video_pullup();
513 if (vid_pullup == 0.0) {
514 if (frames_lower_info_label->get_text () != _("none")) {
515 frames_lower_info_label->set_text(_("none"));
518 sprintf (buf, "%-6.4f", vid_pullup);
519 if (frames_lower_info_label->get_text() != buf) {
520 frames_lower_info_label->set_text (buf);
527 AudioClock::set_minsec (nframes_t when, bool force)
536 hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
537 left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
538 mins = (int) floor (left / (session->frame_rate() * 60.0f));
539 left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
540 secs = left / (float) session->frame_rate();
542 if (force || hrs != ms_last_hrs) {
543 sprintf (buf, "%02d", hrs);
544 ms_hours_label.set_text (buf);
548 if (force || mins != ms_last_mins) {
549 sprintf (buf, "%02d", mins);
550 ms_minutes_label.set_text (buf);
554 if (force || secs != ms_last_secs) {
555 sprintf (buf, "%06.3f", secs);
556 ms_seconds_label.set_text (buf);
562 AudioClock::set_smpte (nframes_t when, bool force)
568 session->smpte_duration (when, smpte);
570 session->smpte_time (when, smpte);
573 if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
574 if (smpte.negative) {
575 sprintf (buf, "-%02" PRIu32, smpte.hours);
577 sprintf (buf, " %02" PRIu32, smpte.hours);
579 hours_label.set_text (buf);
580 last_hrs = smpte.hours;
581 last_negative = smpte.negative;
584 if (force || smpte.minutes != last_mins) {
585 sprintf (buf, "%02" PRIu32, smpte.minutes);
586 minutes_label.set_text (buf);
587 last_mins = smpte.minutes;
590 if (force || smpte.seconds != last_secs) {
591 sprintf (buf, "%02" PRIu32, smpte.seconds);
592 seconds_label.set_text (buf);
593 last_secs = smpte.seconds;
596 if (force || smpte.frames != last_frames) {
597 sprintf (buf, "%02" PRIu32, smpte.frames);
598 frames_label.set_text (buf);
599 last_frames = smpte.frames;
602 if (smpte_upper_info_label) {
603 double smpte_frames = session->smpte_frames_per_second();
605 if ( fmod(smpte_frames, 1.0) == 0.0) {
606 sprintf (buf, "%u", int (smpte_frames));
608 sprintf (buf, "%.2f", smpte_frames);
611 if (smpte_upper_info_label->get_text() != buf) {
612 smpte_upper_info_label->set_text (buf);
615 if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
616 if (session->smpte_drop_frames()) {
619 sprintf (buf, "NDF");
622 // there is no drop frame alternative
626 if (smpte_lower_info_label->get_text() != buf) {
627 smpte_lower_info_label->set_text (buf);
633 AudioClock::set_bbt (nframes_t when, bool force)
638 session->tempo_map().bbt_time (when, bbt);
640 /* handle a common case */
642 if (is_duration && when == 0) {
648 sprintf (buf, "%03" PRIu32, bbt.bars);
649 if (force || bars_label.get_text () != buf) {
650 bars_label.set_text (buf);
652 sprintf (buf, "%02" PRIu32, bbt.beats);
653 if (force || beats_label.get_text () != buf) {
654 beats_label.set_text (buf);
656 sprintf (buf, "%04" PRIu32, bbt.ticks);
657 if (force || ticks_label.get_text () != buf) {
658 ticks_label.set_text (buf);
661 if (bbt_upper_info_label) {
664 if (bbt_reference_time < 0) {
667 pos = bbt_reference_time;
670 TempoMap::Metric m (session->tempo_map().metric_at (pos));
672 sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
673 if (bbt_lower_info_label->get_text() != buf) {
674 bbt_lower_info_label->set_text (buf);
676 sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
677 if (bbt_upper_info_label->get_text() != buf) {
678 bbt_upper_info_label->set_text (buf);
684 AudioClock::set_session (Session *s)
691 XMLNode* node = session->extra_xml (X_("ClockModes"));
692 AudioClock::Mode amode;
695 if ((prop = node->property (_name)) != 0) {
696 amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
701 set (last_when, true);
710 hours_ebox.grab_focus ();
714 bars_ebox.grab_focus ();
718 ms_hours_ebox.grab_focus ();
722 frames_ebox.grab_focus ();
732 AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
734 /* all key activity is handled on key release */
739 AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
744 bool move_on = false;
748 label = &hours_label;
751 label = &minutes_label;
754 label = &seconds_label;
757 label = &frames_label;
761 label = &audio_frames_label;
765 label = &ms_hours_label;
768 label = &ms_minutes_label;
771 label = &ms_seconds_label;
778 label = &beats_label;
781 label = &ticks_label;
787 switch (ev->keyval) {
831 if (_mode == MinSec && field == MS_Seconds) {
846 clock_base.grab_focus ();
847 ChangeAborted(); /* EMIT SIGNAL */
856 if (key_entry_state == 0) {
858 /* initialize with a fresh new string */
860 if (field != AudioFrames) {
861 for (uint32_t xn = 0; xn < field_length[field] - 1; ++xn) {
870 string existing = label->get_text();
871 if (existing.length() >= field_length[field]) {
872 new_text = existing.substr (1, field_length[field] - 1);
874 new_text = existing.substr (0, field_length[field] - 1);
878 new_text += new_char;
879 label->set_text (new_text);
883 if (key_entry_state == field_length[field]) {
889 if (key_entry_state) {
896 // Check SMPTE fields for sanity (may also adjust fields)
897 smpte_sanitize_display();
902 // Bars should never be, unless this clock is for a duration
903 if (atoi(bars_label.get_text()) == 0 && !is_duration) {
904 bars_label.set_text("001");
906 // beats should never be 0, unless this clock is for a duration
907 if (atoi(beats_label.get_text()) == 0 && !is_duration) {
908 beats_label.set_text("01");
915 ValueChanged(); /* EMIT_SIGNAL */
918 /* move on to the next field.
926 minutes_ebox.grab_focus ();
929 seconds_ebox.grab_focus ();
932 frames_ebox.grab_focus ();
935 clock_base.grab_focus ();
940 clock_base.grab_focus ();
946 ms_minutes_ebox.grab_focus ();
949 ms_seconds_ebox.grab_focus ();
952 clock_base.grab_focus ();
958 beats_ebox.grab_focus ();
961 ticks_ebox.grab_focus ();
964 clock_base.grab_focus ();
973 //if user hit Enter, lose focus
974 switch (ev->keyval) {
977 clock_base.grab_focus ();
984 AudioClock::field_focus_in_event (GdkEventFocus *ev, Field field)
988 Keyboard::magic_widget_grab_focus ();
992 hours_ebox.set_flags (Gtk::HAS_FOCUS);
993 hours_ebox.set_state (Gtk::STATE_ACTIVE);
996 minutes_ebox.set_flags (Gtk::HAS_FOCUS);
997 minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1000 seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1001 seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1004 frames_ebox.set_flags (Gtk::HAS_FOCUS);
1005 frames_ebox.set_state (Gtk::STATE_ACTIVE);
1009 audio_frames_ebox.set_flags (Gtk::HAS_FOCUS);
1010 audio_frames_ebox.set_state (Gtk::STATE_ACTIVE);
1014 ms_hours_ebox.set_flags (Gtk::HAS_FOCUS);
1015 ms_hours_ebox.set_state (Gtk::STATE_ACTIVE);
1018 ms_minutes_ebox.set_flags (Gtk::HAS_FOCUS);
1019 ms_minutes_ebox.set_state (Gtk::STATE_ACTIVE);
1022 ms_seconds_ebox.set_flags (Gtk::HAS_FOCUS);
1023 ms_seconds_ebox.set_state (Gtk::STATE_ACTIVE);
1026 bars_ebox.set_flags (Gtk::HAS_FOCUS);
1027 bars_ebox.set_state (Gtk::STATE_ACTIVE);
1030 beats_ebox.set_flags (Gtk::HAS_FOCUS);
1031 beats_ebox.set_state (Gtk::STATE_ACTIVE);
1034 ticks_ebox.set_flags (Gtk::HAS_FOCUS);
1035 ticks_ebox.set_state (Gtk::STATE_ACTIVE);
1043 AudioClock::field_focus_out_event (GdkEventFocus *ev, Field field)
1048 hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1049 hours_ebox.set_state (Gtk::STATE_NORMAL);
1052 minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1053 minutes_ebox.set_state (Gtk::STATE_NORMAL);
1056 seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1057 seconds_ebox.set_state (Gtk::STATE_NORMAL);
1060 frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1061 frames_ebox.set_state (Gtk::STATE_NORMAL);
1065 audio_frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1066 audio_frames_ebox.set_state (Gtk::STATE_NORMAL);
1070 ms_hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1071 ms_hours_ebox.set_state (Gtk::STATE_NORMAL);
1074 ms_minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1075 ms_minutes_ebox.set_state (Gtk::STATE_NORMAL);
1078 ms_seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1079 ms_seconds_ebox.set_state (Gtk::STATE_NORMAL);
1083 bars_ebox.unset_flags (Gtk::HAS_FOCUS);
1084 bars_ebox.set_state (Gtk::STATE_NORMAL);
1087 beats_ebox.unset_flags (Gtk::HAS_FOCUS);
1088 beats_ebox.set_state (Gtk::STATE_NORMAL);
1091 ticks_ebox.unset_flags (Gtk::HAS_FOCUS);
1092 ticks_ebox.set_state (Gtk::STATE_NORMAL);
1096 Keyboard::magic_widget_drop_focus ();
1102 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
1105 gdk_pointer_ungrab (GDK_CURRENT_TIME);
1107 if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
1108 // we actually dragged so return without setting editing focus, or we shift clicked
1114 if (ops_menu == 0) {
1117 ops_menu->popup (1, ev->time);
1121 if (Keyboard::is_context_menu_event (ev)) {
1122 if (ops_menu == 0) {
1125 ops_menu->popup (1, ev->time);
1129 switch (ev->button) {
1133 hours_ebox.grab_focus();
1136 minutes_ebox.grab_focus();
1139 seconds_ebox.grab_focus();
1142 frames_ebox.grab_focus();
1146 audio_frames_ebox.grab_focus();
1150 ms_hours_ebox.grab_focus();
1153 ms_minutes_ebox.grab_focus();
1156 ms_seconds_ebox.grab_focus();
1160 bars_ebox.grab_focus ();
1163 beats_ebox.grab_focus ();
1166 ticks_ebox.grab_focus ();
1179 AudioClock::field_button_press_event (GdkEventButton *ev, Field field)
1181 if (session == 0) return false;
1183 nframes_t frames = 0;
1185 switch (ev->button) {
1187 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1189 ValueChanged (); /* EMIT_SIGNAL */
1192 /* make absolutely sure that the pointer is grabbed */
1193 gdk_pointer_grab(ev->window,false ,
1194 GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
1195 NULL,NULL,ev->time);
1198 drag_start_y = ev->y;
1203 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1205 ValueChanged (); /* EMIT_SIGNAL */
1210 /* used for context sensitive menu */
1223 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
1229 nframes_t frames = 0;
1231 switch (ev->direction) {
1234 frames = get_frames (field);
1236 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1239 set (current_time() + frames, true);
1240 ValueChanged (); /* EMIT_SIGNAL */
1244 case GDK_SCROLL_DOWN:
1245 frames = get_frames (field);
1247 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1251 if ((double)current_time() - (double)frames < 0.0) {
1254 set (current_time() - frames, true);
1257 ValueChanged (); /* EMIT_SIGNAL */
1270 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
1272 if (session == 0 || !dragging) {
1276 float pixel_frame_scale_factor = 0.2f;
1279 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1280 pixel_frame_scale_factor = 0.1f;
1284 if (Keyboard::modifier_state_contains (ev->state,
1285 Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
1287 pixel_frame_scale_factor = 0.025f;
1290 double y_delta = ev->y - drag_y;
1292 drag_accum += y_delta*pixel_frame_scale_factor;
1296 if (trunc(drag_accum) != 0) {
1301 dir = (drag_accum < 0 ? 1:-1);
1302 pos = current_time();
1303 frames = get_frames (field,pos,dir);
1305 if (frames != 0 && frames * drag_accum < current_time()) {
1307 set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land
1315 ValueChanged(); /* EMIT_SIGNAL */
1324 AudioClock::get_frames (Field field,nframes_t pos,int dir)
1327 nframes_t frames = 0;
1331 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1334 frames = (nframes_t) floor (60.0 * session->frame_rate());
1337 frames = session->frame_rate();
1340 frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
1348 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1351 frames = (nframes_t) floor (60.0 * session->frame_rate());
1354 frames = session->frame_rate();
1361 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1367 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1373 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1381 AudioClock::current_time (nframes_t pos) const
1387 ret = smpte_frame_from_display ();
1390 ret = bbt_frame_from_display (pos);
1394 ret = minsec_frame_from_display ();
1398 ret = audio_frame_from_display ();
1409 AudioClock::current_duration (nframes_t pos) const
1415 ret = smpte_frame_from_display ();
1418 ret = bbt_frame_duration_from_display (pos);
1422 ret = minsec_frame_from_display ();
1426 ret = audio_frame_from_display ();
1437 AudioClock::smpte_sanitize_display()
1439 // Check SMPTE fields for sanity, possibly adjusting values
1440 if (atoi(minutes_label.get_text()) > 59) {
1441 minutes_label.set_text("59");
1444 if (atoi(seconds_label.get_text()) > 59) {
1445 seconds_label.set_text("59");
1448 switch ((long)rint(session->smpte_frames_per_second())) {
1450 if (atoi(frames_label.get_text()) > 23) {
1451 frames_label.set_text("23");
1455 if (atoi(frames_label.get_text()) > 24) {
1456 frames_label.set_text("24");
1460 if (atoi(frames_label.get_text()) > 29) {
1461 frames_label.set_text("29");
1468 if (session->smpte_drop_frames()) {
1469 if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
1470 frames_label.set_text("02");
1476 AudioClock::smpte_frame_from_display () const
1485 smpte.hours = atoi (hours_label.get_text());
1486 smpte.minutes = atoi (minutes_label.get_text());
1487 smpte.seconds = atoi (seconds_label.get_text());
1488 smpte.frames = atoi (frames_label.get_text());
1489 smpte.rate = session->smpte_frames_per_second();
1490 smpte.drop= session->smpte_drop_frames();
1492 session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
1496 #define SMPTE_SAMPLE_TEST_1
1497 #define SMPTE_SAMPLE_TEST_2
1498 #define SMPTE_SAMPLE_TEST_3
1499 #define SMPTE_SAMPLE_TEST_4
1500 #define SMPTE_SAMPLE_TEST_5
1501 #define SMPTE_SAMPLE_TEST_6
1502 #define SMPTE_SAMPLE_TEST_7
1504 // Testcode for smpte<->sample conversions (P.S.)
1507 nframes_t oldsample = 0;
1509 nframes_t sample_increment;
1511 sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
1513 #ifdef SMPTE_SAMPLE_TEST_1
1514 // Test 1: use_offset = false, use_subframes = false
1515 cout << "use_offset = false, use_subframes = false" << endl;
1516 for (int i = 0; i < 108003; i++) {
1517 session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
1518 session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
1520 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1521 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1522 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1523 cout << "sample: " << sample1 << endl;
1524 cout << "sample: " << sample1 << " -> ";
1525 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1529 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1530 cout << "ERROR: smpte2 not equal smpte1" << endl;
1531 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1532 cout << "sample: " << sample1 << endl;
1533 cout << "sample: " << sample1 << " -> ";
1534 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1537 oldsample = sample1;
1538 session->smpte_increment( smpte1 );
1541 cout << "sample_increment: " << sample_increment << endl;
1542 cout << "sample: " << sample1 << " -> ";
1543 cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1546 #ifdef SMPTE_SAMPLE_TEST_2
1547 // Test 2: use_offset = true, use_subframes = false
1548 cout << "use_offset = true, use_subframes = false" << endl;
1554 smpte1.subframes = 0;
1555 sample1 = oldsample = 0;
1557 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1558 cout << "Starting at sample: " << sample1 << " -> ";
1559 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1561 for (int i = 0; i < 108003; i++) {
1562 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1563 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1565 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1566 // cout << "sample: " << sample1 << endl;
1567 // cout << "sample: " << sample1 << " -> ";
1568 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1570 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1571 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1572 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1573 cout << "sample: " << sample1 << endl;
1574 cout << "sample: " << sample1 << " -> ";
1575 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1579 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1580 cout << "ERROR: smpte2 not equal smpte1" << endl;
1581 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1582 cout << "sample: " << sample1 << endl;
1583 cout << "sample: " << sample1 << " -> ";
1584 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1587 oldsample = sample1;
1588 session->smpte_increment( smpte1 );
1591 cout << "sample_increment: " << sample_increment << endl;
1592 cout << "sample: " << sample1 << " -> ";
1593 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1596 #ifdef SMPTE_SAMPLE_TEST_3
1597 // Test 3: use_offset = true, use_subframes = false, decrement
1598 cout << "use_offset = true, use_subframes = false, decrement" << endl;
1600 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1601 cout << "Starting at sample: " << sample1 << " -> ";
1602 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1604 for (int i = 0; i < 108003; i++) {
1605 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1606 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1608 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1609 // cout << "sample: " << sample1 << endl;
1610 // cout << "sample: " << sample1 << " -> ";
1611 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1613 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1614 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1615 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1616 cout << "sample: " << sample1 << endl;
1617 cout << "sample: " << sample1 << " -> ";
1618 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1622 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1623 cout << "ERROR: smpte2 not equal smpte1" << endl;
1624 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1625 cout << "sample: " << sample1 << endl;
1626 cout << "sample: " << sample1 << " -> ";
1627 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1630 oldsample = sample1;
1631 session->smpte_decrement( smpte1 );
1634 cout << "sample_decrement: " << sample_increment << endl;
1635 cout << "sample: " << sample1 << " -> ";
1636 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1640 #ifdef SMPTE_SAMPLE_TEST_4
1641 // Test 4: use_offset = true, use_subframes = true
1642 cout << "use_offset = true, use_subframes = true" << endl;
1644 for (long sub = 5; sub < 80; sub += 5) {
1649 smpte1.subframes = 0;
1650 sample1 = oldsample = (sample_increment * sub) / 80;
1652 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
1654 cout << "starting at sample: " << sample1 << " -> ";
1655 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1657 for (int i = 0; i < 108003; i++) {
1658 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1659 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1661 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1662 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1663 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1664 cout << "sample: " << sample1 << endl;
1665 cout << "sample: " << sample1 << " -> ";
1666 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1670 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1671 cout << "ERROR: smpte2 not equal smpte1" << endl;
1672 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1673 cout << "sample: " << sample1 << endl;
1674 cout << "sample: " << sample1 << " -> ";
1675 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1678 oldsample = sample1;
1679 session->smpte_increment( smpte1 );
1682 cout << "sample_increment: " << sample_increment << endl;
1683 cout << "sample: " << sample1 << " -> ";
1684 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1686 for (int i = 0; i < 108003; i++) {
1687 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1688 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1690 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1691 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1692 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1693 cout << "sample: " << sample1 << endl;
1694 cout << "sample: " << sample1 << " -> ";
1695 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1699 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1700 cout << "ERROR: smpte2 not equal smpte1" << endl;
1701 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1702 cout << "sample: " << sample1 << endl;
1703 cout << "sample: " << sample1 << " -> ";
1704 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1707 oldsample = sample1;
1708 session->smpte_decrement( smpte1 );
1711 cout << "sample_decrement: " << sample_increment << endl;
1712 cout << "sample: " << sample1 << " -> ";
1713 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1718 #ifdef SMPTE_SAMPLE_TEST_5
1719 // Test 5: use_offset = true, use_subframes = false, increment seconds
1720 cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
1726 smpte1.subframes = 0;
1727 sample1 = oldsample = 0;
1728 sample_increment = session->frame_rate();
1730 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1731 cout << "Starting at sample: " << sample1 << " -> ";
1732 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1734 for (int i = 0; i < 3600; i++) {
1735 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1736 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1738 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1739 // cout << "sample: " << sample1 << endl;
1740 // cout << "sample: " << sample1 << " -> ";
1741 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1743 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1745 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1749 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1750 cout << "ERROR: smpte2 not equal smpte1" << endl;
1751 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1752 cout << "sample: " << sample1 << endl;
1753 cout << "sample: " << sample1 << " -> ";
1754 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1757 oldsample = sample1;
1758 session->smpte_increment_seconds( smpte1 );
1761 cout << "sample_increment: " << sample_increment << endl;
1762 cout << "sample: " << sample1 << " -> ";
1763 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1767 #ifdef SMPTE_SAMPLE_TEST_6
1768 // Test 6: use_offset = true, use_subframes = false, increment minutes
1769 cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
1775 smpte1.subframes = 0;
1776 sample1 = oldsample = 0;
1777 sample_increment = session->frame_rate() * 60;
1779 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1780 cout << "Starting at sample: " << sample1 << " -> ";
1781 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1783 for (int i = 0; i < 60; i++) {
1784 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1785 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1787 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1788 // cout << "sample: " << sample1 << endl;
1789 // cout << "sample: " << sample1 << " -> ";
1790 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1792 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1794 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1798 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1799 cout << "ERROR: smpte2 not equal smpte1" << endl;
1800 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1801 cout << "sample: " << sample1 << endl;
1802 cout << "sample: " << sample1 << " -> ";
1803 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1806 oldsample = sample1;
1807 session->smpte_increment_minutes( smpte1 );
1810 cout << "sample_increment: " << sample_increment << endl;
1811 cout << "sample: " << sample1 << " -> ";
1812 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1815 #ifdef SMPTE_SAMPLE_TEST_7
1816 // Test 7: use_offset = true, use_subframes = false, increment hours
1817 cout << "use_offset = true, use_subframes = false, increment hours" << endl;
1823 smpte1.subframes = 0;
1824 sample1 = oldsample = 0;
1825 sample_increment = session->frame_rate() * 60 * 60;
1827 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1828 cout << "Starting at sample: " << sample1 << " -> ";
1829 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1831 for (int i = 0; i < 10; i++) {
1832 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1833 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1835 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1836 // cout << "sample: " << sample1 << endl;
1837 // cout << "sample: " << sample1 << " -> ";
1838 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1840 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1842 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1846 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1847 cout << "ERROR: smpte2 not equal smpte1" << endl;
1848 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1849 cout << "sample: " << sample1 << endl;
1850 cout << "sample: " << sample1 << " -> ";
1851 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1854 oldsample = sample1;
1855 session->smpte_increment_hours( smpte1 );
1858 cout << "sample_increment: " << sample_increment << endl;
1859 cout << "sample: " << sample1 << " -> ";
1860 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1869 AudioClock::minsec_frame_from_display () const
1875 int hrs = atoi (ms_hours_label.get_text());
1876 int mins = atoi (ms_minutes_label.get_text());
1877 float secs = atof (ms_seconds_label.get_text());
1879 nframes_t sr = session->frame_rate();
1881 return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
1885 AudioClock::bbt_frame_from_display (nframes_t pos) const
1888 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1893 any.type = AnyTime::BBT;
1895 any.bbt.bars = atoi (bars_label.get_text());
1896 any.bbt.beats = atoi (beats_label.get_text());
1897 any.bbt.ticks = atoi (ticks_label.get_text());
1899 nframes_t ret = session->convert_to_frames_at (pos, any);
1906 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
1909 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1916 bbt.bars = atoi (bars_label.get_text());
1917 bbt.beats = atoi (beats_label.get_text());
1918 bbt.ticks = atoi (ticks_label.get_text());
1920 return session->tempo_map().bbt_duration_at(pos,bbt,1);
1924 AudioClock::audio_frame_from_display () const
1926 return (nframes_t) atoi (audio_frames_label.get_text());
1930 AudioClock::build_ops_menu ()
1932 using namespace Menu_Helpers;
1933 ops_menu = new Menu;
1934 MenuList& ops_items = ops_menu->items();
1935 ops_menu->set_name ("ArdourContextMenu");
1937 if (!Profile->get_sae()) {
1938 ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
1940 ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
1941 ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
1942 ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
1943 ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
1947 AudioClock::set_mode (Mode m)
1949 /* slightly tricky: this is called from within the ARDOUR_UI
1950 constructor by some of its clock members. at that time
1951 the instance pointer is unset, so we have to be careful.
1952 the main idea is to drop keyboard focus in case we had
1953 started editing the clock and then we switch clock mode.
1956 clock_base.grab_focus ();
1962 clock_base.remove ();
1968 clock_base.add (smpte_packer_hbox);
1972 clock_base.add (bbt_packer_hbox);
1976 clock_base.add (minsec_packer_hbox);
1980 clock_base.add (frames_packer_hbox);
1984 clock_base.add (off_hbox);
1988 set_size_requests ();
1990 set (last_when, true);
1991 clock_base.show_all ();
1992 key_entry_state = 0;
1994 if (!is_transient) {
1995 ModeChanged (); /* EMIT SIGNAL */
2000 AudioClock::set_size_requests ()
2002 /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
2006 Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
2007 Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
2008 Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
2009 Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
2013 Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
2014 Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
2015 Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
2019 Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
2020 Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
2021 Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
2025 Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
2029 Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);
2036 AudioClock::set_bbt_reference (nframes64_t pos)
2038 bbt_reference_time = pos;