temporal: remove ill-conceived lookup tables from tempo map (never publically visible)
These were not thread safe, and could not be: to be useful, a thread looking up a time conversion could cache the result, but it would be using the global (shared) copy of the map (because lookup is read-only, and so no write-copy is required). But inserting into the lookup table wasn't lock protected (and shouldn't be because otherwise that defeats the point of RCU). So just drop it.
This commit is contained in:
parent
df52c39ce0
commit
52f1b88749
@ -4128,89 +4128,6 @@ TempoMap::write_copy()
|
||||
return _map_mgr.write_copy();
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::drop_lookup_table (){
|
||||
|
||||
superclock_beat_lookup_table.clear ();
|
||||
beat_superclock_lookup_table.clear ();
|
||||
beat_bbt_lookup_table.clear ();
|
||||
superclock_bbt_lookup_table.clear ();
|
||||
}
|
||||
|
||||
Temporal::Beats
|
||||
TempoMap::beat_lookup (superclock_t sc, bool& found) const
|
||||
{
|
||||
LookupTable::const_iterator i = superclock_beat_lookup_table.find (sc);
|
||||
if (i == superclock_beat_lookup_table.end()) {
|
||||
found = false;
|
||||
return Beats();;
|
||||
}
|
||||
found = true;
|
||||
return Temporal::Beats::ticks (i->second);
|
||||
}
|
||||
|
||||
superclock_t
|
||||
TempoMap::superclock_lookup (Temporal::Beats const & b, bool& found) const
|
||||
{
|
||||
LookupTable::const_iterator i = beat_superclock_lookup_table.find (b.to_ticks());
|
||||
if (i == beat_superclock_lookup_table.end()) {
|
||||
found = false;
|
||||
return 0;
|
||||
}
|
||||
found = true;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
BBT_Time
|
||||
TempoMap::bbt_lookup (Temporal::Beats const & b, bool& found) const
|
||||
{
|
||||
LookupTable::const_iterator i = beat_bbt_lookup_table.find (b.to_ticks());
|
||||
if (i == beat_bbt_lookup_table.end()) {
|
||||
found = false;
|
||||
return BBT_Time ();
|
||||
}
|
||||
found = true;
|
||||
return BBT_Time::from_integer (i->second);
|
||||
}
|
||||
|
||||
BBT_Time
|
||||
TempoMap::bbt_lookup (superclock_t sc, bool& found) const
|
||||
{
|
||||
LookupTable::const_iterator i = superclock_bbt_lookup_table.find (sc);
|
||||
if (i == superclock_bbt_lookup_table.end()) {
|
||||
found = false;
|
||||
return BBT_Time ();
|
||||
}
|
||||
found = true;
|
||||
return BBT_Time::from_integer (i->second);
|
||||
}
|
||||
|
||||
/* see tempo.h comments about why this is const */
|
||||
void
|
||||
TempoMap::superclock_to_beat_store (superclock_t sc, Temporal::Beats const & b) const
|
||||
{
|
||||
superclock_beat_lookup_table[sc] = b.to_ticks();
|
||||
}
|
||||
|
||||
/* see tempo.h comments about why this is const */
|
||||
void
|
||||
TempoMap::beat_to_superclock_store (Temporal::Beats const & b, superclock_t sc) const
|
||||
{
|
||||
beat_superclock_lookup_table[b.to_ticks()] = sc;
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::superclock_to_bbt_store (superclock_t sc, BBT_Time const & bbt) const
|
||||
{
|
||||
superclock_bbt_lookup_table[sc] = bbt.as_integer ();
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::beat_to_bbt_store (Temporal::Beats const & b, BBT_Time const & bbt) const
|
||||
{
|
||||
beat_bbt_lookup_table[b.to_ticks()] = bbt.as_integer ();
|
||||
}
|
||||
|
||||
int
|
||||
TempoMap::update (TempoMap::WritableSharedPtr m)
|
||||
{
|
||||
|
@ -1101,21 +1101,9 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
||||
int parse_meter_state_3x (const XMLNode& node, LegacyMeterState& lts);
|
||||
int set_state_3x (XMLNode const &);
|
||||
|
||||
typedef std::unordered_map<int64_t,int64_t> LookupTable;
|
||||
|
||||
mutable LookupTable superclock_beat_lookup_table;
|
||||
mutable LookupTable beat_superclock_lookup_table;
|
||||
mutable LookupTable beat_bbt_lookup_table;
|
||||
mutable LookupTable superclock_bbt_lookup_table;
|
||||
|
||||
friend class TempoPoint;
|
||||
friend class MeterPoint;
|
||||
friend class TempoMetric;
|
||||
Temporal::Beats beat_lookup (superclock_t, bool& found) const;
|
||||
superclock_t superclock_lookup (Temporal::Beats const &, bool& found) const;
|
||||
|
||||
Temporal::BBT_Time bbt_lookup (superclock_t, bool & found) const;
|
||||
Temporal::BBT_Time bbt_lookup (Temporal::Beats const & b, bool & found) const;
|
||||
|
||||
bool solve_ramped_twist (TempoPoint&, TempoPoint&); /* this is implemented by iteration, and it might fail. */
|
||||
bool solve_constant_twist (TempoPoint&, TempoPoint&); //TODO: currently also done by iteration; should be possible to calculate directly
|
||||
@ -1127,18 +1115,6 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
||||
void reset_section (Points::iterator& begin, Points::iterator& end, superclock_t, TempoMetric& metric);
|
||||
|
||||
TempoMapCutBuffer* cut_copy (timepos_t const & start, timepos_t const & end, bool copy, bool ripple);
|
||||
|
||||
/* These are not really const, but the lookup tables are marked mutable
|
||||
* to allow time domain conversions to store their results while being
|
||||
* marked const (which is more semantically correct).
|
||||
*/
|
||||
|
||||
void superclock_to_beat_store (superclock_t, Temporal::Beats const &) const;
|
||||
void beat_to_superclock_store (Temporal::Beats const &, superclock_t) const;;
|
||||
void beat_to_bbt_store (Temporal::Beats const &, Temporal::BBT_Time const &) const;;
|
||||
void superclock_to_bbt_store (superclock_t, Temporal::BBT_Time const &) const;;
|
||||
|
||||
void drop_lookup_table ();
|
||||
};
|
||||
|
||||
class LIBTEMPORAL_API TempoMapCutBuffer
|
||||
|
Loading…
Reference in New Issue
Block a user