ReactOS 0.4.16-dev-340-g0540c21
sound3d.c
Go to the documentation of this file.
1/* DirectSound
2 *
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2001 TransGaming Technologies, Inc.
6 * Copyright 2002-2003 Rok Mandeljc <rok.mandeljc@gimb.org>
7 *
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.
12 *
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.
17 *
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
21 */
22/*
23 * Most thread locking is complete. There may be a few race
24 * conditions still lurking.
25 *
26 * Tested with a Soundblaster clone, a Gravis UltraSound Classic,
27 * and a Turtle Beach Tropez+.
28 *
29 * TODO:
30 * Implement SetCooperativeLevel properly (need to address focus issues)
31 * Implement DirectSound3DBuffers (stubs in place)
32 * Use hardware 3D support if available
33 * Add critical section locking inside Release and AddRef methods
34 * Handle static buffers - put those in hardware, non-static not in hardware
35 * Hardware DuplicateSoundBuffer
36 * Proper volume calculation, and setting volume in HEL primary buffer
37 * Optimize WINMM and negotiate fragment size, decrease DS_HEL_MARGIN
38 */
39
40#include "dsound_private.h"
41
42/* default velocity of sound in the air */
43#define DEFAULT_VELOCITY 340
44
45/*******************************************************************************
46 * Auxiliary functions
47 */
48
49/* scalar product (I believe it's called dot product in English) */
50static inline D3DVALUE ScalarProduct (const D3DVECTOR *a, const D3DVECTOR *b)
51{
52 D3DVALUE c;
53 c = (a->x*b->x) + (a->y*b->y) + (a->z*b->z);
54 TRACE("(%f,%f,%f) * (%f,%f,%f) = %f)\n", a->x, a->y, a->z, b->x, b->y,
55 b->z, c);
56 return c;
57}
58
59/* vector product (I believe it's called cross product in English */
60static inline D3DVECTOR VectorProduct (const D3DVECTOR *a, const D3DVECTOR *b)
61{
63 c.x = (a->y*b->z) - (a->z*b->y);
64 c.y = (a->z*b->x) - (a->x*b->z);
65 c.z = (a->x*b->y) - (a->y*b->x);
66 TRACE("(%f,%f,%f) x (%f,%f,%f) = (%f,%f,%f)\n", a->x, a->y, a->z, b->x, b->y,
67 b->z, c.x, c.y, c.z);
68 return c;
69}
70
71/* magnitude (length) of vector */
72static inline D3DVALUE VectorMagnitude (const D3DVECTOR *a)
73{
74 D3DVALUE l;
75 l = sqrt (ScalarProduct (a, a));
76 TRACE("|(%f,%f,%f)| = %f\n", a->x, a->y, a->z, l);
77 return l;
78}
79
80/* conversion between radians and degrees */
82{
83 D3DVALUE newangle;
84 newangle = angle * (360/(2*M_PI));
85 TRACE("%f rad = %f deg\n", angle, newangle);
86 return newangle;
87}
88
89/* angle between vectors - rad version */
90static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECTOR *b)
91{
92 D3DVALUE la, lb, product, angle, cos;
93 /* definition of scalar product: a*b = |a|*|b|*cos... therefore: */
94 product = ScalarProduct (a,b);
95 la = VectorMagnitude (a);
96 lb = VectorMagnitude (b);
97 if (!la || !lb)
98 return 0;
99
100 cos = product/(la*lb);
101 angle = acos(cos);
102 TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n", a->x, a->y, a->z, b->x,
103 b->y, b->z, angle, RadToDeg(angle));
104 return angle;
105}
106
107static inline D3DVALUE AngleBetweenVectorsDeg (const D3DVECTOR *a, const D3DVECTOR *b)
108{
110}
111
112/* calculates vector between two points */
114{
115 D3DVECTOR c;
116 c.x = b->x - a->x;
117 c.y = b->y - a->y;
118 c.z = b->z - a->z;
119 TRACE("A (%f,%f,%f), B (%f,%f,%f), AB = (%f,%f,%f)\n", a->x, a->y, a->z, b->x, b->y,
120 b->z, c.x, c.y, c.z);
121 return c;
122}
123
124#ifndef __REACTOS__
125/* calculates the length of vector's projection on another vector */
126static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
127{
128 D3DVALUE prod, result;
129 prod = ScalarProduct(a, p);
130 result = prod/VectorMagnitude(p);
131 TRACE("length projection of (%f,%f,%f) on (%f,%f,%f) = %f\n", a->x, a->y, a->z, p->x,
132 p->y, p->z, result);
133 return result;
134}
135#endif
136
137/*******************************************************************************
138 * 3D Buffer and Listener mixing
139 */
140
142{
143 /* volume, at which the sound will be played after all calcs. */
144 D3DVALUE lVolume = 0;
145 /* stuff for distance related stuff calc. */
146 D3DVECTOR vDistance;
147 D3DVALUE flDistance = 0;
148 /* panning related stuff */
149 D3DVALUE flAngle;
150 D3DVECTOR vLeft;
151 /* doppler shift related stuff */
152#if 0
153 D3DVALUE flFreq, flBufferVel, flListenerVel;
154#endif
155
156 TRACE("(%p)\n",dsb);
157
158 /* initial buffer volume */
159 lVolume = dsb->ds3db_lVolume;
160
161 switch (dsb->ds3db_ds3db.dwMode)
162 {
163 case DS3DMODE_DISABLE:
164 TRACE("3D processing disabled\n");
165 /* this one is here only to eliminate annoying warning message */
167 break;
168 case DS3DMODE_NORMAL:
169 TRACE("Normal 3D processing mode\n");
170 /* we need to calculate distance between buffer and listener*/
172 flDistance = VectorMagnitude (&vDistance);
173 break;
175 TRACE("Head-relative 3D processing mode\n");
176 /* distance between buffer and listener is same as buffer's position */
177 flDistance = VectorMagnitude (&dsb->ds3db_ds3db.vPosition);
178 break;
179 }
180
181 if (flDistance > dsb->ds3db_ds3db.flMaxDistance)
182 {
183 /* some apps don't want you to hear too distant sounds... */
185 {
188 /* i guess mixing here would be a waste of power */
189 return;
190 }
191 else
192 flDistance = dsb->ds3db_ds3db.flMaxDistance;
193 }
194
195 if (flDistance < dsb->ds3db_ds3db.flMinDistance)
196 flDistance = dsb->ds3db_ds3db.flMinDistance;
197
198 /* attenuation proportional to the distance squared, converted to millibels as in lVolume*/
199 lVolume -= log10(flDistance/dsb->ds3db_ds3db.flMinDistance * flDistance/dsb->ds3db_ds3db.flMinDistance)*1000;
200 TRACE("dist. att: Distance = %f, MinDistance = %f => adjusting volume %d to %f\n", flDistance, dsb->ds3db_ds3db.flMinDistance, dsb->ds3db_lVolume, lVolume);
201
202 /* conning */
203 /* sometimes it happens that vConeOrientation vector = (0,0,0); in this case angle is "nan" and it's useless*/
205 {
206 TRACE("conning: cones not set\n");
207 }
208 else
209 {
210 /* calculate angle */
211 flAngle = AngleBetweenVectorsDeg(&dsb->ds3db_ds3db.vConeOrientation, &vDistance);
212 /* if by any chance it happens that OutsideConeAngle = InsideConeAngle (that means that conning has no effect) */
214 {
215 /* my test show that for my way of calc., we need only half of angles */
216 DWORD dwInsideConeAngle = dsb->ds3db_ds3db.dwInsideConeAngle/2;
217 DWORD dwOutsideConeAngle = dsb->ds3db_ds3db.dwOutsideConeAngle/2;
218 if (dwOutsideConeAngle == dwInsideConeAngle)
219 ++dwOutsideConeAngle;
220
221 /* full volume */
222 if (flAngle < dwInsideConeAngle)
223 flAngle = dwInsideConeAngle;
224 /* min (app defined) volume */
225 if (flAngle > dwOutsideConeAngle)
226 flAngle = dwOutsideConeAngle;
227 /* this probably isn't the right thing, but it's ok for the time being */
228 lVolume += ((dsb->ds3db_ds3db.lConeOutsideVolume)/((dwOutsideConeAngle) - (dwInsideConeAngle))) * flAngle;
229 }
230 TRACE("conning: Angle = %f deg; InsideConeAngle(/2) = %d deg; OutsideConeAngle(/2) = %d deg; ConeOutsideVolume = %d => adjusting volume to %f\n",
232 }
233 dsb->volpan.lVolume = lVolume;
234
235 /* panning */
236 if (dsb->device->ds3dl.vPosition.x == dsb->ds3db_ds3db.vPosition.x &&
237 dsb->device->ds3dl.vPosition.y == dsb->ds3db_ds3db.vPosition.y &&
238 dsb->device->ds3dl.vPosition.z == dsb->ds3db_ds3db.vPosition.z) {
239 dsb->volpan.lPan = 0;
240 flAngle = 0.0;
241 }
242 else
243 {
246 flAngle = AngleBetweenVectorsRad(&vLeft, &vDistance);
247 /* for now, we'll use "linear formula" (which is probably incorrect); if someone has it in book, correct it */
248 dsb->volpan.lPan = 10000*2*flAngle/M_PI - 10000;
249 }
250 TRACE("panning: Angle = %f rad, lPan = %d\n", flAngle, dsb->volpan.lPan);
251
252 /* FIXME: Doppler Effect disabled since i have no idea which frequency to change and how to do it */
253#if 0
254 /* doppler shift*/
255 if ((VectorMagnitude(&ds3db_ds3db.vVelocity) == 0) && (VectorMagnitude(&dsb->device->ds3dl.vVelocity) == 0))
256 {
257 TRACE("doppler: Buffer and Listener don't have velocities\n");
258 }
259 else if (ds3db_ds3db.vVelocity != dsb->device->ds3dl.vVelocity)
260 {
261 /* calculate length of ds3db_ds3db.vVelocity component which causes Doppler Effect
262 NOTE: if buffer moves TOWARDS the listener, it's velocity component is NEGATIVE
263 if buffer moves AWAY from listener, it's velocity component is POSITIVE */
264 flBufferVel = ProjectVector(&dsb->ds3db_ds3db.vVelocity, &vDistance);
265 /* calculate length of ds3dl.vVelocity component which causes Doppler Effect
266 NOTE: if listener moves TOWARDS the buffer, it's velocity component is POSITIVE
267 if listener moves AWAY from buffer, it's velocity component is NEGATIVE */
268 flListenerVel = ProjectVector(&dsb->device->ds3dl.vVelocity, &vDistance);
269 /* formula taken from Gianicoli D.: Physics, 4th edition: */
270 /* FIXME: replace dsb->freq with appropriate frequency ! */
271 flFreq = dsb->freq * ((DEFAULT_VELOCITY + flListenerVel)/(DEFAULT_VELOCITY + flBufferVel));
272 TRACE("doppler: Buffer velocity (component) = %lf, Listener velocity (component) = %lf => Doppler shift: %ld Hz -> %lf Hz\n", flBufferVel, flListenerVel,
273 dsb->freq, flFreq);
274 /* FIXME: replace following line with correct frequency setting ! */
275 dsb->freq = flFreq;
277 DSOUND_MixToTemporary(dsb, 0, dsb->buflen);
278 }
279#endif
280
281 /* time for remix */
283}
284
286{
287 TRACE("(%p)\n",dsb);
288
290}
291
293{
294 int i;
295 TRACE("(%p)\n",ds3dl);
296 for (i = 0; i < ds3dl->device->nrofbuffers; i++)
297 {
298 /* check if this buffer is waiting for recalculation */
299 if (ds3dl->device->buffers[i]->ds3db_need_recalc)
300 {
302 }
303 }
304}
305
306/*******************************************************************************
307 * IDirectSound3DBuffer
308 */
309
310/* IUnknown methods */
313{
315
316 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
318}
319
321{
324
325 TRACE("(%p) ref was %d\n", This, ref - 1);
326
327 if(ref == 1)
328 InterlockedIncrement(&This->dsb->numIfaces);
329
330 return ref;
331}
332
334{
337 TRACE("(%p) ref was %d\n", This, ref + 1);
338
339 if (!ref) {
340 This->dsb->ds3db = NULL;
341 if (!InterlockedDecrement(&This->dsb->numIfaces))
344 TRACE("(%p) released\n", This);
345 }
346 return ref;
347}
348
349/* IDirectSound3DBuffer methods */
352 LPDS3DBUFFER lpDs3dBuffer)
353{
355 TRACE("(%p,%p)\n",This,lpDs3dBuffer);
356
357 if (lpDs3dBuffer == NULL) {
358 WARN("invalid parameter: lpDs3dBuffer == NULL\n");
359 return DSERR_INVALIDPARAM;
360 }
361
362 if (lpDs3dBuffer->dwSize < sizeof(*lpDs3dBuffer)) {
363 WARN("invalid parameter: lpDs3dBuffer->dwSize = %d\n",lpDs3dBuffer->dwSize);
364 return DSERR_INVALIDPARAM;
365 }
366
367 TRACE("returning: all parameters\n");
368 *lpDs3dBuffer = This->dsb->ds3db_ds3db;
369 return DS_OK;
370}
371
374 LPDWORD lpdwInsideConeAngle,
375 LPDWORD lpdwOutsideConeAngle)
376{
378 TRACE("returning: Inside Cone Angle = %d degrees; Outside Cone Angle = %d degrees\n",
379 This->dsb->ds3db_ds3db.dwInsideConeAngle, This->dsb->ds3db_ds3db.dwOutsideConeAngle);
380 *lpdwInsideConeAngle = This->dsb->ds3db_ds3db.dwInsideConeAngle;
381 *lpdwOutsideConeAngle = This->dsb->ds3db_ds3db.dwOutsideConeAngle;
382 return DS_OK;
383}
384
387 LPD3DVECTOR lpvConeOrientation)
388{
390 TRACE("returning: Cone Orientation vector = (%f,%f,%f)\n",
391 This->dsb->ds3db_ds3db.vConeOrientation.x,
392 This->dsb->ds3db_ds3db.vConeOrientation.y,
393 This->dsb->ds3db_ds3db.vConeOrientation.z);
394 *lpvConeOrientation = This->dsb->ds3db_ds3db.vConeOrientation;
395 return DS_OK;
396}
397
400 LPLONG lplConeOutsideVolume)
401{
403 TRACE("returning: Cone Outside Volume = %d\n", This->dsb->ds3db_ds3db.lConeOutsideVolume);
404 *lplConeOutsideVolume = This->dsb->ds3db_ds3db.lConeOutsideVolume;
405 return DS_OK;
406}
407
410 LPD3DVALUE lpfMaxDistance)
411{
413 TRACE("returning: Max Distance = %f\n", This->dsb->ds3db_ds3db.flMaxDistance);
414 *lpfMaxDistance = This->dsb->ds3db_ds3db.flMaxDistance;
415 return DS_OK;
416}
417
420 LPD3DVALUE lpfMinDistance)
421{
423 TRACE("returning: Min Distance = %f\n", This->dsb->ds3db_ds3db.flMinDistance);
424 *lpfMinDistance = This->dsb->ds3db_ds3db.flMinDistance;
425 return DS_OK;
426}
427
430 LPDWORD lpdwMode)
431{
433 TRACE("returning: Mode = %d\n", This->dsb->ds3db_ds3db.dwMode);
434 *lpdwMode = This->dsb->ds3db_ds3db.dwMode;
435 return DS_OK;
436}
437
440 LPD3DVECTOR lpvPosition)
441{
443 TRACE("returning: Position vector = (%f,%f,%f)\n",
444 This->dsb->ds3db_ds3db.vPosition.x,
445 This->dsb->ds3db_ds3db.vPosition.y,
446 This->dsb->ds3db_ds3db.vPosition.z);
447 *lpvPosition = This->dsb->ds3db_ds3db.vPosition;
448 return DS_OK;
449}
450
453 LPD3DVECTOR lpvVelocity)
454{
456 TRACE("returning: Velocity vector = (%f,%f,%f)\n",
457 This->dsb->ds3db_ds3db.vVelocity.x,
458 This->dsb->ds3db_ds3db.vVelocity.y,
459 This->dsb->ds3db_ds3db.vVelocity.z);
460 *lpvVelocity = This->dsb->ds3db_ds3db.vVelocity;
461 return DS_OK;
462}
463
466 LPCDS3DBUFFER lpcDs3dBuffer,
467 DWORD dwApply)
468{
471 TRACE("(%p,%p,%x)\n",iface,lpcDs3dBuffer,dwApply);
472
473 if (lpcDs3dBuffer == NULL) {
474 WARN("invalid parameter: lpcDs3dBuffer == NULL\n");
475 return status;
476 }
477
478 if (lpcDs3dBuffer->dwSize != sizeof(DS3DBUFFER)) {
479 WARN("invalid parameter: lpcDs3dBuffer->dwSize = %d\n", lpcDs3dBuffer->dwSize);
480 return status;
481 }
482
483 TRACE("setting: all parameters; dwApply = %d\n", dwApply);
484 This->dsb->ds3db_ds3db = *lpcDs3dBuffer;
485
486 if (dwApply == DS3D_IMMEDIATE)
487 {
489 }
490 This->dsb->ds3db_need_recalc = TRUE;
491 status = DS_OK;
492
493 return status;
494}
495
498 DWORD dwInsideConeAngle,
499 DWORD dwOutsideConeAngle,
500 DWORD dwApply)
501{
503 TRACE("setting: Inside Cone Angle = %d; Outside Cone Angle = %d; dwApply = %d\n",
504 dwInsideConeAngle, dwOutsideConeAngle, dwApply);
505 This->dsb->ds3db_ds3db.dwInsideConeAngle = dwInsideConeAngle;
506 This->dsb->ds3db_ds3db.dwOutsideConeAngle = dwOutsideConeAngle;
507 if (dwApply == DS3D_IMMEDIATE)
508 {
510 }
511 This->dsb->ds3db_need_recalc = TRUE;
512 return DS_OK;
513}
514
518 DWORD dwApply)
519{
521 TRACE("setting: Cone Orientation vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
522 This->dsb->ds3db_ds3db.vConeOrientation.x = x;
523 This->dsb->ds3db_ds3db.vConeOrientation.y = y;
524 This->dsb->ds3db_ds3db.vConeOrientation.z = z;
525 if (dwApply == DS3D_IMMEDIATE)
526 {
527 This->dsb->ds3db_need_recalc = FALSE;
529 }
530 This->dsb->ds3db_need_recalc = TRUE;
531 return DS_OK;
532}
533
536 LONG lConeOutsideVolume,
537 DWORD dwApply)
538{
540 TRACE("setting: ConeOutsideVolume = %d; dwApply = %d\n", lConeOutsideVolume, dwApply);
541 This->dsb->ds3db_ds3db.lConeOutsideVolume = lConeOutsideVolume;
542 if (dwApply == DS3D_IMMEDIATE)
543 {
544 This->dsb->ds3db_need_recalc = FALSE;
546 }
547 This->dsb->ds3db_need_recalc = TRUE;
548 return DS_OK;
549}
550
553 D3DVALUE fMaxDistance,
554 DWORD dwApply)
555{
557 TRACE("setting: MaxDistance = %f; dwApply = %d\n", fMaxDistance, dwApply);
558 This->dsb->ds3db_ds3db.flMaxDistance = fMaxDistance;
559 if (dwApply == DS3D_IMMEDIATE)
560 {
561 This->dsb->ds3db_need_recalc = FALSE;
563 }
564 This->dsb->ds3db_need_recalc = TRUE;
565 return DS_OK;
566}
567
570 D3DVALUE fMinDistance,
571 DWORD dwApply)
572{
574 TRACE("setting: MinDistance = %f; dwApply = %d\n", fMinDistance, dwApply);
575 This->dsb->ds3db_ds3db.flMinDistance = fMinDistance;
576 if (dwApply == DS3D_IMMEDIATE)
577 {
578 This->dsb->ds3db_need_recalc = FALSE;
580 }
581 This->dsb->ds3db_need_recalc = TRUE;
582 return DS_OK;
583}
584
587 DWORD dwMode,
588 DWORD dwApply)
589{
591 TRACE("setting: Mode = %d; dwApply = %d\n", dwMode, dwApply);
592 This->dsb->ds3db_ds3db.dwMode = dwMode;
593 if (dwApply == DS3D_IMMEDIATE)
594 {
595 This->dsb->ds3db_need_recalc = FALSE;
597 }
598 This->dsb->ds3db_need_recalc = TRUE;
599 return DS_OK;
600}
601
605 DWORD dwApply)
606{
608 TRACE("setting: Position vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
609 This->dsb->ds3db_ds3db.vPosition.x = x;
610 This->dsb->ds3db_ds3db.vPosition.y = y;
611 This->dsb->ds3db_ds3db.vPosition.z = z;
612 if (dwApply == DS3D_IMMEDIATE)
613 {
614 This->dsb->ds3db_need_recalc = FALSE;
616 }
617 This->dsb->ds3db_need_recalc = TRUE;
618 return DS_OK;
619}
620
624 DWORD dwApply)
625{
627 TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
628 This->dsb->ds3db_ds3db.vVelocity.x = x;
629 This->dsb->ds3db_ds3db.vVelocity.y = y;
630 This->dsb->ds3db_ds3db.vVelocity.z = z;
631 if (dwApply == DS3D_IMMEDIATE)
632 {
633 This->dsb->ds3db_need_recalc = FALSE;
635 }
636 This->dsb->ds3db_need_recalc = TRUE;
637 return DS_OK;
638}
639
640static const IDirectSound3DBufferVtbl ds3dbvt =
641{
642 /* IUnknown methods */
646 /* IDirectSound3DBuffer methods */
665};
666
670{
672 TRACE("(%p,%p)\n",dsb,pds3db);
673
674 ds3db = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*ds3db));
675
676 if (ds3db == NULL) {
677 WARN("out of memory\n");
678 *pds3db = 0;
679 return DSERR_OUTOFMEMORY;
680 }
681
682 ds3db->ref = 0;
683 ds3db->dsb = dsb;
684 ds3db->lpVtbl = &ds3dbvt;
685
686 ds3db->dsb->ds3db_ds3db.dwSize = sizeof(DS3DBUFFER);
687 ds3db->dsb->ds3db_ds3db.vPosition.x = 0.0;
688 ds3db->dsb->ds3db_ds3db.vPosition.y = 0.0;
689 ds3db->dsb->ds3db_ds3db.vPosition.z = 0.0;
690 ds3db->dsb->ds3db_ds3db.vVelocity.x = 0.0;
691 ds3db->dsb->ds3db_ds3db.vVelocity.y = 0.0;
692 ds3db->dsb->ds3db_ds3db.vVelocity.z = 0.0;
695 ds3db->dsb->ds3db_ds3db.vConeOrientation.x = 0.0;
696 ds3db->dsb->ds3db_ds3db.vConeOrientation.y = 0.0;
697 ds3db->dsb->ds3db_ds3db.vConeOrientation.z = 0.0;
702
703 ds3db->dsb->ds3db_need_recalc = TRUE;
704
705 *pds3db = ds3db;
706 return S_OK;
707}
708
711{
712 TRACE("(%p)\n",pds3db);
713
715
716 return S_OK;
717}
718
719/*******************************************************************************
720 * IDirectSound3DListener
721 */
722
723/* IUnknown methods */
726{
728
729 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
730
731 if (ppobj == NULL) {
732 WARN("invalid parameter\n");
733 return E_INVALIDARG;
734 }
735
736 *ppobj = NULL; /* assume failure */
737
738 if ( IsEqualGUID(riid, &IID_IUnknown) ||
739 IsEqualGUID(riid, &IID_IDirectSound3DListener ) ) {
741 *ppobj = This;
742 return S_OK;
743 }
744
745 if ( IsEqualGUID(riid, &IID_IDirectSoundBuffer) ) {
746 *ppobj = &This->device->primary->IDirectSoundBuffer8_iface;
747 IDirectSoundBuffer8_AddRef(&This->device->primary->IDirectSoundBuffer8_iface);
748 return S_OK;
749 }
750
751 FIXME( "Unknown IID %s\n", debugstr_guid( riid ) );
752 return E_NOINTERFACE;
753}
754
756{
759
760 TRACE("(%p) ref was %d\n", This, ref - 1);
761
762 if(ref == 1)
763 InterlockedIncrement(&This->device->primary->numIfaces);
764
765 return ref;
766}
767
769{
772 TRACE("(%p) ref was %d\n", This, ref + 1);
773
774 if (!ref) {
775 This->device->listener = 0;
776 if (!InterlockedDecrement(&This->device->primary->numIfaces))
777 primarybuffer_destroy(This->device->primary);
779 TRACE("(%p) released\n", This);
780 }
781 return ref;
782}
783
784/* IDirectSound3DListener methods */
787 LPDS3DLISTENER lpDS3DL)
788{
790 TRACE("(%p,%p)\n",This,lpDS3DL);
791
792 if (lpDS3DL == NULL) {
793 WARN("invalid parameter: lpDS3DL == NULL\n");
794 return DSERR_INVALIDPARAM;
795 }
796
797 if (lpDS3DL->dwSize < sizeof(*lpDS3DL)) {
798 WARN("invalid parameter: lpDS3DL->dwSize = %d\n",lpDS3DL->dwSize);
799 return DSERR_INVALIDPARAM;
800 }
801
802 TRACE("returning: all parameters\n");
803 *lpDS3DL = This->device->ds3dl;
804 return DS_OK;
805}
806
809 LPD3DVALUE lpfDistanceFactor)
810{
812 TRACE("returning: Distance Factor = %f\n", This->device->ds3dl.flDistanceFactor);
813 *lpfDistanceFactor = This->device->ds3dl.flDistanceFactor;
814 return DS_OK;
815}
816
819 LPD3DVALUE lpfDopplerFactor)
820{
822 TRACE("returning: Doppler Factor = %f\n", This->device->ds3dl.flDopplerFactor);
823 *lpfDopplerFactor = This->device->ds3dl.flDopplerFactor;
824 return DS_OK;
825}
826
829 LPD3DVECTOR lpvOrientFront,
830 LPD3DVECTOR lpvOrientTop)
831{
833 TRACE("returning: OrientFront vector = (%f,%f,%f); OrientTop vector = (%f,%f,%f)\n", This->device->ds3dl.vOrientFront.x,
834 This->device->ds3dl.vOrientFront.y, This->device->ds3dl.vOrientFront.z, This->device->ds3dl.vOrientTop.x, This->device->ds3dl.vOrientTop.y,
835 This->device->ds3dl.vOrientTop.z);
836 *lpvOrientFront = This->device->ds3dl.vOrientFront;
837 *lpvOrientTop = This->device->ds3dl.vOrientTop;
838 return DS_OK;
839}
840
843 LPD3DVECTOR lpvPosition)
844{
846 TRACE("returning: Position vector = (%f,%f,%f)\n", This->device->ds3dl.vPosition.x, This->device->ds3dl.vPosition.y, This->device->ds3dl.vPosition.z);
847 *lpvPosition = This->device->ds3dl.vPosition;
848 return DS_OK;
849}
850
853 LPD3DVALUE lpfRolloffFactor)
854{
856 TRACE("returning: RolloffFactor = %f\n", This->device->ds3dl.flRolloffFactor);
857 *lpfRolloffFactor = This->device->ds3dl.flRolloffFactor;
858 return DS_OK;
859}
860
863 LPD3DVECTOR lpvVelocity)
864{
866 TRACE("returning: Velocity vector = (%f,%f,%f)\n", This->device->ds3dl.vVelocity.x, This->device->ds3dl.vVelocity.y, This->device->ds3dl.vVelocity.z);
867 *lpvVelocity = This->device->ds3dl.vVelocity;
868 return DS_OK;
869}
870
873 LPCDS3DLISTENER lpcDS3DL,
874 DWORD dwApply)
875{
877 TRACE("setting: all parameters; dwApply = %d\n", dwApply);
878 This->device->ds3dl = *lpcDS3DL;
879 if (dwApply == DS3D_IMMEDIATE)
880 {
881 This->device->ds3dl_need_recalc = FALSE;
883 }
884 This->device->ds3dl_need_recalc = TRUE;
885 return DS_OK;
886}
887
890 D3DVALUE fDistanceFactor,
891 DWORD dwApply)
892{
894 TRACE("setting: Distance Factor = %f; dwApply = %d\n", fDistanceFactor, dwApply);
895 This->device->ds3dl.flDistanceFactor = fDistanceFactor;
896 if (dwApply == DS3D_IMMEDIATE)
897 {
898 This->device->ds3dl_need_recalc = FALSE;
900 }
901 This->device->ds3dl_need_recalc = TRUE;
902 return DS_OK;
903}
904
907 D3DVALUE fDopplerFactor,
908 DWORD dwApply)
909{
911 TRACE("setting: Doppler Factor = %f; dwApply = %d\n", fDopplerFactor, dwApply);
912 This->device->ds3dl.flDopplerFactor = fDopplerFactor;
913 if (dwApply == DS3D_IMMEDIATE)
914 {
915 This->device->ds3dl_need_recalc = FALSE;
917 }
918 This->device->ds3dl_need_recalc = TRUE;
919 return DS_OK;
920}
921
924 D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront,
925 D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop,
926 DWORD dwApply)
927{
929 TRACE("setting: Front vector = (%f,%f,%f); Top vector = (%f,%f,%f); dwApply = %d\n",
930 xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
931 This->device->ds3dl.vOrientFront.x = xFront;
932 This->device->ds3dl.vOrientFront.y = yFront;
933 This->device->ds3dl.vOrientFront.z = zFront;
934 This->device->ds3dl.vOrientTop.x = xTop;
935 This->device->ds3dl.vOrientTop.y = yTop;
936 This->device->ds3dl.vOrientTop.z = zTop;
937 if (dwApply == DS3D_IMMEDIATE)
938 {
939 This->device->ds3dl_need_recalc = FALSE;
941 }
942 This->device->ds3dl_need_recalc = TRUE;
943 return DS_OK;
944}
945
949 DWORD dwApply)
950{
952 TRACE("setting: Position vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
953 This->device->ds3dl.vPosition.x = x;
954 This->device->ds3dl.vPosition.y = y;
955 This->device->ds3dl.vPosition.z = z;
956 if (dwApply == DS3D_IMMEDIATE)
957 {
958 This->device->ds3dl_need_recalc = FALSE;
960 }
961 This->device->ds3dl_need_recalc = TRUE;
962 return DS_OK;
963}
964
967 D3DVALUE fRolloffFactor,
968 DWORD dwApply)
969{
971 TRACE("setting: Rolloff Factor = %f; dwApply = %d\n", fRolloffFactor, dwApply);
972 This->device->ds3dl.flRolloffFactor = fRolloffFactor;
973 if (dwApply == DS3D_IMMEDIATE)
974 {
975 This->device->ds3dl_need_recalc = FALSE;
977 }
978 This->device->ds3dl_need_recalc = TRUE;
979 return DS_OK;
980}
981
985 DWORD dwApply)
986{
988 TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
989 This->device->ds3dl.vVelocity.x = x;
990 This->device->ds3dl.vVelocity.y = y;
991 This->device->ds3dl.vVelocity.z = z;
992 if (dwApply == DS3D_IMMEDIATE)
993 {
994 This->device->ds3dl_need_recalc = FALSE;
996 }
997 This->device->ds3dl_need_recalc = TRUE;
998 return DS_OK;
999}
1000
1003{
1005 TRACE("\n");
1007 return DS_OK;
1008}
1009
1010static const IDirectSound3DListenerVtbl ds3dlvt =
1011{
1012 /* IUnknown methods */
1016 /* IDirectSound3DListener methods */
1032};
1033
1037{
1039 TRACE("(%p,%p)\n",device,ppdsl);
1040
1041 pdsl = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*pdsl));
1042
1043 if (pdsl == NULL) {
1044 WARN("out of memory\n");
1045 *ppdsl = 0;
1046 return DSERR_OUTOFMEMORY;
1047 }
1048
1049 pdsl->ref = 0;
1050 pdsl->lpVtbl = &ds3dlvt;
1051
1052 pdsl->device = device;
1053
1054 pdsl->device->ds3dl.dwSize = sizeof(DS3DLISTENER);
1055 pdsl->device->ds3dl.vPosition.x = 0.0;
1056 pdsl->device->ds3dl.vPosition.y = 0.0;
1057 pdsl->device->ds3dl.vPosition.z = 0.0;
1058 pdsl->device->ds3dl.vVelocity.x = 0.0;
1059 pdsl->device->ds3dl.vVelocity.y = 0.0;
1060 pdsl->device->ds3dl.vVelocity.z = 0.0;
1061 pdsl->device->ds3dl.vOrientFront.x = 0.0;
1062 pdsl->device->ds3dl.vOrientFront.y = 0.0;
1063 pdsl->device->ds3dl.vOrientFront.z = 1.0;
1064 pdsl->device->ds3dl.vOrientTop.x = 0.0;
1065 pdsl->device->ds3dl.vOrientTop.y = 1.0;
1066 pdsl->device->ds3dl.vOrientTop.z = 0.0;
1070
1071 pdsl->device->ds3dl_need_recalc = TRUE;
1072
1073 *ppdsl = pdsl;
1074 return S_OK;
1075}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
r l[0]
Definition: byte_order.h:168
float D3DVALUE
Definition: d3dtypes.h:89
float * LPD3DVALUE
Definition: d3dtypes.h:89
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
Definition: buffer.c:1113
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DSBCAPS_MUTE3DATMAXDISTANCE
Definition: dsound.h:221
#define DS3D_DEFAULTCONEANGLE
Definition: dsound.h:934
struct IDirectSound3DBuffer * LPDIRECTSOUND3DBUFFER
Definition: dsound.h:89
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
struct IDirectSound3DListener * LPDIRECTSOUND3DLISTENER
Definition: dsound.h:86
#define DS3D_DEFAULTMINDISTANCE
Definition: dsound.h:929
#define DS3D_DEFAULTROLLOFFFACTOR
Definition: dsound.h:923
#define DS3DMODE_HEADRELATIVE
Definition: dsound.h:911
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS3DMODE_DISABLE
Definition: dsound.h:912
#define DS_OK
Definition: dsound.h:116
#define DSBVOLUME_MIN
Definition: dsound.h:230
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define IDirectSoundBuffer8_AddRef(p)
Definition: dsound.h:659
#define DS3D_DEFAULTCONEOUTSIDEVOLUME
Definition: dsound.h:936
#define DS3DMODE_NORMAL
Definition: dsound.h:910
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
struct _DS3DBUFFER DS3DBUFFER
#define IDirectSound3DListener_AddRef(p)
Definition: dsound.h:980
#define DS3D_DEFAULTDOPPLERFACTOR
Definition: dsound.h:927
#define IDirectSoundBuffer_QueryInterface(p, a, b)
Definition: dsound.h:572
#define DS3D_DEFAULTMAXDISTANCE
Definition: dsound.h:930
struct _DS3DLISTENER DS3DLISTENER
#define DS3D_DEFAULTDISTANCEFACTOR
Definition: dsound.h:919
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN
Definition: primary.c:763
unsigned long DWORD
Definition: ntddk_ex.h:95
double log10(double x)
Definition: freeldr.c:122
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLfloat angle
Definition: glext.h:10853
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304
GLdouble GLdouble z
Definition: glext.h:5874
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define c
Definition: ke_i.h:80
#define debugstr_guid
Definition: kernel32.h:35
#define M_PI
Definition: macros.h:263
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(LPDIRECTSOUND3DBUFFER iface, LPCDS3DBUFFER lpcDs3dBuffer, DWORD dwApply)
Definition: sound3d.c:464
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance(LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMaxDistance, DWORD dwApply)
Definition: sound3d.c:551
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMaxDistance(LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMaxDistance)
Definition: sound3d.c:408
static HRESULT WINAPI IDirectSound3DListenerImpl_SetAllParameters(LPDIRECTSOUND3DLISTENER iface, LPCDS3DLISTENER lpcDS3DL, DWORD dwApply)
Definition: sound3d.c:871
static HRESULT WINAPI IDirectSound3DListenerImpl_SetDistanceFactor(LPDIRECTSOUND3DLISTENER iface, D3DVALUE fDistanceFactor, DWORD dwApply)
Definition: sound3d.c:888
static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(LPDIRECTSOUND3DLISTENER iface, REFIID riid, LPVOID *ppobj)
Definition: sound3d.c:724
static HRESULT WINAPI IDirectSound3DListenerImpl_SetDopplerFactor(LPDIRECTSOUND3DLISTENER iface, D3DVALUE fDopplerFactor, DWORD dwApply)
Definition: sound3d.c:905
static D3DVALUE AngleBetweenVectorsDeg(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:107
static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
Definition: sound3d.c:320
static HRESULT WINAPI IDirectSound3DListenerImpl_GetOrientation(LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvOrientFront, LPD3DVECTOR lpvOrientTop)
Definition: sound3d.c:827
static HRESULT WINAPI IDirectSound3DListenerImpl_GetPosition(LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvPosition)
Definition: sound3d.c:841
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMinDistance(LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMinDistance)
Definition: sound3d.c:418
static HRESULT WINAPI IDirectSound3DListenerImpl_GetVelocity(LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvVelocity)
Definition: sound3d.c:861
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode(LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwMode)
Definition: sound3d.c:428
static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface(LPDIRECTSOUND3DBUFFER iface, REFIID riid, LPVOID *ppobj)
Definition: sound3d.c:311
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDistanceFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDistanceFactor)
Definition: sound3d.c:807
static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:621
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292
static D3DVALUE AngleBetweenVectorsRad(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:90
static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:768
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume(LPDIRECTSOUND3DBUFFER iface, LONG lConeOutsideVolume, DWORD dwApply)
Definition: sound3d.c:534
static D3DVECTOR VectorBetweenTwoPoints(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:113
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance(LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMinDistance, DWORD dwApply)
Definition: sound3d.c:568
static D3DVECTOR VectorProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:60
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume(LPDIRECTSOUND3DBUFFER iface, LPLONG lplConeOutsideVolume)
Definition: sound3d.c:398
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode(LPDIRECTSOUND3DBUFFER iface, DWORD dwMode, DWORD dwApply)
Definition: sound3d.c:585
static const IDirectSound3DListenerVtbl ds3dlvt
Definition: sound3d.c:1010
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:141
static HRESULT WINAPI IDirectSound3DListenerImpl_SetPosition(LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:946
#define DEFAULT_VELOCITY
Definition: sound3d.c:43
static HRESULT WINAPI IDirectSound3DListenerImpl_CommitDeferredSettings(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:1001
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles(LPDIRECTSOUND3DBUFFER iface, DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply)
Definition: sound3d.c:496
static D3DVALUE RadToDeg(D3DVALUE angle)
Definition: sound3d.c:81
static const IDirectSound3DBufferVtbl ds3dbvt
Definition: sound3d.c:640
static HRESULT WINAPI IDirectSound3DBufferImpl_GetPosition(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvPosition)
Definition: sound3d.c:438
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOrientation(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvConeOrientation)
Definition: sound3d.c:385
static D3DVALUE VectorMagnitude(const D3DVECTOR *a)
Definition: sound3d.c:72
static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation(LPDIRECTSOUND3DLISTENER iface, D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply)
Definition: sound3d.c:922
static D3DVALUE ScalarProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:50
static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters(LPDIRECTSOUND3DBUFFER iface, LPDS3DBUFFER lpDs3dBuffer)
Definition: sound3d.c:350
static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:755
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles(LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwInsideConeAngle, LPDWORD lpdwOutsideConeAngle)
Definition: sound3d.c:372
HRESULT IDirectSound3DBufferImpl_Destroy(IDirectSound3DBufferImpl *pds3db)
Definition: sound3d.c:709
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDopplerFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDopplerFactor)
Definition: sound3d.c:817
static HRESULT WINAPI IDirectSound3DListenerImpl_GetRolloffFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfRolloffFactor)
Definition: sound3d.c:851
static HRESULT WINAPI IDirectSound3DBufferImpl_GetVelocity(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvVelocity)
Definition: sound3d.c:451
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
static HRESULT WINAPI IDirectSound3DListenerImpl_SetRolloffFactor(LPDIRECTSOUND3DLISTENER iface, D3DVALUE fRolloffFactor, DWORD dwApply)
Definition: sound3d.c:965
static HRESULT WINAPI IDirectSound3DListenerImpl_GetAllParameter(LPDIRECTSOUND3DLISTENER iface, LPDS3DLISTENER lpDS3DL)
Definition: sound3d.c:785
static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:602
static HRESULT WINAPI IDirectSound3DListenerImpl_SetVelocity(LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:982
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:515
static D3DVALUE ProjectVector(const D3DVECTOR *a, const D3DVECTOR *p)
Definition: sound3d.c:126
HRESULT IDirectSound3DBufferImpl_Create(IDirectSoundBufferImpl *dsb, IDirectSound3DBufferImpl **pds3db)
Definition: sound3d.c:667
static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface)
Definition: sound3d.c:333
HRESULT IDirectSound3DListenerImpl_Create(DirectSoundDevice *device, IDirectSound3DListenerImpl **ppdsl)
Definition: sound3d.c:1034
DS3DLISTENER ds3dl
IDirectSoundBufferImpl ** buffers
IDirectSoundBufferImpl * dsb
const IDirectSound3DBufferVtbl * lpVtbl
DirectSoundDevice * device
const IDirectSound3DListenerVtbl * lpVtbl
DirectSoundDevice * device
DWORD dwInsideConeAngle
Definition: dsound.h:1029
D3DVECTOR vConeOrientation
Definition: dsound.h:1031
DWORD dwOutsideConeAngle
Definition: dsound.h:1030
DWORD dwMode
Definition: dsound.h:1035
DWORD dwSize
Definition: dsound.h:1026
D3DVECTOR vPosition
Definition: dsound.h:1027
D3DVECTOR vVelocity
Definition: dsound.h:1028
LONG lConeOutsideVolume
Definition: dsound.h:1032
D3DVALUE flMinDistance
Definition: dsound.h:1033
D3DVALUE flMaxDistance
Definition: dsound.h:1034
D3DVECTOR vOrientTop
Definition: dsound.h:943
DWORD dwSize
Definition: dsound.h:939
D3DVALUE flDopplerFactor
Definition: dsound.h:946
D3DVECTOR vVelocity
Definition: dsound.h:941
D3DVALUE flRolloffFactor
Definition: dsound.h:945
D3DVALUE flDistanceFactor
Definition: dsound.h:944
D3DVECTOR vPosition
Definition: dsound.h:940
D3DVECTOR vOrientFront
Definition: dsound.h:942
DWORD dwFlags
Definition: dsound.h:289
LONG lVolume
Definition: dsdriver.h:107
Definition: devices.h:37
Definition: send.c:48
Definition: ps.c:97
int32_t * LPLONG
Definition: typedefs.h:58
uint32_t * LPDWORD
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364