summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-01 20:49:22 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-01 20:49:22 +0000
commita5ea47ff0db48e9b5549f309eb6951138b063de4 (patch)
treeeb99033b2e9ed7736628a028d1d22743f9a48661 /libs/ardour
parent044a2cca8feca24f08726e20b97daca127919c1c (diff)
Re-expose timecode offset in the session option editor.
git-svn-id: svn://localhost/ardour2/branches/3.0@8146 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h8
-rw-r--r--libs/ardour/ardour/session_configuration_vars.h2
-rw-r--r--libs/ardour/session.cc1
-rw-r--r--libs/ardour/session_state.cc5
-rw-r--r--libs/ardour/session_time.cc53
5 files changed, 20 insertions, 49 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index acdeee8cd4..5e3176d59b 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -459,16 +459,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void timecode_duration (framecnt_t, Timecode::Time&) const;
void timecode_duration_string (char *, framecnt_t) const;
- void set_timecode_offset (nframes_t);
- nframes_t timecode_offset () const { return _timecode_offset; }
- void set_timecode_offset_negative (bool);
- bool timecode_offset_negative () const { return _timecode_offset_negative; }
-
nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
static PBD::Signal1<void, framepos_t> StartTimeChanged;
static PBD::Signal1<void, framepos_t> EndTimeChanged;
- static PBD::Signal0<void> TimecodeOffsetChanged;
std::vector<SyncSource> get_available_sync_options() const;
void request_sync_source (Slave*);
@@ -1142,8 +1136,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
double _frames_per_timecode_frame; /* has to be floating point because of drop frame */
nframes_t _frames_per_hour;
nframes_t _timecode_frames_per_hour;
- nframes_t _timecode_offset;
- bool _timecode_offset_negative;
/* cache the most-recently requested time conversions. This helps when we
* have multiple clocks showing the same time (e.g. the transport frame) */
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h
index 057cff01fe..687932da73 100644
--- a/libs/ardour/ardour/session_configuration_vars.h
+++ b/libs/ardour/ardour/session_configuration_vars.h
@@ -51,3 +51,5 @@ CONFIG_VARIABLE (bool, show_group_tabs, "show-group-tabs", true)
CONFIG_VARIABLE (bool, external_sync, "external-sync", false)
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", JACK)
CONFIG_VARIABLE (InsertMergePolicy, insert_merge_policy, "insert-merge-policy", InsertMergeReject)
+CONFIG_VARIABLE (framecnt_t, timecode_offset, "timecode-offset", 0)
+CONFIG_VARIABLE (bool, timecode_offset_negative, "timecode-offset-negative", true)
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 325820b601..5abaaf3508 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -119,7 +119,6 @@ PBD::Signal2<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch;
PBD::Signal0<void> Session::SendFeedback;
PBD::Signal3<int,Session*,std::string,DataType> Session::MissingFile;
-PBD::Signal0<void> Session::TimecodeOffsetChanged;
PBD::Signal1<void, framepos_t> Session::StartTimeChanged;
PBD::Signal1<void, framepos_t> Session::EndTimeChanged;
PBD::Signal0<void> Session::AutoBindingOn;
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index f810e3fa12..dea341bf15 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -249,8 +249,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
}
last_timecode_when = 0;
- _timecode_offset = 0;
- _timecode_offset_negative = true;
last_timecode_valid = false;
sync_time_vars ();
@@ -3402,9 +3400,10 @@ Session::config_changed (std::string p, bool ours)
listen_position_changed ();
} else if (p == "solo-control-is-listen-control") {
solo_control_mode_changed ();
+ } else if (p == "timecode-offset" || p == "timecode-offset-negative") {
+ last_timecode_valid = false;
}
-
set_dirty ();
}
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index b39c9399b3..e33fe3a9fb 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -187,24 +187,6 @@ Session::sync_time_vars ()
}
void
-Session::set_timecode_offset (nframes_t off)
-{
- _timecode_offset = off;
- last_timecode_valid = false;
-
- TimecodeOffsetChanged (); /* EMIT SIGNAL */
-}
-
-void
-Session::set_timecode_offset_negative (bool neg)
-{
- _timecode_offset_negative = neg;
- last_timecode_valid = false;
-
- TimecodeOffsetChanged (); /* EMIT SIGNAL */
-}
-
-void
Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes ) const
{
@@ -273,22 +255,22 @@ Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool
}
if (use_offset) {
- if (timecode_offset_negative()) {
- if (sample >= timecode_offset()) {
- sample -= timecode_offset();
+ if (config.get_timecode_offset_negative()) {
+ if (sample >= config.get_timecode_offset()) {
+ sample -= config.get_timecode_offset();
} else {
/* Prevent song-time from becoming negative */
sample = 0;
}
} else {
if (timecode.negative) {
- if (sample <= timecode_offset()) {
- sample = timecode_offset() - sample;
+ if (sample <= config.get_timecode_offset()) {
+ sample = config.get_timecode_offset() - sample;
} else {
sample = 0;
}
} else {
- sample += timecode_offset();
+ sample += config.get_timecode_offset();
}
}
}
@@ -305,15 +287,15 @@ Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool u
offset_sample = sample;
timecode.negative = false;
} else {
- if (_timecode_offset_negative) {
- offset_sample = sample + _timecode_offset;
+ if (config.get_timecode_offset_negative()) {
+ offset_sample = sample + config.get_timecode_offset ();
timecode.negative = false;
} else {
- if (sample < _timecode_offset) {
- offset_sample = (_timecode_offset - sample);
+ if (sample < config.get_timecode_offset()) {
+ offset_sample = (config.get_timecode_offset() - sample);
timecode.negative = true;
} else {
- offset_sample = sample - _timecode_offset;
+ offset_sample = sample - config.get_timecode_offset();
timecode.negative = false;
}
}
@@ -527,7 +509,7 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/,
#if 0
/* Timecode info */
- pos->timecode_offset = _timecode_offset;
+ pos->timecode_offset = config.get_timecode_offset();
t.timecode_frame_rate = timecode_frames_per_second();
pos->valid = jack_position_bits_t (pos->valid | JackPositionTimecode;
@@ -580,13 +562,10 @@ Session::convert_to_frames_at (nframes_t /*position*/, AnyTime const & any)
secs += any.timecode.minutes * 60;
secs += any.timecode.seconds;
secs += any.timecode.frames / timecode_frames_per_second();
- if (_timecode_offset_negative)
- {
- return (nframes_t) floor (secs * frame_rate()) - _timecode_offset;
- }
- else
- {
- return (nframes_t) floor (secs * frame_rate()) + _timecode_offset;
+ if (config.get_timecode_offset_negative()) {
+ return (nframes_t) floor (secs * frame_rate()) - config.get_timecode_offset();
+ } else {
+ return (nframes_t) floor (secs * frame_rate()) + config.get_timecode_offset();
}
break;