Replacing the loaded AudioSample with playdate->sound->loadIntoSample used to replace the currently playing sound sample as of 3.0.6, but that seems to no longer work as of 3.1.0. The old sample is persistent.
load_sample_test_pdx.zip contains the PDX directory that should work with the simulator on Windows. Note that running this with 3.0.6 simulator has the desired behavior (pressing B changes sound sample), while running the same PDX with 3.1.0 or 3.1.1 does not.
load_sample_test_source.zip contains the source code used to produce the ZIP above.
Sorry for the delayed response! We've been having some server troubles.
I found the problem, huge thanks to your demo. I couldn't reproduce it in my initial test because I created a 1MB buffer and loaded two files smaller than that. Turns out the problem is I changed the free space calculation to fix another issue and since we weren't tracking the actual allocated memory in a consistent way it was failing the check in this case.
The simplest workaround is to create the sample buffer first with newSampleBuffer() and give it 44 bytes more than necessary. Or if you feel like living dangerously, the record of the allocated size is a 32 bit int at offset 4 in the struct--you could tweak the allocated size record directly with *((uint32_t*)sample+1) += 44 right after calling sample->load(). (nb: untested, might not be a good idea)
I've got a fix in for 3.1.2, though no ETA on that currently.