how to dynamically return the name of a buffer in a return function?

    May 11 2016 | 2:16 pm
    Hi list,
    I'd like to change the buffer from which a peek reads dynamically through a return function in gen~. So a return function spits out the buffername for the peek to read from. But I can't get it to work. I attached a patcher in which I recreated the problem. The first gen~ isn't working and the second is working. The second doesn't have a return function, but the name of the buffer is assigned to another. And that is working. That's why I thought it would work in function as well.
    Does anybody know how to do this? Or if it's even possible?

    • May 12 2016 | 12:23 pm
      Ok so after rereading my post I understand the problem is not explained as well as could be. Let me try again.
      I'd like a function in gen~ to return a symbol. This symbol could be the name of a buffer for instance. This would be very handy to change buffers around a samplerate speed. Very cool.
      I read in a post somewhere, this one: that's it's not possible. And ok fine, I can live with that. I'd rather not, but ok.
      The weird thing is, that you CAN refer to a buffer by setting the name of a variable equal to the name of the buffer. Like this:
      bufName = sam2; //here I set bufName equal to sam2 sound = peek(bufName, 0, 0); //and peek understands it
      and then I can re use that bufName variable and change it around to the name of another buffer. Like this:
      bufName = sam1; //here I set bufName equal to sam1 soundB = peek(bufName, 0, 0); //and peek understands it!!!
      So a variable can refer to a buffer. This doesn't work anymore when you try it with only one peek. With an if(x){ bufName = sam2; } else if(y) { bufName = sam1; }
      So my question is. Do I misunderstand something (I hope so) or is it just not possible.