add ::time_domain() methods to Playlist and Region

These are heuristics based on data type for now. That may evolve over time,
but it's a reasonable place to begin
This commit is contained in:
Paul Davis 2022-05-27 15:56:13 -06:00
parent 399a5b3f25
commit 39248d682d
4 changed files with 35 additions and 0 deletions

View File

@ -112,6 +112,8 @@ public:
bool set_name (const std::string& str);
void set_region_ownership ();
Temporal::TimeDomain time_domain() const;
/*playlist group IDs (pgroup_id) is a group identifier that is implicitly
* or explicitly assigned to playlists so they can be associated with each other.
*

View File

@ -108,6 +108,7 @@ public:
bool set_name (const std::string& str);
const DataType& data_type () const { return _type; }
Temporal::TimeDomain time_domain() const;
/** How the region parameters play together:
*

View File

@ -3446,3 +3446,16 @@ Playlist::rdiff_and_add_command (Session* session)
session->add_commands (cmds);
session->add_command (new StatefulDiffCommand (shared_from_this ()));
}
Temporal::TimeDomain
Playlist::time_domain() const
{
switch (_type) {
case DataType::AUDIO:
return Temporal::AudioTime;
default:
break;
}
return Temporal::BeatTime;
}

View File

@ -2068,3 +2068,22 @@ Region::region_relative_position (timepos_t const & p) const
*/
return p.earlier (position());
}
Temporal::TimeDomain
Region::time_domain() const
{
boost::shared_ptr<Playlist> pl (_playlist.lock());
if (pl) {
return pl->time_domain ();
}
switch (_type) {
case DataType::AUDIO:
return Temporal::AudioTime;
default:
break;
}
return Temporal::BeatTime;
}