Partilhar via


WaveBank Constructor (AudioEngine, String, Int32, Int16)

Initializes a new, streaming instance of this class, using a provided AudioEngine and streaming wave bank parameters.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public WaveBank (
         AudioEngine audioEngine,
         string streamingWaveBankFilename,
         int offset,
         short packetsize
)

Parameters

  • audioEngine
    Instance of an AudioEngine to associate this wave bank with.
  • streamingWaveBankFilename
    Path to the wave bank file to stream from.
  • offset
    Offset within the wave bank data file. This offset must be DVD sector aligned.
  • packetsize
    Stream packet size, in sectors, to use for each stream. The minimum value is 2.

Exceptions

Exception type Condition
ArgumentNullException The audioEngine or nonStreamingWaveBankFilenameparameter is null.
InvalidOperationException Unable to create the WaveBank resource.

Remarks

This constructor constructs a streaming wave bank whose contents are streamed from storage as needed.

When setting packetsize, note that the size of a DVD sector is 2,048 bytes. Therefore, setting this value to 2 would result in a packet size of 4,096 bytes. Setting it to 3 would specify packets of 6,144 bytes, setting it to 4 would specify packets of 8,192 bytes, and so on. The optimal DVD size is a multiple of 16 (1 DVD block = 16 DVD sectors).

After creating a streaming wave bank, you must call Update at least once from the AudioEngine that was used to create the streaming wave bank before attempting to play a wave from the wave bank. This properly prepares the wave bank for use. Attempts to play waves out of any wave bank before the wave bank is prepared will result in an error.

See Also

Reference

WaveBank Class
WaveBank Members
Microsoft.Xna.Framework.Audio Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista