LocalBuf - possible to query?

I guess a LocalBuf cannot be queried using b_query? Because when I print the buffer id, it’s reported as 2048, and when I try

s: [ "/b_query", 2048 ]
r: [ "/b_info", 2048, 0, 1939513360, 0.0 ]

while it doesn’t fail, it reports non-sensical values (zero frames, trillions of channels, and zero sample rate). Any idea why this is returned at all?

1 Like

I think b_query should be changed to send back a failure message for LocalBufs. LocalBufs have to have IDs to pass into UGens but (I think) they stand apart from the normal buffer pool. (Even if b_query returned accurate info, I’m pretty sure b_getn would also produce nonsense, or maybe even crash.)

For that matter, I’m not even certain that LocalBuf IDs are unique across all synth instances. If they aren’t unique, then definitely b_query should fail.

Edit: They are not unique:

(
SynthDef(\x, { |in|
	RecordBuf.ar(In.ar(in, 1), LocalBuf(44100, 1), loop: 1);
}).add;
)

a = (type: \on, instrument: \x, in: #[2, 3]).play;

a[\id].do { |id| s.sendMsg(\n_trace, id) };

TRACE 1001  x    #units: 3
... snip
  unit 2 RecordBuf
    in  1024 0 1 0 1 1 1 0 -0.0505362
    out -0.0505362

TRACE 1000  x    #units: 3
... snip
  unit 2 RecordBuf
    in  1024 0 1 0 1 1 1 0 -0.101582
    out -0.101582

a.put(\type, \off).play;

Synth 1000 and synth 1001 both show local buf ID 1024 – so /b_query cannot meaningfully distinguish which localbuf to report on. Therefore failure is the only correct way to handle it.

I’m pretty sure there’s nothing meaningful that you can do in the client with a LocalBuf in any case – any such scenarios should be using regular buffers.

hjh

2 Likes

Thanks, I was suspecting this (also the duplicate ids across synths). I will open a ticket for the missing /fail.