Conversation
More docs for new mix function
|
@Jokab thank you for the PR! I am not sure though the API needs that sort of complication. Why don't you just compare which buffer is longer and mix shorter one into longer one? |
|
@dfcreative I believe what you are suggesting does not work when there is an offset involved. If, for example, you have two buffers A and B, of length 4 and 3 respectively, and an offset of 2. What happens currently is that B[0] is mixed at A[2], B[1] is mixed at A[3], and then the mixing loop stops because As you can see, B is indeed shorter than A, but it still doesn't behave as I would expect it to. The expected behavior, according to me, would be that B[2] is put at A[5], which would indeed extend A by one element. This is the functionality that my PR extends. |
|
@Jokab oh, I see, makes sense. //short & mysterious
a = u.mix(a, b, .5, offset, true)
//long & explicit
a = u.pad(a, Math.max(a.length, b.length) + offset)
u.mix(a, b, .5, offset)Also in your PR Also, this argument is not treated properly (yet). mix(a, b, true)
mix(a, b, .5, true)
mix(a, b, .5, offset, true)As a possible solution, I would think on detecting |
|
@dfcreative Yeah, I suppose you are right that works too. (Though, you need to do |
Hey, I implemented the feature I requested myself since I figured you were busy. I added tests to make sure it works too. I decided to use a boolean parameter to decide whether to mix or not, added docs too.