Include device silence in delay control timing
This commit is contained in:
1 parent
22a03c5880
commit
6896038f30
2 files changed
+5
-4
No files matched your search
@@ -35,7 +35,7 @@ void CallDelay::fail(const char* reason) {
|
|||||||
void CallDelay::reset() {
|
void CallDelay::reset() {
|
||||||
st.clear(); st.setTempo(1);
|
st.clear(); st.setTempo(1);
|
||||||
spanHead = spanCount = trim = 0;
|
spanHead = spanCount = trim = 0;
|
||||||
written = cursor = generated = consumed = stBase = stFed = entry = queuedInput = elapsed = deviceSamples = 0;
|
written = cursor = generated = consumed = stBase = stFed = entry = queuedInput = deviceSamples = 0;
|
||||||
phaseGoal = 0;
|
phaseGoal = 0;
|
||||||
playedSource = cutPhase = 0; tempo = 1;
|
playedSource = cutPhase = 0; tempo = 1;
|
||||||
for (auto& b : buckets) b = {};
|
for (auto& b : buckets) b = {};
|
||||||
@@ -175,7 +175,7 @@ unsigned CallDelay::direct(int16_t* out, unsigned count, unsigned reserve, unsig
|
|||||||
|
|
||||||
/* Нижняя огибающая за 150..200мс убирает пилу пакетизации без зависимости от размера pull. */
|
/* Нижняя огибающая за 150..200мс убирает пилу пакетизации без зависимости от размера pull. */
|
||||||
double CallDelay::lowDepth(double depth, double& inventory) {
|
double CallDelay::lowDepth(double depth, double& inventory) {
|
||||||
uint64_t time = elapsed / (Rate / 20);
|
uint64_t time = deviceSamples / (Rate / 20);
|
||||||
auto& b = buckets[time % 4];
|
auto& b = buckets[time % 4];
|
||||||
if (b.time != time) b = {time, depth, inventory};
|
if (b.time != time) b = {time, depth, inventory};
|
||||||
else { b.low = std::min(b.low, depth); b.inventory = std::min(b.inventory, inventory); }
|
else { b.low = std::min(b.low, depth); b.inventory = std::min(b.inventory, inventory); }
|
||||||
@@ -227,6 +227,5 @@ unsigned CallDelay::pull(int16_t* out, unsigned count, uint64_t queued, unsigned
|
|||||||
consume(n); done += n; deviceSamples += n;
|
consume(n); done += n; deviceSamples += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elapsed += count;
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,8 @@ public:
|
|||||||
unsigned phase = 0; // Ошибка относительно 20мс выхода; 0 — границы совпадают.
|
unsigned phase = 0; // Ошибка относительно 20мс выхода; 0 — границы совпадают.
|
||||||
};
|
};
|
||||||
CallDelay(Input input, void* input_context, soundtouch::SourceCallback source, void* source_context);
|
CallDelay(Input input, void* input_context, soundtouch::SourceCallback source, void* source_context);
|
||||||
|
CallDelay(const CallDelay&) = delete;
|
||||||
|
CallDelay& operator=(const CallDelay&) = delete;
|
||||||
bool valid() const { return !failed; }
|
bool valid() const { return !failed; }
|
||||||
unsigned pull(int16_t* output, unsigned count, uint64_t queued, unsigned reserve);
|
unsigned pull(int16_t* output, unsigned count, uint64_t queued, unsigned reserve);
|
||||||
void reset();
|
void reset();
|
||||||
@@ -42,7 +44,7 @@ private:
|
|||||||
std::array<Span, 32> spans{};
|
std::array<Span, 32> spans{};
|
||||||
unsigned spanHead = 0, spanCount = 0;
|
unsigned spanHead = 0, spanCount = 0;
|
||||||
uint64_t written = 0, cursor = 0, generated = 0, consumed = 0;
|
uint64_t written = 0, cursor = 0, generated = 0, consumed = 0;
|
||||||
uint64_t stBase = 0, stFed = 0, entry = 0, queuedInput = 0, elapsed = 0;
|
uint64_t stBase = 0, stFed = 0, entry = 0, queuedInput = 0;
|
||||||
uint64_t deviceSamples = 0;
|
uint64_t deviceSamples = 0;
|
||||||
int64_t phaseGoal = 0;
|
int64_t phaseGoal = 0;
|
||||||
double playedSource = 0, tempo = 1, cutPhase = 0;
|
double playedSource = 0, tempo = 1, cutPhase = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user