Starsector API
Loading...
Searching...
No Matches
com.fs.starfarer.api.SoundPlayerAPI Interface Reference

Public Member Functions

SoundAPI playUISound (String id, float pitch, float volume)
 
SoundAPI playSound (String id, float pitch, float volume, Vector2f loc, Vector2f vel)
 
void playLoop (String id, Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel)
 
void restartCurrentMusic ()
 
String getCurrentMusicId ()
 
void playCustomMusic (int fadeOutIfAny, int fadeIn, String musicSetId)
 
void playMusic (int fadeOutIfAny, int fadeIn, String musicSetId)
 
void setSuspendDefaultMusicPlayback (boolean suspendMusicPlayback)
 
Vector2f getListenerPos ()
 
void pauseCustomMusic ()
 
void resumeCustomMusic ()
 
void playCustomMusic (int fadeOutIfAny, int fadeIn, String musicSetId, boolean looping)
 
void playUILoop (String id, float pitch, float volume)
 
void playLoop (String id, Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel, float fadeIn, float fadeOut)
 
void applyLowPassFilter (float gain, float gainHF)
 
void setListenerPosOverrideOneFrame (Vector2f listenerPosOverrideOneFrame)
 
void pauseMusic ()
 
void setNextLoopFadeInAndOut (float nextLoopFadeIn, float nextLoopFadeOut)
 

Detailed Description

Author
Alex Mosolov

Copyright 2013 Fractal Softworks, LLC

Definition at line 10 of file SoundPlayerAPI.java.

Member Function Documentation

◆ applyLowPassFilter()

void com.fs.starfarer.api.SoundPlayerAPI.applyLowPassFilter ( float  gain,
float  gainHF 
)

◆ getCurrentMusicId()

String com.fs.starfarer.api.SoundPlayerAPI.getCurrentMusicId ( )

Thread-safe - can be called from threads other than the main loop thread. The music id is the name of the file, including its path. It is NOT the name of the music set that gets passed in to playMusic, which may consist of multiple files, one of which will get picked randomly.

Returns the string "nothing" when nothing is playing.

Returns

◆ getListenerPos()

Vector2f com.fs.starfarer.api.SoundPlayerAPI.getListenerPos ( )

◆ pauseCustomMusic()

void com.fs.starfarer.api.SoundPlayerAPI.pauseCustomMusic ( )

◆ pauseMusic()

void com.fs.starfarer.api.SoundPlayerAPI.pauseMusic ( )

◆ playCustomMusic() [1/2]

void com.fs.starfarer.api.SoundPlayerAPI.playCustomMusic ( int  fadeOutIfAny,
int  fadeIn,
String  musicSetId 
)

Thread-safe - can be called from threads other than the main loop thread.

Fade in/out are in seconds and have to be whole numbers. Can pass in null for musicSetId to stop the current track without starting a new one.

Parameters
fadeOutIfAny
fadeIn
musicSetId

◆ playCustomMusic() [2/2]

void com.fs.starfarer.api.SoundPlayerAPI.playCustomMusic ( int  fadeOutIfAny,
int  fadeIn,
String  musicSetId,
boolean  looping 
)

◆ playLoop() [1/2]

void com.fs.starfarer.api.SoundPlayerAPI.playLoop ( String  id,
Object  playingEntity,
float  pitch,
float  volume,
Vector2f  loc,
Vector2f  vel 
)

Loop a sound. Must be called every frame or the loop will fade out. Should be mono.

Parameters
id
playingEntityRequired. Used to help uniquely identify playing loops. Also used to figure out which loops to not play (i.e., same entity playing multiples of the same loop would only play the one.)
pitch
volume
loc
vel

◆ playLoop() [2/2]

void com.fs.starfarer.api.SoundPlayerAPI.playLoop ( String  id,
Object  playingEntity,
float  pitch,
float  volume,
Vector2f  loc,
Vector2f  vel,
float  fadeIn,
float  fadeOut 
)

◆ playMusic()

void com.fs.starfarer.api.SoundPlayerAPI.playMusic ( int  fadeOutIfAny,
int  fadeIn,
String  musicSetId 
)

Use playCustomMusic instead; has same effect. Deprecation is for naming consistency only.

Parameters
fadeOutIfAny
fadeIn
musicSetId

◆ playSound()

SoundAPI com.fs.starfarer.api.SoundPlayerAPI.playSound ( String  id,
float  pitch,
float  volume,
Vector2f  loc,
Vector2f  vel 
)

Sound file must be mono for it to be properly played within the engine.

Parameters
id
pitch
volume
loc
vel
Returns

◆ playUILoop()

void com.fs.starfarer.api.SoundPlayerAPI.playUILoop ( String  id,
float  pitch,
float  volume 
)

◆ playUISound()

SoundAPI com.fs.starfarer.api.SoundPlayerAPI.playUISound ( String  id,
float  pitch,
float  volume 
)

UI sound files should be stereo.

Parameters
id
pitch
volume

◆ restartCurrentMusic()

void com.fs.starfarer.api.SoundPlayerAPI.restartCurrentMusic ( )

Thread-safe - can be called from threads other than the main loop thread.

◆ resumeCustomMusic()

void com.fs.starfarer.api.SoundPlayerAPI.resumeCustomMusic ( )

◆ setListenerPosOverrideOneFrame()

void com.fs.starfarer.api.SoundPlayerAPI.setListenerPosOverrideOneFrame ( Vector2f  listenerPosOverrideOneFrame)

◆ setNextLoopFadeInAndOut()

void com.fs.starfarer.api.SoundPlayerAPI.setNextLoopFadeInAndOut ( float  nextLoopFadeIn,
float  nextLoopFadeOut 
)

◆ setSuspendDefaultMusicPlayback()

void com.fs.starfarer.api.SoundPlayerAPI.setSuspendDefaultMusicPlayback ( boolean  suspendMusicPlayback)

Thread-safe - can be called from threads other than the main loop thread.

Won't stop any currently-playing music, but will prevent new tracks from starting playback automatically when the current one is over. Meant to be used in conjunction with playMusic() for customized music playback.

See also: SettingsAPI.getCurrentGameState()

Stops

Parameters
suspendMusicPlayback

The documentation for this interface was generated from the following file: