Skip to content

Playing Music and Sound

Bryan Edds edited this page Sep 29, 2024 · 8 revisions

Nu exposes a very simple audio API via the World module -

        /// Get the currently playing song, if any.
        static member getCurrentSongOpt world = ...
            
        /// Get the currently playing song's position or 0.0.
        static member getCurrentSongPosition world = ...

        /// Get the master volume.
        static member getMasterAudioVolume world = ...

        /// Get the master sound volume.
        static member getMasterSoundVolume world = ...

        /// Get the master song volume.
        static member getMasterSongVolume world = ...

        /// Set the master volume.
        static member setMasterAudioVolume volume world = ...

        /// Set the master sound volume.
        static member setMasterSoundVolume volume world = ...

        /// Set the master song volume.
        static member setMasterSongVolume volume world = ...

        /// Send a message to the audio system to play a song.
        static member playSong fadeOutTime fadeInTime startTime volume song world = ...

        /// Send a message to the audio system to play a sound.
        static member playSound volume sound world = ...

        /// Send a message to the audio system to fade out any current song.
        static member fadeOutSong fadeOutTime world = ...

        /// Send a message to the audio system to stop a song.
        static member stopSong world = ...
Clone this wiki locally