diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-26 14:38:58 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-26 14:38:58 +0000 |
commit | fa5aeb7892fb73d45782b42da731bc5a51418e79 (patch) | |
tree | f537bf657cf098076511b47e6f2d6d19203696ec /libs/ardour | |
parent | 5dd8dc0db35bc851bcdcc9ff5212c4344eafb933 (diff) |
change the use of "SMPTE" to "Timecode" to reflect the global economy and the end of american dominance on the world audio production stage
git-svn-id: svn://localhost/ardour2/branches/3.0@5924 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/element_importer.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/export_profile_manager.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 64 | ||||
-rw-r--r-- | libs/ardour/ardour/session_configuration_vars.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/ticker.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/timecode.h (renamed from libs/ardour/ardour/smpte.h) | 36 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 26 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 2 | ||||
-rw-r--r-- | libs/ardour/audio_region_importer.cc | 12 | ||||
-rw-r--r-- | libs/ardour/element_importer.cc | 2 | ||||
-rw-r--r-- | libs/ardour/enums.cc | 24 | ||||
-rw-r--r-- | libs/ardour/export_format_specification.cc | 30 | ||||
-rw-r--r-- | libs/ardour/location_importer.cc | 14 | ||||
-rw-r--r-- | libs/ardour/mtc_slave.cc | 40 | ||||
-rw-r--r-- | libs/ardour/session.cc | 6 | ||||
-rw-r--r-- | libs/ardour/session_events.cc | 4 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 124 | ||||
-rw-r--r-- | libs/ardour/session_process.cc | 10 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 12 | ||||
-rw-r--r-- | libs/ardour/session_time.cc | 286 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 8 | ||||
-rw-r--r-- | libs/ardour/ticker.cc | 4 |
22 files changed, 359 insertions, 359 deletions
diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index 9d2d9cc0de..396ac8358d 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -110,8 +110,8 @@ class ElementImporter /// The sample rate of the session from which we are importing nframes_t sample_rate; - /// Converts smpte time to a string - std::string smpte_to_string (SMPTE::Time & time) const; + /// Converts timecode time to a string + std::string timecode_to_string (Timecode::Time & time) const; /// Converts samples so that times match the sessions sample rate nframes_t rate_convert_samples (nframes_t samples) const; diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index b402550a64..47acacd387 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -108,7 +108,7 @@ class ExportProfileManager typedef std::list<Location *> LocationList; enum TimeFormat { - SMPTE, + Timecode, BBT, MinSec, Frames, @@ -127,7 +127,7 @@ class ExportProfileManager boost::shared_ptr<Location> selection_range, boost::shared_ptr<LocationList> ranges) : timespans (new TimespanList ()), - time_format (SMPTE), + time_format (Timecode), session_range (session_range), selection_range (selection_range), diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index baf7343496..024b866730 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -54,7 +54,7 @@ #include "ardour/rc_configuration.h" #include "ardour/session_configuration.h" #include "ardour/location.h" -#include "ardour/smpte.h" +#include "ardour/timecode.h" #include "ardour/interpolation.h" class XMLTree; @@ -421,15 +421,15 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable nframes_t nominal_frame_rate() const { return _nominal_frame_rate; } nframes_t frames_per_hour() const { return _frames_per_hour; } - double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } - nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } + double frames_per_timecode_frame() const { return _frames_per_timecode_frame; } + nframes_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; } - MIDI::byte get_mtc_smpte_bits() const { - return mtc_smpte_bits; /* encoding of SMTPE type for MTC */ + MIDI::byte get_mtc_timecode_bits() const { + return mtc_timecode_bits; /* encoding of SMTPE type for MTC */ } - float smpte_frames_per_second() const; - bool smpte_drop_frames() const; + float timecode_frames_per_second() const; + bool timecode_drop_frames() const; /* Locations */ @@ -551,25 +551,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void sync_time_vars(); void bbt_time (nframes_t when, BBT_Time&); - void smpte_to_sample(SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_smpte(nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const; - void smpte_time (SMPTE::Time &); - void smpte_time (nframes_t when, SMPTE::Time&); - void smpte_time_subframes (nframes_t when, SMPTE::Time&); + void timecode_to_sample(Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_time (Timecode::Time &); + void timecode_time (nframes_t when, Timecode::Time&); + void timecode_time_subframes (nframes_t when, Timecode::Time&); - void smpte_duration (nframes_t, SMPTE::Time&) const; - void smpte_duration_string (char *, nframes_t) const; + void timecode_duration (nframes_t, Timecode::Time&) const; + void timecode_duration_string (char *, nframes_t) const; - void set_smpte_offset (nframes_t); - nframes_t smpte_offset () const { return _smpte_offset; } - void set_smpte_offset_negative (bool); - bool smpte_offset_negative () const { return _smpte_offset_negative; } + 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 sigc::signal<void> StartTimeChanged; static sigc::signal<void> EndTimeChanged; - static sigc::signal<void> SMPTEOffsetChanged; + static sigc::signal<void> TimecodeOffsetChanged; void request_slave_source (SlaveSource); bool synced_to_jack() const { return Config->get_slave_source() == JACK; } @@ -585,8 +585,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable TempoMap& tempo_map() { return *_tempo_map; } - /// signals the current transport position in frames, bbt and smpte time (in that order) - sigc::signal<void, const nframes_t&, const BBT_Time&, const SMPTE::Time&> tick; + /// signals the current transport position in frames, bbt and timecode time (in that order) + sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick; /* region info */ @@ -1331,25 +1331,25 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable MIDI::byte mmc_buffer[32]; MIDI::byte mtc_msg[16]; - MIDI::byte mtc_smpte_bits; /* encoding of SMTPE type for MTC */ + MIDI::byte mtc_timecode_bits; /* encoding of SMTPE type for MTC */ MIDI::byte midi_msg[16]; - nframes_t outbound_mtc_smpte_frame; - SMPTE::Time transmitting_smpte_time; + nframes_t outbound_mtc_timecode_frame; + Timecode::Time transmitting_timecode_time; int next_quarter_frame_to_send; - double _frames_per_smpte_frame; /* has to be floating point because of drop frame */ + double _frames_per_timecode_frame; /* has to be floating point because of drop frame */ nframes_t _frames_per_hour; - nframes_t _smpte_frames_per_hour; - nframes_t _smpte_offset; - bool _smpte_offset_negative; + 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) */ - bool last_smpte_valid; - nframes_t last_smpte_when; - SMPTE::Time last_smpte; + bool last_timecode_valid; + nframes_t last_timecode_when; + Timecode::Time last_timecode; - bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle + bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle int send_full_time_code(nframes_t nframes); int send_midi_time_code_for_cycle(nframes_t nframes); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 5330932b26..8c1dffc884 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -33,7 +33,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 (SmpteFormat, smpte_format, "smpte-format", smpte_30) +CONFIG_VARIABLE (SmpteFormat, timecode_format, "timecode-format", timecode_30) CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand) CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US") CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US") diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index f87bca665d..3e0f1844a6 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -40,7 +40,7 @@ public: virtual void tick( const nframes_t& transport_frames, const BBT_Time& transport_bbt, - const SMPTE::Time& transport_smpte) = 0; + const Timecode::Time& transport_timecode) = 0; virtual void set_session(Session& s); virtual void going_away() { _session = 0; } @@ -68,7 +68,7 @@ public: void tick( const nframes_t& transport_frames, const BBT_Time& transport_bbt, - const SMPTE::Time& transport_smpte); + const Timecode::Time& transport_timecode); void set_session(Session& s); void going_away() { _midi_port = 0; Ticker::going_away(); } diff --git a/libs/ardour/ardour/smpte.h b/libs/ardour/ardour/timecode.h index fa18a1eec4..dd357ea33c 100644 --- a/libs/ardour/ardour/smpte.h +++ b/libs/ardour/ardour/timecode.h @@ -15,12 +15,12 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __ardour_smpte_h__ -#define __ardour_smpte_h__ +#ifndef __ardour_timecode_h__ +#define __ardour_timecode_h__ #include <inttypes.h> -namespace SMPTE { +namespace Timecode { enum Wrap { NONE = 0, @@ -30,7 +30,7 @@ enum Wrap { HOURS }; -/** SMPTE frame rate (in frames per second). +/** Timecode frame rate (in frames per second). * * This should be eliminated in favour of a float to support arbitrary rates. */ @@ -46,7 +46,7 @@ struct Time { uint32_t hours; uint32_t minutes; uint32_t seconds; - uint32_t frames; ///< SMPTE frames (not audio samples) + uint32_t frames; ///< Timecode frames (not audio samples) uint32_t subframes; ///< Typically unused FPS rate; ///< Frame rate of this Time static FPS default_rate; ///< Rate to use for default constructor @@ -62,18 +62,18 @@ struct Time { } }; -Wrap increment( Time& smpte ); -Wrap decrement( Time& smpte ); -Wrap increment_subframes( Time& smpte ); -Wrap decrement_subframes( Time& smpte ); -Wrap increment_seconds( Time& smpte ); -Wrap increment_minutes( Time& smpte ); -Wrap increment_hours( Time& smpte ); -void frames_floor( Time& smpte ); -void seconds_floor( Time& smpte ); -void minutes_floor( Time& smpte ); -void hours_floor( Time& smpte ); +Wrap increment( Time& timecode ); +Wrap decrement( Time& timecode ); +Wrap increment_subframes( Time& timecode ); +Wrap decrement_subframes( Time& timecode ); +Wrap increment_seconds( Time& timecode ); +Wrap increment_minutes( Time& timecode ); +Wrap increment_hours( Time& timecode ); +void frames_floor( Time& timecode ); +void seconds_floor( Time& timecode ); +void minutes_floor( Time& timecode ); +void hours_floor( Time& timecode ); -} // namespace SMPTE +} // namespace Timecode -#endif // __ardour_smpte_h__ +#endif // __ardour_timecode_h__ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 38a0e6d625..1cc619424e 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -31,7 +31,7 @@ #include <inttypes.h> #include <jack/types.h> #include <jack/midiport.h> -#include "control_protocol/smpte.h" +#include "control_protocol/timecode.h" #include "pbd/id.h" #include <map> @@ -184,21 +184,21 @@ namespace ARDOUR { }; enum SmpteFormat { - smpte_23976, - smpte_24, - smpte_24976, - smpte_25, - smpte_2997, - smpte_2997drop, - smpte_30, - smpte_30drop, - smpte_5994, - smpte_60 + timecode_23976, + timecode_24, + timecode_24976, + timecode_25, + timecode_2997, + timecode_2997drop, + timecode_30, + timecode_30drop, + timecode_5994, + timecode_60 }; struct AnyTime { enum Type { - SMPTE, + Timecode, BBT, Frames, Seconds @@ -206,7 +206,7 @@ namespace ARDOUR { Type type; - SMPTE::Time smpte; + Timecode::Time timecode; BBT_Time bbt; union { diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 661ddf139e..70b4a6bf20 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -2000,7 +2000,7 @@ AudioDiskstream::allocate_temporary_buffers () { /* make sure the wrap buffer is at least large enough to deal with the speeds up to 1.2, to allow for micro-variation - when slaving to MTC, SMPTE etc. + when slaving to MTC, Timecode etc. */ double sp = max (fabsf (_actual_speed), 1.2f); diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc index 19653f55c0..c9203435d5 100644 --- a/libs/ardour/audio_region_importer.cc +++ b/libs/ardour/audio_region_importer.cc @@ -127,7 +127,7 @@ string AudioRegionImporter::get_info () const { nframes_t length, position; - SMPTE::Time length_time, position_time; + Timecode::Time length_time, position_time; std::ostringstream oss; // Get sample positions @@ -136,15 +136,15 @@ AudioRegionImporter::get_info () const std::istringstream iss_position(xml_region.property ("position")->value()); iss_position >> position; - // Convert to smpte - session.sample_to_smpte(length, length_time, true, false); - session.sample_to_smpte(position, position_time, true, false); + // Convert to timecode + session.sample_to_timecode(length, length_time, true, false); + session.sample_to_timecode(position, position_time, true, false); // return info oss << _("Length: ") << - smpte_to_string(length_time) << + timecode_to_string(length_time) << _("\nPosition: ") << - smpte_to_string(position_time) << + timecode_to_string(position_time) << _("\nChannels: ") << xml_region.property ("channels")->value(); diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc index 4438985586..c02b841ea7 100644 --- a/libs/ardour/element_importer.cc +++ b/libs/ardour/element_importer.cc @@ -79,7 +79,7 @@ ElementImporter::cancel_move () } string -ElementImporter::smpte_to_string(SMPTE::Time & time) const +ElementImporter::timecode_to_string(Timecode::Time & time) const { std::ostringstream oss; oss << std::setfill('0') << std::right << diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 1ca26f8fae..e2ba2bd6a5 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -311,16 +311,16 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Session, InCleanup); REGISTER_BITS (_Session_StateOfTheState); - REGISTER_ENUM (smpte_23976); - REGISTER_ENUM (smpte_24); - REGISTER_ENUM (smpte_24976); - REGISTER_ENUM (smpte_25); - REGISTER_ENUM (smpte_2997); - REGISTER_ENUM (smpte_2997drop); - REGISTER_ENUM (smpte_30); - REGISTER_ENUM (smpte_30drop); - REGISTER_ENUM (smpte_5994); - REGISTER_ENUM (smpte_60); + REGISTER_ENUM (timecode_23976); + REGISTER_ENUM (timecode_24); + REGISTER_ENUM (timecode_24976); + REGISTER_ENUM (timecode_25); + REGISTER_ENUM (timecode_2997); + REGISTER_ENUM (timecode_2997drop); + REGISTER_ENUM (timecode_30); + REGISTER_ENUM (timecode_30drop); + REGISTER_ENUM (timecode_5994); + REGISTER_ENUM (timecode_60); REGISTER (_Session_SmpteFormat); REGISTER_CLASS_ENUM (Session, pullup_Plus4Plus1); @@ -423,7 +423,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (AutomationList, Curved); REGISTER (_AutomationList_InterpolationStyle); - REGISTER_CLASS_ENUM (AnyTime, SMPTE); + REGISTER_CLASS_ENUM (AnyTime, Timecode); REGISTER_CLASS_ENUM (AnyTime, BBT); REGISTER_CLASS_ENUM (AnyTime, Frames); REGISTER_CLASS_ENUM (AnyTime, Seconds); @@ -502,7 +502,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (ExportFormatBase, SRC_Linear); REGISTER (_ExportFormatBase_SRCQuality); - REGISTER_CLASS_ENUM (ExportProfileManager, SMPTE); + REGISTER_CLASS_ENUM (ExportProfileManager, Timecode); REGISTER_CLASS_ENUM (ExportProfileManager, BBT); REGISTER_CLASS_ENUM (ExportProfileManager, MinSec); REGISTER_CLASS_ENUM (ExportProfileManager, Frames); diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index 60a7732b58..e1e6776a1b 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -43,7 +43,7 @@ ExportFormatSpecification::Time & ExportFormatSpecification::Time::operator= (AnyTime const & other) { type = other.type; - smpte = other.smpte; + timecode = other.timecode; bbt = other.bbt; if (type == Frames) { @@ -73,11 +73,11 @@ ExportFormatSpecification::Time::get_state () node->add_property ("format", enum_2_string (type)); switch (type) { - case SMPTE: - node->add_property ("hours", to_string (smpte.hours, std::dec)); - node->add_property ("minutes", to_string (smpte.minutes, std::dec)); - node->add_property ("seconds", to_string (smpte.seconds, std::dec)); - node->add_property ("frames", to_string (smpte.frames, std::dec)); + case Timecode: + node->add_property ("hours", to_string (timecode.hours, std::dec)); + node->add_property ("minutes", to_string (timecode.minutes, std::dec)); + node->add_property ("seconds", to_string (timecode.seconds, std::dec)); + node->add_property ("frames", to_string (timecode.frames, std::dec)); break; case BBT: node->add_property ("bars", to_string (bbt.bars, std::dec)); @@ -107,21 +107,21 @@ ExportFormatSpecification::Time::set_state (const XMLNode & node) type = (Type) string_2_enum (prop->value(), Type); switch (type) { - case SMPTE: + case Timecode: if ((prop = node.property ("hours"))) { - smpte.hours = atoi (prop->value()); + timecode.hours = atoi (prop->value()); } if ((prop = node.property ("minutes"))) { - smpte.minutes = atoi (prop->value()); + timecode.minutes = atoi (prop->value()); } if ((prop = node.property ("seconds"))) { - smpte.seconds = atoi (prop->value()); + timecode.seconds = atoi (prop->value()); } if ((prop = node.property ("frames"))) { - smpte.frames = atoi (prop->value()); + timecode.frames = atoi (prop->value()); } break; @@ -191,8 +191,8 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const , _silence_beginning (s) , _silence_end (s) { - _silence_beginning.type = Time::SMPTE; - _silence_end.type = Time::SMPTE; + _silence_beginning.type = Time::Timecode; + _silence_end.type = Time::Timecode; set_state (state); } @@ -396,7 +396,7 @@ ExportFormatSpecification::set_state (const XMLNode & root) _silence_beginning.set_state (*child); } } else { - _silence_beginning.type = Time::SMPTE; + _silence_beginning.type = Time::Timecode; } } } @@ -416,7 +416,7 @@ ExportFormatSpecification::set_state (const XMLNode & root) _silence_end.set_state (*child); } } else { - _silence_end.type = Time::SMPTE; + _silence_end.type = Time::Timecode; } } } diff --git a/libs/ardour/location_importer.cc b/libs/ardour/location_importer.cc index fd74e802a7..6fb9f7b7db 100644 --- a/libs/ardour/location_importer.cc +++ b/libs/ardour/location_importer.cc @@ -105,7 +105,7 @@ string LocationImporter::get_info () const { nframes_t start, end; - SMPTE::Time start_time, end_time; + Timecode::Time start_time, end_time; // Get sample positions std::istringstream iss_start (xml_location.property ("start")->value()); @@ -113,17 +113,17 @@ LocationImporter::get_info () const std::istringstream iss_end (xml_location.property ("end")->value()); iss_end >> end; - // Convert to smpte - session.sample_to_smpte (start, start_time, true, false); - session.sample_to_smpte (end, end_time, true, false); + // Convert to timecode + session.sample_to_timecode (start, start_time, true, false); + session.sample_to_timecode (end, end_time, true, false); // return info std::ostringstream oss; if (start == end) { - oss << _("Location: ") << smpte_to_string (start_time); + oss << _("Location: ") << timecode_to_string (start_time); } else { - oss << _("Range\nstart: ") << smpte_to_string (start_time) << - _("\nend: ") << smpte_to_string (end_time); + oss << _("Range\nstart: ") << timecode_to_string (start_time) << + _("\nend: ") << timecode_to_string (end_time); } return oss.str(); diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index a97b8aa658..4034ef32be 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -44,7 +44,7 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) { can_notify_on_unknown_rate = true; - last_mtc_fps_byte = session.get_mtc_smpte_bits (); + last_mtc_fps_byte = session.get_mtc_timecode_bits (); rebind (p); reset (); @@ -76,7 +76,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/) nframes_t qtr; static cycles_t last_qtr = 0; - qtr = (long) (session.frames_per_smpte_frame() / 4); + qtr = (long) (session.frames_per_timecode_frame() / 4); mtc_frame += qtr; last_qtr = cnow; @@ -92,34 +92,34 @@ void MTC_Slave::update_mtc_time (const byte *msg, bool was_full) { nframes_t now = session.engine().frame_time(); - SMPTE::Time smpte; + Timecode::Time timecode; - smpte.hours = msg[3]; - smpte.minutes = msg[2]; - smpte.seconds = msg[1]; - smpte.frames = msg[0]; + timecode.hours = msg[3]; + timecode.minutes = msg[2]; + timecode.seconds = msg[1]; + timecode.frames = msg[0]; last_mtc_fps_byte = msg[4]; switch (msg[4]) { case MTC_24_FPS: - smpte.rate = 24; - smpte.drop = false; + timecode.rate = 24; + timecode.drop = false; can_notify_on_unknown_rate = true; break; case MTC_25_FPS: - smpte.rate = 25; - smpte.drop = false; + timecode.rate = 25; + timecode.drop = false; can_notify_on_unknown_rate = true; break; case MTC_30_FPS_DROP: - smpte.rate = 30; - smpte.drop = true; + timecode.rate = 30; + timecode.drop = true; can_notify_on_unknown_rate = true; break; case MTC_30_FPS: - smpte.rate = 30; - smpte.drop = false; + timecode.rate = 30; + timecode.drop = false; can_notify_on_unknown_rate = true; break; default: @@ -130,11 +130,11 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) << endmsg; can_notify_on_unknown_rate = false; } - smpte.rate = session.smpte_frames_per_second(); - smpte.drop = session.smpte_drop_frames(); + timecode.rate = session.timecode_frames_per_second(); + timecode.drop = session.timecode_drop_frames(); } - session.smpte_to_sample (smpte, mtc_frame, true, false); + session.timecode_to_sample (timecode, mtc_frame, true, false); if (was_full) { @@ -158,7 +158,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) Also compensate for audio latency. */ - mtc_frame += (long) (1.75 * session.frames_per_smpte_frame()) + session.worst_output_latency(); + mtc_frame += (long) (1.75 * session.frames_per_timecode_frame()) + session.worst_output_latency(); if (first_mtc_frame == 0) { first_mtc_frame = mtc_frame; @@ -338,7 +338,7 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos) ARDOUR::nframes_t MTC_Slave::resolution() const { - return (nframes_t) session.frames_per_smpte_frame(); + return (nframes_t) session.frames_per_timecode_frame(); } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index aef643efea..1b054fd6fb 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -104,7 +104,7 @@ sigc::signal<int> Session::AskAboutPendingState; sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch; sigc::signal<void> Session::SendFeedback; -sigc::signal<void> Session::SMPTEOffsetChanged; +sigc::signal<void> Session::TimecodeOffsetChanged; sigc::signal<void> Session::StartTimeChanged; sigc::signal<void> Session::EndTimeChanged; sigc::signal<void> Session::AutoBindingOn; @@ -132,7 +132,7 @@ Session::Session (AudioEngine &eng, state_tree (0), _butler (new Butler (this)), post_transport_work((PostTransportWork)0), - _send_smpte_update (false), + _send_timecode_update (false), midi_thread (pthread_t (0)), midi_requests (128), // the size of this should match the midi request pool size diskstreams (new DiskstreamList), @@ -218,7 +218,7 @@ Session::Session (AudioEngine &eng, state_tree (0), _butler (new Butler (this)), post_transport_work((PostTransportWork)0), - _send_smpte_update (false), + _send_timecode_update (false), midi_thread (pthread_t (0)), midi_requests (16), diskstreams (new DiskstreamList), diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 716ade0075..b795d3fb59 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -340,7 +340,7 @@ Session::process_event (Event* ev) // cerr << "soft locate to " << ev->target_frame << endl; start_locate (ev->target_frame, false, true, false); } - _send_smpte_update = true; + _send_timecode_update = true; break; case Event::LocateRoll: @@ -351,7 +351,7 @@ Session::process_event (Event* ev) // cerr << "soft locate to+roll " << ev->target_frame << endl; start_locate (ev->target_frame, true, true, false); } - _send_smpte_update = true; + _send_timecode_update = true; break; case Event::LocateRollLocate: diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 25807687a8..f7ee8ef3c9 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -43,7 +43,7 @@ #include "ardour/audio_diskstream.h" #include "ardour/slave.h" #include "ardour/cycles.h" -#include "ardour/smpte.h" +#include "ardour/timecode.h" #include "i18n.h" @@ -469,7 +469,7 @@ Session::get_trace_midi_output(MIDI::Port *port) void Session::setup_midi_control () { - outbound_mtc_smpte_frame = 0; + outbound_mtc_timecode_frame = 0; next_quarter_frame_to_send = 0; /* setup the MMC buffer */ @@ -638,7 +638,7 @@ Session::mmc_step (MIDI::MachineControl &/*mmc*/, int steps) } double diff_secs = diff.tv_sec + (diff.tv_usec / 1000000.0); - double cur_speed = (((steps * 0.5) * smpte_frames_per_second()) / diff_secs) / smpte_frames_per_second(); + double cur_speed = (((steps * 0.5) * timecode_frames_per_second()) / diff_secs) / timecode_frames_per_second(); if (_transport_speed == 0 || cur_speed * _transport_speed < 0) { /* change direction */ @@ -691,17 +691,17 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) } nframes_t target_frame; - SMPTE::Time smpte; + Timecode::Time timecode; - smpte.hours = mmc_tc[0] & 0xf; - smpte.minutes = mmc_tc[1]; - smpte.seconds = mmc_tc[2]; - smpte.frames = mmc_tc[3]; - smpte.rate = smpte_frames_per_second(); - smpte.drop = smpte_drop_frames(); + timecode.hours = mmc_tc[0] & 0xf; + timecode.minutes = mmc_tc[1]; + timecode.seconds = mmc_tc[2]; + timecode.frames = mmc_tc[3]; + timecode.rate = timecode_frames_per_second(); + timecode.drop = timecode_drop_frames(); - // Also takes smpte offset into account: - smpte_to_sample( smpte, target_frame, true /* use_offset */, false /* use_subframes */ ); + // Also takes timecode offset into account: + timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ ); if (target_frame > max_frames) { target_frame = max_frames; @@ -773,7 +773,7 @@ Session::change_midi_ports () poke_midi_thread (); } -/** Send MTC Full Frame message (complete SMPTE time) for the start of this cycle. +/** Send MTC Full Frame message (complete Timecode time) for the start of this cycle. * This resets the MTC code, the next quarter frame message that is sent will be * the first one with the beginning of this cycle as the new start point. */ @@ -784,33 +784,33 @@ Session::send_full_time_code(nframes_t /*nframes*/) * that be useful? Does ardour do sub-block accurate locating? [DR] */ MIDI::byte msg[10]; - SMPTE::Time smpte; + Timecode::Time timecode; - _send_smpte_update = false; + _send_timecode_update = false; if (_mtc_port == 0 || !session_send_mtc) { return 0; } - // Get smpte time for this transport frame - sample_to_smpte(_transport_frame, smpte, true /* use_offset */, false /* no subframes */); + // Get timecode time for this transport frame + sample_to_timecode(_transport_frame, timecode, true /* use_offset */, false /* no subframes */); - transmitting_smpte_time = smpte; - outbound_mtc_smpte_frame = _transport_frame; + transmitting_timecode_time = timecode; + outbound_mtc_timecode_frame = _transport_frame; // I don't understand this bit yet.. [DR] - if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) { + if (((mtc_timecode_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_timecode_time.frames % 2)) { // start MTC quarter frame transmission on an even frame - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); - outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame; + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); + outbound_mtc_timecode_frame += (nframes_t) _frames_per_timecode_frame; } // Compensate for audio latency - outbound_mtc_smpte_frame += _worst_output_latency; + outbound_mtc_timecode_frame += _worst_output_latency; next_quarter_frame_to_send = 0; - // Sync slave to the same SMPTE time as we are on + // Sync slave to the same Timecode time as we are on msg[0] = 0xf0; msg[1] = 0x7f; msg[2] = 0x7f; @@ -818,12 +818,12 @@ Session::send_full_time_code(nframes_t /*nframes*/) msg[4] = 0x1; msg[9] = 0xf7; - msg[5] = mtc_smpte_bits | smpte.hours; - msg[6] = smpte.minutes; - msg[7] = smpte.seconds; - msg[8] = smpte.frames; + msg[5] = mtc_timecode_bits | timecode.hours; + msg[6] = timecode.minutes; + msg[7] = timecode.seconds; + msg[8] = timecode.frames; - cerr << "MTC: Sending full time code at " << outbound_mtc_smpte_frame << endl; + cerr << "MTC: Sending full time code at " << outbound_mtc_timecode_frame << endl; // Send message at offset 0, sent time is for the start of this cycle if (_mtc_port->midimsg (msg, sizeof (msg), 0)) { @@ -836,9 +836,9 @@ Session::send_full_time_code(nframes_t /*nframes*/) /** Send MTC (quarter-frame) messages for this cycle. * Must be called exactly once per cycle from the audio thread. Realtime safe. - * This function assumes the state of full SMPTE is sane, eg. the slave is + * This function assumes the state of full Timecode is sane, eg. the slave is * expecting quarter frame messages and has the right frame of reference (any - * full MTC SMPTE time messages that needed to be sent should have been sent + * full MTC Timecode time messages that needed to be sent should have been sent * earlier already this cycle by send_full_time_code) */ int @@ -847,57 +847,57 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) assert (next_quarter_frame_to_send >= 0); assert (next_quarter_frame_to_send <= 7); - if (_mtc_port == 0 || !session_send_mtc || transmitting_smpte_time.negative + if (_mtc_port == 0 || !session_send_mtc || transmitting_timecode_time.negative /*|| (next_quarter_frame_to_send < 0)*/ ) { // cerr << "(MTC) Not sending MTC\n"; return 0; } /* Duration of one quarter frame */ - nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2; + nframes_t quarter_frame_duration = ((long) _frames_per_timecode_frame) >> 2; - // cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_smpte_frame + // cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_timecode_frame // << " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl; // FIXME: this should always be true - //assert((outbound_mtc_smpte_frame + (next_quarter_frame_to_send * quarter_frame_duration)) + //assert((outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) // > _transport_frame); // Send quarter frames for this cycle - while (_transport_frame + nframes > (outbound_mtc_smpte_frame + + while (_transport_frame + nframes > (outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration))) { // cerr << "(MTC) Next frame to send: " << next_quarter_frame_to_send << endl; switch (next_quarter_frame_to_send) { case 0: - mtc_msg[1] = 0x00 | (transmitting_smpte_time.frames & 0xf); + mtc_msg[1] = 0x00 | (transmitting_timecode_time.frames & 0xf); break; case 1: - mtc_msg[1] = 0x10 | ((transmitting_smpte_time.frames & 0xf0) >> 4); + mtc_msg[1] = 0x10 | ((transmitting_timecode_time.frames & 0xf0) >> 4); break; case 2: - mtc_msg[1] = 0x20 | (transmitting_smpte_time.seconds & 0xf); + mtc_msg[1] = 0x20 | (transmitting_timecode_time.seconds & 0xf); break; case 3: - mtc_msg[1] = 0x30 | ((transmitting_smpte_time.seconds & 0xf0) >> 4); + mtc_msg[1] = 0x30 | ((transmitting_timecode_time.seconds & 0xf0) >> 4); break; case 4: - mtc_msg[1] = 0x40 | (transmitting_smpte_time.minutes & 0xf); + mtc_msg[1] = 0x40 | (transmitting_timecode_time.minutes & 0xf); break; case 5: - mtc_msg[1] = 0x50 | ((transmitting_smpte_time.minutes & 0xf0) >> 4); + mtc_msg[1] = 0x50 | ((transmitting_timecode_time.minutes & 0xf0) >> 4); break; case 6: - mtc_msg[1] = 0x60 | ((mtc_smpte_bits|transmitting_smpte_time.hours) & 0xf); + mtc_msg[1] = 0x60 | ((mtc_timecode_bits|transmitting_timecode_time.hours) & 0xf); break; case 7: - mtc_msg[1] = 0x70 | (((mtc_smpte_bits|transmitting_smpte_time.hours) & 0xf0) >> 4); + mtc_msg[1] = 0x70 | (((mtc_timecode_bits|transmitting_timecode_time.hours) & 0xf0) >> 4); break; } - const nframes_t msg_time = (outbound_mtc_smpte_frame + const nframes_t msg_time = (outbound_mtc_timecode_frame + (quarter_frame_duration * next_quarter_frame_to_send)); // This message must fall within this block or something is broken @@ -913,10 +913,10 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) return -1; } - /*cerr << "(MTC) SMPTE: " << transmitting_smpte_time.hours - << ":" << transmitting_smpte_time.minutes - << ":" << transmitting_smpte_time.seconds - << ":" << transmitting_smpte_time.frames + /*cerr << "(MTC) Timecode: " << transmitting_timecode_time.hours + << ":" << transmitting_timecode_time.minutes + << ":" << transmitting_timecode_time.seconds + << ":" << transmitting_timecode_time.frames << ", qfm = " << next_quarter_frame_to_send << ", stamp = " << out_stamp << ", delta = " << _transport_frame + out_stamp - last_time << endl;*/ @@ -927,14 +927,14 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) if (next_quarter_frame_to_send >= 8) { // Wrap quarter frame counter next_quarter_frame_to_send = 0; - // Increment smpte time twice - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); - SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() ); + // Increment timecode time twice + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); + Timecode::increment( transmitting_timecode_time, config.get_subframes_per_frame() ); // Re-calculate timing of first quarter frame - //smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false ); - outbound_mtc_smpte_frame += 8 * quarter_frame_duration; + //timecode_to_sample( transmitting_timecode_time, outbound_mtc_timecode_frame, true /* use_offset */, false ); + outbound_mtc_timecode_frame += 8 * quarter_frame_duration; // Compensate for audio latency - outbound_mtc_smpte_frame += _worst_output_latency; + outbound_mtc_timecode_frame += _worst_output_latency; } } @@ -950,7 +950,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where) { using namespace MIDI; int nbytes = 4; - SMPTE::Time smpte; + Timecode::Time timecode; if (_mmc_port == 0 || !session_send_mmc) { // cerr << "Not delivering MMC " << _mmc_port << " - " << session_send_mmc << endl; @@ -963,15 +963,15 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where) switch (cmd) { case MachineControl::cmdLocate: - smpte_time_subframes (where, smpte); + timecode_time_subframes (where, timecode); mmc_buffer[nbytes++] = 0x6; // byte count mmc_buffer[nbytes++] = 0x1; // "TARGET" subcommand - mmc_buffer[nbytes++] = smpte.hours; - mmc_buffer[nbytes++] = smpte.minutes; - mmc_buffer[nbytes++] = smpte.seconds; - mmc_buffer[nbytes++] = smpte.frames; - mmc_buffer[nbytes++] = smpte.subframes; + mmc_buffer[nbytes++] = timecode.hours; + mmc_buffer[nbytes++] = timecode.minutes; + mmc_buffer[nbytes++] = timecode.seconds; + mmc_buffer[nbytes++] = timecode.frames; + mmc_buffer[nbytes++] = timecode.subframes; break; case MachineControl::cmdStop: diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 8b4d88b704..ea63e71307 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -76,9 +76,9 @@ Session::process (nframes_t nframes) nframes_t transport_frames = transport_frame(); BBT_Time transport_bbt; bbt_time(transport_frames, transport_bbt); - SMPTE::Time transport_smpte; - smpte_time(transport_frames, transport_smpte); - tick (transport_frames, transport_bbt, transport_smpte); /* EMIT SIGNAL */ + Timecode::Time transport_timecode; + timecode_time(transport_frames, transport_timecode); + tick (transport_frames, transport_bbt, transport_timecode); /* EMIT SIGNAL */ SendFeedback (); /* EMIT SIGNAL */ @@ -305,11 +305,11 @@ Session::process_with_events (nframes_t nframes) process_event (ev); } - /* Events caused a transport change, send an MTC Full Frame (SMPTE) message. + /* Events caused a transport change, send an MTC Full Frame (Timecode) message. * This is sent whether rolling or not, to give slaves an idea of ardour time * on locates (and allow slow slaves to position and prepare for rolling) */ - if (_send_smpte_update) { + if (_send_timecode_update) { send_full_time_code(nframes); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 4a5d974563..83cebbccbe 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -187,7 +187,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) pending_locate_flush = false; state_was_pending = false; set_next_event (); - outbound_mtc_smpte_frame = 0; + outbound_mtc_timecode_frame = 0; next_quarter_frame_to_send = -1; current_block_size = 0; solo_update_disabled = false; @@ -244,10 +244,10 @@ Session::first_stage_init (string fullpath, string snapshot_name) waiting_for_sync_offset = false; } - last_smpte_when = 0; - _smpte_offset = 0; - _smpte_offset_negative = true; - last_smpte_valid = false; + last_timecode_when = 0; + _timecode_offset = 0; + _timecode_offset_negative = true; + last_timecode_valid = false; sync_time_vars (); @@ -3103,7 +3103,7 @@ Session::config_changed (std::string p, bool ours) setup_raid_path (config.get_raid_path()); - } else if (p == "smpte-format") { + } else if (p == "timecode-format") { sync_time_vars (); diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index ae8d07e9ee..167d936f50 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -52,102 +52,102 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt) _tempo_map->bbt_time (when, bbt); } -/* SMPTE TIME */ +/* Timecode TIME */ float -Session::smpte_frames_per_second() const +Session::timecode_frames_per_second() const { - switch (config.get_smpte_format()) { - case smpte_23976: + switch (config.get_timecode_format()) { + case timecode_23976: return 23.976; break; - case smpte_24: + case timecode_24: return 24; break; - case smpte_24976: + case timecode_24976: return 24.976; break; - case smpte_25: + case timecode_25: return 25; break; - case smpte_2997: + case timecode_2997: return 29.97; break; - case smpte_2997drop: + case timecode_2997drop: return 29.97; break; - case smpte_30: + case timecode_30: return 30; break; - case smpte_30drop: + case timecode_30drop: return 30; break; - case smpte_5994: + case timecode_5994: return 59.94; break; - case smpte_60: + case timecode_60: return 60; break; default: - cerr << "Editor received unexpected smpte type" << endl; + cerr << "Editor received unexpected timecode type" << endl; } return 30.0; } bool -Session::smpte_drop_frames() const +Session::timecode_drop_frames() const { - switch (config.get_smpte_format()) { - case smpte_23976: + switch (config.get_timecode_format()) { + case timecode_23976: return false; break; - case smpte_24: + case timecode_24: return false; break; - case smpte_24976: + case timecode_24976: return false; break; - case smpte_25: + case timecode_25: return false; break; - case smpte_2997: + case timecode_2997: return false; break; - case smpte_2997drop: + case timecode_2997drop: return true; break; - case smpte_30: + case timecode_30: return false; break; - case smpte_30drop: + case timecode_30drop: return true; break; - case smpte_5994: + case timecode_5994: return false; break; - case smpte_60: + case timecode_60: return false; break; default: - cerr << "Editor received unexpected smpte type" << endl; + cerr << "Editor received unexpected timecode type" << endl; } return false; } @@ -155,59 +155,59 @@ void Session::sync_time_vars () { _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0))); - _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second(); - if (smpte_drop_frames()) { - _frames_per_hour = (long)(107892 * _frames_per_smpte_frame); + _frames_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second(); + if (timecode_drop_frames()) { + _frames_per_hour = (long)(107892 * _frames_per_timecode_frame); } else { - _frames_per_hour = (long)(3600 * rint(smpte_frames_per_second()) * _frames_per_smpte_frame); + _frames_per_hour = (long)(3600 * rint(timecode_frames_per_second()) * _frames_per_timecode_frame); } - _smpte_frames_per_hour = (nframes_t)rint(smpte_frames_per_second() * 3600.0); + _timecode_frames_per_hour = (nframes_t)rint(timecode_frames_per_second() * 3600.0); - last_smpte_valid = false; - // smpte type bits are the middle two in the upper nibble - switch ((int) ceil (smpte_frames_per_second())) { + last_timecode_valid = false; + // timecode type bits are the middle two in the upper nibble + switch ((int) ceil (timecode_frames_per_second())) { case 24: - mtc_smpte_bits = 0; + mtc_timecode_bits = 0; break; case 25: - mtc_smpte_bits = 0x20; + mtc_timecode_bits = 0x20; break; case 30: default: - if (smpte_drop_frames()) { - mtc_smpte_bits = 0x40; + if (timecode_drop_frames()) { + mtc_timecode_bits = 0x40; } else { - mtc_smpte_bits = 0x60; + mtc_timecode_bits = 0x60; } break; }; } void -Session::set_smpte_offset (nframes_t off) +Session::set_timecode_offset (nframes_t off) { - _smpte_offset = off; - last_smpte_valid = false; + _timecode_offset = off; + last_timecode_valid = false; - SMPTEOffsetChanged (); /* EMIT SIGNAL */ + TimecodeOffsetChanged (); /* EMIT SIGNAL */ } void -Session::set_smpte_offset_negative (bool neg) +Session::set_timecode_offset_negative (bool neg) { - _smpte_offset_negative = neg; - last_smpte_valid = false; + _timecode_offset_negative = neg; + last_timecode_valid = false; - SMPTEOffsetChanged (); /* EMIT SIGNAL */ + TimecodeOffsetChanged (); /* EMIT SIGNAL */ } void -Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const +Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes ) const { - if (smpte.drop) { + if (timecode.drop) { // The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997.... // framerate of NTSC color TV. The used frame rate of drop frame is 29.97, which drifts by about // 0.108 frame per hour, or about 1.3 frames per 12 hours. This is not perfect, but a lot better @@ -222,7 +222,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset // // In table form: // - // SMPTE value frames offset subframes offset seconds (rounded) 44100 sample (rounded) + // Timecode value frames offset subframes offset seconds (rounded) 44100 sample (rounded) // 0:00:00:00 0.0 0 0.000 0 (accurate) // 0:00:59:29 1.8 144 60.027 2647177 // 0:01:00:02 -0.2 -16 60.060 2648648 @@ -248,46 +248,46 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset // Per Sigmond <per@sigmond.no> // Samples inside time dividable by 10 minutes (real time accurate) - nframes_t base_samples = (nframes_t) (((smpte.hours * 107892) + ((smpte.minutes / 10) * 17982)) * _frames_per_smpte_frame); + nframes_t base_samples = (nframes_t) (((timecode.hours * 107892) + ((timecode.minutes / 10) * 17982)) * _frames_per_timecode_frame); // Samples inside time exceeding the nearest 10 minutes (always offset, see above) - long exceeding_df_minutes = smpte.minutes % 10; - long exceeding_df_seconds = (exceeding_df_minutes * 60) + smpte.seconds; - long exceeding_df_frames = (30 * exceeding_df_seconds) + smpte.frames - (2 * exceeding_df_minutes); - nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame); + long exceeding_df_minutes = timecode.minutes % 10; + long exceeding_df_seconds = (exceeding_df_minutes * 60) + timecode.seconds; + long exceeding_df_frames = (30 * exceeding_df_seconds) + timecode.frames - (2 * exceeding_df_minutes); + nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_timecode_frame); sample = base_samples + exceeding_samples; } else { /* Non drop is easy.. just note the use of - rint(smpte.rate) * _frames_per_smpte_frame - (frames per SMPTE second), which is larger than - frame_rate() in the non-integer SMPTE rate case. + rint(timecode.rate) * _frames_per_timecode_frame + (frames per Timecode second), which is larger than + frame_rate() in the non-integer Timecode rate case. */ - sample = (nframes_t)rint((((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * (rint(smpte.rate) * _frames_per_smpte_frame)) + (smpte.frames * _frames_per_smpte_frame)); + sample = (nframes_t)rint((((timecode.hours * 60 * 60) + (timecode.minutes * 60) + timecode.seconds) * (rint(timecode.rate) * _frames_per_timecode_frame)) + (timecode.frames * _frames_per_timecode_frame)); } if (use_subframes) { - sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame()); + sample += (long) (((double)timecode.subframes * _frames_per_timecode_frame) / config.get_subframes_per_frame()); } if (use_offset) { - if (smpte_offset_negative()) { - if (sample >= smpte_offset()) { - sample -= smpte_offset(); + if (timecode_offset_negative()) { + if (sample >= timecode_offset()) { + sample -= timecode_offset(); } else { /* Prevent song-time from becoming negative */ sample = 0; } } else { - if (smpte.negative) { - if (sample <= smpte_offset()) { - sample = smpte_offset() - sample; + if (timecode.negative) { + if (sample <= timecode_offset()) { + sample = timecode_offset() - sample; } else { sample = 0; } } else { - sample += smpte_offset(); + sample += timecode_offset(); } } } @@ -296,152 +296,152 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset void -Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const +Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const { nframes_t offset_sample; if (!use_offset) { offset_sample = sample; - smpte.negative = false; + timecode.negative = false; } else { - if (_smpte_offset_negative) { - offset_sample = sample + _smpte_offset; - smpte.negative = false; + if (_timecode_offset_negative) { + offset_sample = sample + _timecode_offset; + timecode.negative = false; } else { - if (sample < _smpte_offset) { - offset_sample = (_smpte_offset - sample); - smpte.negative = true; + if (sample < _timecode_offset) { + offset_sample = (_timecode_offset - sample); + timecode.negative = true; } else { - offset_sample = sample - _smpte_offset; - smpte.negative = false; + offset_sample = sample - _timecode_offset; + timecode.negative = false; } } } - double smpte_frames_left_exact; - double smpte_frames_fraction; - unsigned long smpte_frames_left; + double timecode_frames_left_exact; + double timecode_frames_fraction; + unsigned long timecode_frames_left; // Extract whole hours. Do this to prevent rounding errors with // high sample numbers in the calculations that follow. - smpte.hours = offset_sample / _frames_per_hour; + timecode.hours = offset_sample / _frames_per_hour; offset_sample = offset_sample % _frames_per_hour; - // Calculate exact number of (exceeding) smpte frames and fractional frames - smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame; - smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact ); - smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame()); + // Calculate exact number of (exceeding) timecode frames and fractional frames + timecode_frames_left_exact = (double) offset_sample / _frames_per_timecode_frame; + timecode_frames_fraction = timecode_frames_left_exact - floor( timecode_frames_left_exact ); + timecode.subframes = (long) rint(timecode_frames_fraction * config.get_subframes_per_frame()); // XXX Not sure if this is necessary anymore... - if (smpte.subframes == config.get_subframes_per_frame()) { + if (timecode.subframes == config.get_subframes_per_frame()) { // This can happen with 24 fps (and 29.97 fps ?) - smpte_frames_left_exact = ceil( smpte_frames_left_exact ); - smpte.subframes = 0; + timecode_frames_left_exact = ceil( timecode_frames_left_exact ); + timecode.subframes = 0; } // Extract hour-exceeding frames for minute, second and frame calculations - smpte_frames_left = ((long) floor( smpte_frames_left_exact )); + timecode_frames_left = ((long) floor( timecode_frames_left_exact )); - if (smpte_drop_frames()) { - // See long explanation in smpte_to_sample()... + if (timecode_drop_frames()) { + // See long explanation in timecode_to_sample()... // Number of 10 minute chunks - smpte.minutes = (smpte_frames_left / 17982) * 10; // exactly 17982 frames in 10 minutes + timecode.minutes = (timecode_frames_left / 17982) * 10; // exactly 17982 frames in 10 minutes // frames exceeding the nearest 10 minute barrier - long exceeding_df_frames = smpte_frames_left % 17982; + long exceeding_df_frames = timecode_frames_left % 17982; // Find minutes exceeding the nearest 10 minute barrier if (exceeding_df_frames >= 1800) { // nothing to do if we are inside the first minute (0-1799) exceeding_df_frames -= 1800; // take away first minute (different number of frames than the others) long extra_minutes_minus_1 = exceeding_df_frames / 1798; // how many minutes after the first one exceeding_df_frames -= extra_minutes_minus_1 * 1798; // take away the (extra) minutes just found - smpte.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes + timecode.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes } // Adjust frame numbering for dropped frames (frame 0 and 1 skipped at start of every minute except every 10th) - if (smpte.minutes % 10) { + if (timecode.minutes % 10) { // Every minute except every 10th if (exceeding_df_frames < 28) { // First second, frames 0 and 1 are skipped - smpte.seconds = 0; - smpte.frames = exceeding_df_frames + 2; + timecode.seconds = 0; + timecode.frames = exceeding_df_frames + 2; } else { // All other seconds, all 30 frames are counted exceeding_df_frames -= 28; - smpte.seconds = (exceeding_df_frames / 30) + 1; - smpte.frames = exceeding_df_frames % 30; + timecode.seconds = (exceeding_df_frames / 30) + 1; + timecode.frames = exceeding_df_frames % 30; } } else { // Every 10th minute, all 30 frames counted in all seconds - smpte.seconds = exceeding_df_frames / 30; - smpte.frames = exceeding_df_frames % 30; + timecode.seconds = exceeding_df_frames / 30; + timecode.frames = exceeding_df_frames % 30; } } else { // Non drop is easy - smpte.minutes = smpte_frames_left / ((long) rint (smpte_frames_per_second ()) * 60); - smpte_frames_left = smpte_frames_left % ((long) rint (smpte_frames_per_second ()) * 60); - smpte.seconds = smpte_frames_left / (long) rint(smpte_frames_per_second ()); - smpte.frames = smpte_frames_left % (long) rint(smpte_frames_per_second ()); + timecode.minutes = timecode_frames_left / ((long) rint (timecode_frames_per_second ()) * 60); + timecode_frames_left = timecode_frames_left % ((long) rint (timecode_frames_per_second ()) * 60); + timecode.seconds = timecode_frames_left / (long) rint(timecode_frames_per_second ()); + timecode.frames = timecode_frames_left % (long) rint(timecode_frames_per_second ()); } if (!use_subframes) { - smpte.subframes = 0; + timecode.subframes = 0; } /* set frame rate and drop frame */ - smpte.rate = smpte_frames_per_second (); - smpte.drop = smpte_drop_frames(); + timecode.rate = timecode_frames_per_second (); + timecode.drop = timecode_drop_frames(); } void -Session::smpte_time (nframes_t when, SMPTE::Time& smpte) +Session::timecode_time (nframes_t when, Timecode::Time& timecode) { - if (last_smpte_valid && when == last_smpte_when) { - smpte = last_smpte; + if (last_timecode_valid && when == last_timecode_when) { + timecode = last_timecode; return; } - sample_to_smpte( when, smpte, true /* use_offset */, false /* use_subframes */ ); + sample_to_timecode( when, timecode, true /* use_offset */, false /* use_subframes */ ); - last_smpte_when = when; - last_smpte = smpte; - last_smpte_valid = true; + last_timecode_when = when; + last_timecode = timecode; + last_timecode_valid = true; } void -Session::smpte_time_subframes (nframes_t when, SMPTE::Time& smpte) +Session::timecode_time_subframes (nframes_t when, Timecode::Time& timecode) { - if (last_smpte_valid && when == last_smpte_when) { - smpte = last_smpte; + if (last_timecode_valid && when == last_timecode_when) { + timecode = last_timecode; return; } - sample_to_smpte( when, smpte, true /* use_offset */, true /* use_subframes */ ); + sample_to_timecode( when, timecode, true /* use_offset */, true /* use_subframes */ ); - last_smpte_when = when; - last_smpte = smpte; - last_smpte_valid = true; + last_timecode_when = when; + last_timecode = timecode; + last_timecode_valid = true; } void -Session::smpte_duration (nframes_t when, SMPTE::Time& smpte) const +Session::timecode_duration (nframes_t when, Timecode::Time& timecode) const { - sample_to_smpte( when, smpte, false /* use_offset */, true /* use_subframes */ ); + sample_to_timecode( when, timecode, false /* use_offset */, true /* use_subframes */ ); } void -Session::smpte_duration_string (char* buf, nframes_t when) const +Session::timecode_duration_string (char* buf, nframes_t when) const { - SMPTE::Time smpte; + Timecode::Time timecode; - smpte_duration (when, smpte); - snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); + timecode_duration (when, timecode); + snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); } void -Session::smpte_time (SMPTE::Time &t) +Session::timecode_time (Timecode::Time &t) { - smpte_time (_transport_frame, t); + timecode_time (_transport_frame, t); } int @@ -520,15 +520,15 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/, #ifdef HAVE_JACK_VIDEO_SUPPORT //poke audio video ratio so Ardour can track Video Sync - pos->audio_frames_per_video_frame = frame_rate() / smpte_frames_per_second(); + pos->audio_frames_per_video_frame = frame_rate() / timecode_frames_per_second(); pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio); #endif #if 0 - /* SMPTE info */ + /* Timecode info */ - t.smpte_offset = _smpte_offset; - t.smpte_frame_rate = smpte_frames_per_second(); + t.timecode_offset = _timecode_offset; + t.timecode_frame_rate = timecode_frames_per_second(); if (_transport_speed) { @@ -574,19 +574,19 @@ Session::convert_to_frames_at (nframes_t /*position*/, AnyTime const & any) return _tempo_map->frame_time ( any.bbt); break; - case AnyTime::SMPTE: + case AnyTime::Timecode: /* XXX need to handle negative values */ - secs = any.smpte.hours * 60 * 60; - secs += any.smpte.minutes * 60; - secs += any.smpte.seconds; - secs += any.smpte.frames / smpte_frames_per_second(); - if (_smpte_offset_negative) + secs = any.timecode.hours * 60 * 60; + 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()) - _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) - _timecode_offset; } else { - return (nframes_t) floor (secs * frame_rate()) + _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) + _timecode_offset; } break; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index a4e4a81c95..b5c203189f 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -681,11 +681,11 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w return; } - // Update SMPTE time + // Update Timecode time // [DR] FIXME: find out exactly where this should go below _transport_frame = target_frame; - smpte_time(_transport_frame, transmitting_smpte_time); - outbound_mtc_smpte_frame = _transport_frame; + timecode_time(_transport_frame, transmitting_timecode_time); + outbound_mtc_timecode_frame = _transport_frame; next_quarter_frame_to_send = 0; if (_transport_speed && (!with_loop || loop_changing)) { @@ -785,7 +785,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w loop_changing = false; - _send_smpte_update = true; + _send_timecode_update = true; Located (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 19f5ed195d..97e44ebf7b 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -103,7 +103,7 @@ void MidiClockTicker::transport_state_changed() send_stop_event(0); } - tick(position, *((ARDOUR::BBT_Time *) 0), *((SMPTE::Time *)0)); + tick(position, *((ARDOUR::BBT_Time *) 0), *((Timecode::Time *)0)); } void MidiClockTicker::position_changed(nframes_t position) @@ -133,7 +133,7 @@ void MidiClockTicker::transport_looped() _last_tick = loop_location->start() - elapsed_since_last_tick; } -void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /*transport_bbt*/, const SMPTE::Time& /*transport_smpt*/) +void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /*transport_bbt*/, const Timecode::Time& /*transport_smpt*/) { #ifdef WITH_JACK_MIDI if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f) |