- The range and volume of sounds emitted by StatusEffects can be changed and they can be set to loop.
- StatusEffect sounds are configured as child elements of the StatusEffect (instead of attributes). - Background sprites can emit sounds.
This commit is contained in:
@@ -184,7 +184,7 @@ namespace Barotrauma.Sounds
|
||||
if (Disabled) return;
|
||||
|
||||
if (sourceIndex < 1) return;
|
||||
|
||||
|
||||
var state = AL.GetSourceState(alSources[sourceIndex]);
|
||||
if (state == ALSourceState.Playing || state == ALSourceState.Paused)
|
||||
{
|
||||
@@ -195,6 +195,20 @@ namespace Barotrauma.Sounds
|
||||
}
|
||||
}
|
||||
|
||||
public static void Stop(Sound sound)
|
||||
{
|
||||
if (Disabled) return;
|
||||
|
||||
for (int i = 0; i < soundsPlaying.Length; i++)
|
||||
{
|
||||
if (soundsPlaying[i] == sound)
|
||||
{
|
||||
Stop(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Sound GetPlayingSound(int sourceIndex)
|
||||
{
|
||||
if (Disabled) return null;
|
||||
@@ -215,6 +229,29 @@ namespace Barotrauma.Sounds
|
||||
return AL.GetSourceState(alSources[sourceIndex]) == ALSourceState.Playing;
|
||||
}
|
||||
|
||||
public static bool IsPlaying(Sound sound)
|
||||
{
|
||||
int temp;
|
||||
return IsPlaying(sound, out temp);
|
||||
}
|
||||
|
||||
public static bool IsPlaying(Sound sound, out int sourceIndex)
|
||||
{
|
||||
sourceIndex = -1;
|
||||
if (Disabled) return false;
|
||||
|
||||
for (int i = 0; i < soundsPlaying.Length; i++)
|
||||
{
|
||||
if (soundsPlaying[i] == sound && AL.GetSourceState(alSources[i]) == ALSourceState.Playing)
|
||||
{
|
||||
sourceIndex = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPaused(int sourceIndex)
|
||||
{
|
||||
if (Disabled) return false;
|
||||
|
||||
Reference in New Issue
Block a user