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
->listen
;
358 listener
->dwSize
= sizeof(*listener
);
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 EnterCriticalSection(This
->crst
);
495 caps
->dwFlags
= This
->flags
;
496 caps
->dwBufferBytes
= This
->buf_size
;
497 caps
->dwUnlockTransferRate
= 0;
498 caps
->dwPlayCpuOverhead
= 0;
499 LeaveCriticalSection(This
->crst
);
504 static HRESULT WINAPI
DS8Primary_GetCurrentPosition(IDirectSoundBuffer
*iface
, DWORD
*playpos
, DWORD
*curpos
)
506 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
507 HRESULT hr
= DSERR_PRIOLEVELNEEDED
;
509 EnterCriticalSection(This
->crst
);
511 hr
= IDirectSoundBuffer8_GetCurrentPosition(This
->write_emu
, playpos
, curpos
);
512 LeaveCriticalSection(This
->crst
);
517 static HRESULT WINAPI
DS8Primary_GetFormat(IDirectSoundBuffer
*iface
, WAVEFORMATEX
*wfx
, DWORD allocated
, DWORD
*written
)
519 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
525 WARN("Cannot report format or format size\n");
526 return DSERR_INVALIDPARAM
;
529 EnterCriticalSection(This
->crst
);
530 size
= sizeof(This
->format
.Format
) + This
->format
.Format
.cbSize
;
536 hr
= DSERR_INVALIDPARAM
;
538 memcpy(wfx
, &This
->format
.Format
, size
);
540 LeaveCriticalSection(This
->crst
);
545 static HRESULT WINAPI
DS8Primary_GetVolume(IDirectSoundBuffer
*iface
, LONG
*volume
)
547 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
550 TRACE("(%p)->(%p)\n", iface
, volume
);
553 return DSERR_INVALIDPARAM
;
556 if(!(This
->flags
&DSBCAPS_CTRLVOLUME
))
557 return DSERR_CONTROLUNAVAIL
;
559 setALContext(This
->ctx
);
560 alGetListenerf(AL_GAIN
, &gain
);
564 *volume
= clampI(gain_to_mB(gain
), DSBVOLUME_MIN
, DSBVOLUME_MAX
);
568 static HRESULT WINAPI
DS8Primary_GetPan(IDirectSoundBuffer
*iface
, LONG
*pan
)
570 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
573 WARN("(%p)->(%p): semi-stub\n", iface
, pan
);
576 return DSERR_INVALIDPARAM
;
578 EnterCriticalSection(This
->crst
);
580 hr
= IDirectSoundBuffer8_GetPan(This
->write_emu
, pan
);
581 else if(!(This
->flags
& DSBCAPS_CTRLPAN
))
582 hr
= DSERR_CONTROLUNAVAIL
;
585 LeaveCriticalSection(This
->crst
);
590 static HRESULT WINAPI
DS8Primary_GetFrequency(IDirectSoundBuffer
*iface
, DWORD
*freq
)
592 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
595 WARN("(%p)->(%p): semi-stub\n", iface
, freq
);
598 return DSERR_INVALIDPARAM
;
600 if(!(This
->flags
&DSBCAPS_CTRLFREQUENCY
))
601 return DSERR_CONTROLUNAVAIL
;
603 EnterCriticalSection(This
->crst
);
604 *freq
= This
->format
.Format
.nSamplesPerSec
;
605 LeaveCriticalSection(This
->crst
);
610 static HRESULT WINAPI
DS8Primary_GetStatus(IDirectSoundBuffer
*iface
, DWORD
*status
)
612 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
614 TRACE("(%p)->(%p)\n", iface
, status
);
617 return DSERR_INVALIDPARAM
;
619 EnterCriticalSection(This
->crst
);
620 *status
= DSBSTATUS_PLAYING
|DSBSTATUS_LOOPING
;
621 if((This
->flags
&DSBCAPS_LOCDEFER
))
622 *status
|= DSBSTATUS_LOCHARDWARE
;
629 for(i
= 0;i
< This
->nbuffers
;++i
)
631 hr
= IDirectSoundBuffer8_GetStatus(&This
->buffers
[i
]->IDirectSoundBuffer8_iface
, &state
);
632 if(SUCCEEDED(hr
) && (state
&DSBSTATUS_PLAYING
))
635 if(i
== This
->nbuffers
)
637 /* Primary stopped and no buffers playing.. */
641 LeaveCriticalSection(This
->crst
);
646 static HRESULT WINAPI
DS8Primary_Initialize(IDirectSoundBuffer
*iface
, IDirectSound
*ds
, const DSBUFFERDESC
*desc
)
648 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
651 TRACE("(%p)->(%p, %p)\n", iface
, ds
, desc
);
653 if(!desc
|| desc
->lpwfxFormat
|| desc
->dwBufferBytes
)
655 WARN("Bad DSBDESC for primary buffer\n");
656 return DSERR_INVALIDPARAM
;
658 if((desc
->dwFlags
&DSBCAPS_CTRLFX
) ||
659 (desc
->dwFlags
&DSBCAPS_CTRLPOSITIONNOTIFY
) ||
660 (desc
->dwFlags
&DSBCAPS_LOCSOFTWARE
))
662 WARN("Bad dwFlags %08"LONGFMT
"x\n", desc
->dwFlags
);
663 return DSERR_INVALIDPARAM
;
666 /* Should be 0 if not initialized */
668 return DSERR_ALREADYINITIALIZED
;
671 if(This
->parent
->prio_level
== DSSCL_WRITEPRIMARY
)
673 DSBUFFERDESC emudesc
;
678 ERR("There shouldn't be a write_emu!\n");
679 IDirectSoundBuffer8_Release(This
->write_emu
);
680 This
->write_emu
= NULL
;
683 memset(&emudesc
, 0, sizeof(emudesc
));
684 emudesc
.dwSize
= sizeof(emudesc
);
685 emudesc
.dwFlags
= DSBCAPS_LOCHARDWARE
| (desc
->dwFlags
&DSBCAPS_CTRLPAN
);
686 /* Dont play last incomplete sample */
687 emudesc
.dwBufferBytes
= This
->buf_size
- (This
->buf_size
%This
->format
.Format
.nBlockAlign
);
688 emudesc
.lpwfxFormat
= &This
->format
.Format
;
690 hr
= DS8Buffer_Create(&emu
, This
, NULL
);
693 This
->write_emu
= &emu
->IDirectSoundBuffer8_iface
;
694 hr
= IDirectSoundBuffer8_Initialize(This
->write_emu
, ds
, &emudesc
);
697 IDirectSoundBuffer8_Release(This
->write_emu
);
698 This
->write_emu
= NULL
;
704 This
->flags
= desc
->dwFlags
| DSBCAPS_LOCHARDWARE
;
708 static HRESULT WINAPI
DS8Primary_Lock(IDirectSoundBuffer
*iface
, DWORD ofs
, DWORD bytes
, void **ptr1
, DWORD
*len1
, void **ptr2
, DWORD
*len2
, DWORD flags
)
710 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
711 HRESULT hr
= DSERR_PRIOLEVELNEEDED
;
713 TRACE("(%p)->(%"LONGFMT
"u, %"LONGFMT
"u, %p, %p, %p, %p, %"LONGFMT
"u)\n", iface
, ofs
, bytes
, ptr1
, len1
, ptr2
, len2
, flags
);
715 EnterCriticalSection(This
->crst
);
717 hr
= IDirectSoundBuffer8_Lock(This
->write_emu
, ofs
, bytes
, ptr1
, len1
, ptr2
, len2
, flags
);
718 LeaveCriticalSection(This
->crst
);
723 static HRESULT WINAPI
DS8Primary_Play(IDirectSoundBuffer
*iface
, DWORD res1
, DWORD res2
, DWORD flags
)
725 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
728 TRACE("(%p)->(%"LONGFMT
"u, %"LONGFMT
"u, %"LONGFMT
"u)\n", iface
, res1
, res2
, flags
);
730 if(!(flags
& DSBPLAY_LOOPING
))
732 WARN("Flags (%08"LONGFMT
"x) not set to DSBPLAY_LOOPING\n", flags
);
733 return DSERR_INVALIDPARAM
;
736 EnterCriticalSection(This
->crst
);
739 hr
= IDirectSoundBuffer8_Play(This
->write_emu
, res1
, res2
, flags
);
741 This
->stopped
= FALSE
;
742 LeaveCriticalSection(This
->crst
);
747 static HRESULT WINAPI
DS8Primary_SetCurrentPosition(IDirectSoundBuffer
*iface
, DWORD pos
)
749 WARN("(%p)->(%"LONGFMT
"u)\n", iface
, pos
);
750 return DSERR_INVALIDCALL
;
753 /* Just assume the format is crap, and clean up the damage */
754 static void copy_waveformat(WAVEFORMATEX
*wfx
, const WAVEFORMATEX
*from
)
756 if(from
->wFormatTag
== WAVE_FORMAT_PCM
)
759 if(from
->wBitsPerSample
== 8 ||
760 from
->wBitsPerSample
== 16 ||
761 from
->wBitsPerSample
== 24 ||
762 from
->wBitsPerSample
== 32)
763 wfx
->wBitsPerSample
= from
->wBitsPerSample
;
765 else if(from
->wFormatTag
== WAVE_FORMAT_EXTENSIBLE
)
767 WAVEFORMATEXTENSIBLE
*wfe
= (WAVEFORMATEXTENSIBLE
*)wfx
;
768 const WAVEFORMATEXTENSIBLE
*fromx
= (const WAVEFORMATEXTENSIBLE
*)from
;
769 DWORD size
= sizeof(WAVEFORMATEXTENSIBLE
) - sizeof(WAVEFORMATEX
);
771 /* Fail silently.. */
772 if(from
->cbSize
< size
)
774 if(!fromx
->Samples
.wValidBitsPerSample
&&
775 !fromx
->Format
.wBitsPerSample
)
778 if(!IsEqualGUID(&wfe
->SubFormat
, &KSDATAFORMAT_SUBTYPE_PCM
) &&
779 !IsEqualGUID(&wfe
->SubFormat
, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))
781 ERR("Unhandled extensible format: %s\n", debugstr_guid(&wfe
->SubFormat
));
785 wfe
->Format
.wBitsPerSample
= from
->wBitsPerSample
;
786 wfe
->Samples
.wValidBitsPerSample
= fromx
->Samples
.wValidBitsPerSample
;
787 if(!wfe
->Samples
.wValidBitsPerSample
)
788 wfe
->Samples
.wValidBitsPerSample
= wfe
->Format
.wBitsPerSample
;
789 wfe
->Format
.cbSize
= size
;
790 wfe
->dwChannelMask
= fromx
->dwChannelMask
;
791 wfe
->SubFormat
= fromx
->SubFormat
;
795 ERR("Unhandled format tag %04x\n", from
->wFormatTag
);
800 wfx
->nChannels
= from
->nChannels
;
801 wfx
->wFormatTag
= from
->wFormatTag
;
802 if(from
->nSamplesPerSec
>= DSBFREQUENCY_MIN
&&
803 from
->nSamplesPerSec
<= DSBFREQUENCY_MAX
)
804 wfx
->nSamplesPerSec
= from
->nSamplesPerSec
;
805 wfx
->nBlockAlign
= wfx
->wBitsPerSample
* wfx
->nChannels
/ 8;
806 wfx
->nAvgBytesPerSec
= wfx
->nSamplesPerSec
* wfx
->nBlockAlign
;
809 static HRESULT WINAPI
DS8Primary_SetFormat(IDirectSoundBuffer
*iface
, const WAVEFORMATEX
*wfx
)
811 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
815 TRACE("(%p)->(%p)\n", iface
, wfx
);
819 WARN("Missing format\n");
820 return DSERR_INVALIDPARAM
;
823 EnterCriticalSection(This
->crst
);
825 if(This
->parent
->prio_level
< DSSCL_PRIORITY
)
827 hr
= DSERR_PRIOLEVELNEEDED
;
831 TRACE("Requested primary format:\n"
832 " FormatTag = %04x\n"
834 " SamplesPerSec = %"LONGFMT
"u\n"
835 " AvgBytesPerSec = %"LONGFMT
"u\n"
837 " BitsPerSample = %u\n",
838 wfx
->wFormatTag
, wfx
->nChannels
,
839 wfx
->nSamplesPerSec
, wfx
->nAvgBytesPerSec
,
840 wfx
->nBlockAlign
, wfx
->wBitsPerSample
);
842 copy_waveformat(&This
->format
.Format
, wfx
);
844 freq
= This
->format
.Format
.nSamplesPerSec
;
845 alcGetIntegerv(This
->parent
->device
, ALC_FREQUENCY
, 1, &freq
);
846 checkALCError(This
->parent
->device
);
848 This
->format
.Format
.nSamplesPerSec
= freq
;
849 This
->format
.Format
.nAvgBytesPerSec
= This
->format
.Format
.nBlockAlign
*
850 This
->format
.Format
.nSamplesPerSec
;
857 memset(&desc
, 0, sizeof(desc
));
858 desc
.dwSize
= sizeof(desc
);
859 desc
.dwFlags
= DSBCAPS_LOCHARDWARE
|DSBCAPS_CTRLPAN
;
860 desc
.dwBufferBytes
= This
->buf_size
- (This
->buf_size
% This
->format
.Format
.nBlockAlign
);
861 desc
.lpwfxFormat
= &This
->format
.Format
;
863 hr
= DS8Buffer_Create(&buf
, This
, NULL
);
867 hr
= IDirectSoundBuffer8_Initialize(&buf
->IDirectSoundBuffer8_iface
, &This
->parent
->IDirectSound_iface
, &desc
);
869 DS8Buffer_Destroy(buf
);
872 IDirectSoundBuffer8_Release(This
->write_emu
);
873 This
->write_emu
= &buf
->IDirectSoundBuffer8_iface
;
878 LeaveCriticalSection(This
->crst
);
882 static HRESULT WINAPI
DS8Primary_SetVolume(IDirectSoundBuffer
*iface
, LONG vol
)
884 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
886 TRACE("(%p)->(%"LONGFMT
"d)\n", iface
, vol
);
888 if(vol
> DSBVOLUME_MAX
|| vol
< DSBVOLUME_MIN
)
890 WARN("Invalid volume (%"LONGFMT
"d)\n", vol
);
891 return DSERR_INVALIDPARAM
;
894 if(!(This
->flags
&DSBCAPS_CTRLVOLUME
))
895 return DSERR_CONTROLUNAVAIL
;
897 setALContext(This
->ctx
);
898 alListenerf(AL_GAIN
, mB_to_gain(vol
));
904 static HRESULT WINAPI
DS8Primary_SetPan(IDirectSoundBuffer
*iface
, LONG pan
)
906 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
909 TRACE("(%p)->(%"LONGFMT
"d)\n", iface
, pan
);
911 if(pan
> DSBPAN_RIGHT
|| pan
< DSBPAN_LEFT
)
913 WARN("invalid parameter: pan = %"LONGFMT
"d\n", pan
);
914 return DSERR_INVALIDPARAM
;
917 EnterCriticalSection(This
->crst
);
918 if(!(This
->flags
&DSBCAPS_CTRLPAN
))
920 WARN("control unavailable\n");
921 hr
= DSERR_CONTROLUNAVAIL
;
923 else if(This
->write_emu
)
924 hr
= IDirectSoundBuffer8_SetPan(This
->write_emu
, pan
);
927 FIXME("Not supported\n");
930 LeaveCriticalSection(This
->crst
);
935 static HRESULT WINAPI
DS8Primary_SetFrequency(IDirectSoundBuffer
*iface
, DWORD freq
)
937 WARN("(%p)->(%"LONGFMT
"u)\n", iface
, freq
);
938 return DSERR_CONTROLUNAVAIL
;
941 static HRESULT WINAPI
DS8Primary_Stop(IDirectSoundBuffer
*iface
)
943 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
946 TRACE("(%p)->()\n", iface
);
948 EnterCriticalSection(This
->crst
);
950 hr
= IDirectSoundBuffer8_Stop(This
->write_emu
);
952 This
->stopped
= TRUE
;
953 LeaveCriticalSection(This
->crst
);
958 static HRESULT WINAPI
DS8Primary_Unlock(IDirectSoundBuffer
*iface
, void *ptr1
, DWORD len1
, void *ptr2
, DWORD len2
)
960 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
961 HRESULT hr
= DSERR_INVALIDCALL
;
963 TRACE("(%p)->(%p, %"LONGFMT
"u, %p, %"LONGFMT
"u)\n", iface
, ptr1
, len1
, ptr2
, len2
);
965 EnterCriticalSection(This
->crst
);
967 hr
= IDirectSoundBuffer8_Unlock(This
->write_emu
, ptr1
, len1
, ptr2
, len2
);
968 LeaveCriticalSection(This
->crst
);
973 static HRESULT WINAPI
DS8Primary_Restore(IDirectSoundBuffer
*iface
)
975 DS8Primary
*This
= impl_from_IDirectSoundBuffer(iface
);
978 TRACE("(%p)->()\n", iface
);
980 EnterCriticalSection(This
->crst
);
982 hr
= IDirectSoundBuffer8_Restore(This
->write_emu
);
983 LeaveCriticalSection(This
->crst
);
988 static const IDirectSoundBufferVtbl DS8Primary_Vtbl
=
990 DS8Primary_QueryInterface
,
994 DS8Primary_GetCurrentPosition
,
995 DS8Primary_GetFormat
,
996 DS8Primary_GetVolume
,
998 DS8Primary_GetFrequency
,
999 DS8Primary_GetStatus
,
1000 DS8Primary_Initialize
,
1003 DS8Primary_SetCurrentPosition
,
1004 DS8Primary_SetFormat
,
1005 DS8Primary_SetVolume
,
1007 DS8Primary_SetFrequency
,
1014 static HRESULT WINAPI
DS8Primary3D_QueryInterface(IDirectSound3DListener
*iface
, REFIID riid
, void **ppv
)
1016 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1017 return DS8Primary_QueryInterface(&This
->IDirectSoundBuffer_iface
, riid
, ppv
);
1020 static ULONG WINAPI
DS8Primary3D_AddRef(IDirectSound3DListener
*iface
)
1022 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1025 ret
= InterlockedIncrement(&This
->ds3d_ref
);
1026 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1031 static ULONG WINAPI
DS8Primary3D_Release(IDirectSound3DListener
*iface
)
1033 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1036 ret
= InterlockedDecrement(&This
->ds3d_ref
);
1037 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1043 static HRESULT WINAPI
DS8Primary3D_GetAllParameters(IDirectSound3DListener
*iface
, DS3DLISTENER
*listener
)
1045 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1047 TRACE("(%p)->(%p)\n", iface
, listener
);
1049 if(!listener
|| listener
->dwSize
< sizeof(*listener
))
1051 WARN("Invalid DS3DLISTENER %p %"LONGFMT
"u\n", listener
, listener
? listener
->dwSize
: 0);
1052 return DSERR_INVALIDPARAM
;
1055 EnterCriticalSection(This
->crst
);
1056 setALContext(This
->ctx
);
1057 IDirectSound3DListener_GetPosition(iface
, &listener
->vPosition
);
1058 IDirectSound3DListener_GetVelocity(iface
, &listener
->vVelocity
);
1059 IDirectSound3DListener_GetOrientation(iface
, &listener
->vOrientFront
, &listener
->vOrientTop
);
1060 IDirectSound3DListener_GetDistanceFactor(iface
, &listener
->flDistanceFactor
);
1061 IDirectSound3DListener_GetRolloffFactor(iface
, &listener
->flRolloffFactor
);
1062 IDirectSound3DListener_GetDopplerFactor(iface
, &listener
->flDopplerFactor
);
1064 LeaveCriticalSection(This
->crst
);
1069 static HRESULT WINAPI
DS8Primary3D_GetDistanceFactor(IDirectSound3DListener
*iface
, D3DVALUE
*distancefactor
)
1071 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1073 TRACE("(%p)->(%p)\n", iface
, distancefactor
);
1077 WARN("Invalid parameter %p\n", distancefactor
);
1078 return DSERR_INVALIDPARAM
;
1081 setALContext(This
->ctx
);
1082 *distancefactor
= 343.3f
/alGetFloat(AL_SPEED_OF_SOUND
);
1089 static HRESULT WINAPI
DS8Primary3D_GetDopplerFactor(IDirectSound3DListener
*iface
, D3DVALUE
*dopplerfactor
)
1091 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1093 TRACE("(%p)->(%p)\n", iface
, dopplerfactor
);
1097 WARN("Invalid parameter %p\n", dopplerfactor
);
1098 return DSERR_INVALIDPARAM
;
1101 setALContext(This
->ctx
);
1102 *dopplerfactor
= alGetFloat(AL_DOPPLER_FACTOR
);
1109 static HRESULT WINAPI
DS8Primary3D_GetOrientation(IDirectSound3DListener
*iface
, D3DVECTOR
*front
, D3DVECTOR
*top
)
1111 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1114 TRACE("(%p)->(%p, %p)\n", iface
, front
, top
);
1118 WARN("Invalid parameter %p %p\n", front
, top
);
1119 return DSERR_INVALIDPARAM
;
1122 setALContext(This
->ctx
);
1123 alGetListenerfv(AL_ORIENTATION
, orient
);
1127 front
->x
= orient
[0];
1128 front
->y
= orient
[1];
1129 front
->z
= -orient
[2];
1132 top
->z
= -orient
[5];
1136 static HRESULT WINAPI
DS8Primary3D_GetPosition(IDirectSound3DListener
*iface
, D3DVECTOR
*pos
)
1138 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1141 TRACE("(%p)->(%p)\n", iface
, pos
);
1145 WARN("Invalid parameter %p\n", pos
);
1146 return DSERR_INVALIDPARAM
;
1149 setALContext(This
->ctx
);
1150 alGetListenerfv(AL_POSITION
, alpos
);
1160 static HRESULT WINAPI
DS8Primary3D_GetRolloffFactor(IDirectSound3DListener
*iface
, D3DVALUE
*rollofffactor
)
1162 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1164 TRACE("(%p)->(%p)\n", iface
, rollofffactor
);
1168 WARN("Invalid parameter %p\n", rollofffactor
);
1169 return DSERR_INVALIDPARAM
;
1172 EnterCriticalSection(This
->crst
);
1173 *rollofffactor
= This
->rollofffactor
;
1174 LeaveCriticalSection(This
->crst
);
1179 static HRESULT WINAPI
DS8Primary3D_GetVelocity(IDirectSound3DListener
*iface
, D3DVECTOR
*velocity
)
1181 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1184 TRACE("(%p)->(%p)\n", iface
, velocity
);
1188 WARN("Invalid parameter %p\n", velocity
);
1189 return DSERR_INVALIDPARAM
;
1192 setALContext(This
->ctx
);
1193 alGetListenerfv(AL_VELOCITY
, vel
);
1197 velocity
->x
= vel
[0];
1198 velocity
->y
= vel
[1];
1199 velocity
->z
= -vel
[2];
1203 static HRESULT WINAPI
DS8Primary3D_SetAllParameters(IDirectSound3DListener
*iface
, const DS3DLISTENER
*listen
, DWORD apply
)
1205 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1207 TRACE("(%p)->(%p, %"LONGFMT
"u)\n", iface
, listen
, apply
);
1209 if(!listen
|| listen
->dwSize
< sizeof(*listen
))
1211 WARN("Invalid parameter %p %"LONGFMT
"u\n", listen
, listen
? listen
->dwSize
: 0);
1212 return DSERR_INVALIDPARAM
;
1215 if(listen
->flDistanceFactor
> DS3D_MAXDISTANCEFACTOR
||
1216 listen
->flDistanceFactor
< DS3D_MINDISTANCEFACTOR
)
1218 WARN("Invalid distance factor (%f)\n", listen
->flDistanceFactor
);
1219 return DSERR_INVALIDPARAM
;
1222 if(listen
->flDopplerFactor
> DS3D_MAXDOPPLERFACTOR
||
1223 listen
->flDopplerFactor
< DS3D_MINDOPPLERFACTOR
)
1225 WARN("Invalid doppler factor (%f)\n", listen
->flDopplerFactor
);
1226 return DSERR_INVALIDPARAM
;
1229 if(listen
->flRolloffFactor
< DS3D_MINROLLOFFFACTOR
||
1230 listen
->flRolloffFactor
> DS3D_MAXROLLOFFFACTOR
)
1232 WARN("Invalid rolloff factor (%f)\n", listen
->flRolloffFactor
);
1233 return DSERR_INVALIDPARAM
;
1236 EnterCriticalSection(This
->crst
);
1237 setALContext(This
->ctx
);
1238 IDirectSound3DListener_SetPosition(iface
, listen
->vPosition
.x
, listen
->vPosition
.y
, listen
->vPosition
.z
, apply
);
1239 IDirectSound3DListener_SetVelocity(iface
, listen
->vVelocity
.x
, listen
->vVelocity
.y
, listen
->vVelocity
.z
, apply
);
1240 IDirectSound3DListener_SetOrientation(iface
, listen
->vOrientFront
.x
, listen
->vOrientFront
.y
, listen
->vOrientFront
.z
,
1241 listen
->vOrientTop
.x
, listen
->vOrientTop
.y
, listen
->vOrientTop
.z
, apply
);
1242 IDirectSound3DListener_SetDistanceFactor(iface
, listen
->flDistanceFactor
, apply
);
1243 IDirectSound3DListener_SetRolloffFactor(iface
, listen
->flRolloffFactor
, apply
);
1244 IDirectSound3DListener_SetDopplerFactor(iface
, listen
->flDopplerFactor
, apply
);
1246 LeaveCriticalSection(This
->crst
);
1251 static HRESULT WINAPI
DS8Primary3D_SetDistanceFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1253 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1255 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1257 if(factor
< DS3D_MINDISTANCEFACTOR
||
1258 factor
> DS3D_MAXDISTANCEFACTOR
)
1260 WARN("Invalid parameter %f\n", factor
);
1261 return DSERR_INVALIDPARAM
;
1264 if(apply
== DS3D_DEFERRED
)
1266 EnterCriticalSection(This
->crst
);
1267 This
->listen
.flDistanceFactor
= factor
;
1268 This
->dirty
.bit
.distancefactor
= 1;
1269 LeaveCriticalSection(This
->crst
);
1273 setALContext(This
->ctx
);
1274 alSpeedOfSound(343.3f
/factor
);
1275 if(This
->SupportedExt
[EXT_EFX
])
1276 alListenerf(AL_METERS_PER_UNIT
, factor
);
1284 static HRESULT WINAPI
DS8Primary3D_SetDopplerFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1286 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1288 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1290 if(factor
< DS3D_MINDOPPLERFACTOR
||
1291 factor
> DS3D_MAXDOPPLERFACTOR
)
1293 WARN("Invalid parameter %f\n", factor
);
1294 return DSERR_INVALIDPARAM
;
1297 if(apply
== DS3D_DEFERRED
)
1299 EnterCriticalSection(This
->crst
);
1300 This
->listen
.flDopplerFactor
= factor
;
1301 This
->dirty
.bit
.dopplerfactor
= 1;
1302 LeaveCriticalSection(This
->crst
);
1306 setALContext(This
->ctx
);
1307 alDopplerFactor(factor
);
1315 static HRESULT WINAPI
DS8Primary3D_SetOrientation(IDirectSound3DListener
*iface
, D3DVALUE xFront
, D3DVALUE yFront
, D3DVALUE zFront
, D3DVALUE xTop
, D3DVALUE yTop
, D3DVALUE zTop
, DWORD apply
)
1317 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1319 TRACE("(%p)->(%f, %f, %f, %f, %f, %f, %"LONGFMT
"u)\n", iface
, xFront
, yFront
, zFront
, xTop
, yTop
, zTop
, apply
);
1321 if(apply
== DS3D_DEFERRED
)
1323 EnterCriticalSection(This
->crst
);
1324 This
->listen
.vOrientFront
.x
= xFront
;
1325 This
->listen
.vOrientFront
.y
= yFront
;
1326 This
->listen
.vOrientFront
.z
= zFront
;
1327 This
->listen
.vOrientTop
.x
= xTop
;
1328 This
->listen
.vOrientTop
.y
= yTop
;
1329 This
->listen
.vOrientTop
.z
= zTop
;
1330 This
->dirty
.bit
.orientation
= 1;
1331 LeaveCriticalSection(This
->crst
);
1335 ALfloat orient
[6] = {
1336 xFront
, yFront
, -zFront
,
1339 setALContext(This
->ctx
);
1340 alListenerfv(AL_ORIENTATION
, orient
);
1348 static HRESULT WINAPI
DS8Primary3D_SetPosition(IDirectSound3DListener
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
, DWORD apply
)
1350 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1352 TRACE("(%p)->(%f, %f, %f, %"LONGFMT
"u)\n", iface
, x
, y
, z
, apply
);
1354 if(apply
== DS3D_DEFERRED
)
1356 EnterCriticalSection(This
->crst
);
1357 This
->listen
.vPosition
.x
= x
;
1358 This
->listen
.vPosition
.y
= y
;
1359 This
->listen
.vPosition
.z
= z
;
1360 This
->dirty
.bit
.pos
= 1;
1361 LeaveCriticalSection(This
->crst
);
1365 setALContext(This
->ctx
);
1366 alListener3f(AL_POSITION
, x
, y
, -z
);
1374 static HRESULT WINAPI
DS8Primary3D_SetRolloffFactor(IDirectSound3DListener
*iface
, D3DVALUE factor
, DWORD apply
)
1376 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1378 TRACE("(%p)->(%f, %"LONGFMT
"u)\n", iface
, factor
, apply
);
1380 if(factor
< DS3D_MINROLLOFFFACTOR
||
1381 factor
> DS3D_MAXROLLOFFFACTOR
)
1383 WARN("Invalid parameter %f\n", factor
);
1384 return DSERR_INVALIDPARAM
;
1387 EnterCriticalSection(This
->crst
);
1388 if(apply
== DS3D_DEFERRED
)
1390 This
->listen
.flRolloffFactor
= factor
;
1391 This
->dirty
.bit
.rollofffactor
= 1;
1397 setALContext(This
->ctx
);
1398 for(i
= 0;i
< This
->nbuffers
;++i
)
1400 if(This
->buffers
[i
]->ds3dmode
!= DS3DMODE_DISABLE
)
1401 alSourcef(This
->buffers
[i
]->source
, AL_ROLLOFF_FACTOR
, factor
);
1406 This
->rollofffactor
= factor
;
1408 LeaveCriticalSection(This
->crst
);
1413 static HRESULT WINAPI
DS8Primary3D_SetVelocity(IDirectSound3DListener
*iface
, D3DVALUE x
, D3DVALUE y
, D3DVALUE z
, DWORD apply
)
1415 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1417 TRACE("(%p)->(%f, %f, %f, %"LONGFMT
"u)\n", iface
, x
, y
, z
, apply
);
1419 if(apply
== DS3D_DEFERRED
)
1421 EnterCriticalSection(This
->crst
);
1422 This
->listen
.vVelocity
.x
= x
;
1423 This
->listen
.vVelocity
.y
= y
;
1424 This
->listen
.vVelocity
.z
= z
;
1425 This
->dirty
.bit
.vel
= 1;
1426 LeaveCriticalSection(This
->crst
);
1430 setALContext(This
->ctx
);
1431 alListener3f(AL_VELOCITY
, x
, y
, -z
);
1439 static HRESULT WINAPI
DS8Primary3D_CommitDeferredSettings(IDirectSound3DListener
*iface
)
1441 DS8Primary
*This
= impl_from_IDirectSound3DListener(iface
);
1442 const DS3DLISTENER
*listen
= &This
->listen
;
1445 EnterCriticalSection(This
->crst
);
1446 setALContext(This
->ctx
);
1447 This
->DeferUpdates();
1449 if(This
->dirty
.bit
.pos
)
1450 alListener3f(AL_POSITION
, listen
->vPosition
.x
, listen
->vPosition
.y
, -listen
->vPosition
.z
);
1451 if(This
->dirty
.bit
.vel
)
1452 alListener3f(AL_VELOCITY
, listen
->vVelocity
.x
, listen
->vVelocity
.y
, -listen
->vVelocity
.z
);
1453 if(This
->dirty
.bit
.orientation
)
1455 ALfloat orient
[6] = {
1456 listen
->vOrientFront
.x
, listen
->vOrientFront
.y
, -listen
->vOrientFront
.z
,
1457 listen
->vOrientTop
.x
, listen
->vOrientTop
.y
, -listen
->vOrientTop
.z
1459 alListenerfv(AL_ORIENTATION
, orient
);
1462 if(This
->dirty
.bit
.distancefactor
)
1464 alSpeedOfSound(343.3f
/listen
->flDistanceFactor
);
1465 if(This
->SupportedExt
[EXT_EFX
])
1466 alListenerf(AL_METERS_PER_UNIT
, listen
->flDistanceFactor
);
1469 if(This
->dirty
.bit
.rollofffactor
)
1471 ALfloat rolloff
= listen
->flRolloffFactor
;
1472 for(i
= 0;i
< This
->nbuffers
;++i
)
1474 DS8Buffer
*buf
= This
->buffers
[i
];
1475 if(buf
->ds3dmode
!= DS3DMODE_DISABLE
)
1476 alSourcef(buf
->source
, AL_ROLLOFF_FACTOR
, rolloff
);
1478 This
->rollofffactor
= rolloff
;
1481 if(This
->dirty
.bit
.dopplerfactor
)
1482 alDopplerFactor(listen
->flDopplerFactor
);
1484 if(This
->dirty
.bit
.effect
)
1485 This
->ExtAL
->AuxiliaryEffectSloti(This
->auxslot
, AL_EFFECTSLOT_EFFECT
, This
->effect
);
1487 /* checkALError is here for debugging */
1490 TRACE("Dirty flags was: 0x%02x\n", This
->dirty
.flags
);
1491 This
->dirty
.flags
= 0;
1493 for(i
= 0;i
< This
->nbuffers
;++i
)
1495 DS8Buffer
*buf
= This
->buffers
[i
];
1498 if((flags
=InterlockedExchange(&buf
->dirty
.flags
, 0)) == 0)
1501 DS8Buffer_SetParams(buf
, &buf
->ds3dbuffer
, flags
);
1505 This
->ProcessUpdates();
1507 LeaveCriticalSection(This
->crst
);
1512 static const IDirectSound3DListenerVtbl DS8Primary3D_Vtbl
=
1514 DS8Primary3D_QueryInterface
,
1515 DS8Primary3D_AddRef
,
1516 DS8Primary3D_Release
,
1517 DS8Primary3D_GetAllParameters
,
1518 DS8Primary3D_GetDistanceFactor
,
1519 DS8Primary3D_GetDopplerFactor
,
1520 DS8Primary3D_GetOrientation
,
1521 DS8Primary3D_GetPosition
,
1522 DS8Primary3D_GetRolloffFactor
,
1523 DS8Primary3D_GetVelocity
,
1524 DS8Primary3D_SetAllParameters
,
1525 DS8Primary3D_SetDistanceFactor
,
1526 DS8Primary3D_SetDopplerFactor
,
1527 DS8Primary3D_SetOrientation
,
1528 DS8Primary3D_SetPosition
,
1529 DS8Primary3D_SetRolloffFactor
,
1530 DS8Primary3D_SetVelocity
,
1531 DS8Primary3D_CommitDeferredSettings
1534 /* NOTE: Although the app handles listener properties through secondary buffers,
1535 * we pass the requests to the primary buffer though a propertyset interface.
1536 * These methods are not exposed to the app. */
1537 static HRESULT WINAPI
DS8PrimaryProp_QueryInterface(IKsPropertySet
*iface
, REFIID riid
, void **ppv
)
1539 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1540 return DS8Primary_QueryInterface(&This
->IDirectSoundBuffer_iface
, riid
, ppv
);
1543 static ULONG WINAPI
DS8PrimaryProp_AddRef(IKsPropertySet
*iface
)
1545 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1548 ret
= InterlockedIncrement(&This
->prop_ref
);
1549 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1554 static ULONG WINAPI
DS8PrimaryProp_Release(IKsPropertySet
*iface
)
1556 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1559 ret
= InterlockedDecrement(&This
->prop_ref
);
1560 TRACE("new refcount %"LONGFMT
"d\n", ret
);
1565 static HRESULT WINAPI
DS8PrimaryProp_Get(IKsPropertySet
*iface
,
1566 REFGUID guidPropSet
, ULONG dwPropID
,
1567 LPVOID pInstanceData
, ULONG cbInstanceData
,
1568 LPVOID pPropData
, ULONG cbPropData
,
1571 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1572 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
1573 (void)pInstanceData
;
1574 (void)cbInstanceData
;
1576 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
1578 EnterCriticalSection(This
->crst
);
1580 if(This
->effect
== 0)
1581 res
= E_PROP_ID_UNSUPPORTED
;
1582 else switch(dwPropID
)
1584 case DSPROPERTY_EAXLISTENER_ALLPARAMETERS
:
1585 res
= DSERR_INVALIDPARAM
;
1586 if(cbPropData
>= sizeof(EAXLISTENERPROPERTIES
))
1590 EAXLISTENERPROPERTIES
*props
;
1591 } data
= { pPropData
};
1593 *data
.props
= This
->eax_prop
;
1594 *pcbReturned
= sizeof(EAXLISTENERPROPERTIES
);
1599 case DSPROPERTY_EAXLISTENER_ROOM
:
1600 res
= DSERR_INVALIDPARAM
;
1601 if(cbPropData
>= sizeof(LONG
))
1606 } data
= { pPropData
};
1608 *data
.l
= This
->eax_prop
.lRoom
;
1609 *pcbReturned
= sizeof(LONG
);
1613 case DSPROPERTY_EAXLISTENER_ROOMHF
:
1614 res
= DSERR_INVALIDPARAM
;
1615 if(cbPropData
>= sizeof(LONG
))
1620 } data
= { pPropData
};
1622 *data
.l
= This
->eax_prop
.lRoomHF
;
1623 *pcbReturned
= sizeof(LONG
);
1628 case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
:
1629 res
= DSERR_INVALIDPARAM
;
1630 if(cbPropData
>= sizeof(FLOAT
))
1635 } data
= { pPropData
};
1637 *data
.fl
= This
->eax_prop
.flRoomRolloffFactor
;
1638 *pcbReturned
= sizeof(FLOAT
);
1643 case DSPROPERTY_EAXLISTENER_ENVIRONMENT
:
1644 res
= DSERR_INVALIDPARAM
;
1645 if(cbPropData
>= sizeof(DWORD
))
1650 } data
= { pPropData
};
1652 *data
.dw
= This
->eax_prop
.dwEnvironment
;
1653 *pcbReturned
= sizeof(DWORD
);
1658 case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
:
1659 res
= DSERR_INVALIDPARAM
;
1660 if(cbPropData
>= sizeof(FLOAT
))
1665 } data
= { pPropData
};
1667 *data
.fl
= This
->eax_prop
.flEnvironmentSize
;
1668 *pcbReturned
= sizeof(FLOAT
);
1672 case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
:
1673 res
= DSERR_INVALIDPARAM
;
1674 if(cbPropData
>= sizeof(FLOAT
))
1679 } data
= { pPropData
};
1681 *data
.fl
= This
->eax_prop
.flEnvironmentDiffusion
;
1682 *pcbReturned
= sizeof(FLOAT
);
1687 case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
:
1688 res
= DSERR_INVALIDPARAM
;
1689 if(cbPropData
>= sizeof(FLOAT
))
1694 } data
= { pPropData
};
1696 *data
.fl
= This
->eax_prop
.flAirAbsorptionHF
;
1697 *pcbReturned
= sizeof(FLOAT
);
1702 case DSPROPERTY_EAXLISTENER_FLAGS
:
1703 res
= DSERR_INVALIDPARAM
;
1704 if(cbPropData
>= sizeof(DWORD
))
1709 } data
= { pPropData
};
1711 *data
.dw
= This
->eax_prop
.dwFlags
;
1712 *pcbReturned
= sizeof(DWORD
);
1718 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", dwPropID
);
1722 LeaveCriticalSection(This
->crst
);
1725 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
1730 static HRESULT WINAPI
DS8PrimaryProp_Set(IKsPropertySet
*iface
,
1731 REFGUID guidPropSet
, ULONG dwPropID
,
1732 LPVOID pInstanceData
, ULONG cbInstanceData
,
1733 LPVOID pPropData
, ULONG cbPropData
)
1735 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
1736 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
1737 (void)pInstanceData
;
1738 (void)cbInstanceData
;
1740 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
1742 DWORD propid
= dwPropID
& ~DSPROPERTY_EAXLISTENER_DEFERRED
;
1743 BOOL immediate
= !(dwPropID
&DSPROPERTY_EAXLISTENER_DEFERRED
);
1745 EnterCriticalSection(This
->crst
);
1746 setALContext(This
->ctx
);
1748 if(This
->effect
== 0)
1749 res
= E_PROP_ID_UNSUPPORTED
;
1752 case 0: /* 0 = not setting any property, just apply */
1756 case DSPROPERTY_EAXLISTENER_ALLPARAMETERS
:
1758 res
= DSERR_INVALIDPARAM
;
1759 if(cbPropData
>= sizeof(EAXLISTENERPROPERTIES
))
1763 const EAXLISTENERPROPERTIES
*props
;
1764 } data
= { pPropData
};
1766 /* FIXME: Need to validate property values... Ignore? Clamp? Error? */
1767 This
->eax_prop
= *data
.props
;
1768 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DENSITY
,
1769 (data
.props
->flEnvironmentSize
< 2.0f
) ?
1770 (data
.props
->flEnvironmentSize
- 1.0f
) : 1.0f
);
1771 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DIFFUSION
,
1772 data
.props
->flEnvironmentDiffusion
);
1774 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAIN
,
1775 mB_to_gain(data
.props
->lRoom
));
1776 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAINHF
,
1777 mB_to_gain(data
.props
->lRoomHF
));
1779 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_ROOM_ROLLOFF_FACTOR
,
1780 data
.props
->flRoomRolloffFactor
);
1782 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DECAY_TIME
,
1783 data
.props
->flDecayTime
);
1784 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DECAY_HFRATIO
,
1785 data
.props
->flDecayHFRatio
);
1787 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_REFLECTIONS_GAIN
,
1788 mB_to_gain(data
.props
->lReflections
));
1789 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_REFLECTIONS_DELAY
,
1790 data
.props
->flReflectionsDelay
);
1792 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_LATE_REVERB_GAIN
,
1793 mB_to_gain(data
.props
->lReverb
));
1794 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_LATE_REVERB_DELAY
,
1795 data
.props
->flReverbDelay
);
1797 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_AIR_ABSORPTION_GAINHF
,
1798 mB_to_gain(data
.props
->flAirAbsorptionHF
));
1800 This
->ExtAL
->Effecti(This
->effect
, AL_REVERB_DECAY_HFLIMIT
,
1801 (data
.props
->dwFlags
&EAXLISTENERFLAGS_DECAYHFLIMIT
) ?
1802 AL_TRUE
: AL_FALSE
);
1806 This
->dirty
.bit
.effect
= 1;
1811 case DSPROPERTY_EAXLISTENER_ROOM
:
1812 res
= DSERR_INVALIDPARAM
;
1813 if(cbPropData
>= sizeof(LONG
))
1818 } data
= { pPropData
};
1820 This
->eax_prop
.lRoom
= *data
.l
;
1821 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAIN
,
1822 mB_to_gain(This
->eax_prop
.lRoom
));
1825 This
->dirty
.bit
.effect
= 1;
1829 case DSPROPERTY_EAXLISTENER_ROOMHF
:
1830 res
= DSERR_INVALIDPARAM
;
1831 if(cbPropData
>= sizeof(LONG
))
1836 } data
= { pPropData
};
1838 This
->eax_prop
.lRoomHF
= *data
.l
;
1839 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_GAINHF
,
1840 mB_to_gain(This
->eax_prop
.lRoomHF
));
1843 This
->dirty
.bit
.effect
= 1;
1848 case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
:
1849 res
= DSERR_INVALIDPARAM
;
1850 if(cbPropData
>= sizeof(FLOAT
))
1855 } data
= { pPropData
};
1857 This
->eax_prop
.flRoomRolloffFactor
= *data
.fl
;
1858 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_ROOM_ROLLOFF_FACTOR
,
1859 This
->eax_prop
.flRoomRolloffFactor
);
1862 This
->dirty
.bit
.effect
= 1;
1867 case DSPROPERTY_EAXLISTENER_ENVIRONMENT
:
1868 res
= DSERR_INVALIDPARAM
;
1869 if(cbPropData
>= sizeof(DWORD
))
1874 } data
= { pPropData
};
1876 if(*data
.dw
< EAX_ENVIRONMENT_COUNT
)
1878 /* Get the environment index's default and pass it down to
1880 propid
= DSPROPERTY_EAXLISTENER_ALLPARAMETERS
;
1881 pPropData
= (void*)&EnvironmentDefaults
[*data
.dw
];
1882 cbPropData
= sizeof(EnvironmentDefaults
[*data
.dw
]);
1888 case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
:
1889 res
= DSERR_INVALIDPARAM
;
1890 if(cbPropData
>= sizeof(FLOAT
))
1895 } data
= { pPropData
};
1897 if(*data
.fl
>= 1.0f
&& *data
.fl
<= 100.0f
)
1899 double scale
= (*data
.fl
)/This
->eax_prop
.flEnvironmentSize
;
1901 This
->eax_prop
.flEnvironmentSize
= *data
.fl
;
1903 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_DECAYTIMESCALE
))
1905 This
->eax_prop
.flDecayTime
*= scale
;
1906 This
->eax_prop
.flDecayTime
= clampF(This
->eax_prop
.flDecayTime
, 0.1f
, 20.0f
);
1908 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REFLECTIONSSCALE
))
1910 This
->eax_prop
.lReflections
+= gain_to_mB(1.0/scale
);
1911 This
->eax_prop
.lReflections
= clampI(This
->eax_prop
.lReflections
, -10000, 1000);
1913 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE
))
1915 This
->eax_prop
.flReflectionsDelay
*= scale
;
1916 This
->eax_prop
.flReflectionsDelay
= clampF(This
->eax_prop
.flReflectionsDelay
, 0.0f
, 0.3f
);
1918 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REVERBSCALE
))
1920 This
->eax_prop
.lReverb
+= gain_to_mB(1.0/scale
);
1921 This
->eax_prop
.lReverb
= clampI(This
->eax_prop
.lReverb
, -10000, 2000);
1923 if((This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_REVERBDELAYSCALE
))
1925 This
->eax_prop
.flReverbDelay
*= scale
;
1926 This
->eax_prop
.flReverbDelay
= clampF(This
->eax_prop
.flReverbDelay
, 0.0f
, 0.1f
);
1929 /* Pass the updated environment properties down to ALLPARAMETERS */
1930 propid
= DSPROPERTY_EAXLISTENER_ALLPARAMETERS
;
1931 pPropData
= (void*)&This
->eax_prop
;
1932 cbPropData
= sizeof(This
->eax_prop
);
1937 case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
:
1938 res
= DSERR_INVALIDPARAM
;
1939 if(cbPropData
>= sizeof(FLOAT
))
1944 } data
= { pPropData
};
1946 This
->eax_prop
.flEnvironmentDiffusion
= *data
.fl
;
1947 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_DIFFUSION
,
1948 This
->eax_prop
.flEnvironmentDiffusion
);
1951 This
->dirty
.bit
.effect
= 1;
1956 case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
:
1957 res
= DSERR_INVALIDPARAM
;
1958 if(cbPropData
>= sizeof(FLOAT
))
1963 } data
= { pPropData
};
1965 This
->eax_prop
.flAirAbsorptionHF
= *data
.fl
;
1966 This
->ExtAL
->Effectf(This
->effect
, AL_REVERB_AIR_ABSORPTION_GAINHF
,
1967 mB_to_gain(This
->eax_prop
.flAirAbsorptionHF
));
1970 This
->dirty
.bit
.effect
= 1;
1975 case DSPROPERTY_EAXLISTENER_FLAGS
:
1976 res
= DSERR_INVALIDPARAM
;
1977 if(cbPropData
>= sizeof(DWORD
))
1982 } data
= { pPropData
};
1984 This
->eax_prop
.dwFlags
= *data
.dw
;
1985 This
->ExtAL
->Effecti(This
->effect
, AL_REVERB_DECAY_HFLIMIT
,
1986 (This
->eax_prop
.dwFlags
&EAXLISTENERFLAGS_DECAYHFLIMIT
) ?
1987 AL_TRUE
: AL_FALSE
);
1990 This
->dirty
.bit
.effect
= 1;
1996 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", propid
);
2000 if(res
== DS_OK
&& immediate
)
2001 IDirectSound3DListener_CommitDeferredSettings(&This
->IDirectSound3DListener_iface
);
2004 LeaveCriticalSection(This
->crst
);
2007 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
2012 static HRESULT WINAPI
DS8PrimaryProp_QuerySupport(IKsPropertySet
*iface
,
2013 REFGUID guidPropSet
, ULONG dwPropID
,
2014 PULONG pTypeSupport
)
2016 DS8Primary
*This
= impl_from_IKsPropertySet(iface
);
2017 HRESULT res
= E_PROP_ID_UNSUPPORTED
;
2019 if(IsEqualIID(guidPropSet
, &DSPROPSETID_EAX20_ListenerProperties
))
2021 EnterCriticalSection(This
->crst
);
2023 if(This
->effect
== 0)
2024 res
= E_PROP_ID_UNSUPPORTED
;
2025 else if(dwPropID
== DSPROPERTY_EAXLISTENER_ALLPARAMETERS
||
2026 dwPropID
== DSPROPERTY_EAXLISTENER_ROOM
||
2027 dwPropID
== DSPROPERTY_EAXLISTENER_ROOMHF
||
2028 dwPropID
== DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR
||
2029 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENT
||
2030 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE
||
2031 dwPropID
== DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION
||
2032 dwPropID
== DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
||
2033 dwPropID
== DSPROPERTY_EAXLISTENER_FLAGS
)
2035 *pTypeSupport
= KSPROPERTY_SUPPORT_GET
|KSPROPERTY_SUPPORT_SET
;
2039 FIXME("Unhandled propid: 0x%08"LONGFMT
"x\n", dwPropID
);
2041 LeaveCriticalSection(This
->crst
);
2044 FIXME("Unhandled propset: %s\n", debugstr_guid(guidPropSet
));
2049 static const IKsPropertySetVtbl DS8PrimaryProp_Vtbl
=
2051 DS8PrimaryProp_QueryInterface
,
2052 DS8PrimaryProp_AddRef
,
2053 DS8PrimaryProp_Release
,
2056 DS8PrimaryProp_QuerySupport