summaryrefslogtreecommitdiff
path: root/gtk2_ardour/audio_clock.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-06-14 21:17:32 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-06-14 21:17:32 +0000
commitb09ab546542040b1d468c9925c60bda2dfd80da8 (patch)
treea64fdab212cbcc61fe0e2cf9d20dbc363141cf2a /gtk2_ardour/audio_clock.cc
parent2387ef8bfb49e60b233244580fd132d25c6dc3e3 (diff)
use libsndfile for all audio file i/o, and rename DiskStream AudioDiskStream
git-svn-id: svn://localhost/ardour2/trunk@589 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r--gtk2_ardour/audio_clock.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index a5e7aa7193..8289fac8a7 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -195,6 +195,8 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
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 ();
}
@@ -390,6 +392,25 @@ AudioClock::set (jack_nframes_t when, bool force)
}
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)
{
char buf[32];
@@ -446,9 +467,9 @@ AudioClock::set_smpte (jack_nframes_t when, bool force)
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;
@@ -456,19 +477,19 @@ AudioClock::set_smpte (jack_nframes_t when, bool force)
}
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;
}
@@ -1267,7 +1288,7 @@ AudioClock::smpte_frame_from_display () const
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 */ );