Captain's Log: Stardate 77659.2

I ended up deciding to just push forward and finish the tests for the physics simulator. Today I didn't finish this task, but I made a lot of progress. I'm testing things like the circuit breaker, the flow control for the bidirecitonal SPSC queues, error handling, "too big" model loading, all the weirdest edge cases that the simulator has to handle. This is nice, because when this stuff breaks it can be really hard to understand. A few weeks ago I noticed that flow control was broken, and it has been 6 weeks since I broke it -- that's a lot of code to look through to find the root cause. Now I'll find out within minutes.

One interesting detail for today's work was that I was testing that the simulator can correctly handle the situation in which the DAW gives the plugin a sample buffer that is either bigger or smaller than the "expected" sample buffer size it provided. Which is apparently something DAWs are known to do. Strangely, the audio from a weird sample buffer size was NOT identical with audio form a normal size.

This turned out to indicate that while the simulation is deterministic, the outcome did depend on the number of samples in the buffer. Which is terrible, because that itself may vary. In particular, it would mean that rendered audio might come out different depending on buffer size, etc.

This was due to the fact that I was seeding my custom PRNG on each buffer block with a number partly derived from the current sample number. Fixing this was a simple matter of seeding the PRNG once at startup, and maintaining that state permanently in global memory. The extra R/W to global memory sucks, but it only has to be paid once per block -- it's cached in private memory during the simulation. So in practice the extra latency is not measurable.

But, yay, things are perfectly determinstic again and things are easier to test! 😄

Also, this is hilarious to me, and totally accidental

I do not, in fact, intentionally do tests in powers of two


© 2024 Anukari LLC, All Rights Reserved
Contact Us|Legal