Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
play_audio(3)			  Arcan Lua API 		   play_audio(3)

NAME
     play_audio - Play an audio sample

SYNOPSIS
     nil
     play_audio( aid:sample )
     play_audio( aid:sample, number:gain )
     play_audio( aid:sample, number:gain, function:callback() )
     play_audio( aid:sample, function:callback() )

DESCRIPTION
     This  function  is  used to control audio playback. When called it issues a
     new playback of the specified audio sample that has previously been  loaded
     or synthesised using load_asample .

     The  argument  form where a gain  is supplied will override any global gain
     settings on the output device through WORLDID .

     If a callback is provided, it will be triggered as soon as  the  underlying
     audio  stack tells us that playback of the sample has finished. This is in-
     tended as a way of sequencing playback samples together.

     Multiple playbacks of the same samples can be running  at	the  same  time,
     limited  by  the mixing capabilities of the underlying driver stack as well
     as a compile-time engine limit (32 by default).

     If a sample fails to queue or mix properly, the function will return false.

EXAMPLE
     function play_audio0()
	   local aid = load_asample("test.wav");
	   play_audio(aid, 0.5);
	   play_audio(aid, function() print("done"); end)
     end

MISUSE
     function play_audio0()
	   play_audio(fill_surface(32, 32, 0, 0, 0), 0.5);
     end

SEE ALSO:
     pause_audio(3) delete_audio(3) load_asample(3) audio_gain(3)

audio				   August 2026			   play_audio(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=play_audio&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help