Package openmw.menuΒΆ
openmw.ambient controls background sounds, specific to given player (2D-sounds).
Can be used only by menu scripts and local scripts, that are attached to a player.
Usage:
local ambient = require('openmw.ambient')
Type ambient
| ambient.isMusicPlaying() |
Check if music is playing |
| ambient.isSoundFilePlaying(fileName) |
Check if sound file is playing |
| ambient.isSoundPlaying(soundId) |
Check if sound is playing |
| ambient.playSound(soundId, options) |
Play a 2D sound |
| ambient.playSoundFile(fileName, options) |
Play a 2D sound file |
| ambient.stopMusic() |
Stop to play current music |
| ambient.stopSound(soundId) |
Stop a sound |
| ambient.stopSoundFile(fileName) |
Stop a sound file |
| ambient.streamMusic(fileName) |
Play a sound file as a music track |
Type ambient
Field(s)
- ambient.isMusicPlaying()
-
Check if music is playing
Return value
#boolean:
Usage:
local isPlaying = ambient.isMusicPlaying();
- ambient.isSoundFilePlaying(fileName)
-
Check if sound file is playing
Parameter
-
#string fileName: Path to sound file in VFS
Return value
#boolean:
Usage:
local isPlaying = ambient.isSoundFilePlaying("Sound\\test.mp3"); -
- ambient.isSoundPlaying(soundId)
-
Check if sound is playing
Parameter
-
#string soundId: ID of Sound record to check
Return value
#boolean:
Usage:
local isPlaying = ambient.isSoundPlaying("shock bolt"); -
- ambient.playSound(soundId, options)
-
Play a 2D sound
Parameters
-
#string soundId: ID of Sound record to play -
#table options: An optional table with additional optional arguments. Can contain:timeOffset- a floating point number >= 0, to some time (in second) from beginning of sound file (default: 0);volume- a floating point number >= 0, to set a sound volume (default: 1);pitch- a floating point number >= 0, to set a sound pitch (default: 1);scale- a boolean, to set if sound pitch should be scaled by simulation time scaling (default: true);loop- a boolean, to set if sound should be repeated when it ends (default: false);
Usage:
local params = { timeOffset=0.1 volume=0.3, scale=false, pitch=1.0, loop=true }; ambient.playSound("shock bolt", params) -
- ambient.playSoundFile(fileName, options)
-
Play a 2D sound file
Parameters
-
#string fileName: Path to sound file in VFS -
#table options: An optional table with additional optional arguments. Can contain:timeOffset- a floating point number >= 0, to some time (in second) from beginning of sound file (default: 0);volume- a floating point number >= 0, to set a sound volume (default: 1);pitch- a floating point number >= 0, to set a sound pitch (default: 1);scale- a boolean, to set if sound pitch should be scaled by simulation time scaling (default: true);loop- a boolean, to set if sound should be repeated when it ends (default: false);
Usage:
local params = { timeOffset=0.1 volume=0.3, scale=false, pitch=1.0, loop=true }; ambient.playSoundFile("Sound\\test.mp3", params) -
- ambient.stopMusic()
-
Stop to play current music
Usage:
ambient.stopMusic();
- ambient.stopSound(soundId)
-
Stop a sound
Parameter
-
#string soundId: ID of Sound record to stop
Usage:
ambient.stopSound("shock bolt"); -
- ambient.stopSoundFile(fileName)
-
Stop a sound file
Parameter
-
#string fileName: Path to sound file in VFS
Usage:
ambient.stopSoundFile("Sound\\test.mp3"); -
- ambient.streamMusic(fileName)
-
Play a sound file as a music track
Parameter
-
#string fileName: Path to file in VFS
Usage:
ambient.streamMusic("Music\\Test\\Test.mp3"); -