mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
cache midi metrics depending on meter-type and data-type(s)
This commit is contained in:
parent
51d3fa09ca
commit
008628fd57
1 changed files with 14 additions and 4 deletions
|
|
@ -52,15 +52,17 @@ sigc::signal<void, int, ARDOUR::RouteGroup*, ARDOUR::MeterType> ArdourMeter::Set
|
||||||
/* pattern cache */
|
/* pattern cache */
|
||||||
|
|
||||||
struct MeterMatricsMapKey {
|
struct MeterMatricsMapKey {
|
||||||
MeterMatricsMapKey (std::string n, MeterType t)
|
MeterMatricsMapKey (std::string n, MeterType t, int dt)
|
||||||
: _n(n)
|
: _n(n)
|
||||||
, _t(t)
|
, _t(t)
|
||||||
|
, _dt(dt)
|
||||||
{}
|
{}
|
||||||
inline bool operator<(const MeterMatricsMapKey& rhs) const {
|
inline bool operator<(const MeterMatricsMapKey& rhs) const {
|
||||||
return (_n < rhs._n) || (_n == rhs._n && _t < rhs._t);
|
return (_n < rhs._n) || (_n == rhs._n && _t < rhs._t) || (_n == rhs._n && _t == rhs._t && _dt < rhs._dt);
|
||||||
}
|
}
|
||||||
std::string _n;
|
std::string _n;
|
||||||
MeterType _t;
|
MeterType _t;
|
||||||
|
int _dt;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ArdourMeter {
|
namespace ArdourMeter {
|
||||||
|
|
@ -108,6 +110,14 @@ ArdourMeter::meter_type_string (ARDOUR::MeterType mt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int types_to_bit (vector<ARDOUR::DataType> types) {
|
||||||
|
int rv = 0;
|
||||||
|
for (vector<DataType>::const_iterator i = types.begin(); i != types.end(); ++i) {
|
||||||
|
rv |= 1 << (*i);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static inline float mtr_col_and_fract(
|
static inline float mtr_col_and_fract(
|
||||||
cairo_t* cr, Gdk::Color const * const c, const uint32_t peakcolor, const MeterType mt, const float val)
|
cairo_t* cr, Gdk::Color const * const c, const uint32_t peakcolor, const MeterType mt, const float val)
|
||||||
{
|
{
|
||||||
|
|
@ -906,7 +916,7 @@ ArdourMeter::meter_expose_ticks (GdkEventExpose *ev, MeterType type, std::vector
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
cairo_pattern_t* pattern;
|
cairo_pattern_t* pattern;
|
||||||
const MeterMatricsMapKey key (mta->get_name(), type);
|
const MeterMatricsMapKey key (mta->get_name(), type, types_to_bit(types));
|
||||||
MetricPatternMap::iterator i = ticks_patterns.find (key);
|
MetricPatternMap::iterator i = ticks_patterns.find (key);
|
||||||
|
|
||||||
if (i == ticks_patterns.end()) {
|
if (i == ticks_patterns.end()) {
|
||||||
|
|
@ -944,7 +954,7 @@ ArdourMeter::meter_expose_metrics (GdkEventExpose *ev, MeterType type, std::vect
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
cairo_pattern_t* pattern;
|
cairo_pattern_t* pattern;
|
||||||
const MeterMatricsMapKey key (mma->get_name(), type);
|
const MeterMatricsMapKey key (mma->get_name(), type, types_to_bit(types));
|
||||||
MetricPatternMap::iterator i = metric_patterns.find (key);
|
MetricPatternMap::iterator i = metric_patterns.find (key);
|
||||||
|
|
||||||
if (i == metric_patterns.end()) {
|
if (i == metric_patterns.end()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue