VST anomaly

ron

Member
I am toying with VSTs for the first time. (9.1D06 on Solaris)

I find that field _Record-BytesRead in _ActRecord most often contains a very large negative number. What can a negative number mean ... virtual bytes?

Any clues?

Ron.
 

Corwin

New Member
This is a fun one!

The issue is that values in excess of 2 billion roll into negative values. This is because the sign bit gets written into.

I've got a workaround I did for values into the 4 billion range that goes something like:

assign lr = _Buffer-LogicRds / 10.
if lr < 0 then lr = (214748365 * 2) + lr.

This, of course, knocks a zero off of the resulting value, and is thus always an approximation. I cheat by appending a zero (NOT multiplying it) into displays. Very ugly, but it works.

It is not a true fix for big values, but works up to the point the value rolls over 4 billion. If you HAVE to get around that you need to track the cycle of rolls, which I leave completely up to you.
 
One very good reason for storing all the results of these things in decimals!

Any integer is limited to a maximum value of (2^31) - 1, but decimals can have up to 50 significant digits!
 

ron

Member
Corwin said:
This is a fun one!

The issue is that values in excess of 2 billion roll into negative values. This is because the sign bit gets written into.

I've got a workaround I did for values into the 4 billion range that goes something like:

assign lr = _Buffer-LogicRds / 10.
if lr < 0 then lr = (214748365 * 2) + lr.

This, of course, knocks a zero off of the resulting value, and is thus always an approximation. I cheat by appending a zero (NOT multiplying it) into displays. Very ugly, but it works.

It is not a true fix for big values, but works up to the point the value rolls over 4 billion. If you HAVE to get around that you need to track the cycle of rolls, which I leave completely up to you.

Thanks, mate!

Coming from an assembler background, overflowing into the sign bit certainly crossed my mind! The data is being collected and "processed" ... so I can "fix" it. The small loss of significance is not a concern.

Ron.
 
Top