<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>In Pd, signal inlets and outlets can share the same buffer.
      Therefore it is important that for any given sample index you
      never write to any outlet before reading from all inlets.</p>
    <p>In your case, you have to first make a copy of all input signals
      before passing them through to the outlets. You can allocate the
      necessary intermediate buffers in the dsp() method.</p>
    <p>
      <blockquote type="cite">I've been working with variable amounts of
        inlets and outlets</blockquote>
      What do you mean by "variable" inlets/outlets? Do you mean that
      the number of inlets/outlets is determined by creation arguments?
      In that case, this is not related to the problem at ahdn. Buffer
      aliasing can happen either way. (It actually depends on how the
      surrounding objects are connected.)</p>
    <p>Christof<br>
    </p>
    <div class="moz-cite-prefix">On 31.05.2020 21:12, Eric Lennartson
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGkKnE1X6RmTfc_gFagN5TkrUstQAh_xFP7q89WV1c+7i6zE2w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">I've been looking at the code for those, but I'm
          finding it a little hard to parse. 
          <div>Not sure how this is going to look on your end, but sorry
            for the text wall. If there's a better way to share lmk. </div>
          <div>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(178,24,137);background-color:rgb(30,32,40)">typedef<span
                style="color:rgb(255,255,255)"> </span>struct<span
                style="color:rgb(255,255,255)"> </span><span
                style="color:rgb(93,216,255)">_viotest</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">{</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(131,192,87)">t_object</span>
              x_obj;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">int</span> n_outs,
              n_ins, n_iolets;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(65,182,69);background-color:rgb(30,32,40)"><span
                style="color:rgb(255,255,255)">    </span><span
                style="color:rgb(131,192,87)">t_sample</span><span
                style="color:rgb(255,255,255)"> **in_vec, **out_vec; </span>//
              vector to hold all the inlets and outlets</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">}
              t_viotest_tilde;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px"><br>
            </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(131,192,87);background-color:rgb(30,32,40)"><span
                style="color:rgb(178,24,137)">static</span><span
                style="color:rgb(255,255,255)"> </span><span
                style="color:rgb(178,24,137)">void</span><span
                style="color:rgb(255,255,255)"> </span><span
                style="color:rgb(65,161,192)">viotest_tilde_input</span><span
                style="color:rgb(255,255,255)">(</span>t_viotest_tilde<span
                style="color:rgb(255,255,255)"> *x, </span>t_floatarg<span
                style="color:rgb(255,255,255)"> f)</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">{</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(219,44,56);background-color:rgb(30,32,40)"><span
                style="color:rgb(255,255,255)">      </span><span
                style="color:rgb(131,192,87)">error</span><span
                style="color:rgb(255,255,255)">(</span>"[viotest~]: no
              method for float."<span style="color:rgb(255,255,255)">);</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">}</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px"><br>
            </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(65,161,192);background-color:rgb(30,32,40)"><span
                style="color:rgb(178,24,137)">static</span><span
                style="color:rgb(255,255,255)"> </span>t_int<span
                style="color:rgb(255,255,255)"> *</span>viotest_tilde_perform<span
                style="color:rgb(255,255,255)">(</span><span
                style="color:rgb(131,192,87)">t_int</span><span
                style="color:rgb(255,255,255)"> *w)</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">{</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(131,192,87);background-color:rgb(30,32,40)"><span
                style="color:rgb(255,255,255)">    </span>t_viotest_tilde<span
                style="color:rgb(255,255,255)"> *x = (</span>t_viotest_tilde<span
                style="color:rgb(255,255,255)"> *)(w[</span><span
                style="color:rgb(120,109,196)">1</span><span
                style="color:rgb(255,255,255)">]);</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">int</span> nblock =
              (<span style="color:rgb(178,24,137)">int</span>)(w[<span
                style="color:rgb(120,109,196)">2</span>]);</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">int</span> n =
              nblock;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(131,192,87)">t_sample</span>
              **in_vec = x-><span style="color:rgb(131,192,87)">in_vec</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(131,192,87)">t_sample</span>
              **out_vec = x-><span style="color:rgb(131,192,87)">out_vec</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">int</span> smaller
              = (x-><span style="color:rgb(131,192,87)">n_ins</span>
              < x-> <span style="color:rgb(131,192,87)">n_outs</span>)
              ? x-><span style="color:rgb(131,192,87)">n_ins</span> :
              x-><span style="color:rgb(131,192,87)">n_outs</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">for</span>(<span
                style="color:rgb(178,24,137)">int</span> channel = <span
                style="color:rgb(120,109,196)">0</span>; channel <
              smaller; ++channel)</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                {</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    <span style="color:rgb(131,192,87)">t_sample</span>*
              in = in_vec[channel];</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    <span style="color:rgb(131,192,87)">t_sample</span>*
              out = out_vec[channel];</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    n = nblock;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    <span style="color:rgb(178,24,137)">while</span>(n--)</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    {</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                        <span style="color:rgb(131,192,87)">t_sample</span>
              out_val = *in++;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                        *out++ = out_val;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    }</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                }</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px"><br>
            </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">return</span> (w +
              <span style="color:rgb(120,109,196)">3</span>);</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">}</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px"><br>
            </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(131,192,87);background-color:rgb(30,32,40)"><span
                style="color:rgb(178,24,137)">static</span><span
                style="color:rgb(255,255,255)"> </span><span
                style="color:rgb(178,24,137)">void</span><span
                style="color:rgb(255,255,255)"> </span><span
                style="color:rgb(65,161,192)">viotest_tilde_dsp</span><span
                style="color:rgb(255,255,255)">(</span>t_viotest_tilde<span
                style="color:rgb(255,255,255)"> *x, </span>t_signal<span
                style="color:rgb(255,255,255)"> **sp)</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">{</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">int</span> i,
              nblock = sp[<span style="color:rgb(120,109,196)">0</span>]-><span
                style="color:rgb(131,192,87)">s_n</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(131,192,87)">t_sample</span>
              **dummy = x-><span style="color:rgb(131,192,87)">in_vec</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">for</span>(i = <span
                style="color:rgb(120,109,196)">0</span>; i < x-><span
                style="color:rgb(131,192,87)">n_ins</span>; ++i)</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                {</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    *dummy++ = sp[i]-><span
                style="color:rgb(131,192,87)">s_vec</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                }</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                <span style="color:rgb(178,24,137)">for</span>(; i <
              x-><span style="color:rgb(131,192,87)">n_iolets</span>;
              ++i)</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                {</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                    *dummy++ = sp[i]-><span
                style="color:rgb(131,192,87)">s_vec</span>;</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)"> 
                }</p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40);min-height:11px">  
               </p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(131,192,87);background-color:rgb(30,32,40)"><span
                style="color:rgb(255,255,255)">    </span>dsp_add<span
                style="color:rgb(255,255,255)">(</span>viotest_tilde_perform<span
                style="color:rgb(255,255,255)">, </span><span
                style="color:rgb(120,109,196)">2</span><span
                style="color:rgb(255,255,255)">, x, nblock);</span></p>
            <p
style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(30,32,40)">}</p>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sun, May 31, 2020 at 12:05
          PM Alexandre Torres Porres <<a
            href="mailto:porres@gmail.com" target="_blank"
            moz-do-not-send="true">porres@gmail.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">I remember I went through similar stuff, see
            the code of else/mtx~ and cyclone/matrix~ 
            <div><br>
            </div>
            <div>and, share your code?</div>
            <div><br>
            </div>
            <div>cheers</div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">Em dom., 31 de mai. de
              2020 às 16:00, Eric Lennartson <<a
                href="mailto:lennartsoneric@gmail.com" target="_blank"
                moz-do-not-send="true">lennartsoneric@gmail.com</a>>
              escreveu:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">Hey all, 
                <div><br>
                </div>
                <div>I've been working with variable amounts of inlets
                  and outlets and for the most part it's been working
                  fine. If it's only variable inlets and the outlets are
                  fixed, or vice versa, it works fine. However when both
                  are variable I can't seem to get the inlets to go to
                  the correct outlet. My current code is cycling through
                  the inlets and outlets in pairs, but for some reason
                  this isn't working. Any thoughts?</div>
                <div><br>
                </div>
                <div>Thanks</div>
                <div>Eric</div>
              </div>
              _______________________________________________<br>
              Pd-dev mailing list<br>
              <a href="mailto:Pd-dev@lists.iem.at" target="_blank"
                moz-do-not-send="true">Pd-dev@lists.iem.at</a><br>
              <a href="https://lists.puredata.info/listinfo/pd-dev"
                rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.puredata.info/listinfo/pd-dev</a><br>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Pd-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>
<a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-dev">https://lists.puredata.info/listinfo/pd-dev</a>
</pre>
    </blockquote>
  </body>
</html>