| 1 | |
| 2 | <refentry id="OSCcount"> |
| 3 | <indexterm id="IndexOSCcount"><primary>OSCcount</primary></indexterm> |
| 4 | <refentryinfo><title>OSC</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>OSCcount</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>OSCcount</refname> |
| 11 | <refpurpose> |
| 12 | Gives the Count of OSC messages currently unread. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para>Plugin opcode in osc.</para> |
| 19 | <para> |
| 20 | Gives the Count of OSC messages currently unread but received by |
| 21 | the current listeners. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>kans <command>OSCcount</command></synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>kans</emphasis> -- set to the number of messages |
| 34 | accepted by this Csound process to any address but not yet |
| 35 | presented to a call of OSClisten. |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | The expected use of this opcode is when there are a number of |
| 40 | listeners and we can decide checking them all if there are no |
| 41 | messages. |
| 42 | </para> |
| 43 | </refsect1> |
| 44 | |
| 45 | <refsect1> |
| 46 | <title>Example</title> |
| 47 | <para> |
| 48 | This example shows a pair of floating point numbers being received |
| 49 | on port 7770. |
| 50 | </para> |
| 51 | |
| 52 | <informalexample> |
| 53 | <programlisting> |
| 54 | <emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100 |
| 55 | <emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 100 |
| 56 | <emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 2 |
| 57 | |
| 58 | gihandle <emphasis role="opc">OSCinit</emphasis> 7770 |
| 59 | |
| 60 | <emphasis role="oblock">instr</emphasis> 1 |
| 61 | kf1 <emphasis role="opc">init</emphasis> 0 |
| 62 | kf2 <emphasis role="opc">init</emphasis> 0 |
| 63 | kk <emphasis role="opc">OSCcount</emphasis> |
| 64 | nxtmsg: |
| 65 | |
| 66 | if (kk <emphasis role="opc">==</emphasis> 0) goto ex |
| 67 | kr <emphasis role="opc">OSClisten</emphasis> gihandle, "/foo/bar", "ff", kf1, kf2 |
| 68 | <emphasis role="opc">printk</emphasis> 0,kf1 |
| 69 | <emphasis role="opc">printk</emphasis> 0,kf2 |
| 70 | kk -= 1 |
| 71 | <emphasis role="opc">kgoto</emphasis> nxtmsg |
| 72 | ex: |
| 73 | <emphasis role="oblock">endin</emphasis> |
| 74 | </programlisting> |
| 75 | </informalexample> |
| 76 | </refsect1> |
| 77 | |
| 78 | <refsect1> |
| 79 | <title>See also</title> |
| 80 | <para><link linkend="OSC"><citetitle>OSC (Open Sound Control)</citetitle></link></para> |
| 81 | <para> More information on this opcode: <ulink url="http://www.youtube.com/watch?v=JX1C3TqP_9Y"><citetitle>http://www.youtube.com/watch?v=JX1C3TqP_9Y</citetitle></ulink> , made by Andrés Cabrera </para> |
| 82 | </refsect1> |
| 83 | |
| 84 | <refsect1> |
| 85 | <title>Credits</title> |
| 86 | <para> |
| 87 | <simplelist> |
| 88 | <member>Author: &namejohn;</member> |
| 89 | <member>2018 new in Csound 6.12</member> |
| 90 | </simplelist> |
| 91 | </para> |
| 92 | </refsect1> |
| 93 | </refentry> |