Skip to content

Inconsistent edge behavior with fluid.bufampslice~ #369

Open
@rconstanzo

Description

@rconstanzo

So when iterating through different startframe values in fluid.bufampslice~ I noticed that when sending negative values for startframe, they get internally clamped to zero (this is good IMO). However, if you having a startframe + numframes that exceeds the duration of the file, you get a red error message plastered to the console.

This leads to inconsistent behavior where when programmatically moving through positions in a buffer one needs to be careful of the ending of the file, and not the beginning.

I get that what is being clamped is different (clamping startframe at zero (though not at the top end) vs having a numframes that exceeds the duration), but the UX is awkward as you have to be careful in one direction only.

IMO a more consistent behavior would be:

if ((startframe + numframes) > duration) {
     numframes = duration - startframe;
     carryOnWithAnalysis;
}

That way you can still analyze whatever you want programmatically without having to count samples at edge cases.

Example patch:
Screenshot 2023-07-11 at 5 34 31 PM

<pre><code>
----------begin_max5_patcher----------
1126.3ocwXsrbiiBEcs8WAkVMyTNt3kjrmUY47OLcWov1nDRICpDn7n6p6u8
At3WIwIlDK4YQDgqQb4btOQ+b7nrElmj1Lzei9WznQ+b7nQfnffQalOJas3o
k0BKrrrkl0qkZW1j3u4jO4.47oHW6yJ8sHmAIzh5m+gDIPMFqxoLZjoyYUqj
HSExcmDsnqpR1hD0VCpU55Z0V+agjssl1s6csRKWZ5zfBnaD1zJsd8KBa5Mu
XErMqnxncUhkxfLxFY5t0JcszYOTnZEbxMKt+JNK6f21p9A71T7T79Mvifs6
.9fEqEqgEm8Ox5GjN0Rw1spQ3VdmmQtoUtzE4X1LpeKQTBKLvJyCC7hoXz2C
uyuFON7XRh1h0RqUbq7M1BqSz5pZ8GLDgx4buN7mePfEUvmfVHz2lcLpgdDp
glcTNXKKFE4dtQFgXVF56uOAPx4.APIwAVbX3HfqH3OD9uu+DMUBB2mDzrx.
iLGdRwkmE87dwpriEq1HrNHz7aYR8puk8pH0sAomSDJ8LhPYyuPQnE.mS3yg
HTB+rhPeOK.8PK.3shdT4tCok254sGjnGD0cRzxZUiEcf2re03+OH+YWHxGG
1Rzr7H2WNHbOY5Ne9pVyZeQJOYqVsqTU14PTkWFhhVBtmbnZBCGyo12D08F8
s0OiV00BtSn+PoQVw5lZo8O+PmvSxR4YeHcbD.WDyKx8dC4dGjY.tYCacS1K
JbvwyKRszAKwRGLVuVaMVTkTDqsxJNqhGK5bt8ACmzjR26sF3Kmr8FoVrnVd
ngMQTBj7GgzhXZYZzOfx29rW8F.Wf4SSsOIVu1FPAjy.wygH7MVzupoTKeze
BeC.+KDIYzQK+jnqp1HboXD4D.haZLt2gnmFwjjQYQ+ixxxCa0ubHPoRWY9M
BRW6uLWhQrT9ww57OFqSP9b9VXbmfT9mveJcRdDLFLPvC9kClgG7T7zdMEed
99x9TRwfvOWkdVg7A.aLnylYyGh.kp5N0po9azPi9vIlY+ShRXuOMRYygpWk
CRhu3s11kTHN97TgpJ47CGG0zSld3jUuIEzCvOgUNnlZeCq1Z0R4uQWaMcsK
k63jqeYjO55J+Uf8ya5ZPr8yVYdTiXy7Rr0lG276TJNeu.XIQQ9N4uymz3NS
8JOP8yqp1KfOsnnH+r5cl7IMKPt2DbFi4byIPaGr7unwP3bscpTcwH4e8lFC
Z5Uoyy9Roc7VsozYzbLGmSlS8EpogNKisRmiOKeyOGcvI8.crym9qwFrB7ml
Mf8C7le0WRF1+f7WRQwvvMmlsehQDd2wZkz5TZnl6AKhDWyQsBIqHxkRQ3Kj
hB2f7xnnTrQgdJOaMEtpwI0T31VHx4pIdJXprOvTQpZpWvTwozTQefoKkqWn
LwkQQo330GwRInm723KDSyJZZdP1Z2rXPE9ZN2afr+yl.SU53zbXZq7A010G
kHZ8o8c9b9cswO43SEwKCls1rR1p8krBkVFG.mWkP8rvmmz1r4ygBk8F+qw+
G0Q1xVB
-----------end_max5_patcher-----------
</code></pre>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions