[nas] Re: Can play file with AuSoundPlayFromFile

Erik Auerswald auerswal at unix-ag.uni-kl.de
Fri Jul 28 19:53:42 MDT 2006


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.

Erik



More information about the Nas mailing list