Hi Guys,

I have been playing with the audio driver. All I want to do is a simple
loopthrough function, however, I am finding that the driver locks up
quite randomly when its file handles are being closed.

Has anyone else come up with this issue? I have attached the function I
am playing with, if anyone can replicate the issue I would be most
interested. Sometimes it can run several times with no issue and other
times lock-up each time it is executed.

Regards,

Andrew


void audioloop(unsigned char timesecs)
{
        int fdr;
        int fdw;
        unsigned char buffer[64];
        unsigned char done = 0;

        if( (fdr=open("/dev/sound/dsp",O_RDONLY)) < 0)
        {
                printf( "Sound Input Port failed!\n");
        }
        else
        {
                if( (fdw=open("/dev/sound/dsp",O_WRONLY)) < 0)
                {
                        printf( "Sound Output Port failed!\n");
                }
                else
                {

                        time(&starttime);

                        while (done==0)
                        {
                                read(fdr,buffer,64);
                                ioctl(fdr, SOUND_PCM_SYNC, 0);
                                write(fdw,buffer,64);
                                if (timesecs > 0)
                                {
                                        time(&currenttime);
                                        if ((int)(currenttime - starttime) > 
timesecs)
                                        {
                                                done=1;
                                        }                       
                                }
                        }
                        close (fdr);
                }
                printf( "Closing sound port ...\n");
                close (fdw);
                printf( "... Done\n");
        }
}

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to