WaveBank Constructor (AudioEngine, String, Int32, Int16)
Initializes a new, streaming instance of this class, using a provided AudioEngine and streaming wave bank parameters.
Syntax
'Declaration
Public Sub New ( _
audioEngine As AudioEngine, _
streamingWaveBankFilename As String, _
offset As Integer, _
packetsize As Short _
)
public WaveBank (
AudioEngine audioEngine,
string streamingWaveBankFilename,
int offset,
short packetsize
)
public:
WaveBank(
AudioEngine audioEngine,
String streamingWaveBankFilename,
int offset,
short packetsize
)
Parameters
- audioEngine
Type: AudioEngine
Instance of an AudioEngine to associate this wave bank with. - streamingWaveBankFilename
Type: String
Path to the wave bank file to stream from. - offset
Type: Int32
Offset within the wave bank data file. This offset must be DVD sector aligned. - packetsize
Type: Int16
Stream packet size, in sectors, to use for each stream. The minimum value is 2.
Exceptions
Exception type | Condition |
---|---|
ArgumentNullException | The audioEngine or nonStreamingWaveBankFilename parameter 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.
Requirements
Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
WaveBank Class
WaveBank Members
Microsoft.Xna.Framework.Audio Namespace
Platforms
Windows Phone