Table of Contents

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

sound Sound
audioManager BSAudioManager

The game's audio manager.

utility IUtility

The service that waits one frame between tests of the sound.

source TSource

The reference the sound plays at and follows.

cancellationToken CancellationToken

Cancels the wait on the next frame, and the sound continues to play.

Returns

Task<bool>

True once the sound has finished, and false where the game did not start it.

Type Parameters

TSource

Remarks

A new game or a save load cancels the wait. Call on the game's thread.

Exceptions

ArgumentNullException

utility is null.

InvalidOperationException

source has 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

sound Sound
audioManager BSAudioManager

The game's audio manager.

source TSource

The reference the sound plays at and follows.

Returns

SoundInstance?

The playback, or null where the game did not start the sound.

Type Parameters

TSource

Remarks

Call on the game's thread.

Exceptions

InvalidOperationException

source has no 3D.