The allocation message sent to the server explicitly truncates (see allocMsg
: numFrames.asInteger
).
The only confusing bit is that Buffer doesn’t change the numFrames value to match the actual server value. Possibly it should? But you can request an update:
s.boot;
s.dumpOSC(1);
// buffer is allocated with an integer numFrames
// but the Buffer object's variable keeps the given, fractional, value (maybe a mistake)
b = Buffer.alloc(s, s.sampleRate * 0.9666, 1);
-> Buffer(0, 46396.8, 1, 48000.0, nil)
[ "/b_alloc", 0, 46396, 1, 0 ]
// if you `query` the buffer then it shows the integer number
b.query;
[ "/b_query", 0 ]
bufnum: 0
numFrames: 46396
numChannels: 1
sampleRate: 48000.0
b
-> Buffer(0, 46396, 1, 48000.0, nil) // and now the numFrames variable is fixed too
Tim Blechmann (supernova author) argued the same thing – supernova throws (threw?) an error if you ask it to allocate a float number of samples in a buffer.
hjh