Streamed music played from an audio file.
// Declare a new music auto music = new Music(); // Open it from an audio file if (!music.openFromFile("music.ogg")) { // error... } // change its 3D position music.position = Vector3f(0, 1, 10); // increase the pitch music.pitch = 2; // reduce the volume music.volume = 50; // make it loop music.loop = true; // Play it music.play();
$(SOUND_LINK), $(SOUNDSTREAM_LINK)
Musics are sounds that are streamed rather than completely loaded in memory.
This is especially useful for compressed musics that usually take hundreds of MB when they are uncompressed: by streaming it instead of loading it entirely, you avoid saturating the memory and have almost no loading delay.
Apart from that, a $(U Music) has almost the same features as the $(SOUNDBUFFER_LINK)/$(SOUND_LINK) pair: you can play/pause/stop it, request its parameters (channels, sample rate), change the way it is played (pitch, volume, 3D position, ...), etc.
As a sound stream, a music is played in its own thread in order not to block the rest of the program. This means that you can leave the music alone after calling play(), it will manage itself very well.