encoding audio reminder

angelo <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Dear Gentlemen,

i have developed a PC application that stream and receive audio to a 
remote embedded device, in an half duplex fashon.
Everything works quite fine now, except for a little problem:
I have the following operation sequence:
TX1) I start to capture and sending audio chunks to the remote device.
RX1) I stop to capture, clear someway captured samples, and set the PC 
application in RX mode.
TX2) I start to capture again, and sending udio chunks to the remote device.

The second time i start to capture and send (TX2), seems i am sending 
still a chunk of old session TX1.

I try to add some code:

I open the capture device at application startup.

TX ()
{
    alcCaptureStart( capture );

    AudioThread (true);
}

audio thread read and send now

RX ()
{
    if (capture)
    {
        alcCaptureStop    (capture);

        ALCint remainder;

        alcGetIntegerv    (capture, ALC_CAPTURE_SAMPLES, 1, &remainder);

        int block;

        while (remainder > 0)
        {
            block = (remainder)>512?512:remainder;

            alcCaptureSamples    (capture, &buffsamples[OFS_PLD], block);

            remainder -= block;
        }

        /**
        * this clear every AL error, so that next "alut" functions don't 
fail,
        * in particular "alutCreateBufferFromFile" need a clean start.
        */
        alcGetError    (capture);
    }

    .... RX init code
}

Is there a way to be sure i am not reading/capturing old samples still 
in AL buffer from the previous capture session  ?


many thanks in advice,
Angelo


_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.