Re: [linux-audio-dev] sound/gui interaction

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] sound/gui interaction
From: douglas irving repetto (douglas_AT_roar.music.columbia.edu)
Date: Thu Jul 20 2000 - 20:43:24 EEST


Benno Senoner wrote:
>
> Hi Douglas, glad to see you here too :-)
>
> Your problem is a typical latency problem:
>
> see my small (outdated) HOWTO for how to improve latencies:
>
> http://www.crosswinds.net/~linuxmusic/lowlatency.html

hi,

thanks to everyone for the responses!

i am indeed running SCHED_FIFO. from my main:

        struct sched_param schp;
        /*
         * set the process to realtime privs
         */
        memset(&schp, 0, sizeof(schp));
        schp.sched_priority = sched_get_priority_max(SCHED_FIFO);

        if (sched_setscheduler(0, SCHED_FIFO, &schp) != 0)
                perror("sched_setscheduler");

this helped a lot, although it's a bit distrubing that users will have
to run the program as root to get glitch-free performance. i'm sure this
has been beaten to death -- i'll have a look at the archives.

i've also (i think) set my dsp thread to the highest priority:

        /* start our audio thread */
        printf("going to create audio thread\n");
        retcode = pthread_create(&th_sound, NULL, ProcessLoop, (void*)this);
        if (retcode != 0)
                fprintf(stderr, "create a failed %d\n", retcode);
        else
                printf("thread created\n");
        
        sched_param param;
        memset(&param, 0, sizeof(param));
        param.sched_priority = sched_get_priority_max(SCHED_FIFO);
        
        retcode = pthread_setschedparam(th_sound, SCHED_FIFO, &param);
        
        if (retcode != 0)
                fprintf(stderr, "failed to set sched param%d\n", retcode);
        
        retcode = pthread_detach(th_sound);
        
        if (retcode != 0)
                fprintf(stderr, "failed to detach thread%d\n", retcode);

this seems to _hurt_ performance quite a bit! i get more glitches than
ever this way, so i must be doing something dumb. any comments? i've
pretty much just copied this code from the man pages...

thanks,
douglas

-- 
                        douglas irving repetto 
                  http://music.columbia.edu/~douglas 
                the music-dsp mailing list and website:
                  http://shoko.calarts.edu/musicdsp


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Jul 20 2000 - 21:19:45 EEST