[nas] Re: Can play file with AuSoundPlayFromFile

Pooly pooly7 at gmail.com
Tue Aug 8 04:49:31 MDT 2006


2006/7/29, Erik Auerswald <auerswal at unix-ag.uni-kl.de>:
> Hi,
>
> On Fri, Jul 28, 2006 at 04:09:37PM +0100, Pooly wrote:
> > 2006/7/28, Pooly <pooly7 at gmail.com>:
> > >        if ( nas ) {
> > >               AuFixedPoint volume, AuFixedPointFromFraction(100,100);
>                                       =
>
> > >               if ( AuSoundPlayFromFile( nas, soundName, AuNone, volume,
> > >                              NULL, NULL, NULL, NULL, NULL, NULL ) == NULL
> > >                              )
> > >                   fprintf(stderr, "Can't play audio.\n");
> > >              AuFlush(nas);
> > >      }
> >
> > I managed to get a sound by doing :
> >        if ( nas ) {
> >                AuStatus ret;
> >                AuEvent ev;
> >                AuFixedPoint volume, AuFixedPointFromFraction(100,100);
> >               //sync_play_cb is a dummy callback and does not do anything
> >                if ( AuSoundPlayFromFile( nas, soundName, AuNone, volume,
> >                               sync_play_cb, NULL, &autoflowid, NULL,
> > NULL, &ret) == NULL )
> >                    fprintf(stderr, "Can't play audio.\n");
> >
> >               AuNextEvent(nas, AuTrue, &ev);
> >              AuDispatchEvent(nas, &ev);
> >       }
> >
> > Is it the correct way to play a file asynchronously ? I don't want to
> > have AuNextEvent waiting for an incoming event.
>
> Take a look at nas/clients/audio/examples/playSimul.c to see how to wait
> on events only when playing.

Does this ensure that the playing is done asynchronously so that I can
use that method in a near real-time app ?

-- 
http://www.w-fenec.org/



More information about the Nas mailing list