Couldn't one use double buffering, like for screen graphics?
For example, one can have two 250ms samples as buffers... in your loop, you use ChannelPlaying (does it exist in BlitzMax?) to see if sample A is playing... if so, you continue generating sample B. If sample A is no longer playing, you now play sample B and begin generating a new sample A. You will get a latency of however big your buffer is (for example, if your buffer is 250ms seconds, then changes in your realtime settings only change every 250ms seconds).
This could probably be encapsulated in an object/library, so it would be completly transparent (You would just use methods to change the buffer and call a worker method each loop and the object would handle the rest of the stuff).
The only reason it might not work is if the commands to create a sample, load a sample, and then discard a sample are too slow. But since this is all in memory and there is no disk usage, I don't see why this would be the case?
As a side note, how I am assuming .samples works like an array, and for a stereo sample I can use something like:
sound.samples[ksample, left_channel] = whitenoise()
It wasn't fully explained in the docs.
For example, one can have two 250ms samples as buffers... in your loop, you use ChannelPlaying (does it exist in BlitzMax?) to see if sample A is playing... if so, you continue generating sample B. If sample A is no longer playing, you now play sample B and begin generating a new sample A. You will get a latency of however big your buffer is (for example, if your buffer is 250ms seconds, then changes in your realtime settings only change every 250ms seconds).
This could probably be encapsulated in an object/library, so it would be completly transparent (You would just use methods to change the buffer and call a worker method each loop and the object would handle the rest of the stuff).
The only reason it might not work is if the commands to create a sample, load a sample, and then discard a sample are too slow. But since this is all in memory and there is no disk usage, I don't see why this would be the case?
As a side note, how I am assuming .samples works like an array, and for a stereo sample I can use something like:
sound.samples[ksample, left_channel] = whitenoise()
It wasn't fully explained in the docs.