Audio Library

PreviousNext

Streaming

Streams are used to play music/sound almost endless. Whenever the sound player needs some audio data, an event is fired were you have to fill in new sound data.

There is one built-in stream class in the Audio Library. It is a EM_AUDIO_MOVIE_STREAM, which plays the audio track from movies.

Create a stream

There is a base stream class called EM_AUDIO_STREAM, which provides you with a deferred feature named hook_music_function.

Use this feature to fill a_stream with up to a_length bytes of sound data corresponding to the mixer output settings (see Audio Initialization for more informations). If formats don't match, you will here beeping or other funny stuff.

Use a stream

You may create any stream object by calling create_stream from class EM_AUDIO_FACTORY. The stream will automatically be registered and music will start to play.

Note: Audio subsystem has to be active before using a stream. See Audio Initialization to learn more about enabling the subsystem.

Notes

Please note that streaming is CPU intensive and if you're doing many things in parallel (like drawing many widgets), your application may hang or crash.

There may only one stream be registered at the same time. This is, as it uses a lot of performance and also makes no sense to have two streams played at the same time.