|
From: Vladimir S. <ha...@so...> - 2004-02-08 18:51:33
|
Hi Everybody, I've been thinking about note stealing or as i'd like to call it "voice stealing". So far the following comes to mind: 1) When number of voices reaches max there will not be any time to release them, so we have to start releasing them earlier. I'm introducing AUDIO_VOICES_THRESHOLD. It should be set to be a certain percentage of MAX_AUDIO_VOICES depending on how long the release phase is. If it's set to the same value as MAX_AUDIO_VOICES or higher, then voice stealing will be disabled. 2) When number of voices reaches the threshold and a new key is pressed, ls will try the following: a) locate voices on that same key and release all but the last one of them b) if that didn't yeld any results, go thru all keys and try same c) if that didn't work either, try same as above but be more aggressive i.e. free the last voice as well. What do you guys think? Any better ideas? I've been playing around with it and it seems to work OK. With max voices set to 64 i've set the threshold to 48 and it seems to take care of most situations. Depending on how long the release phase is, it may need to be set to something lower (or max voices will have to be increased). At some point we could add a clever algorithm to calculate the threshold automatically based on how long the release phase is (average release time for all samples?) I'm including a patch against latest CVS. This patch also includes some command line and EG changes. Christian will likely review those (but not the voice stealing part) next weekend and it might make it in some shape of form into the CVS, so please give it some testing also, if you have time. If you have trouble with voice stealing and just want to play around with the EG you can turn off voice stealing by setting AUDIO_VOICES_THRESHOLD to be same as MAX_AUDIO_VOICES in audiothread.h. Regards, Vladimir. |