Microsoft DirectX 8.1 (Visual Basic) |
You may want your application to be notified when the read cursor reaches a certain point in the buffer, or when it reaches the end. The read cursor is at the point up to which it is safe to read data from the buffer. With the DirectSoundCaptureBuffer8.SetNotificationPositions method, you can set any number of points within the buffer where events are to be signaled.
To set notification events on a buffer, you must first implement the DirectXEvent8 class in the form that contains the code for the buffer. Create a DirectXEvent8.DXCallback method by choosing DirectXEvent8 from the drop-down class list, and add the code you want to be executed when the event is signaled.
Create an event handle by calling the DirectX8.CreateEvent method and pass the event handle in the hEventNotify member of a DSBPOSITIONNOTIFY type. Pass the type to the DirectSoundCaptureBuffer8.SetNotificationPositions method. The event handle will now be passed to DirectXEvent8.DXCallback whenever the play cursor reaches that position.