Class SoundExtensions
- Namespace
- SkyrimForge.Game
- Assembly
- SkyrimForge.Game.dll
Provides extension members for Sound.
public static class SoundExtensions
- Inheritance
-
SoundExtensions
- Inherited Members
Methods
PlayAndWait<TSource>(Sound, BSAudioManager, IUtility, TSource, CancellationToken)
Plays the sound from source and waits for it to finish, as Papyrus's PlayAndWait does.
public static Task<bool> PlayAndWait<TSource>(this Sound sound, BSAudioManager audioManager, IUtility utility, TSource source, CancellationToken cancellationToken = default) where TSource : notnull, IObjectReference
Parameters
soundSoundaudioManagerBSAudioManagerThe game's audio manager.
utilityIUtilityThe service that waits one frame between tests of the sound.
sourceTSourceThe reference the sound plays at and follows.
cancellationTokenCancellationTokenCancels the wait on the next frame, and the sound continues to play.
Returns
Type Parameters
TSource
Remarks
A new game or a save load cancels the wait. Call on the game's thread.
Exceptions
- ArgumentNullException
utilityisnull.- InvalidOperationException
sourcehas no 3D.
Play<TSource>(Sound, BSAudioManager, TSource)
Plays the sound from source, as Papyrus's Play does.
public static SoundInstance? Play<TSource>(this Sound sound, BSAudioManager audioManager, TSource source) where TSource : notnull, IObjectReference
Parameters
soundSoundaudioManagerBSAudioManagerThe game's audio manager.
sourceTSourceThe reference the sound plays at and follows.
Returns
- SoundInstance?
The playback, or
nullwhere the game did not start the sound.
Type Parameters
TSource
Remarks
Call on the game's thread.
Exceptions
- InvalidOperationException
sourcehas no 3D.