From 032ff829554699bcd527926723f121e5e4b70ffa Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 7 Apr 2025 23:12:27 -0500 Subject: [PATCH] fix low quality not working in acquireDirect performance may be reduced --- extern/blip_buf/blip_buf.c | 5 ++++- extern/blip_buf/blip_buf.h | 5 ++++- src/engine/dispatchContainer.cpp | 29 ++++++++--------------------- src/engine/engine.cpp | 6 ++++++ 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/extern/blip_buf/blip_buf.c b/extern/blip_buf/blip_buf.c index 63f14a049..0ed95a732 100644 --- a/extern/blip_buf/blip_buf.c +++ b/extern/blip_buf/blip_buf.c @@ -299,7 +299,7 @@ possibly-wider fixed_t. On 32-bit platforms, this is likely more efficient. And by having pre_shift 32, a 32-bit platform can easily do the shift by simply ignoring the low half. */ -void blip_add_delta( blip_t* m, unsigned time, int delta ) +void blip_add_delta_slow( blip_t* m, unsigned time, int delta ) { unsigned fixed = (unsigned) ((time * m->factor + m->offset) >> pre_shift); buf_t* out = SAMPLES( m ) + m->avail + (fixed >> frac_bits); @@ -350,3 +350,6 @@ void blip_add_delta_fast( blip_t* m, unsigned time, int delta ) out [7] += delta * delta_unit - delta2; out [8] += delta2; } + +/* (tildearrow) ability to change blip_add_delta at runtime */ +void (*blip_add_delta)( blip_t*, unsigned int, int )=blip_add_delta_slow; \ No newline at end of file diff --git a/extern/blip_buf/blip_buf.h b/extern/blip_buf/blip_buf.h index 524d10265..8df664b55 100644 --- a/extern/blip_buf/blip_buf.h +++ b/extern/blip_buf/blip_buf.h @@ -35,8 +35,11 @@ blip_max_ratio = 1 << 20 }; /** Clears entire buffer. Afterwards, blip_samples_avail() == 0. */ void blip_clear( blip_t* ); +/** (tildearrow) ability to change blip_add_delta at runtime */ +extern void (*blip_add_delta)( blip_t*, unsigned int, int ); + /** Adds positive/negative delta into buffer at specified clock time. */ -void blip_add_delta( blip_t*, unsigned int clock_time, int delta ); +void blip_add_delta_slow( blip_t*, unsigned int clock_time, int delta ); /** Same as blip_add_delta(), but uses faster, lower-quality synthesis. */ void blip_add_delta_fast( blip_t*, unsigned int clock_time, int delta ); diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index e594ecc95..23cbde76b 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -194,27 +194,14 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) } } } - if (lowQuality) { - for (int i=0; i