/* pos = current frame. */
        pos = 0;
        /* number of frames can be played with the current AY register.*/
        left = 0;
        rate = audio_format.channels * ( audio_format.bits / 8 );
        /*number of frames played.*/
        donow = 0;
        do
        {
                stream = sndbuf;
                /* fill partialy sound buffer frame by frame.
                    need is the number of frames remaining.*/
                for ( need = SNDNEED ; need > 0 ; need -= donow )
                {
                        if ( left > 0 )
                        {
                                /* stream current frame. */
                                donow = ( need > left ) ? left : need;
                                left -= donow;
                                stream = ayemu_gen_sound ( &ay ,
(char*)stream , donow * rate );
                        }
                        else
                        {
                                /* get next frame clean buffer. */
                                if ( pos++ > vtx->frames )
                                {
                                        end = 1;
                                        donow = need;
                                        memset (stream , 0 , donow*rate );
                                }
                                else
                                {
                                        /* get current frame and unpack data. */
                                        ayemu_vtx_getframe ( vtx , pos
,  regs );
                                        /* left =
audio_frequency/player_frequency ??? */
                                        left = 44100 / vtx->playerFreq;
                                        ayemu_set_regs ( &ay , regs );
                                        donow = 0;
                                }
                        }
                }

Thats all i can know.
Now its simple, you need more informations about weirds operations?
need more informations about his working, you have 2 solutions, either
you studying under AY/YM sound chip or you simply forget this plugin.
I've contacted the author about these weird operations and i'm waiting
reply since yesturday.


2009/11/3, Max Kellermann <m...@duempel.org>:
> On 2009/11/03 16:10, kernel error <k3rn3l.3r...@gmail.com> wrote:
>> After take a lookt at source code, I'm guessing the code doen't fill
>> completly the buffer, it fill only a part of song frame by frame, so
>> thats an essential part of code, i can't remove this loop.
>
> Stop guessing.
>
> - I don't see any "frame by frame" code, please point me to it.
>
> - what is the meaning of "need", "donow", "left", "pos"?
>
> - why does the loop call memset()?  Why does it generate zeroes after
>   the end of the song?
>
> - why does the loop alternate between two states?  (gen_sound and
>   getframe)  Why not just call these two sequentially?
>
> - what if ayemu_gen_sound() generates less than the specified number
>   of bytes?
>
> - "44100 / vtx->playerFreq" what does that formula do?
>


-- 
Regards,
kernel_error

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to