Could someone tell me how to use dsound7's notification positions?

sdk says that i must create some event stuff.
how do i do that?




another thing: how much RAM has a typical sound card?
Posted on 2002-06-25 12:45:25 by ti_mo_n



DSNotifyThreadProc proto lpParameter:dword

DSBPOSITIONNOTIFY struct
dwOffset DWORD ?
hEventNotify DWORD ?
DSBPOSITIONNOTIFY ends

IDirectSoundNotifyVtbl struct
; IUnknown Interface
QueryInterface dd ?
AddRef dd ?
Release dd ?
; IDirectSoundNotify Interface
SetNotificationPositions dd ?
IDirectSoundNotifyVtbl ends

IDirectSoundNotify struct
pVtbl dd ?
IDirectSoundNotify ends

.const

DSBCAPS_CTRLPOSITIONNOTIFY equ 100h
DSBCAPS_GETCURRENTPOSITION2 equ 10000h

.data

IID_IDirectSoundNotify GUID <0b0210783h, 89cdh, 11d0h, \
<0afh, 8h, 0h, 0a0h, 0c9h, 25h, 0cdh, 16h>>

szNotifyEvent db "DSNotifyEvent", 0
dspn DSBPOSITIONNOTIFY 2 dup (<>)
lpDirectSoundNotify IDirectSoundNotify <>

.code

invoke CreateEvent, NULL, TRUE, FALSE, addr szNotifyEvent
mov hEvent, eax

; fill out array of DSBPOSITIONNOTIFY structures
mov dspn[0].dwOffset, 0
mov eax, hEvent
mov dspn[0].hEventNotify, eax
mov dspn[sizeof DSBPOSITIONNOTIFY].dwOffset, DS_BUFFER_SIZE / 2
mov eax, hEvent
mov dspn[sizeof DSBPOSITIONNOTIFY].hEventNotify, eax

push offset lpDirectSoundNotify
push offset IID_IDirectSoundNotify
COMETHOD lpSecondaryBuffer, IDirectSoundBufferVtbl.QueryInterface

push offset dspn
push 2
COMETHOD lpDirectSoundNotify, IDirectSoundNotifyVtbl.SetNotificationPositions

invoke CreateThread, 0, 0, addr DSNotifyThreadProc, NULL, 0, addr dwThreadID
mov hThread, eax

DSNotifyThreadProc proc uses esi edi ebx, lpParameter:dword
.while (1)
invoke WaitForSingleObject, hEvent, INFINITE
invoke ResetEvent, hEvent
; fill sound buffer
.endw
DSNotifyThreadProc endp


That's the relevant stuff. Remember to pass the DSBCAPS_CTRLPOSITIONNOTIFY flag when you create your secondary buffer.
Posted on 2002-06-25 14:44:48 by grv575
BIG THANX MAN!
Posted on 2002-06-29 12:19:46 by ti_mo_n