1 /* DirectSound COM interface
3 * Copyright 2009 Maarten Lankhorst
5 * Some code taken from the original dsound-openal implementation
6 * Copyright 2007-2009 Chris Robinson
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #define NONAMELESSSTRUCT
29 #define NONAMELESSUNION
39 #include "wine/debug.h"
42 #include "dsound_private.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(dsound
);
56 #include "dsound_private.h"
58 DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM
, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
59 DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
61 #ifndef E_PROP_ID_UNSUPPORTED
62 #define E_PROP_ID_UNSUPPORTED ((HRESULT)0x80070490)
67 static const IDirectSoundBufferVtbl DS8Primary_Vtbl
;
68 static const IDirectSound3DListenerVtbl DS8Primary3D_Vtbl
;
69 static const IKsPropertySetVtbl DS8PrimaryProp_Vtbl
;
72 static inline DS8Primary
*impl_from_IDirectSoundBuffer(IDirectSoundBuffer
*iface
)
74 return CONTAINING_RECORD(iface
, DS8Primary
, IDirectSoundBuffer_iface
);
77 static inline DS8Primary
*impl_from_IDirectSound3DListener(IDirectSound3DListener
*iface
)
79 return CONTAINING_RECORD(iface
, DS8Primary
, IDirectSound3DListener_iface
);
82 static inline DS8Primary
*impl_from_IKsPropertySet(IKsPropertySet
*iface
)
84 return CONTAINING_RECORD(iface
, DS8Primary
, IKsPropertySet_iface
);
88 static void AL_APIENTRY
wrap_DeferUpdates(void)
89 { alcSuspendContext(alcGetCurrentContext()); }
90 static void AL_APIENTRY
wrap_ProcessUpdates(void)
91 { alcProcessContext(alcGetCurrentContext()); }
94 static void trigger_elapsed_notifies(DS8Buffer
*buf
, DWORD lastpos
, DWORD curpos
)
97 for(i
= 0; i
< buf
->nnotify
; ++i
)
99 DSBPOSITIONNOTIFY
*not = &buf
->notify
[i
];
100 HANDLE event
= not->hEventNotify
;
101 DWORD ofs
= not->dwOffset
;
103 if(ofs
== (DWORD
)DSBPN_OFFSETSTOP
)
106 /* Wraparound case */
109 if(ofs
< curpos
|| ofs
>= lastpos
)
115 if(ofs
>= lastpos
&& ofs
< curpos
)
120 static void trigger_stop_notifies(DS8Buffer
*buf
)
123 for(i
= 0; i
< buf
->nnotify
; ++i
)
125 DSBPOSITIONNOTIFY
*not = &buf
->notify
[i
];
126 if(not->dwOffset
== (DWORD
)DSBPN_OFFSETSTOP
)
127 SetEvent(not->hEventNotify
);
131 static DWORD CALLBACK
DS8Primary_thread(void *dwUser
)
133 DS8Primary
*prim
= (DS8Primary
*)dwUser
;
134 DWORD i
, active_notifies
;
137 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL
);
139 TRACE("Primary buffer (%p) message loop start\n", prim
);
140 while(GetMessageA(&msg
, NULL
, 0, 0))
142 if(msg
.message
!= WM_USER
)
145 EnterCriticalSection(prim
->crst
);
146 setALContext(prim
->ctx
);
148 for(i
= 0;i
< prim
->nnotifies
;)
150 DS8Buffer
*buf
= prim
->notifies
[i
];
151 IDirectSoundBuffer8
*dsb
= &buf
->IDirectSoundBuffer8_iface
;
152 DWORD status
=0, curpos
=buf
->lastpos
;
154 IDirectSoundBuffer8_GetStatus(dsb
, &status
);
155 IDirectSoundBuffer8_GetCurrentPosition(dsb
, &curpos
, NULL
);
156 if(buf
->lastpos
!= curpos
)
158 trigger_elapsed_notifies(buf
, buf
->lastpos
, curpos
);
159 buf
->lastpos
= curpos
;
161 if(!(status
&DSBSTATUS_PLAYING
))
163 /* Remove this buffer from list and put another at the
164 * current position; don't increment i
166 trigger_stop_notifies(buf
);
167 prim
->notifies
[i
] = prim
->notifies
[--prim
->nnotifies
];
174 /* OpenAL doesn't support our lovely buffer extensions
175 * so just make sure enough buffers are queued
177 if(!prim
->SupportedExt
[SOFT_BUFFER_SAMPLES
] &&
178 !prim
->SupportedExt
[SOFT_BUFFER_SUB_DATA
] &&
179 !prim
->SupportedExt
[EXT_STATIC_BUFFER
])
181 for(i
= 0;i
< prim
->nbuffers
;++i
)
183 DS8Buffer
*buf
= prim
->buffers
[i
];
184 ALint done
= 0, queued
= QBUFFERS
, state
= AL_PLAYING
;
187 if(buf
->buffer
->numsegs
== 1 || !buf
->isplaying
)
190 alGetSourcei(buf
->source
, AL_SOURCE_STATE
, &state
);
191 alGetSourcei(buf
->source
, AL_BUFFERS_QUEUED
, &queued
);
192 alGetSourcei(buf
->source
, AL_BUFFERS_PROCESSED
, &done
);
196 alSourceUnqueueBuffers(buf
->source
, 1, &which
);
197 while(queued
< QBUFFERS
)
199 which
= buf
->buffer
->buffers
[buf
->curidx
];
200 ofs
= buf
->curidx
*buf
->buffer
->segsize
;
201 if(buf
->curidx
< buf
->buffer
->numsegs
-1)
202 alBufferData(which
, buf
->buffer
->buf_format
,
203 buf
->buffer
->data
+ ofs
, buf
->buffer
->segsize
,
204 buf
->buffer
->format
.Format
.nSamplesPerSec
);
206 alBufferData(which
, buf
->buffer
->buf_format
,
207 buf
->buffer
->data
+ ofs
, buf
->buffer
->lastsegsize
,
208 buf
->buffer
->format
.Format
.nSamplesPerSec
);
210 alSourceQueueBuffers(buf
->source
, 1, &which
);
211 buf
->curidx
= (buf
->curidx
+1)%buf
->buffer
->numsegs
;
214 if(!buf
->curidx
&& !buf
->islooping
)
216 buf
->isplaying
= FALSE
;
220 if(state
!= AL_PLAYING
)
224 IDirectSoundBuffer8_Stop(&buf
->IDirectSoundBuffer8_iface
);
227 alSourcePlay(buf
->source
);
232 else if(active_notifies
== 0 && prim
->timer_id
)
234 TRACE("No more notifies, killing timer\n");
235 timeKillEvent(prim
->timer_id
);
237 timeEndPeriod(prim
->timer_res
);
241 LeaveCriticalSection(prim
->crst
);
243 TRACE("Primary buffer (%p) message loop quit\n", prim
);
247 timeKillEvent(prim
->timer_id
);
249 timeEndPeriod(prim
->timer_res
);
250 TRACE("Killed timer\n");
256 static void CALLBACK
DS8Primary_timer(UINT timerID
, UINT msg
, DWORD_PTR dwUser
,
257 DWORD_PTR dw1
, DWORD_PTR dw2
)
263 PostThreadMessageA(dwUser
, WM_USER
, 0, 0);
266 void DS8Primary_starttimer(DS8Primary
*prim
)
268 DWORD triggertime
, res
= DS_TIME_RES
;
269 ALint refresh
= FAKE_REFRESH_COUNT
;
275 timeGetDevCaps(&time
, sizeof(TIMECAPS
));
277 alcGetIntegerv(prim
->parent
->device
, ALC_REFRESH
, 1, &refresh
);
278 checkALCError(prim
->parent
->device
);
280 triggertime
= 1000 / refresh
/ 2;
281 if(triggertime
< time
.wPeriodMin
)
282 triggertime
= time
.wPeriodMin
;
283 TRACE("Calling timer every %"LONGFMT
"u ms for %i refreshes per second\n", triggertime
, refresh
);
285 if (res
< time
.wPeriodMin
)
286 res
= time
.wPeriodMin
;
287 if (timeBeginPeriod(res
) == TIMERR_NOCANDO
)
288 WARN("Could not set minimum resolution, don't expect sound\n");
290 prim
->timer_res
= res
;
291 prim
->timer_id
= timeSetEvent(triggertime
, res
, DS8Primary_timer
, prim
->thread_id
, TIME_PERIODIC
|TIME_KILL_SYNCHRONOUS
);
296 HRESULT
DS8Primary_PreInit(DS8Primary
*This
, DS8Impl
*parent
)
298 DS3DLISTENER
*listener
;
302 This
->IDirectSoundBuffer_iface
.lpVtbl
= (IDirectSoundBufferVtbl
*)&DS8Primary_Vtbl
;
303 This
->IDirectSound3DListener_iface
.lpVtbl
= (IDirectSound3DListenerVtbl
*)&DS8Primary3D_Vtbl
;
304 This
->IKsPropertySet_iface
.lpVtbl
= (IKsPropertySetVtbl
*)&DS8PrimaryProp_Vtbl
;
306 This
->parent
= parent
;
307 This
->crst
= &parent
->share
->crst
;
308 This
->ctx
= parent
->share
->ctx
;
309 This
->SupportedExt
= parent
->share
->SupportedExt
;
310 This
->ExtAL
= &parent
->share
->ExtAL
;
311 This
->sources
= parent
->share
->sources
;
312 This
->auxslot
= parent
->share
->auxslot
;
314 /* Allocate enough for a WAVEFORMATEXTENSIBLE */
315 wfx
= &This
->format
.Format
;
317 wfx
->wFormatTag
= WAVE_FORMAT_PCM
;
319 wfx
->wBitsPerSample
= 8;
320 wfx
->nSamplesPerSec
= 22050;
321 wfx
->nBlockAlign
= wfx
->wBitsPerSample
* wfx
->nChannels
/ 8;
322 wfx
->nAvgBytesPerSec
= wfx
->nSamplesPerSec
* wfx
->nBlockAlign
;
325 This
->stopped
= TRUE
;
327 /* Apparently primary buffer size is always 32k,
328 * tested on windows with 192k 24 bits sound @ 6 channels
329 * where it will run out in 60 ms and it isn't pointer aligned
331 This
->buf_size
= 32768;
333 if(This
->SupportedExt
[SOFT_DEFERRED_UPDATES
])
335 This
->DeferUpdates
= This
->ExtAL
->DeferUpdatesSOFT
;
336 This
->ProcessUpdates
= This
->ExtAL
->ProcessUpdatesSOFT
;
340 This
->DeferUpdates
= wrap_DeferUpdates
;
341 This
->ProcessUpdates
= wrap_ProcessUpdates
;
344 This
->eax_prop
= EnvironmentDefaults
[EAX_ENVIRONMENT_GENERIC
];
345 if(This
->SupportedExt
[EXT_EFX
] && This
->auxslot
!= 0)
347 ALint revid
= alGetEnumValue("AL_EFFECT_REVERB");
348 if(revid
!= 0 && revid
!= -1)
350 This
->ExtAL
->GenEffects(1, &This
->effect
);
351 This
->ExtAL
->Effecti(This
->effect
, AL_EFFECT_TYPE
, AL_EFFECT_REVERB
);
356 /* Make sure DS3DListener defaults are applied to OpenAL */
357 listener
= &This
->params
;
358 listener
->dwSize
= sizeof(This
->params
);
359 listener
->vPosition
.x
= 0.0;
360 listener
->vPosition
.y
= 0.0;
361 listener
->vPosition
.z
= 0.0;
362 listener
->vVelocity
.x
= 0.0;
363 listener
->vVelocity
.y
= 0.0;
364 listener
->vVelocity
.z
= 0.0;
365 listener
->vOrientFront
.x
= 0.0;
366 listener
->vOrientFront
.y
= 0.0;
367 listener
->vOrientFront
.z
= 1.0;
368 listener
->vOrientTop
.x
= 0.0;
369 listener
->vOrientTop
.y
= 1.0;
370 listener
->vOrientTop
.z
= 0.0;
371 listener
->flDistanceFactor
= DS3D_DEFAULTDISTANCEFACTOR
;
372 listener
->flRolloffFactor
= DS3D_DEFAULTROLLOFFFACTOR
;
373 listener
->flDopplerFactor
= DS3D_DEFAULTDOPPLERFACTOR
;
374 hr
= IDirectSound3DListener_SetAllParameters(&This
->IDirectSound3DListener_iface
, listener
, DS3D_IMMEDIATE
);
376 ERR("Could not set 3d parameters: %08"LONGFMT
"x\n", hr
);
378 This
->sizenotifies
= This
->sizebuffers
= parent
->share
->max_sources
;
380 hr
= DSERR_OUTOFMEMORY
;
381 This
->buffers
= HeapAlloc(GetProcessHeap(), 0, This
->sizebuffers
*sizeof(*This
->buffers
));
382 This
->notifies
= HeapAlloc(GetProcessHeap(), 0, This
->sizenotifies
*sizeof(*This
->notifies
));
383 if(!This
->buffers
|| !This
->notifies
)
386 This
->thread_hdl
= CreateThread(NULL
, 0, DS8Primary_thread
, This
, 0, &This
->thread_id
);
387 if(This
->thread_hdl
== NULL
)
393 DS8Primary_Clear(This
);
397 void DS8Primary_Clear(DS8Primary
*This
)
399 TRACE("Clearing primary %p\n", This
);
406 PostThreadMessageA(This
->thread_id
, WM_QUIT
, 0, 0);
407 if(WaitForSingleObject(This
->thread_hdl
, 1000) != WAIT_OBJECT_0
)
409 /* HACK: Apparently, if the device is initialized (thus the primary
410 * buffer has PreInit called) then immediately deleted (the primary
411 * buffer has Clear called), the WM_QUIT message gets sent before
412 * the thread has a chance to run which apparently prevents it from
413 * receiving the message.
414 * If the wait attempt fails, try sending the message again. */
415 PostThreadMessageA(This
->thread_id
, WM_QUIT
, 0, 0);
416 if(WaitForSingleObject(This
->thread_hdl
, 1000) != WAIT_OBJECT_0
)
417 ERR("Thread wait timed out\n");
419 CloseHandle(This
->thread_hdl
);
422 setALContext(This
->ctx
);
424 This
->ExtAL
->DeleteEffects(1, &This
->effect
);
426 while(This
->nbuffers
--)
427 DS8Buffer_Destroy(This
->buffers
[This
->nbuffers
]);
429 HeapFree(GetProcessHeap(), 0, This
->notifies
);
430 HeapFree(GetProcessHeap(), 0, This
->buffers
);
431 memset(This
, 0, sizeof(*This
));
434 static HRESULT WINAPI
DS8Primary_QueryInterface(IDirectSoundBuffer
*iface
, REFIID riid
, LPVOID
*ppv
)
436 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
438 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppv
);
441 if(IsEqualIID(riid
, &IID_IUnknown
) ||
442 IsEqualIID(riid
, &IID_IDirectSoundBuffer
))
443 *ppv
= &This
->IDirectSoundBuffer_iface
;
444 else if(IsEqualIID(riid
, &IID_IDirectSound3DListener
))
446 if((This
->flags
&DSBCAPS_CTRL3D
))
447 *ppv
= &This
->IDirectSound3DListener_iface
;
450 FIXME("Unhandled GUID: %s\n", debugstr_guid(riid
));
454 IUnknown_AddRef((IUnknown
*)*ppv
);
458 return E_NOINTERFACE
;
461 static ULONG WINAPI
DS8Primary_AddRef(IDirectSoundBuffer
*iface
)
463 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
466 ret
= InterlockedIncrement(&This
->ref
);
467 if(ret
== 1) This
->flags
= 0;
472 static ULONG WINAPI
DS8Primary_Release(IDirectSoundBuffer
*iface
)
474 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
477 ret
= InterlockedDecrement(&This
->ref
);
482 static HRESULT WINAPI
DS8Primary_GetCaps(IDirectSoundBuffer
*iface
, DSBCAPS
*caps
)
484 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
486 TRACE("(%p)->(%p)\n", iface
, caps
);
488 if(!caps
|| caps
->dwSize
< sizeof(*caps
))
490 WARN("Invalid DSBCAPS (%p, %"LONGFMT
"u)\n", caps
, caps
? caps
->dwSize
: 0);
491 return DSERR_INVALIDPARAM
;
494 caps
->dwFlags
= This
->flags
;
495 caps
->dwBufferBytes
= This
->buf_size
;
496 caps
->dwUnlockTransferRate
= 0;
497 caps
->dwPlayCpuOverhead
= 0;
502 static HRESULT WINAPI
DS8Primary_GetCurrentPosition(IDirectSoundBuffer
*iface
, DWORD
*playpos
, DWORD
*curpos
)
504 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
505 HRESULT hr
= DSERR_PRIOLEVELNEEDED
;
507 EnterCriticalSection(This
->crst
);
509 hr
= IDirectSoundBuffer8_GetCurrentPosition(This
->write_emu
, playpos
, curpos
);
510 LeaveCriticalSection(This
->crst
);
515 static HRESULT WINAPI
DS8Primary_GetFormat(IDirectSoundBuffer
*iface
, WAVEFORMATEX
*wfx
, DWORD allocated
, DWORD
*written
)
517 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
523 WARN("Cannot report format or format size\n");
524 return DSERR_INVALIDPARAM
;
527 EnterCriticalSection(This
->crst
);
528 size
= sizeof(This
->format
.Format
) + This
->format
.Format
.cbSize
;
534 hr
= DSERR_INVALIDPARAM
;
536 memcpy(wfx
, &This
->format
.Format
, size
);
538 LeaveCriticalSection(This
->crst
);
543 static HRESULT WINAPI
DS8Primary_GetVolume(IDirectSoundBuffer
*iface
, LONG
*volume
)
545 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
548 TRACE("(%p)->(%p)\n", iface
, volume
);
551 return DSERR_INVALIDPARAM
;
554 if(!(This
->flags
&DSBCAPS_CTRLVOLUME
))
555 return DSERR_CONTROLUNAVAIL
;
557 setALContext(This
->ctx
);
558 alGetListenerf(AL_GAIN
, &gain
);
562 *volume
= clampI(gain_to_mB(gain
), DSBVOLUME_MIN
, DSBVOLUME_MAX
);
566 static HRESULT WINAPI
DS8Primary_GetPan(IDirectSoundBuffer
*iface
, LONG
*pan
)
568 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
571 WARN("(%p)->(%p): semi-stub\n", iface
, pan
);
574 return DSERR_INVALIDPARAM
;
576 EnterCriticalSection(This
->crst
);
578 hr
= IDirectSoundBuffer8_GetPan(This
->write_emu
, pan
);
579 else if(!(This
->flags
& DSBCAPS_CTRLPAN
))
580 hr
= DSERR_CONTROLUNAVAIL
;
583 LeaveCriticalSection(This
->crst
);
588 static HRESULT WINAPI
DS8Primary_GetFrequency(IDirectSoundBuffer
*iface
, DWORD
*freq
)
590 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
593 WARN("(%p)->(%p): semi-stub\n", iface
, freq
);
596 return DSERR_INVALIDPARAM
;
598 if(!(This
->flags
&DSBCAPS_CTRLFREQUENCY
))
599 return DSERR_CONTROLUNAVAIL
;
601 EnterCriticalSection(This
->crst
);
602 *freq
= This
->format
.Format
.nSamplesPerSec
;
603 LeaveCriticalSection(This
->crst
);
608 static HRESULT WINAPI
DS8Primary_GetStatus(IDirectSoundBuffer
*iface
, DWORD
*status
)
610 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
612 TRACE("(%p)->(%p)\n", iface
, status
);
615 return DSERR_INVALIDPARAM
;
617 EnterCriticalSection(This
->crst
);
618 *status
= DSBSTATUS_PLAYING
|DSBSTATUS_LOOPING
;
619 if((This
->flags
&DSBCAPS_LOCDEFER
))
620 *status
|= DSBSTATUS_LOCHARDWARE
;
627 for(i
= 0;i
< This
->nbuffers
;++i
)
629 hr
= IDirectSoundBuffer8_GetStatus(&This
->buffers
[i
]->IDirectSoundBuffer8_iface
, &state
);
630 if(SUCCEEDED(hr
) && (state
&DSBSTATUS_PLAYING
))
633 if(i
== This
->nbuffers
)
635 /* Primary stopped and no buffers playing.. */
639 LeaveCriticalSection(This
->crst
);
644 static HRESULT WINAPI
DS8Primary_Initialize(IDirectSoundBuffer
*iface
, IDirectSound
*ds
, const DSBUFFERDESC
*desc
)
646 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
649 TRACE("(%p)->(%p, %p)\n", iface
, ds
, desc
);
651 if(!desc
|| desc
->lpwfxFormat
|| desc
->dwBufferBytes
)
653 WARN("Bad DSBDESC for primary buffer\n");
654 return DSERR_INVALIDPARAM
;
656 if((desc
->dwFlags
&DSBCAPS_CTRLFX
) ||
657 (desc
->dwFlags
&DSBCAPS_CTRLPOSITIONNOTIFY
) ||
658 (desc
->dwFlags
&DSBCAPS_LOCSOFTWARE
))
660 WARN("Bad dwFlags %08"LONGFMT
"x\n", desc
->dwFlags
);
661 return DSERR_INVALIDPARAM
;
664 /* Should be 0 if not initialized */
666 return DSERR_ALREADYINITIALIZED
;
669 if(This
->parent
->prio_level
== DSSCL_WRITEPRIMARY
)
671 DSBUFFERDESC emudesc
;
676 ERR("There shouldn't be a write_emu!\n");
677 IDirectSoundBuffer8_Release(This
->write_emu
);
678 This
->write_emu
= NULL
;
681 memset(&emudesc
, 0, sizeof(emudesc
));
682 emudesc
.dwSize
= sizeof(emudesc
);
683 emudesc
.dwFlags
= DSBCAPS_LOCHARDWARE
| (desc
->dwFlags
&DSBCAPS_CTRLPAN
);
684 /* Dont play last incomplete sample */
685 emudesc
.dwBufferBytes
= This
->buf_size
- (This
->buf_size
%This
->format
.Format
.nBlockAlign
);
686 emudesc
.lpwfxFormat
= &This
->format
.Format
;
688 hr
= DS8Buffer_Create(&emu
, This
, NULL
);
691 This
->write_emu
= &emu
->IDirectSoundBuffer8_iface
;
692 hr
= IDirectSoundBuffer8_Initialize(This
->write_emu
, ds
, &emudesc
);
695 IDirectSoundBuffer8_Release(This
->write_emu
);
696 This
->write_emu
= NULL
;
702 This
->flags
= desc
->dwFlags
| DSBCAPS_LOCHARDWARE
;
706 static HRESULT WINAPI
DS8Primary_Lock(IDirectSoundBuffer
*iface
, DWORD ofs
, DWORD bytes
, void **ptr1
, DWORD
*len1
, void **ptr2
, DWORD
*len2
, DWORD flags
)
708 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
709 HRESULT hr
= DSERR_PRIOLEVELNEEDED
;
711 TRACE("(%p)->(%"LONGFMT
"u, %"LONGFMT
"u, %p, %p, %p, %p, %"LONGFMT
"u)\n", iface
, ofs
, bytes
, ptr1
, len1
, ptr2
, len2
, flags
);
713 EnterCriticalSection(This
->crst
);
715 hr
= IDirectSoundBuffer8_Lock(This
->write_emu
, ofs
, bytes
, ptr1
, len1
, ptr2
, len2
, flags
);
716 LeaveCriticalSection(This
->crst
);
721 static HRESULT WINAPI
DS8Primary_Play(IDirectSoundBuffer
*iface
, DWORD res1
, DWORD res2
, DWORD flags
)
723 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
726 TRACE("(%p)->(%"LONGFMT
"u, %"LONGFMT
"u, %"LONGFMT
"u)\n", iface
, res1
, res2
, flags
);
728 if(!(flags
& DSBPLAY_LOOPING
))
730 WARN("Flags (%08"LONGFMT
"x) not set to DSBPLAY_LOOPING\n", flags
);
731 return DSERR_INVALIDPARAM
;
734 EnterCriticalSection(This
->crst
);
737 hr
= IDirectSoundBuffer8_Play(This
->write_emu
, res1
, res2
, flags
);
739 This
->stopped
= FALSE
;
740 LeaveCriticalSection(This
->crst
);
745 static HRESULT WINAPI
DS8Primary_SetCurrentPosition(IDirectSoundBuffer
*iface
, DWORD pos
)
747 WARN("(%p)->(%"LONGFMT
"u)\n", iface
, pos
);
748 return DSERR_INVALIDCALL
;
751 /* Just assume the format is crap, and clean up the damage */
752 static void copy_waveformat(WAVEFORMATEX
*wfx
, const WAVEFORMATEX
*from
)
754 if(from
->wFormatTag
== WAVE_FORMAT_PCM
)
757 if(from
->wBitsPerSample
== 8 ||
758 from
->wBitsPerSample
== 16 ||
759 from
->wBitsPerSample
== 24 ||
760 from
->wBitsPerSample
== 32)
761 wfx
->wBitsPerSample
= from
->wBitsPerSample
;
763 else if(from
->wFormatTag
== WAVE_FORMAT_EXTENSIBLE
)
765 WAVEFORMATEXTENSIBLE
*wfe
= (WAVEFORMATEXTENSIBLE
*)wfx
;
766 const WAVEFORMATEXTENSIBLE
*fromx
= (const WAVEFORMATEXTENSIBLE
*)from
;
767 DWORD size
= sizeof(WAVEFORMATEXTENSIBLE
) - sizeof(WAVEFORMATEX
);
769 /* Fail silently.. */
770 if(from
->cbSize
< size
)
772 if(!fromx
->Samples
.wValidBitsPerSample
&&
773 !fromx
->Format
.wBitsPerSample
)
776 if(!IsEqualGUID(&wfe
->SubFormat
, &KSDATAFORMAT_SUBTYPE_PCM
) &&
777 !IsEqualGUID(&wfe
->SubFormat
, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))
779 ERR("Unhandled extensible format: %s\n", debugstr_guid(&wfe
->SubFormat
));
783 wfe
->Format
.wBitsPerSample
= from
->wBitsPerSample
;
784 wfe
->Samples
.wValidBitsPerSample
= fromx
->Samples
.wValidBitsPerSample
;
785 if(!wfe
->Samples
.wValidBitsPerSample
)
786 wfe
->Samples
.wValidBitsPerSample
= wfe
->Format
.wBitsPerSample
;
787 wfe
->Format
.cbSize
= size
;
788 wfe
->dwChannelMask
= fromx
->dwChannelMask
;
789 wfe
->SubFormat
= fromx
->SubFormat
;
793 ERR("Unhandled format tag %04x\n", from
->wFormatTag
);
798 wfx
->nChannels
= from
->nChannels
;
799 wfx
->wFormatTag
= from
->wFormatTag
;
800 if(from
->nSamplesPerSec
>= DSBFREQUENCY_MIN
&&
801 from
->nSamplesPerSec
<= DSBFREQUENCY_MAX
)
802 wfx
->nSamplesPerSec
= from
->nSamplesPerSec
;
803 wfx
->nBlockAlign
= wfx
->wBitsPerSample
* wfx
->nChannels
/ 8;
804 wfx
->nAvgBytesPerSec
= wfx
->nSamplesPerSec
* wfx
->nBlockAlign
;
807 static HRESULT WINAPI
DS8Primary_SetFormat(IDirectSoundBuffer
*iface
, const WAVEFORMATEX
*wfx
)
809 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
813 TRACE("(%p)->(%p)\n", iface
, wfx
);
817 WARN("Missing format\n");
818 return DSERR_INVALIDPARAM
;
821 EnterCriticalSection(This
->crst
);
823 if(This
->parent
->prio_level
< DSSCL_PRIORITY
)
825 hr
= DSERR_PRIOLEVELNEEDED
;
829 TRACE("Requested primary format:\n"
830 " FormatTag = %04x\n"
832 " SamplesPerSec = %"LONGFMT
"u\n"
833 " AvgBytesPerSec = %"LONGFMT
"u\n"
835 " BitsPerSample = %u\n",
836 wfx
->wFormatTag
, wfx
->nChannels
,
837 wfx
->nSamplesPerSec
, wfx
->nAvgBytesPerSec
,
838 wfx
->nBlockAlign
, wfx
->wBitsPerSample
);
840 copy_waveformat(&This
->format
.Format
, wfx
);
842 freq
= This
->format
.Format
.nSamplesPerSec
;
843 alcGetIntegerv(This
->parent
->device
, ALC_FREQUENCY
, 1, &freq
);
844 checkALCError(This
->parent
->device
);
846 This
->format
.Format
.nSamplesPerSec
= freq
;
847 This
->format
.Format
.nAvgBytesPerSec
= This
->format
.Format
.nBlockAlign
*
848 This
->format
.Format
.nSamplesPerSec
;
855 memset(&desc
, 0, sizeof(desc
));
856 desc
.dwSize
= sizeof(desc
);
857 desc
.dwFlags
= DSBCAPS_LOCHARDWARE
|DSBCAPS_CTRLPAN
;
858 desc
.dwBufferBytes
= This
->buf_size
- (This
->buf_size
% This
->format
.Format
.nBlockAlign
);
859 desc
.lpwfxFormat
= &This
->format
.Format
;
861 hr
= DS8Buffer_Create(&buf
, This
, NULL
);
865 hr
= IDirectSoundBuffer8_Initialize(&buf
->IDirectSoundBuffer8_iface
, &This
->parent
->IDirectSound_iface
, &desc
);
867 DS8Buffer_Destroy(buf
);
870 IDirectSoundBuffer8_Release(This
->write_emu
);
871 This
->write_emu
= &buf
->IDirectSoundBuffer8_iface
;
876 LeaveCriticalSection(This
->crst
);
880 static HRESULT WINAPI
DS8Primary_SetVolume(IDirectSoundBuffer
*iface
, LONG vol
)
882 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
884 TRACE("(%p)->(%"LONGFMT
"d)\n", iface
, vol
);
886 if(vol
> DSBVOLUME_MAX
|| vol
< DSBVOLUME_MIN
)
888 WARN("Invalid volume (%"LONGFMT
"d)\n", vol
);
889 return DSERR_INVALIDPARAM
;
892 if(!(This
->flags
&DSBCAPS_CTRLVOLUME
))
893 return DSERR_CONTROLUNAVAIL
;
895 setALContext(This
->ctx
);
896 alListenerf(AL_GAIN
, mB_to_gain(vol
));
902 static HRESULT WINAPI
DS8Primary_SetPan(IDirectSoundBuffer
*iface
, LONG pan
)
904 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
907 TRACE("(%p)->(%"LONGFMT
"d)\n", iface
, pan
);
909 if(pan
> DSBPAN_RIGHT
|| pan
< DSBPAN_LEFT
)
911 WARN("invalid parameter: pan = %"LONGFMT
"d\n", pan
);
912 return DSERR_INVALIDPARAM
;
915 EnterCriticalSection(This
->crst
);
916 if(!(This
->flags
&DSBCAPS_CTRLPAN
))
918 WARN("control unavailable\n");
919 hr
= DSERR_CONTROLUNAVAIL
;
921 else if(This
->write_emu
)
922 hr
= IDirectSoundBuffer8_SetPan(This
->write_emu
, pan
);
925 FIXME("Not supported\n");
928 LeaveCriticalSection(This
->crst
);
933 static HRESULT WINAPI
DS8Primary_SetFrequency(IDirectSoundBuffer
*iface
, DWORD freq
)
935 WARN("(%p)->(%"LONGFMT
"u)\n", iface
, freq
);
936 return DSERR_CONTROLUNAVAIL
;
939 static HRESULT WINAPI
DS8Primary_Stop(IDirectSoundBuffer
*iface
)
941 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
944 TRACE("(%p)->()\n", iface
);
946 EnterCriticalSection(This
->crst
);
948 hr
= IDirectSoundBuffer8_Stop(This
->write_emu
);
950 This
->stopped
= TRUE
;
951 LeaveCriticalSection(This
->crst
);
956 static HRESULT WINAPI
DS8Primary_Unlock(IDirectSoundBuffer
*iface
, void *ptr1
, DWORD len1
, void *ptr2
, DWORD len2
)
958 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
959 HRESULT hr
= DSERR_INVALIDCALL
;
961 TRACE("(%p)->(%p, %"LONGFMT
"u, %p, %"LONGFMT
"u)\n", iface
, ptr1
, len1
, ptr2
, len2
);
963 EnterCriticalSection(This
->crst
);
965 hr
= IDirectSoundBuffer8_Unlock(This
->write_emu
, ptr1
, len1
, ptr2
, len2
);
966 LeaveCriticalSection(This
->crst
);
971 static HRESULT WINAPI
DS8Primary_Restore(IDirectSoundBuffer
*iface
)
973 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
976 TRACE("(%p)->()\n", iface
);
978 EnterCriticalSection(This
->crst
);
980 hr
= IDirectSoundBuffer8_Restore(This
->write_emu
);
981 LeaveCriticalSection(This
->crst
);
986 static const IDirectSoundBufferVtbl DS8Primary_Vtbl
=
988 DS8Primary_QueryInterface
,
992 DS8Primary_GetCurrentPosition
,
993 DS8Primary_GetFormat
,
994 DS8Primary_GetVolume
,
996 DS8Primary_GetFrequency
,
997 DS8Primary_GetStatus
,
998 DS8Primary_Initialize
,
1001 DS8Primary_SetCurrentPosition
,
1002 DS8Primary_SetFormat
,
1003 DS8Primary_SetVolume
,
1005 DS8Primary_SetFrequency
,
1012 static void DS8Primary_SetParams(DS8Primary
*This
, const DS3DLISTENER
*params
, LONG flags
)
1014 union PrimaryParamFlags dirty
= { flags
};
1018 alListener3f(AL_POSITION
, params
->vPosition
.x
, params
->vPosition
.y
,
1019 -params
->vPosition
.z
);
1021 alListener3f(AL_VELOCITY
, params
->vVelocity
.x
, params
->vVelocity
.y
,
1022 -params
->vVelocity
.z
);
1023 if(dirty
.bit
.orientation
)
1025 ALfloat orient
[6] = {
1026 params
->vOrientFront
.x
, params
->vOrientFront
.y
, -params
->vOrientFront
.z
,
1027 params
->vOrientTop
.x
, params
->vOrientTop
.y
, -params
->vOrientTop
.z
1029 alListenerfv(AL_ORIENTATION
, orient
);
1031 if(dirty
.bit
.distancefactor
)
1033 alSpeedOfSound(343.3f
/params
->flDistanceFactor
);
1034 if(This
->SupportedExt
[EXT_EFX
])
1035 alListenerf(AL_METERS_PER_UNIT
, params
->flDistanceFactor
);
1037 if(dirty
.bit
.rollofffactor
)
1039 ALfloat rolloff
= params
->flRolloffFactor
;
1040 This
->rollofffactor
= rolloff
;
1041 for(i
= 0;i
< This
->nbuffers
;++i
)
1043 const DS8Buffer
*buf
= This
->buffers
[i
];
1044 if(buf
->ds3dmode
!= DS3DMODE_DISABLE
)
1045 alSourcef(buf
->source
, AL_ROLLOFF_FACTOR
, rolloff
);
1048 if(dirty
.bit
.dopplerfactor
)
1049 alDopplerFactor(params
->flDopplerFactor
);
1050 if(dirty
.bit
.effect
)
1051 This
->ExtAL
->AuxiliaryEffectSloti(This
->auxslot
, AL_EFFECTSLOT_EFFECT
, This
->effect
);
1054 static HRESULT WINAPI
DS8Primary3D_QueryInterface(IDirectSound3DListener
*iface
, REFIID riid
, void **ppv
)
1056 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1057 return DS8Primary_QueryInterface(&This
->IDirectSoundBuffer_iface
, riid
, ppv
);
1060 static ULONG WINAPI
DS8Primary3D_AddRef(IDirectSound3DListener
*iface
)
1062 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1065 ret
= InterlockedIncrement(&This
->ds3d_ref
);
1066 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1071 static ULONG WINAPI
DS8Primary3D_Release(IDirectSound3DListener
*iface
)
1073 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1076 ret
= InterlockedDecrement(&This
->ds3d_ref
);
1077 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1083 static HRESULT WINAPI
DS8Primary3D_GetAllParameters(IDirectSound3DListener
*iface
, DS3DLISTENER
*listener
)
1085 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1087 TRACE("(%p)->(%p)\n", iface
, listener
);
1089 if(!listener
|| listener
->dwSize
< sizeof(*listener
))
1091 WARN("Invalid DS3DLISTENER %p %"LONGFMT
"u\n", listener
, listener
? listener
->dwSize
: 0);
1092 return DSERR_INVALIDPARAM
;
1095 EnterCriticalSection(This
->crst
);
1096 setALContext(This
->ctx
);
1097 IDirectSound3DListener_GetPosition(iface
, &listener
->vPosition
);
1098 IDirectSound3DListener_GetVelocity(iface
, &listener
->vVelocity
);
1099 IDirectSound3DListener_GetOrientation(iface
, &listener
->vOrientFront
, &listener
->vOrientTop
);
1100 IDirectSound3DListener_GetDistanceFactor(iface
, &listener
->flDistanceFactor
);
1101 IDirectSound3DListener_GetRolloffFactor(iface
, &listener
->flRolloffFactor
);
1102 IDirectSound3DListener_GetDopplerFactor(iface
, &listener
->flDopplerFactor
);
1104 LeaveCriticalSection(This
->crst
);
1109 static HRESULT WINAPI
DS8Primary3D_GetDistanceFactor(IDirectSound3DListener
*iface
, D3DVALUE
*distancefactor
)
1111 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1113 TRACE("(%p)->(%p)\n", iface
, distancefactor
);
1117 WARN("Invalid parameter %p\n", distancefactor
);
1118 return DSERR_INVALIDPARAM
;
1121 setALContext(This
->ctx
);
1122 *distancefactor
= 343.3f
/alGetFloat(AL_SPEED_OF_SOUND
);
1129 static HRESULT WINAPI
DS8Primary3D_GetDopplerFactor(IDirectSound3DListener
*iface
, D3DVALUE
*dopplerfactor
)
1131 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1133 TRACE("(%p)->(%p)\n", iface
, dopplerfactor
);
1137 WARN("Invalid parameter %p\n", dopplerfactor
);
1138 return DSERR_INVALIDPARAM
;
1141 setALContext(This
->ctx
);
1142 *dopplerfactor
= alGetFloat(AL_DOPPLER_FACTOR
);
1149 static HRESULT WINAPI
DS8Primary3D_GetOrientation(IDirectSound3DListener
*iface
, D3DVECTOR
*front
, D3DVECTOR
*top
)
1151 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1154 TRACE("(%p)->(%p, %p)\n", iface
, front
, top
);
1158 WARN("Invalid parameter %p %p\n", front
, top
);
1159 return DSERR_INVALIDPARAM
;
1162 setALContext(This
->ctx
);
1163 alGetListenerfv(AL_ORIENTATION
, orient
);
1167 front
->x
= orient
[0];
1168 front
->y
= orient
[1];
1169 front
->z
= -orient
[2];
1172 top
->z
= -orient
[5];
1176 static HRESULT WINAPI
DS8Primary3D_GetPosition(IDirectSound3DListener
*iface
, D3DVECTOR
*pos
)
1178 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1181 TRACE("(%p)->(%p)\n", iface
, pos
);
1185 WARN("Invalid parameter %p\n", pos
);
1186 return DSERR_INVALIDPARAM
;
1189 setALContext(This
->ctx
);
1190 alGetListenerfv(AL_POSITION
, alpos
);
1200 static HRESULT WINAPI
DS8Primary3D_GetRolloffFactor(IDirectSound3DListener
*iface
, D3DVALUE
*rollofffactor
)
1202 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1204 TRACE("(%p)->(%p)\n", iface
, rollofffactor
);
1208 WARN("Invalid parameter %p\n", rollofffactor
);
1209 return DSERR_INVALIDPARAM
;
1212 EnterCriticalSection(This
->crst
);
1213 *rollofffactor
= This
->rollofffactor
;
1214 LeaveCriticalSection(This
->crst
);
1219 static HRESULT WINAPI
DS8Primary3D_GetVelocity(IDirectSound3DListener
*iface
, D3DVECTOR
*velocity
)
1221 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1224 TRACE("(%p)->(%p)\n", iface
, velocity
);
1228 WARN("Invalid parameter %p\n", velocity
);
1229 return DSERR_INVALIDPARAM
;
1232 setALContext(This
->ctx
);
1233 alGetListenerfv(AL_VELOCITY
, vel
);
1237 velocity
->x
= vel
[0];
1238 velocity
->y
= vel
[1];
1239 velocity
->z
= -vel
[2];
1243 static HRESULT WINAPI
DS8Primary3D_SetAllParameters(IDirectSound3DListener
*iface
, const DS3DLISTENER
*listen
, DWORD apply
)
1245 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1247 TRACE("(%p)->(%p, %"LONGFMT
"u)\n", iface
, listen
, apply
);
1249 if(!listen
|| listen
->dwSize
< sizeof(*listen
))
1251 WARN("Invalid parameter %p %"LONGFMT
"u\n", listen
, listen
? listen
->dwSize
: 0);
1252 return DSERR_INVALIDPARAM
;
1255 if(listen
->flDistanceFactor
> DS3D_MAXDISTANCEFACTOR
||
1256 listen
->flDistanceFactor
< DS3D_MINDISTANCEFACTOR
)
1258 WARN("Invalid distance factor (%f)\n", listen
->flDistanceFactor
);
1259 return DSERR_INVALIDPARAM
;
1262 if(listen
->flDopplerFactor
> DS3D_MAXDOPPLERFACTOR
||
1263 listen
->flDopplerFactor
< DS3D_MINDOPPLERFACTOR
)
1265 WARN("Invalid doppler factor (%f)\n", listen
->flDopplerFactor
);
1266 return DSERR_INVALIDPARAM
;
1269 if(listen
->flRolloffFactor
< DS3D_MINROLLOFFFACTOR
||
1270 listen
->flRolloffFactor
> DS3D_MAXROLLOFFFACTOR
)
1272 WARN("Invalid rolloff factor (%f)\n", listen
->flRolloffFactor
);
1273 return DSERR_INVALIDPARAM
;
1276 if(apply
== DS3D_DEFERRED
)
1278 EnterCriticalSection(This
->crst
);
1279 This
->params
= *listen
;
1280 This
->params
.dwSize
= sizeof(This
->params
);
1281 This
->dirty
.bit
.pos
= 1;
1282 This
->dirty
.bit
.vel
= 1;
1283 This
->dirty
.bit
.orientation
= 1;
1284 This
->dirty
.bit
.distancefactor
= 1;
1285 This
->dirty
.bit
.rollofffactor
= 1;
1286 This
->dirty
.bit
.dopplerfactor
= 1;
1287 LeaveCriticalSection(This
->crst
);
1291 union PrimaryParamFlags dirty
= { 0l };
1294 dirty
.bit
.orientation
= 1;
1295 dirty
.bit
.distancefactor
= 1;
1296 dirty
.bit
.rollofffactor
= 1;
1297 dirty
.bit
.dopplerfactor
= 1;
1299 EnterCriticalSection(This
->crst
);
1300 setALContext(This
->ctx
);
1301 DS8Primary_SetParams(This
, listen
, dirty
.flags
);
1304 LeaveCriticalSection(This
->crst
);
1310 static HRESULT WINAPI
DS8Primary3D_SetDistanceFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1312 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1314 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1316 if(factor
< DS3D_MINDISTANCEFACTOR
||
1317 factor
> DS3D_MAXDISTANCEFACTOR
)
1319 WARN("Invalid parameter %f\n", factor
);
1320 return DSERR_INVALIDPARAM
;
1323 if(apply
== DS3D_DEFERRED
)
1325 EnterCriticalSection(This
->crst
);
1326 This
->params
.flDistanceFactor
= factor
;
1327 This
->dirty
.bit
.distancefactor
= 1;
1328 LeaveCriticalSection(This
->crst
);
1332 setALContext(This
->ctx
);
1333 alSpeedOfSound(343.3f
/factor
);
1334 if(This
->SupportedExt
[EXT_EFX
])
1335 alListenerf(AL_METERS_PER_UNIT
, factor
);
1343 static HRESULT WINAPI
DS8Primary3D_SetDopplerFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1345 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1347 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1349 if(factor
< DS3D_MINDOPPLERFACTOR
||
1350 factor
> DS3D_MAXDOPPLERFACTOR
)
1352 WARN("Invalid parameter %f\n", factor
);
1353 return DSERR_INVALIDPARAM
;
1356 if(apply
== DS3D_DEFERRED
)
1358 EnterCriticalSection(This
->crst
);
1359 This
->params
.flDopplerFactor
= factor
;
1360 This
->dirty
.bit
.dopplerfactor
= 1;
1361 LeaveCriticalSection(This
->crst
);
1365 setALContext(This
->ctx
);
1366 alDopplerFactor(factor
);
1374 static HRESULT WINAPI
DS8Primary3D_SetOrientation(IDirectSound3DListener
*iface
, D3DVALUE xFront
, D3DVALUE yFront
, D3DVALUE zFront
, D3DVALUE xTop
, D3DVALUE yTop
, D3DVALUE zTop
, DWORD apply
)
1376 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1378 TRACE("(%p)->(%f, %f, %f, %f, %f, %f, %"LONGFMT
"u)\n", iface
, xFront
, yFront
, zFront
, xTop
, yTop
, zTop
, apply
);
1380 if(apply
== DS3D_DEFERRED
)
1382 EnterCriticalSection(This
->crst
);
1383 This
->params
.vOrientFront
.x
= xFront
;
1384 This
->params
.vOrientFront
.y
= yFront
;
1385 This
->params
.vOrientFront
.z
= zFront
;
1386 This
->params
.vOrientTop
.x
= xTop
;
1387 This
->params
.vOrientTop
.y
= yTop
;
1388 This
->params
.vOrientTop
.z
= zTop
;
1389 This
->dirty
.bit
.orientation
= 1;
1390 LeaveCriticalSection(This
->crst
);
1394 ALfloat orient
[6] = {
1395 xFront
, yFront
, -zFront
,
1398 setALContext(This
->ctx
);
1399 alListenerfv(AL_ORIENTATION
, orient
);
1407 static HRESULT WINAPI
DS8Primary3D_SetPosition(IDirectSound3DListener
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
, DWORD apply
)
1409 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1411 TRACE("(%p)->(%f, %f, %f, %"LONGFMT
"u)\n", iface
, x
, y
, z
, apply
);
1413 if(apply
== DS3D_DEFERRED
)
1415 EnterCriticalSection(This
->crst
);
1416 This
->params
.vPosition
.x
= x
;
1417 This
->params
.vPosition
.y
= y
;
1418 This
->params
.vPosition
.z
= z
;
1419 This
->dirty
.bit
.pos
= 1;
1420 LeaveCriticalSection(This
->crst
);
1424 setALContext(This
->ctx
);
1425 alListener3f(AL_POSITION
, x
, y
, -z
);
1433 static HRESULT WINAPI
DS8Primary3D_SetRolloffFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1435 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1437 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1439 if(factor
< DS3D_MINROLLOFFFACTOR
||
1440 factor
> DS3D_MAXROLLOFFFACTOR
)
1442 WARN("Invalid parameter %f\n", factor
);
1443 return DSERR_INVALIDPARAM
;
1446 EnterCriticalSection(This
->crst
);
1447 if(apply
== DS3D_DEFERRED
)
1449 This
->params
.flRolloffFactor
= factor
;
1450 This
->dirty
.bit
.rollofffactor
= 1;
1456 setALContext(This
->ctx
);
1457 for(i
= 0;i
< This
->nbuffers
;++i
)
1459 if(This
->buffers
[i
]->ds3dmode
!= DS3DMODE_DISABLE
)
1460 alSourcef(This
->buffers
[i
]->source
, AL_ROLLOFF_FACTOR
, factor
);
1465 This
->rollofffactor
= factor
;
1467 LeaveCriticalSection(This
->crst
);
1472 static HRESULT WINAPI
DS8Primary3D_SetVelocity(IDirectSound3DListener
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
, DWORD apply
)
1474 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1476 TRACE("(%p)->(%f, %f, %f, %"LONGFMT
"u)\n", iface
, x
, y
, z
, apply
);
1478 if(apply
== DS3D_DEFERRED
)
1480 EnterCriticalSection(This
->crst
);
1481 This
->params
.vVelocity
.x
= x
;
1482 This
->params
.vVelocity
.y
= y
;
1483 This
->params
.vVelocity
.z
= z
;
1484 This
->dirty
.bit
.vel
= 1;
1485 LeaveCriticalSection(This
->crst
);
1489 setALContext(This
->ctx
);
1490 alListener3f(AL_VELOCITY
, x
, y
, -z
);
1498 static HRESULT WINAPI
DS8Primary3D_CommitDeferredSettings(IDirectSound3DListener
*iface
)
1500 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1504 EnterCriticalSection(This
->crst
);
1505 setALContext(This
->ctx
);
1506 This
->DeferUpdates();
1508 if((flags
=InterlockedExchange(&This
->dirty
.flags
, 0)) != 0)
1510 DS8Primary_SetParams(This
, &This
->params
, flags
);
1511 /* checkALError is here for debugging */
1514 TRACE("Dirty flags was: 0x%02x\n", flags
);
1516 for(i
= 0;i
< This
->nbuffers
;++i
)
1518 DS8Buffer
*buf
= This
->buffers
[i
];
1520 if((flags
=InterlockedExchange(&buf
->dirty
.flags
, 0)) != 0)
1521 DS8Buffer_SetParams(buf
, &buf
->params
, flags
);
1525 This
->ProcessUpdates();
1527 LeaveCriticalSection(This
->crst
);
1532 static const IDirectSound3DListenerVtbl DS8Primary3D_Vtbl
=
1534 DS8Primary3D_QueryInterface
,
1535 DS8Primary3D_AddRef
,
1536 DS8Primary3D_Release
,
1537 DS8Primary3D_GetAllParameters
,
1538 DS8Primary3D_GetDistanceFactor
,
1539 DS8Primary3D_GetDopplerFactor
,
1540 DS8Primary3D_GetOrientation
,
1541 DS8Primary3D_GetPosition
,
1542 DS8Primary3D_GetRolloffFactor
,
1543 DS8Primary3D_GetVelocity
,
1544 DS8Primary3D_SetAllParameters
,
1545 DS8Primary3D_SetDistanceFactor
,
1546 DS8Primary3D_SetDopplerFactor
,
1547 DS8Primary3D_SetOrientation
,
1548 DS8Primary3D_SetPosition
,
1549 DS8Primary3D_SetRolloffFactor
,
1550 DS8Primary3D_SetVelocity
,
1551 DS8Primary3D_CommitDeferredSettings
1554 /* NOTE: Although the app handles listener properties through secondary buffers,
1555 * we pass the requests to the primary buffer though a propertyset interface.
1556 * These methods are not exposed to the app. */
1557 static HRESULT WINAPI
DS8PrimaryProp_QueryInterface(IKsPropertySet
*iface
, REFIID riid
, void **ppv
)
1559 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1560 return DS8Primary_QueryInterface(&This
->IDirectSoundBuffer_iface
, riid
, ppv
);
1563 static ULONG WINAPI
DS8PrimaryProp_AddRef(IKsPropertySet
*iface
)
1565 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1568 ret
= InterlockedIncrement(&This
->prop_ref
);
1569 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1574 static ULONG WINAPI
DS8PrimaryProp_Release(IKsPropertySet
*iface
)
1576 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1579 ret
= InterlockedDecrement(&This
->prop_ref
);
1580 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1585 static HRESULT WINAPI
DS8PrimaryProp_Get(IKsPropertySet
*iface
,
1586 REFGUID guidPropSet
, ULONG dwPropID
,
1587 LPVOID pInstanceData
, ULONG cbInstanceData
,
1588 LPVOID pPropData
, ULONG cbPropData
,
1591 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1592 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
1593 (void)pInstanceData
;
1594 (void)cbInstanceData
;
1596 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
1598 EnterCriticalSection(This
->crst
);
1600 if(This
->effect
== 0)
1601 res
= E_PROP_ID_UNSUPPORTED
;
1602 else switch(dwPropID
)
1604 case DSPROPERTY_EAXLISTENER_ALLPARAMETERS
:
1605 res
= DSERR_INVALIDPARAM
;
1606 if(cbPropData
>= sizeof(EAXLISTENERPROPERTIES
))
1610 EAXLISTENERPROPERTIES
*props
;
1611 } data
= { pPropData
};
1613 *data
.props
= This
->eax_prop
;
1614 *pcbReturned
= sizeof(EAXLISTENERPROPERTIES
);
1619 case DSPROPERTY_EAXLISTENER_ROOM
:
1620 res
= DSERR_INVALIDPARAM
;
1621 if(cbPropData
>= sizeof(LONG
))
1626 } data
= { pPropData
};
1628 *data
.l
= This
->eax_prop
.lRoom
;
1629 *pcbReturned
= sizeof(LONG
);
1633 case DSPROPERTY_EAXLISTENER_ROOMHF
:
1634 res
= DSERR_INVALIDPARAM
;
1635 if(cbPropData
>= sizeof(LONG
))
1640 } data
= { pPropData
};
1642 *data
.l
= This
->eax_prop
.lRoomHF
;
1643 *pcbReturned
= sizeof(LONG
);
1648 case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
:
1649 res
= DSERR_INVALIDPARAM
;
1650 if(cbPropData
>= sizeof(FLOAT
))
1655 } data
= { pPropData
};
1657 *data
.fl
= This
->eax_prop
.flRoomRolloffFactor
;
1658 *pcbReturned
= sizeof(FLOAT
);
1663 case DSPROPERTY_EAXLISTENER_ENVIRONMENT
:
1664 res
= DSERR_INVALIDPARAM
;
1665 if(cbPropData
>= sizeof(DWORD
))
1670 } data
= { pPropData
};
1672 *data
.dw
= This
->eax_prop
.dwEnvironment
;
1673 *pcbReturned
= sizeof(DWORD
);
1678 case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
:
1679 res
= DSERR_INVALIDPARAM
;
1680 if(cbPropData
>= sizeof(FLOAT
))
1685 } data
= { pPropData
};
1687 *data
.fl
= This
->eax_prop
.flEnvironmentSize
;
1688 *pcbReturned
= sizeof(FLOAT
);
1692 case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
:
1693 res
= DSERR_INVALIDPARAM
;
1694 if(cbPropData
>= sizeof(FLOAT
))
1699 } data
= { pPropData
};
1701 *data
.fl
= This
->eax_prop
.flEnvironmentDiffusion
;
1702 *pcbReturned
= sizeof(FLOAT
);
1707 case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
:
1708 res
= DSERR_INVALIDPARAM
;
1709 if(cbPropData
>= sizeof(FLOAT
))
1714 } data
= { pPropData
};
1716 *data
.fl
= This
->eax_prop
.flAirAbsorptionHF
;
1717 *pcbReturned
= sizeof(FLOAT
);
1722 case DSPROPERTY_EAXLISTENER_FLAGS
:
1723 res
= DSERR_INVALIDPARAM
;
1724 if(cbPropData
>= sizeof(DWORD
))
1729 } data
= { pPropData
};
1731 *data
.dw
= This
->eax_prop
.dwFlags
;
1732 *pcbReturned
= sizeof(DWORD
);
1738 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", dwPropID
);
1742 LeaveCriticalSection(This
->crst
);
1745 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
1750 static HRESULT WINAPI
DS8PrimaryProp_Set(IKsPropertySet
*iface
,
1751 REFGUID guidPropSet
, ULONG dwPropID
,
1752 LPVOID pInstanceData
, ULONG cbInstanceData
,
1753 LPVOID pPropData
, ULONG cbPropData
)
1755 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1756 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
1757 (void)pInstanceData
;
1758 (void)cbInstanceData
;
1760 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
1762 DWORD propid
= dwPropID
& ~DSPROPERTY_EAXLISTENER_DEFERRED
;
1763 BOOL immediate
= !(dwPropID
&DSPROPERTY_EAXLISTENER_DEFERRED
);
1765 EnterCriticalSection(This
->crst
);
1766 setALContext(This
->ctx
);
1768 if(This
->effect
== 0)
1769 res
= E_PROP_ID_UNSUPPORTED
;
1772 case 0: /* 0 = not setting any property, just apply */
1776 case DSPROPERTY_EAXLISTENER_ALLPARAMETERS
:
1778 res
= DSERR_INVALIDPARAM
;
1779 if(cbPropData
>= sizeof(EAXLISTENERPROPERTIES
))
1783 const EAXLISTENERPROPERTIES
*props
;
1784 } data
= { pPropData
};
1786 /* FIXME: Need to validate property values... Ignore? Clamp? Error? */
1787 This
->eax_prop
= *data
.props
;
1788 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DENSITY
,
1789 (data
.props
->flEnvironmentSize
< 2.0f
) ?
1790 (data
.props
->flEnvironmentSize
- 1.0f
) : 1.0f
);
1791 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DIFFUSION
,
1792 data
.props
->flEnvironmentDiffusion
);
1794 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAIN
,
1795 mB_to_gain(data
.props
->lRoom
));
1796 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAINHF
,
1797 mB_to_gain(data
.props
->lRoomHF
));
1799 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_ROOM_ROLLOFF_FACTOR
,
1800 data
.props
->flRoomRolloffFactor
);
1802 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DECAY_TIME
,
1803 data
.props
->flDecayTime
);
1804 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DECAY_HFRATIO
,
1805 data
.props
->flDecayHFRatio
);
1807 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_REFLECTIONS_GAIN
,
1808 mB_to_gain(data
.props
->lReflections
));
1809 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_REFLECTIONS_DELAY
,
1810 data
.props
->flReflectionsDelay
);
1812 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_LATE_REVERB_GAIN
,
1813 mB_to_gain(data
.props
->lReverb
));
1814 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_LATE_REVERB_DELAY
,
1815 data
.props
->flReverbDelay
);
1817 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_AIR_ABSORPTION_GAINHF
,
1818 mB_to_gain(data
.props
->flAirAbsorptionHF
));
1820 This
->ExtAL
->Effecti(This
->effect
, AL_REVERB_DECAY_HFLIMIT
,
1821 (data
.props
->dwFlags
&EAXLISTENERFLAGS_DECAYHFLIMIT
) ?
1822 AL_TRUE
: AL_FALSE
);
1826 This
->dirty
.bit
.effect
= 1;
1831 case DSPROPERTY_EAXLISTENER_ROOM
:
1832 res
= DSERR_INVALIDPARAM
;
1833 if(cbPropData
>= sizeof(LONG
))
1838 } data
= { pPropData
};
1840 This
->eax_prop
.lRoom
= *data
.l
;
1841 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAIN
,
1842 mB_to_gain(This
->eax_prop
.lRoom
));
1845 This
->dirty
.bit
.effect
= 1;
1849 case DSPROPERTY_EAXLISTENER_ROOMHF
:
1850 res
= DSERR_INVALIDPARAM
;
1851 if(cbPropData
>= sizeof(LONG
))
1856 } data
= { pPropData
};
1858 This
->eax_prop
.lRoomHF
= *data
.l
;
1859 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAINHF
,
1860 mB_to_gain(This
->eax_prop
.lRoomHF
));
1863 This
->dirty
.bit
.effect
= 1;
1868 case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
:
1869 res
= DSERR_INVALIDPARAM
;
1870 if(cbPropData
>= sizeof(FLOAT
))
1875 } data
= { pPropData
};
1877 This
->eax_prop
.flRoomRolloffFactor
= *data
.fl
;
1878 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_ROOM_ROLLOFF_FACTOR
,
1879 This
->eax_prop
.flRoomRolloffFactor
);
1882 This
->dirty
.bit
.effect
= 1;
1887 case DSPROPERTY_EAXLISTENER_ENVIRONMENT
:
1888 res
= DSERR_INVALIDPARAM
;
1889 if(cbPropData
>= sizeof(DWORD
))
1894 } data
= { pPropData
};
1896 if(*data
.dw
< EAX_ENVIRONMENT_COUNT
)
1898 /* Get the environment index's default and pass it down to
1900 propid
= DSPROPERTY_EAXLISTENER_ALLPARAMETERS
;
1901 pPropData
= (void*)&EnvironmentDefaults
[*data
.dw
];
1902 cbPropData
= sizeof(EnvironmentDefaults
[*data
.dw
]);
1908 case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
:
1909 res
= DSERR_INVALIDPARAM
;
1910 if(cbPropData
>= sizeof(FLOAT
))
1915 } data
= { pPropData
};
1917 if(*data
.fl
>= 1.0f
&& *data
.fl
<= 100.0f
)
1919 double scale
= (*data
.fl
)/This
->eax_prop
.flEnvironmentSize
;
1921 This
->eax_prop
.flEnvironmentSize
= *data
.fl
;
1923 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_DECAYTIMESCALE
))
1925 This
->eax_prop
.flDecayTime
*= scale
;
1926 This
->eax_prop
.flDecayTime
= clampF(This
->eax_prop
.flDecayTime
, 0.1f
, 20.0f
);
1928 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REFLECTIONSSCALE
))
1930 This
->eax_prop
.lReflections
+= gain_to_mB(1.0/scale
);
1931 This
->eax_prop
.lReflections
= clampI(This
->eax_prop
.lReflections
, -10000, 1000);
1933 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE
))
1935 This
->eax_prop
.flReflectionsDelay
*= scale
;
1936 This
->eax_prop
.flReflectionsDelay
= clampF(This
->eax_prop
.flReflectionsDelay
, 0.0f
, 0.3f
);
1938 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REVERBSCALE
))
1940 This
->eax_prop
.lReverb
+= gain_to_mB(1.0/scale
);
1941 This
->eax_prop
.lReverb
= clampI(This
->eax_prop
.lReverb
, -10000, 2000);
1943 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REVERBDELAYSCALE
))
1945 This
->eax_prop
.flReverbDelay
*= scale
;
1946 This
->eax_prop
.flReverbDelay
= clampF(This
->eax_prop
.flReverbDelay
, 0.0f
, 0.1f
);
1949 /* Pass the updated environment properties down to ALLPARAMETERS */
1950 propid
= DSPROPERTY_EAXLISTENER_ALLPARAMETERS
;
1951 pPropData
= (void*)&This
->eax_prop
;
1952 cbPropData
= sizeof(This
->eax_prop
);
1957 case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
:
1958 res
= DSERR_INVALIDPARAM
;
1959 if(cbPropData
>= sizeof(FLOAT
))
1964 } data
= { pPropData
};
1966 This
->eax_prop
.flEnvironmentDiffusion
= *data
.fl
;
1967 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DIFFUSION
,
1968 This
->eax_prop
.flEnvironmentDiffusion
);
1971 This
->dirty
.bit
.effect
= 1;
1976 case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
:
1977 res
= DSERR_INVALIDPARAM
;
1978 if(cbPropData
>= sizeof(FLOAT
))
1983 } data
= { pPropData
};
1985 This
->eax_prop
.flAirAbsorptionHF
= *data
.fl
;
1986 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_AIR_ABSORPTION_GAINHF
,
1987 mB_to_gain(This
->eax_prop
.flAirAbsorptionHF
));
1990 This
->dirty
.bit
.effect
= 1;
1995 case DSPROPERTY_EAXLISTENER_FLAGS
:
1996 res
= DSERR_INVALIDPARAM
;
1997 if(cbPropData
>= sizeof(DWORD
))
2002 } data
= { pPropData
};
2004 This
->eax_prop
.dwFlags
= *data
.dw
;
2005 This
->ExtAL
->Effecti(This
->effect
, AL_REVERB_DECAY_HFLIMIT
,
2006 (This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_DECAYHFLIMIT
) ?
2007 AL_TRUE
: AL_FALSE
);
2010 This
->dirty
.bit
.effect
= 1;
2016 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", propid
);
2020 if(res
== DS_OK
&& immediate
)
2021 IDirectSound3DListener_CommitDeferredSettings(&This
->IDirectSound3DListener_iface
);
2024 LeaveCriticalSection(This
->crst
);
2027 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
2032 static HRESULT WINAPI
DS8PrimaryProp_QuerySupport(IKsPropertySet
*iface
,
2033 REFGUID guidPropSet
, ULONG dwPropID
,
2034 PULONG pTypeSupport
)
2036 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
2037 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
2039 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
2041 EnterCriticalSection(This
->crst
);
2043 if(This
->effect
== 0)
2044 res
= E_PROP_ID_UNSUPPORTED
;
2045 else if(dwPropID
== DSPROPERTY_EAXLISTENER_ALLPARAMETERS
||
2046 dwPropID
== DSPROPERTY_EAXLISTENER_ROOM
||
2047 dwPropID
== DSPROPERTY_EAXLISTENER_ROOMHF
||
2048 dwPropID
== DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
||
2049 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENT
||
2050 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
||
2051 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
||
2052 dwPropID
== DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
||
2053 dwPropID
== DSPROPERTY_EAXLISTENER_FLAGS
)
2055 *pTypeSupport
= KSPROPERTY_SUPPORT_GET
|KSPROPERTY_SUPPORT_SET
;
2059 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", dwPropID
);
2061 LeaveCriticalSection(This
->crst
);
2064 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
2069 static const IKsPropertySetVtbl DS8PrimaryProp_Vtbl
=
2071 DS8PrimaryProp_QueryInterface
,
2072 DS8PrimaryProp_AddRef
,
2073 DS8PrimaryProp_Release
,
2076 DS8PrimaryProp_QuerySupport