audio_create_stream

Create a new sound index from an external audio source for streaming.

Syntax:

audio_create_stream(filename);


Argument Description
filename The file (OGG only) to stream the audio from.


Returns: Sound Index


Description

With this function you can create a new sound index which can then be used in the regular audio functions to stream audio directly from an external OGG file source. The function requires the filename (which can be an included file, for example) and will return the new sound index for use. Note that after you no longer need the sound you should call the function audio_destroy_stream() with the sound index to remove it from memory otherwise you may get a memory leak which will slow down and eventually crash your game.


Example:

snd = audio_create_stream("Music/Track1.ogg");
audio_play_sound(snd, 0, true);

The above code creates a new sound index in the variable "snd" from the given file, then plays this sound.


Back: Audio
Next: audio_destroy_stream
© Copyright YoYo Games Ltd. 2018 All Rights Reserved