Share via


BufferPlayFlags Enumeration (Microsoft.DirectX.DirectSound)

Contains constants for specifying the play behavior of the buffer.

Definition

Visual Basic Public Enum BufferPlayFlags
C# public enum BufferPlayFlags
C++ public enum class BufferPlayFlags
JScript public enum BufferPlayFlags

Members

Member Value Description
TerminateByPriority 32 If the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. The buffer prematurely terminated will be the one with the lowest priority as set by the priority parameter Play method for the buffer.
TerminateByDistance 16 If the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. The buffer prematurely terminated will be selected from buffers that have the buffer's BufferDescription.Mute3DAtMaximumDistance property set to true and are beyond their maximum distance. If there are no such buffers, the method fails.
TerminateByTime 8 If the hardware has no available voices, a currently playing nonlooping buffer will be stopped to make room for the new buffer. The buffer prematurely terminated is the one with the least time left to play.
LocateInSoftware 4 Play this voice in a software buffer only. This flag cannot be combined with LocateInHardware or any voice management flag.
LocateInHardware 2 Play this voice in a hardware buffer only. If the hardware has no available voices and no voice management flags are set, the Play method fails. This flag cannot be combined with LocateInSoftware.
Looping 1 After the end of the audio buffer is reached, play restarts at the beginning of the buffer. Play continues until explicitly stopped. This flag must be set when playing a primary buffer.
Default 0 Play this voice with the default settings.

Remarks

This enumeration is used by the Play method of a buffer to specify the play behavior of the buffer.

This enumeration is also used by the SecondaryBuffer.AquireResources method to set the capabilities of a SecondaryBuffer object that was created with the DeferLocation flag set in the BufferDescription in order to use the use voice allocation and management.

When using this enumeration in the SecondaryBuffer.AquireResources method, you must cast it to an integer, as done in the following code.

[C#]int flags = (int)(BufferPlayFlags.LocateInSoftware | BufferPlayFlags.TerminateByTime);
EffectsReturnValue[] returnval = buffer.AcquireResources(flags,1);

Voice allocation flags (LocateInSoftware, LocateInHardware)

The voice allocation flags are valid only for buffers created with the DeferLocation flag set in the BufferDescription. One of the following flags can be used to force the processing of the sound into hardware or software. If neither LocateInHardware nor LocateInSoftware is set, the sound is played in either software or hardware, depending on the availability of resources at the time the method is called.

Voice management flags (TerminateByPriority, TerminateByDistance, TerminateByTime)

The voice management flags are valid only for buffers created with the DeferLocation flag set in the BufferDescription, and are used for sounds that are to play in hardware. These flags enable hardware resources that are already in use to be yielded to the current sound. Only buffers created with the DeferLocation flag set in the BufferDescription are candidates for premature termination.

The following table shows the behavior of the method under various combinations of the voice allocation and voice management flags when no free hardware voices are available.

LocateInHardware

Neither LocateInHardware nor LocateInSoftware

LocateInSoftware

TerminateByDistance

If any sounds currently playing in hardware are beyond their maximum distance and have the BufferDescription.Mute3DAtMaximumDistance property set to true, one of them is terminated and the new sound plays in hardware. Otherwise, the call fails.

If any sounds currently playing in hardware are beyond their maximum distance and have the BufferDescription.Mute3DAtMaximumDistance property set to true, one of them is terminated and the new sound plays in hardware. Otherwise, the new sound plays in software.

New sound plays in software.

TerminateByPriority

If the new sound's priority is higher than or equal to that of any sound currently playing in hardware, one of the lowest-priority sounds is terminated and the new sound plays in hardware. Otherwise, the call fails.

If the new sound's priority is higher than or equal to that of any sound currently playing in hardware, one of the lowest-priority sounds is terminated and the new sound plays in hardware. Otherwise, the new sound plays in software.

New sound plays in software.

TerminateByTime

The sound with the least time left to play is terminated and the new sound plays on the released voice.

The sound with the least time left to play is terminated and the new sound plays on the released voice.

New sound plays in software.

If the buffer specified in the method is already playing, the call to the method succeeds and the buffer continues to play. However, the flags defined in the most recent call supersede flags defined in previous calls.

TerminateByTime and TerminateByDistance cannot be combined, but either may be combined with TerminateByPriority, in which case the TerminateByTime or TerminateByDistance flag is used to determine which buffer should be terminated in the event of a priority tie.

If the method is called with a voice allocation or voice management flag set on a buffer that was not created with the DeferLocation flag set in the BufferDescription, the call fails with ArgumentExceptionLeave Site.

Enumeration Information

Namespace Microsoft.DirectX.DirectSound
Assembly Microsoft.DirectX.DirectSound (microsoft.directx.directsound.dll)
Strong Name Microsoft.DirectX.DirectSound,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

See Also