ExternalData and ReadLock
-
Does it make sense to ReadLock data the way I do when you have more than one ExternalData?
void setExternalData(const ExternalData& ed, int index) { data = ed; // so data changes for each external table, right? tableIdx = index; ed.referBlockTo(tableValues[tableIdx], 0); } float getSample(float input) { DataReadLock sl(data); // then, does this make sense??? // and now, is data safe when reading any table? idx 0 here but could 17 or whatever... auto interpolatedValue = tableValues[0][valueInterpolator]; return input * interpolatedValue; }
-
@ustk yup looks good, you can improve the performance by moving the lock acquisition outside the per sample call (so it is called once for each block).
-
@Christoph-Hart Great! all I needed!
-
-
@Christoph-Hart But I still don't understand
data = ed
It is to me likedata
is alternately one table at a time (and even only the last one) or I don't understand whated
is... Does it holds all externals at once? -
@Christoph-Hart And I get an error here
template <typename T> void process(T& data) { DataReadLock sl(data); // Can't find constructor that matches init values { $p0 } for(auto ch: data) { for(auto& s: data.toChannelData(ch)) { s = getSample(s); } } }