Platform SDK: DirectX

IDirectSoundNotify::SetNotificationPositions

The IDirectSoundCaptureBuffer::SetNotificationPositions method sets the notification positions. During capture or playback, whenever the position reaches an offset specified in one of the DSBPOSITIONNOTIFY structures in the caller-supplied array, the associated event will be signaled. The position tracked in playback is the current play position; in capture it is the current read position.

HRESULT SetNotificationPositions(
  DWORD cPositionNotifies,                  
  LPCDSBPOSITIONNOTIFY lpcPositionNotifies  
);

Parameters

cPositionNotifies
Number of DSBPOSITIONNOTIFY structures.
lpcPositionNotifies
Pointer to an array of DSBPOSITIONNOTIFY structures.

Return Values

If the method succeeds, the return value is DS_OK.

If the method fails, the return value may be one of the following error values:

DSERR_INVALIDPARAM
DSERR_OUTOFMEMORY

Remarks

The value DSBPN_OFFSETSTOP can be specified in the dwOffset member to tell DirectSound to signal the associated event when the IDirectSoundBuffer::Stop or IDirectSoundCaptureBuffer::Stop method is called or when the end of the buffer has been reached and the playback is not looping. If it is used, this should be the last item in the position-notify array.

If a position-notify array has already been set, calling this function again will replace the previous position-notify array.

The buffer must be stopped when this method is called.

Note  On VxD drivers, if a sound buffer is created with DSBCAPS_CTRLPOSITIONNOTIFY, this buffer will always be a software buffer. This is because the VxD driver model doesn't support the notify interface. With WDM drivers, a position notification enabled buffer may be in hardware, if hardware is available.

When using LOC_DEFER and NOTIFY along with any voice management TERMINATEBY flag, it is possible that a sound that has notifications set, but not yet reached, may be terminated by the voice manager. In this event, the notification event will not occur.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dsound.h.
  Import Library: Use dsound.lib.