<div dir="ltr"><div>I am making a lightweight opus audio player. This is my portaudio callback function. But i hear a stammering song when i try to play a .opus song file. Can anybody say what is wrong or provide me link to any code which can play opus file written in c/c++(light). I tried to see some open source(vlc opus play) but was unable to follow.</div>
<div><br></div><div>int MyCallback(const void* input,</div><div><span class="" style="white-space:pre">                        </span>   void* output,</div><div><span class="" style="white-space:pre">                        </span>   unsigned long frameCount,</div>
<div><span class="" style="white-space:pre">                        </span>   const PaStreamCallbackTimeInfo* paInfo,</div><div><span class="" style="white-space:pre">                        </span>   PaStreamCallbackFlags paCallbacks,</div><div><span class="" style="white-space:pre">                        </span>   void *userData</div>
<div><span class="" style="white-space:pre">                        </span>   )</div><div>{</div><div><span class="" style="white-space:pre">        </span>OurData *data=(OurData*) userData;</div><div><span class="" style="white-space:pre">        </span>opus_int16* out=(opus_int16 *)output;</div>
<div><span class="" style="white-space:pre">        </span>int thisSize=frameCount;</div><div><span class="" style="white-space:pre">        </span>int smpls_decoded;</div><div><span class="" style="white-space:pre">        </span>while (thisSize&gt;0)</div>
<div><span class="" style="white-space:pre">        </span>{</div><div><span class="" style="white-space:pre">                </span>smpls_decoded=op_read(data-&gt;sndFile,out,thisSize,NULL);</div><div><span class="" style="white-space:pre">                </span>out+=data-&gt;channels*smpls_decoded;</div>
<div><span class="" style="white-space:pre">                </span>thisSize-=data-&gt;channels*smpls_decoded;</div><div><span class="" style="white-space:pre">        </span>}</div><div><span class="" style="white-space:pre">        </span></div><div>
 <span class="" style="white-space:pre">        </span>return paContinue;</div><div>}</div></div>