WaveBank Constructor (AudioEngine, String, Int32, Int16)

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)

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


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

Exception typeCondition
ArgumentNullException The audioEngine or nonStreamingWaveBankFilename parameter is null.
InvalidOperationException Unable to create the WaveBank resource.

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.

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions

© 2016 Microsoft