summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/session_option_editor.cc1
-rw-r--r--libs/ardour/ardour/session_configuration_vars.h2
-rw-r--r--libs/ardour/ardour/slave.h6
-rw-r--r--libs/ardour/ardour/types.h17
-rw-r--r--libs/ardour/enums.cc1
-rw-r--r--libs/ardour/mtc_slave.cc3
-rw-r--r--libs/ardour/session_time.cc96
-rw-r--r--libs/timecode/src/time.cc102
-rw-r--r--libs/timecode/timecode/time.h16
9 files changed, 133 insertions, 111 deletions
diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc
index c0c8bc07cd..b21e76c140 100644
--- a/gtk2_ardour/session_option_editor.cc
+++ b/gtk2_ardour/session_option_editor.cc
@@ -26,6 +26,7 @@
using namespace std;
using namespace ARDOUR;
+using namespace Timecode;
SessionOptionEditor::SessionOptionEditor (Session* s)
: OptionEditor (&(s->config), _("Session Properties"))
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h
index 5b7064196f..d70d770587 100644
--- a/libs/ardour/ardour/session_configuration_vars.h
+++ b/libs/ardour/ardour/session_configuration_vars.h
@@ -40,7 +40,7 @@ CONFIG_VARIABLE (bool, auto_input, "auto-input", true)
CONFIG_VARIABLE (bool, punch_in, "punch-in", false)
CONFIG_VARIABLE (bool, punch_out, "punch-out", false)
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
-CONFIG_VARIABLE (TimecodeFormat, timecode_format, "timecode-format", timecode_30)
+CONFIG_VARIABLE (Timecode::TimecodeFormat, timecode_format, "timecode-format", Timecode::timecode_30)
CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand)
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", search_path_expand)
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", search_path_expand)
diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h
index 8379c689ce..59f219cba6 100644
--- a/libs/ardour/ardour/slave.h
+++ b/libs/ardour/ardour/slave.h
@@ -252,7 +252,7 @@ class MTC_Slave : public Slave {
framepos_t window_end;
framepos_t first_mtc_timestamp;
bool did_reset_tc_format;
- TimecodeFormat saved_tc_format;
+ Timecode::TimecodeFormat saved_tc_format;
Glib::Threads::Mutex reset_lock;
uint32_t reset_pending;
bool reset_position;
@@ -260,8 +260,8 @@ class MTC_Slave : public Slave {
int busy_guard1;
int busy_guard2;
- TimecodeFormat mtc_timecode;
- TimecodeFormat a3e_timecode;
+ Timecode::TimecodeFormat mtc_timecode;
+ Timecode::TimecodeFormat a3e_timecode;
bool printed_timecode_warning;
/* DLL - chase MTC */
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 595ee38369..b84eb8e7f6 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -200,19 +200,6 @@ namespace ARDOUR {
TrackColor
};
- enum TimecodeFormat {
- timecode_23976,
- timecode_24,
- timecode_24976,
- timecode_25,
- timecode_2997,
- timecode_2997drop,
- timecode_30,
- timecode_30drop,
- timecode_5994,
- timecode_60
- };
-
class AnyTime {
public:
enum Type {
@@ -589,7 +576,7 @@ std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeChoice& sf);
std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
-std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
+std::istream& operator>>(std::istream& o, Timecode::TimecodeFormat& sf);
std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
@@ -610,7 +597,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeChoice& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
-std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);
+std::ostream& operator<<(std::ostream& o, const Timecode::TimecodeFormat& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index b291372503..5776db21c7 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -41,6 +41,7 @@ using namespace std;
using namespace PBD;
using namespace ARDOUR;
using namespace MIDI;
+using namespace Timecode;
namespace ARDOUR {
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index f2477b4175..af6394a215 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -38,6 +38,7 @@ using namespace std;
using namespace ARDOUR;
using namespace MIDI;
using namespace PBD;
+using namespace Timecode;
/* length (in timecode frames) of the "window" that we consider legal given receipt of
a given timecode position. Ardour will try to chase within this window, and will
@@ -280,7 +281,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
*/
//DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self()));
- Timecode::Time timecode;
+ Time timecode;
TimecodeFormat tc_format;
bool reset_tc = true;
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index 42ae315597..36f4aac01f 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -50,105 +50,19 @@ Session::bbt_time (framepos_t when, Timecode::BBT_Time& bbt)
}
/* Timecode TIME */
+
float
Session::timecode_frames_per_second() const
{
- switch (config.get_timecode_format()) {
- case timecode_23976:
- return 23.976;
-
- break;
- case timecode_24:
- return 24;
-
- break;
- case timecode_24976:
- return 24.976;
-
- break;
- case timecode_25:
- return 25;
-
- break;
- case timecode_2997:
- return 29.97;
-
- break;
- case timecode_2997drop:
- return 29.97;
-
- break;
- case timecode_30:
- return 30;
-
- break;
- case timecode_30drop:
- return 30;
-
- break;
- case timecode_5994:
- return 59.94;
-
- break;
- case timecode_60:
- return 60;
-
- break;
- default:
- cerr << "Editor received unexpected timecode type" << endl;
- }
- return 30.0;
+ return Timecode::timecode_to_frames_per_second (config.get_timecode_format());
}
+
bool
Session::timecode_drop_frames() const
{
- switch (config.get_timecode_format()) {
- case timecode_23976:
- return false;
-
- break;
- case timecode_24:
- return false;
-
- break;
- case timecode_24976:
- return false;
-
- break;
- case timecode_25:
- return false;
-
- break;
- case timecode_2997:
- return false;
-
- break;
- case timecode_2997drop:
- return true;
-
- break;
- case timecode_30:
- return false;
-
- break;
- case timecode_30drop:
- return true;
-
- break;
- case timecode_5994:
- return false;
-
- break;
- case timecode_60:
- return false;
-
- break;
- default:
- error << "Editor received unexpected timecode type" << endmsg;
- }
-
- return false;
+ return Timecode::timecode_has_drop_frames(config.get_timecode_format());
}
+
void
Session::sync_time_vars ()
{
diff --git a/libs/timecode/src/time.cc b/libs/timecode/src/time.cc
index 92cede1d9d..6dc123624b 100644
--- a/libs/timecode/src/time.cc
+++ b/libs/timecode/src/time.cc
@@ -423,6 +423,108 @@ hours_floor(Time& timecode)
}
}
+float
+timecode_to_frames_per_second(TimecodeFormat t)
+{
+ switch (t) {
+ case timecode_23976:
+ return (24000.0/1001.0); //23.976;
+
+ break;
+ case timecode_24:
+ return 24;
+
+ break;
+ case timecode_24976:
+ return (25000.0/1001.0); //24.976;
+
+ break;
+ case timecode_25:
+ return 25;
+
+ break;
+ case timecode_2997:
+ return 29.97;
+
+ break;
+ case timecode_2997drop:
+ return (30000.0/1001.0); //29.97;
+
+ break;
+ case timecode_30:
+ return 30;
+
+ break;
+ case timecode_30drop:
+ return 30;
+
+ break;
+ case timecode_5994:
+ return (60000.0/1001.0); //59.94;
+
+ break;
+ case timecode_60:
+ return 60;
+
+ break;
+ default:
+ //std::cerr << "Editor received unexpected timecode type" << std::endl;
+ break;
+ }
+ return 30.0;
+}
+
+bool
+timecode_has_drop_frames(TimecodeFormat t)
+{
+ switch (t) {
+ case timecode_23976:
+ return false;
+
+ break;
+ case timecode_24:
+ return false;
+
+ break;
+ case timecode_24976:
+ return false;
+
+ break;
+ case timecode_25:
+ return false;
+
+ break;
+ case timecode_2997:
+ return false;
+
+ break;
+ case timecode_2997drop:
+ return true;
+
+ break;
+ case timecode_30:
+ return false;
+
+ break;
+ case timecode_30drop:
+ return true;
+
+ break;
+ case timecode_5994:
+ return false;
+
+ break;
+ case timecode_60:
+ return false;
+
+ break;
+ default:
+ //error << "Editor received unexpected timecode type" << endmsg;
+ break;
+ }
+
+ return false;
+}
} // namespace Timecode
diff --git a/libs/timecode/timecode/time.h b/libs/timecode/timecode/time.h
index bcb078f3f1..090d3851fb 100644
--- a/libs/timecode/timecode/time.h
+++ b/libs/timecode/timecode/time.h
@@ -32,6 +32,19 @@ enum Wrap {
HOURS
};
+enum TimecodeFormat {
+ timecode_23976,
+ timecode_24,
+ timecode_24976,
+ timecode_25,
+ timecode_2997,
+ timecode_2997drop,
+ timecode_30,
+ timecode_30drop,
+ timecode_5994,
+ timecode_60
+};
+
struct Time {
bool negative;
uint32_t hours;
@@ -84,6 +97,9 @@ void seconds_floor (Time& timecode);
void minutes_floor (Time& timecode);
void hours_floor (Time& timecode);
+float timecode_to_frames_per_second(TimecodeFormat const t);
+bool timecode_has_drop_frames(TimecodeFormat const t);
+
} // namespace Timecode
std::ostream& operator<< (std::ostream& ostr, const Timecode::Time& t);