#include "i18n.h"
using namespace ARDOUR;
+using namespace PBD;
using namespace sigc;
using namespace Gtk;
using PBD::atoi;
+using PBD::atof;
const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
2, /* SMPTE_Hours */
clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
+ Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
+
if (editable) {
setup_events ();
}
last_when = when;
}
+void
+AudioClock::smpte_offset_changed ()
+{
+ jack_nframes_t current;
+
+ switch (_mode) {
+ case SMPTE:
+ if (is_duration) {
+ current = current_duration();
+ } else {
+ current = current_time ();
+ }
+ set (current, true);
+ break;
+ default:
+ break;
+ }
+}
+
void
AudioClock::set_frames (jack_nframes_t when, bool force)
{
AudioClock::set_smpte (jack_nframes_t when, bool force)
{
char buf[32];
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
if (is_duration) {
session->smpte_duration (when, smpte);
if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
if (smpte.negative) {
- sprintf (buf, "-%02ld", smpte.hours);
+ sprintf (buf, "-%02" PRIu32, smpte.hours);
} else {
- sprintf (buf, " %02ld", smpte.hours);
+ sprintf (buf, " %02" PRIu32, smpte.hours);
}
hours_label.set_text (buf);
last_hrs = smpte.hours;
}
if (force || smpte.minutes != last_mins) {
- sprintf (buf, "%02ld", smpte.minutes);
+ sprintf (buf, "%02" PRIu32, smpte.minutes);
minutes_label.set_text (buf);
last_mins = smpte.minutes;
}
if (force || smpte.seconds != last_secs) {
- sprintf (buf, "%02ld", smpte.seconds);
+ sprintf (buf, "%02" PRIu32, smpte.seconds);
seconds_label.set_text (buf);
last_secs = smpte.seconds;
}
if (force || smpte.frames != last_frames) {
- sprintf (buf, "%02ld", smpte.frames);
+ sprintf (buf, "%02" PRIu32, smpte.frames);
frames_label.set_text (buf);
last_frames = smpte.frames;
}
return 0;
}
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
jack_nframes_t sample;
smpte.hours = atoi (hours_label.get_text());
smpte.minutes = atoi (minutes_label.get_text());
smpte.seconds = atoi (seconds_label.get_text());
smpte.frames = atoi (frames_label.get_text());
-
+
session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
#define SMPTE_SAMPLE_TEST_7
// Testcode for smpte<->sample conversions (P.S.)
- SMPTE_Time smpte1;
+ SMPTE::Time smpte1;
jack_nframes_t sample1;
jack_nframes_t oldsample = 0;
- SMPTE_Time smpte2;
+ SMPTE::Time smpte2;
jack_nframes_t sample_increment;
sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
started editing the clock and then we switch clock mode.
*/
- // GTK2FIX might need an equivalent here for drop focus
-
-
+ clock_base.grab_focus ();
+
if (_mode == m) {
return;
}