Support Android C++11 in shared delay processor
This commit is contained in:
1 parent
b7b043777b
commit
c244808b77
1 file changed
+12
-3
+12
-3
@@ -7,6 +7,12 @@ using soundtouch::SourceKind;
|
||||
using soundtouch::SourceError;
|
||||
using soundtouch::SourceSpan;
|
||||
|
||||
// Android собирает общий голосовой стек в C++11: константам, переданным по ссылке, нужны определения.
|
||||
constexpr unsigned CallDelay::Rate;
|
||||
constexpr unsigned CallDelay::Frame;
|
||||
constexpr unsigned CallDelay::Capacity;
|
||||
constexpr unsigned CallDelay::Context;
|
||||
|
||||
static int16_t to_pcm(float value) {
|
||||
return (int16_t)std::lrintf(std::max(-32768.0f, std::min(32767.0f, value * 32768.0f)));
|
||||
}
|
||||
@@ -45,8 +51,11 @@ void CallDelay::reset() {
|
||||
}
|
||||
|
||||
CallDelay::Stats CallDelay::stats() const {
|
||||
unsigned phase = (unsigned)((cursor % Frame + Frame - deviceSamples % Frame) % Frame);
|
||||
return {mode, tempo, std::max(0.0, written - playedSource), cuts, entered, exited, phase};
|
||||
Stats result;
|
||||
result.mode = mode; result.tempo = tempo; result.pending = std::max(0.0, written - playedSource);
|
||||
result.cuts = cuts; result.entered = entered; result.exited = exited;
|
||||
result.phase = (unsigned)((cursor % Frame + Frame - deviceSamples % Frame) % Frame);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CallDelay::silence(unsigned count) { deviceSamples += count; }
|
||||
@@ -177,7 +186,7 @@ unsigned CallDelay::direct(int16_t* out, unsigned count, unsigned reserve, unsig
|
||||
double CallDelay::lowDepth(double depth, double& inventory) {
|
||||
uint64_t time = deviceSamples / (Rate / 20);
|
||||
auto& b = buckets[time % 4];
|
||||
if (b.time != time) b = {time, depth, inventory};
|
||||
if (b.time != time) { b.time = time; b.low = depth; b.inventory = inventory; }
|
||||
else { b.low = std::min(b.low, depth); b.inventory = std::min(b.inventory, inventory); }
|
||||
for (const auto& item : buckets) if (item.time <= time && time - item.time < 4) {
|
||||
depth = std::min(depth, item.low); inventory = std::min(inventory, item.inventory);
|
||||
|
||||
Reference in new issue
Block a user