Implement looping SFX and immediate rotation opcodes
This commit is contained in:
@@ -1608,12 +1608,14 @@ public sealed class GodotAdvHost : IHost
|
||||
if (audio != null) _main.CallDeferred("LoadSoundEffect", audio.Bytes, audio.Name, channel);
|
||||
}
|
||||
|
||||
public void StartSoundEffect(int channel)
|
||||
public void StartSoundEffect(int channel) => StartSoundEffect(channel, 0);
|
||||
|
||||
public void StartSoundEffect(int channel, int startMode)
|
||||
{
|
||||
if ((uint)channel >= (uint)_sfxNames.Length || _sfxNames[channel] == null) return;
|
||||
_timeline?.Event("sfx-start", new() { ["channel"] = channel,
|
||||
["file"] = _sfxNames[channel] });
|
||||
_main.CallDeferred("StartSoundEffect", channel);
|
||||
["start_mode"] = startMode, ["file"] = _sfxNames[channel] });
|
||||
_main.CallDeferred("StartSoundEffect", channel, startMode);
|
||||
}
|
||||
|
||||
public void ScheduleSoundEffectStart(int channel, int startMode, long delayMs)
|
||||
|
||||
@@ -1890,10 +1890,16 @@ public partial class Main : Godot.Control
|
||||
_sfx[channel].Stream = stream;
|
||||
}
|
||||
|
||||
public void StartSoundEffect(int channel)
|
||||
public void StartSoundEffect(int channel) => StartSoundEffect(channel, 0);
|
||||
|
||||
public void StartSoundEffect(int channel, int startMode)
|
||||
{
|
||||
if ((uint)channel < (uint)_sfx.Length && _sfx[channel].Stream != null)
|
||||
_sfx[channel].Play();
|
||||
if ((uint)channel >= (uint)_sfx.Length || _sfx[channel].Stream == null) return;
|
||||
if (_sfx[channel].Stream is AudioStreamWav wav)
|
||||
wav.LoopMode = startMode == 0
|
||||
? AudioStreamWav.LoopModeEnum.Disabled
|
||||
: AudioStreamWav.LoopModeEnum.Forward;
|
||||
_sfx[channel].Play();
|
||||
}
|
||||
|
||||
public void ScheduleSoundEffectStart(int channel, int startMode, double realDelaySeconds)
|
||||
|
||||
Reference in New Issue
Block a user