class music : ?pitch:float -> ?volume:float -> ?position:float * float * float -> ?relative_to_listener:bool -> ?min_distance:float -> ?attenuation:float -> ?playing_offset:OcsfmlSystem.Time.t -> ?loop:bool -> unit -> object .. end
Streamed music played from an audio file.

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 sf::Music has almost the same features as the sf::SoundBuffer / sf::Sound 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.

Usage example:

    (* Declare a new music *)
    let music = new music () in
    (* Open it from an audio file *)
    if not (music#open_from_file "music.ogg")
    then begin
    (* error...*)
    (* Change some parameters *)
    music#set_position 0. 1. 10. ; (* change its 3D position *)
    music#set_pitch 2. ;           (* increase the pitch     *)
    music#set_volume 50. ;         (* reduce the volume      *)
    music#set_loop true ;          (* make it loop           *)
    (* Play it *)

method destroy : unit
method get_duration : OcsfmlSystem.Time.t
Get the total duration of the music.
Returns Music duration
method open_from_file : string -> bool
Open a music from an audio file.

This function doesn't start playing the music (call play() to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
Returns True if loading succeeded, false if it failed