ReactOS  0.4.14-dev-337-gf981a68
sound3d.c File Reference
#include "dsound_private.h"
Include dependency graph for sound3d.c:

Go to the source code of this file.

Macros

#define DEFAULT_VELOCITY   340
 

Functions

static D3DVALUE ScalarProduct (const D3DVECTOR *a, const D3DVECTOR *b)
 
static D3DVECTOR VectorProduct (const D3DVECTOR *a, const D3DVECTOR *b)
 
static D3DVALUE VectorMagnitude (const D3DVECTOR *a)
 
static D3DVALUE RadToDeg (D3DVALUE angle)
 
static D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECTOR *b)
 
static D3DVALUE AngleBetweenVectorsDeg (const D3DVECTOR *a, const D3DVECTOR *b)
 
static D3DVECTOR VectorBetweenTwoPoints (const D3DVECTOR *a, const D3DVECTOR *b)
 
static D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
 
void DSOUND_Calc3DBuffer (IDirectSoundBufferImpl *dsb)
 
static void DSOUND_Mix3DBuffer (IDirectSoundBufferImpl *dsb)
 
static void DSOUND_ChangeListener (IDirectSound3DListenerImpl *ds3dl)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface (LPDIRECTSOUND3DBUFFER iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound3DBufferImpl_AddRef (LPDIRECTSOUND3DBUFFER iface)
 
static ULONG WINAPI IDirectSound3DBufferImpl_Release (LPDIRECTSOUND3DBUFFER iface)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters (LPDIRECTSOUND3DBUFFER iface, LPDS3DBUFFER lpDs3dBuffer)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles (LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwInsideConeAngle, LPDWORD lpdwOutsideConeAngle)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOrientation (LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvConeOrientation)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume (LPDIRECTSOUND3DBUFFER iface, LPLONG lplConeOutsideVolume)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMaxDistance (LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMaxDistance)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMinDistance (LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMinDistance)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode (LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwMode)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetPosition (LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvPosition)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_GetVelocity (LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvVelocity)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters (LPDIRECTSOUND3DBUFFER iface, LPCDS3DBUFFER lpcDs3dBuffer, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles (LPDIRECTSOUND3DBUFFER iface, DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation (LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume (LPDIRECTSOUND3DBUFFER iface, LONG lConeOutsideVolume, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance (LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMaxDistance, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance (LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMinDistance, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode (LPDIRECTSOUND3DBUFFER iface, DWORD dwMode, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition (LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity (LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
 
HRESULT IDirectSound3DBufferImpl_Create (IDirectSoundBufferImpl *dsb, IDirectSound3DBufferImpl **pds3db)
 
HRESULT IDirectSound3DBufferImpl_Destroy (IDirectSound3DBufferImpl *pds3db)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface (LPDIRECTSOUND3DLISTENER iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound3DListenerImpl_AddRef (LPDIRECTSOUND3DLISTENER iface)
 
static ULONG WINAPI IDirectSound3DListenerImpl_Release (LPDIRECTSOUND3DLISTENER iface)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetAllParameter (LPDIRECTSOUND3DLISTENER iface, LPDS3DLISTENER lpDS3DL)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDistanceFactor (LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDistanceFactor)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDopplerFactor (LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDopplerFactor)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetOrientation (LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvOrientFront, LPD3DVECTOR lpvOrientTop)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetPosition (LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvPosition)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetRolloffFactor (LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfRolloffFactor)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_GetVelocity (LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvVelocity)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetAllParameters (LPDIRECTSOUND3DLISTENER iface, LPCDS3DLISTENER lpcDS3DL, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetDistanceFactor (LPDIRECTSOUND3DLISTENER iface, D3DVALUE fDistanceFactor, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetDopplerFactor (LPDIRECTSOUND3DLISTENER iface, D3DVALUE fDopplerFactor, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation (LPDIRECTSOUND3DLISTENER iface, D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetPosition (LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetRolloffFactor (LPDIRECTSOUND3DLISTENER iface, D3DVALUE fRolloffFactor, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_SetVelocity (LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
 
static HRESULT WINAPI IDirectSound3DListenerImpl_CommitDeferredSettings (LPDIRECTSOUND3DLISTENER iface)
 
HRESULT IDirectSound3DListenerImpl_Create (DirectSoundDevice *device, IDirectSound3DListenerImpl **ppdsl)
 

Variables

static const IDirectSound3DBufferVtbl ds3dbvt
 
static const IDirectSound3DListenerVtbl ds3dlvt
 

Macro Definition Documentation

◆ DEFAULT_VELOCITY

#define DEFAULT_VELOCITY   340

Definition at line 43 of file sound3d.c.

Function Documentation

◆ AngleBetweenVectorsDeg()

static D3DVALUE AngleBetweenVectorsDeg ( const D3DVECTOR a,
const D3DVECTOR b 
)
inlinestatic

Definition at line 107 of file sound3d.c.

108 {
110 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static D3DVALUE RadToDeg(D3DVALUE angle)
Definition: sound3d.c:81
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static D3DVALUE AngleBetweenVectorsRad(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:90

Referenced by DSOUND_Calc3DBuffer().

◆ AngleBetweenVectorsRad()

static D3DVALUE AngleBetweenVectorsRad ( const D3DVECTOR a,
const D3DVECTOR b 
)
inlinestatic

Definition at line 90 of file sound3d.c.

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 }
GLfloat angle
Definition: glext.h:10853
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
float D3DVALUE
Definition: d3dtypes.h:89
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
static D3DVALUE ScalarProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:50
static D3DVALUE RadToDeg(D3DVALUE angle)
Definition: sound3d.c:81
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static D3DVALUE VectorMagnitude(const D3DVECTOR *a)
Definition: sound3d.c:72

Referenced by AngleBetweenVectorsDeg(), and DSOUND_Calc3DBuffer().

◆ DSOUND_Calc3DBuffer()

void DSOUND_Calc3DBuffer ( IDirectSoundBufferImpl dsb)

Definition at line 141 of file sound3d.c.

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 */
166  DSOUND_RecalcVolPan (&dsb->volpan);
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  {
187  DSOUND_RecalcVolPan (&dsb->volpan);
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*/
204  if (dsb->ds3db_ds3db.vConeOrientation.x == 0 && dsb->ds3db_ds3db.vConeOrientation.y == 0 && dsb->ds3db_ds3db.vConeOrientation.z == 0)
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  {
245  vLeft = VectorProduct(&dsb->device->ds3dl.vOrientFront, &dsb->device->ds3dl.vOrientTop);
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;
276  DSOUND_RecalcFormat(dsb);
277  DSOUND_MixToTemporary(dsb, 0, dsb->buflen);
278  }
279 #endif
280 
281  /* time for remix */
283 }
D3DVECTOR vOrientTop
Definition: dsound.h:943
#define DS3DMODE_NORMAL
Definition: dsound.h:910
D3DVALUE flMaxDistance
Definition: dsound.h:1034
static D3DVALUE ProjectVector(const D3DVECTOR *a, const D3DVECTOR *p)
Definition: sound3d.c:126
D3DVECTOR vVelocity
Definition: dsound.h:1028
DWORD dwOutsideConeAngle
Definition: dsound.h:1030
static D3DVALUE AngleBetweenVectorsDeg(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:107
LONG lConeOutsideVolume
Definition: dsound.h:1032
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
D3DVECTOR vVelocity
Definition: dsound.h:941
static D3DVECTOR VectorProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:60
float D3DVALUE
Definition: d3dtypes.h:89
D3DVECTOR vConeOrientation
Definition: dsound.h:1031
#define TRACE(s)
Definition: solgame.cpp:4
_STLP_DECLSPEC complex< float > _STLP_CALL log10(const complex< float > &)
Definition: complex.cpp:230
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DS3DMODE_DISABLE
Definition: dsound.h:912
#define DS3DMODE_HEADRELATIVE
Definition: dsound.h:911
#define DSBVOLUME_MIN
Definition: dsound.h:230
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
DWORD dwInsideConeAngle
Definition: dsound.h:1029
DirectSoundDevice * device
#define DEFAULT_VELOCITY
Definition: sound3d.c:43
DS3DLISTENER ds3dl
D3DVALUE flMinDistance
Definition: dsound.h:1033
#define M_PI
Definition: macros.h:263
D3DVECTOR vPosition
Definition: dsound.h:940
static D3DVECTOR VectorBetweenTwoPoints(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:113
DWORD dwFlags
Definition: dsound.h:289
DWORD dwMode
Definition: dsound.h:1035
LONG lVolume
Definition: dsdriver.h:107
#define DSBCAPS_MUTE3DATMAXDISTANCE
Definition: dsound.h:221
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
static D3DVALUE VectorMagnitude(const D3DVECTOR *a)
Definition: sound3d.c:72
D3DVECTOR vOrientFront
Definition: dsound.h:942
D3DVECTOR vPosition
Definition: dsound.h:1027
static D3DVALUE AngleBetweenVectorsRad(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:90

Referenced by DSOUND_Mix3DBuffer(), IDirectSoundBufferImpl_Create(), and IDirectSoundBufferImpl_SetVolume().

◆ DSOUND_ChangeListener()

static void DSOUND_ChangeListener ( IDirectSound3DListenerImpl ds3dl)
static

Definition at line 292 of file sound3d.c.

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 }
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
IDirectSoundBufferImpl ** buffers
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
DirectSoundDevice * device
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by IDirectSound3DListenerImpl_CommitDeferredSettings(), IDirectSound3DListenerImpl_SetAllParameters(), IDirectSound3DListenerImpl_SetDistanceFactor(), IDirectSound3DListenerImpl_SetDopplerFactor(), IDirectSound3DListenerImpl_SetOrientation(), IDirectSound3DListenerImpl_SetPosition(), IDirectSound3DListenerImpl_SetRolloffFactor(), and IDirectSound3DListenerImpl_SetVelocity().

◆ DSOUND_Mix3DBuffer()

◆ IDirectSound3DBufferImpl_AddRef()

static ULONG WINAPI IDirectSound3DBufferImpl_AddRef ( LPDIRECTSOUND3DBUFFER  iface)
static

Definition at line 320 of file sound3d.c.

321 {
323  ULONG ref = InterlockedIncrement(&(This->ref));
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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSound3DBufferImpl_Create()

HRESULT IDirectSound3DBufferImpl_Create ( IDirectSoundBufferImpl dsb,
IDirectSound3DBufferImpl **  pds3db 
)

Definition at line 667 of file sound3d.c.

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 }
IDirectSoundBufferImpl * dsb
#define TRUE
Definition: types.h:120
struct _DS3DBUFFER DS3DBUFFER
#define DS3DMODE_NORMAL
Definition: dsound.h:910
#define WARN(fmt,...)
Definition: debug.h:111
D3DVALUE flMaxDistance
Definition: dsound.h:1034
#define DS3D_DEFAULTMINDISTANCE
Definition: dsound.h:929
D3DVECTOR vVelocity
Definition: dsound.h:1028
DWORD dwOutsideConeAngle
Definition: dsound.h:1030
const IDirectSound3DBufferVtbl * lpVtbl
#define DS3D_DEFAULTMAXDISTANCE
Definition: dsound.h:930
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
LONG lConeOutsideVolume
Definition: dsound.h:1032
static const IDirectSound3DBufferVtbl ds3dbvt
Definition: sound3d.c:640
smooth NULL
Definition: ftsmooth.c:416
D3DVECTOR vConeOrientation
Definition: dsound.h:1031
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD dwInsideConeAngle
Definition: dsound.h:1029
#define DS3D_DEFAULTCONEANGLE
Definition: dsound.h:934
D3DVALUE flMinDistance
Definition: dsound.h:1033
#define S_OK
Definition: intsafe.h:59
#define DS3D_DEFAULTCONEOUTSIDEVOLUME
Definition: dsound.h:936
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwSize
Definition: dsound.h:1026
DWORD dwMode
Definition: dsound.h:1035
D3DVECTOR vPosition
Definition: dsound.h:1027

Referenced by IDirectSoundBufferImpl_QueryInterface().

◆ IDirectSound3DBufferImpl_Destroy()

HRESULT IDirectSound3DBufferImpl_Destroy ( IDirectSound3DBufferImpl pds3db)

Definition at line 709 of file sound3d.c.

711 {
712  TRACE("(%p)\n",pds3db);
713 
715 
716  return S_OK;
717 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
struct IDirectSound3DBuffer * LPDIRECTSOUND3DBUFFER
Definition: dsound.h:89
static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface)
Definition: sound3d.c:333

Referenced by IDirectSoundBufferImpl_Destroy().

◆ IDirectSound3DBufferImpl_GetAllParameters()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters ( LPDIRECTSOUND3DBUFFER  iface,
LPDS3DBUFFER  lpDs3dBuffer 
)
static

Definition at line 350 of file sound3d.c.

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 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwSize
Definition: dsound.h:1026

◆ IDirectSound3DBufferImpl_GetConeAngles()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles ( LPDIRECTSOUND3DBUFFER  iface,
LPDWORD  lpdwInsideConeAngle,
LPDWORD  lpdwOutsideConeAngle 
)
static

Definition at line 372 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetConeOrientation()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOrientation ( LPDIRECTSOUND3DBUFFER  iface,
LPD3DVECTOR  lpvConeOrientation 
)
static

Definition at line 385 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetConeOutsideVolume()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume ( LPDIRECTSOUND3DBUFFER  iface,
LPLONG  lplConeOutsideVolume 
)
static

Definition at line 398 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetMaxDistance()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetMaxDistance ( LPDIRECTSOUND3DBUFFER  iface,
LPD3DVALUE  lpfMaxDistance 
)
static

Definition at line 408 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetMinDistance()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetMinDistance ( LPDIRECTSOUND3DBUFFER  iface,
LPD3DVALUE  lpfMinDistance 
)
static

Definition at line 418 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetMode()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode ( LPDIRECTSOUND3DBUFFER  iface,
LPDWORD  lpdwMode 
)
static

Definition at line 428 of file sound3d.c.

431 {
433  TRACE("returning: Mode = %d\n", This->dsb->ds3db_ds3db.dwMode);
434  *lpdwMode = This->dsb->ds3db_ds3db.dwMode;
435  return DS_OK;
436 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetPosition()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetPosition ( LPDIRECTSOUND3DBUFFER  iface,
LPD3DVECTOR  lpvPosition 
)
static

Definition at line 438 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_GetVelocity()

static HRESULT WINAPI IDirectSound3DBufferImpl_GetVelocity ( LPDIRECTSOUND3DBUFFER  iface,
LPD3DVECTOR  lpvVelocity 
)
static

Definition at line 451 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_QueryInterface()

static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface ( LPDIRECTSOUND3DBUFFER  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 311 of file sound3d.c.

313 {
315 
316  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
318 }
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
REFIID riid
Definition: precomp.h:44
#define IDirectSoundBuffer_QueryInterface(p, a, b)
Definition: dsound.h:572
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_Release()

static ULONG WINAPI IDirectSound3DBufferImpl_Release ( LPDIRECTSOUND3DBUFFER  iface)
static

Definition at line 333 of file sound3d.c.

334 {
336  ULONG ref = InterlockedDecrement(&(This->ref));
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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
Definition: buffer.c:1113
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by IDirectSound3DBufferImpl_Destroy().

◆ IDirectSound3DBufferImpl_SetAllParameters()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters ( LPDIRECTSOUND3DBUFFER  iface,
LPCDS3DBUFFER  lpcDs3dBuffer,
DWORD  dwApply 
)
static

Definition at line 464 of file sound3d.c.

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  {
488  DSOUND_Mix3DBuffer(This->dsb);
489  }
490  This->dsb->ds3db_need_recalc = TRUE;
491  status = DS_OK;
492 
493  return status;
494 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwSize
Definition: dsound.h:1026
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ IDirectSound3DBufferImpl_SetConeAngles()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles ( LPDIRECTSOUND3DBUFFER  iface,
DWORD  dwInsideConeAngle,
DWORD  dwOutsideConeAngle,
DWORD  dwApply 
)
static

Definition at line 496 of file sound3d.c.

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  {
509  DSOUND_Mix3DBuffer(This->dsb);
510  }
511  This->dsb->ds3db_need_recalc = TRUE;
512  return DS_OK;
513 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_SetConeOrientation()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation ( LPDIRECTSOUND3DBUFFER  iface,
D3DVALUE  x,
D3DVALUE  y,
D3DVALUE  z,
DWORD  dwApply 
)
static

Definition at line 515 of file sound3d.c.

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;
528  DSOUND_Mix3DBuffer(This->dsb);
529  }
530  This->dsb->ds3db_need_recalc = TRUE;
531  return DS_OK;
532 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DS3D_IMMEDIATE
Definition: dsound.h:914
GLdouble GLdouble z
Definition: glext.h:5874
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ IDirectSound3DBufferImpl_SetConeOutsideVolume()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume ( LPDIRECTSOUND3DBUFFER  iface,
LONG  lConeOutsideVolume,
DWORD  dwApply 
)
static

Definition at line 534 of file sound3d.c.

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;
545  DSOUND_Mix3DBuffer(This->dsb);
546  }
547  This->dsb->ds3db_need_recalc = TRUE;
548  return DS_OK;
549 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_SetMaxDistance()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance ( LPDIRECTSOUND3DBUFFER  iface,
D3DVALUE  fMaxDistance,
DWORD  dwApply 
)
static

Definition at line 551 of file sound3d.c.

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;
562  DSOUND_Mix3DBuffer(This->dsb);
563  }
564  This->dsb->ds3db_need_recalc = TRUE;
565  return DS_OK;
566 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_SetMinDistance()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance ( LPDIRECTSOUND3DBUFFER  iface,
D3DVALUE  fMinDistance,
DWORD  dwApply 
)
static

Definition at line 568 of file sound3d.c.

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;
579  DSOUND_Mix3DBuffer(This->dsb);
580  }
581  This->dsb->ds3db_need_recalc = TRUE;
582  return DS_OK;
583 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_SetMode()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode ( LPDIRECTSOUND3DBUFFER  iface,
DWORD  dwMode,
DWORD  dwApply 
)
static

Definition at line 585 of file sound3d.c.

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;
596  DSOUND_Mix3DBuffer(This->dsb);
597  }
598  This->dsb->ds3db_need_recalc = TRUE;
599  return DS_OK;
600 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DBufferImpl_SetPosition()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition ( LPDIRECTSOUND3DBUFFER  iface,
D3DVALUE  x,
D3DVALUE  y,
D3DVALUE  z,
DWORD  dwApply 
)
static

Definition at line 602 of file sound3d.c.

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;
615  DSOUND_Mix3DBuffer(This->dsb);
616  }
617  This->dsb->ds3db_need_recalc = TRUE;
618  return DS_OK;
619 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DS3D_IMMEDIATE
Definition: dsound.h:914
GLdouble GLdouble z
Definition: glext.h:5874
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ IDirectSound3DBufferImpl_SetVelocity()

static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity ( LPDIRECTSOUND3DBUFFER  iface,
D3DVALUE  x,
D3DVALUE  y,
D3DVALUE  z,
DWORD  dwApply 
)
static

Definition at line 621 of file sound3d.c.

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;
634  DSOUND_Mix3DBuffer(This->dsb);
635  }
636  This->dsb->ds3db_need_recalc = TRUE;
637  return DS_OK;
638 }
#define TRUE
Definition: types.h:120
static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
Definition: sound3d.c:285
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DS3D_IMMEDIATE
Definition: dsound.h:914
GLdouble GLdouble z
Definition: glext.h:5874
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ IDirectSound3DListenerImpl_AddRef()

static ULONG WINAPI IDirectSound3DListenerImpl_AddRef ( LPDIRECTSOUND3DLISTENER  iface)
static

Definition at line 755 of file sound3d.c.

756 {
758  ULONG ref = InterlockedIncrement(&(This->ref));
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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSound3DListenerImpl_CommitDeferredSettings()

static HRESULT WINAPI IDirectSound3DListenerImpl_CommitDeferredSettings ( LPDIRECTSOUND3DLISTENER  iface)
static

Definition at line 1001 of file sound3d.c.

1003 {
1005  TRACE("\n");
1007  return DS_OK;
1008 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_Create()

HRESULT IDirectSound3DListenerImpl_Create ( DirectSoundDevice device,
IDirectSound3DListenerImpl **  ppdsl 
)

Definition at line 1034 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
D3DVECTOR vOrientTop
Definition: dsound.h:943
#define WARN(fmt,...)
Definition: debug.h:111
D3DVALUE flRolloffFactor
Definition: dsound.h:945
const IDirectSound3DListenerVtbl * lpVtbl
#define DS3D_DEFAULTDISTANCEFACTOR
Definition: dsound.h:919
DirectSoundDevice * device
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
Definition: devices.h:37
D3DVALUE flDistanceFactor
Definition: dsound.h:944
D3DVECTOR vVelocity
Definition: dsound.h:941
#define DS3D_DEFAULTROLLOFFFACTOR
Definition: dsound.h:923
smooth NULL
Definition: ftsmooth.c:416
struct _DS3DLISTENER DS3DLISTENER
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
D3DVALUE flDopplerFactor
Definition: dsound.h:946
#define DS3D_DEFAULTDOPPLERFACTOR
Definition: dsound.h:927
DS3DLISTENER ds3dl
#define S_OK
Definition: intsafe.h:59
DWORD dwSize
Definition: dsound.h:939
D3DVECTOR vPosition
Definition: dsound.h:940
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const IDirectSound3DListenerVtbl ds3dlvt
Definition: sound3d.c:1010
D3DVECTOR vOrientFront
Definition: dsound.h:942

Referenced by PrimaryBufferImpl_QueryInterface().

◆ IDirectSound3DListenerImpl_GetAllParameter()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetAllParameter ( LPDIRECTSOUND3DLISTENER  iface,
LPDS3DLISTENER  lpDS3DL 
)
static

Definition at line 785 of file sound3d.c.

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 }
#define WARN(fmt,...)
Definition: debug.h:111
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwSize
Definition: dsound.h:939

◆ IDirectSound3DListenerImpl_GetDistanceFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetDistanceFactor ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVALUE  lpfDistanceFactor 
)
static

Definition at line 807 of file sound3d.c.

810 {
812  TRACE("returning: Distance Factor = %f\n", This->device->ds3dl.flDistanceFactor);
813  *lpfDistanceFactor = This->device->ds3dl.flDistanceFactor;
814  return DS_OK;
815 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_GetDopplerFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetDopplerFactor ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVALUE  lpfDopplerFactor 
)
static

Definition at line 817 of file sound3d.c.

820 {
822  TRACE("returning: Doppler Factor = %f\n", This->device->ds3dl.flDopplerFactor);
823  *lpfDopplerFactor = This->device->ds3dl.flDopplerFactor;
824  return DS_OK;
825 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_GetOrientation()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetOrientation ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVECTOR  lpvOrientFront,
LPD3DVECTOR  lpvOrientTop 
)
static

Definition at line 827 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_GetPosition()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetPosition ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVECTOR  lpvPosition 
)
static

Definition at line 841 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_GetRolloffFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetRolloffFactor ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVALUE  lpfRolloffFactor 
)
static

Definition at line 851 of file sound3d.c.

854 {
856  TRACE("returning: RolloffFactor = %f\n", This->device->ds3dl.flRolloffFactor);
857  *lpfRolloffFactor = This->device->ds3dl.flRolloffFactor;
858  return DS_OK;
859 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_GetVelocity()

static HRESULT WINAPI IDirectSound3DListenerImpl_GetVelocity ( LPDIRECTSOUND3DLISTENER  iface,
LPD3DVECTOR  lpvVelocity 
)
static

Definition at line 861 of file sound3d.c.

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 }
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectSound3DListenerImpl_QueryInterface()

static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface ( LPDIRECTSOUND3DLISTENER  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 724 of file sound3d.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define IDirectSoundBuffer8_AddRef(p)
Definition: dsound.h:659
#define IDirectSound3DListener_AddRef(p)
Definition: dsound.h:980
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
struct IDirectSound3DListener * LPDIRECTSOUND3DLISTENER
Definition: dsound.h:86
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ IDirectSound3DListenerImpl_Release()

static ULONG WINAPI IDirectSound3DListenerImpl_Release ( LPDIRECTSOUND3DLISTENER  iface)
static

Definition at line 768 of file sound3d.c.

769 {
771  ULONG ref = InterlockedDecrement(&(This->ref));
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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN
Definition: primary.c:763
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ IDirectSound3DListenerImpl_SetAllParameters()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetAllParameters ( LPDIRECTSOUND3DLISTENER  iface,
LPCDS3DLISTENER  lpcDS3DL,
DWORD  dwApply 
)
static

Definition at line 871 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_SetDistanceFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetDistanceFactor ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  fDistanceFactor,
DWORD  dwApply 
)
static

Definition at line 888 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_SetDopplerFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetDopplerFactor ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  fDopplerFactor,
DWORD  dwApply 
)
static

Definition at line 905 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_SetOrientation()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  xFront,
D3DVALUE  yFront,
D3DVALUE  zFront,
D3DVALUE  xTop,
D3DVALUE  yTop,
D3DVALUE  zTop,
DWORD  dwApply 
)
static

Definition at line 922 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_SetPosition()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetPosition ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  x,
D3DVALUE  y,
D3DVALUE  z,
DWORD  dwApply 
)
static

Definition at line 946 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DS3D_IMMEDIATE
Definition: dsound.h:914
GLdouble GLdouble z
Definition: glext.h:5874
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ IDirectSound3DListenerImpl_SetRolloffFactor()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetRolloffFactor ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  fRolloffFactor,
DWORD  dwApply 
)
static

Definition at line 965 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
#define DS3D_IMMEDIATE
Definition: dsound.h:914
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292

◆ IDirectSound3DListenerImpl_SetVelocity()

static HRESULT WINAPI IDirectSound3DListenerImpl_SetVelocity ( LPDIRECTSOUND3DLISTENER  iface,
D3DVALUE  x,
D3DVALUE  y,
D3DVALUE  z,
DWORD  dwApply 
)
static

Definition at line 982 of file sound3d.c.

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 }
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DS3D_IMMEDIATE
Definition: dsound.h:914
GLdouble GLdouble z
Definition: glext.h:5874
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
Definition: sound3d.c:292
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ProjectVector()

static D3DVALUE ProjectVector ( const D3DVECTOR a,
const D3DVECTOR p 
)
inlinestatic

Definition at line 126 of file sound3d.c.

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 }
float D3DVALUE
Definition: d3dtypes.h:89
#define TRACE(s)
Definition: solgame.cpp:4
static D3DVALUE ScalarProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:50
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
static D3DVALUE VectorMagnitude(const D3DVECTOR *a)
Definition: sound3d.c:72

Referenced by DSOUND_Calc3DBuffer().

◆ RadToDeg()

static D3DVALUE RadToDeg ( D3DVALUE  angle)
inlinestatic

Definition at line 81 of file sound3d.c.

82 {
83  D3DVALUE newangle;
84  newangle = angle * (360/(2*M_PI));
85  TRACE("%f rad = %f deg\n", angle, newangle);
86  return newangle;
87 }
GLfloat angle
Definition: glext.h:10853
float D3DVALUE
Definition: d3dtypes.h:89
#define TRACE(s)
Definition: solgame.cpp:4
#define M_PI
Definition: macros.h:263

Referenced by AngleBetweenVectorsDeg(), and AngleBetweenVectorsRad().

◆ ScalarProduct()

static D3DVALUE ScalarProduct ( const D3DVECTOR a,
const D3DVECTOR b 
)
inlinestatic

Definition at line 50 of file sound3d.c.

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 }
float D3DVALUE
Definition: d3dtypes.h:89
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by AngleBetweenVectorsRad(), ProjectVector(), and VectorMagnitude().

◆ VectorBetweenTwoPoints()

static D3DVECTOR VectorBetweenTwoPoints ( const D3DVECTOR a,
const D3DVECTOR b 
)
inlinestatic

Definition at line 113 of file sound3d.c.

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 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by DSOUND_Calc3DBuffer().

◆ VectorMagnitude()

static D3DVALUE VectorMagnitude ( const D3DVECTOR a)
inlinestatic

Definition at line 72 of file sound3d.c.

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 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
float D3DVALUE
Definition: d3dtypes.h:89
r l[0]
Definition: byte_order.h:167
#define TRACE(s)
Definition: solgame.cpp:4
static D3DVALUE ScalarProduct(const D3DVECTOR *a, const D3DVECTOR *b)
Definition: sound3d.c:50
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by AngleBetweenVectorsRad(), DSOUND_Calc3DBuffer(), and ProjectVector().

◆ VectorProduct()

static D3DVECTOR VectorProduct ( const D3DVECTOR a,
const D3DVECTOR b 
)
inlinestatic

Definition at line 60 of file sound3d.c.

61 {
62  D3DVECTOR c;
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 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by DSOUND_Calc3DBuffer().

Variable Documentation

◆ ds3dbvt

const IDirectSound3DBufferVtbl ds3dbvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles(LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwInsideConeAngle, LPDWORD lpdwOutsideConeAngle)
Definition: sound3d.c:372
static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
Definition: sound3d.c:320
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode(LPDIRECTSOUND3DBUFFER iface, DWORD dwMode, DWORD dwApply)
Definition: sound3d.c:585
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume(LPDIRECTSOUND3DBUFFER iface, LONG lConeOutsideVolume, DWORD dwApply)
Definition: sound3d.c:534
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume(LPDIRECTSOUND3DBUFFER iface, LPLONG lplConeOutsideVolume)
Definition: sound3d.c:398
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance(LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMaxDistance, DWORD dwApply)
Definition: sound3d.c:551
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode(LPDIRECTSOUND3DBUFFER iface, LPDWORD lpdwMode)
Definition: sound3d.c:428
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMinDistance(LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMinDistance)
Definition: sound3d.c:418
static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:621
static HRESULT WINAPI IDirectSound3DBufferImpl_GetVelocity(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvVelocity)
Definition: sound3d.c:451
static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters(LPDIRECTSOUND3DBUFFER iface, LPDS3DBUFFER lpDs3dBuffer)
Definition: sound3d.c:350
static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance(LPDIRECTSOUND3DBUFFER iface, D3DVALUE fMinDistance, DWORD dwApply)
Definition: sound3d.c:568
static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(LPDIRECTSOUND3DBUFFER iface, LPCDS3DBUFFER lpcDs3dBuffer, DWORD dwApply)
Definition: sound3d.c:464
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles(LPDIRECTSOUND3DBUFFER iface, DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply)
Definition: sound3d.c:496
static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:602
static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOrientation(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvConeOrientation)
Definition: sound3d.c:385
static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface(LPDIRECTSOUND3DBUFFER iface, REFIID riid, LPVOID *ppobj)
Definition: sound3d.c:311
static HRESULT WINAPI IDirectSound3DBufferImpl_GetMaxDistance(LPDIRECTSOUND3DBUFFER iface, LPD3DVALUE lpfMaxDistance)
Definition: sound3d.c:408
static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface)
Definition: sound3d.c:333
static HRESULT WINAPI IDirectSound3DBufferImpl_GetPosition(LPDIRECTSOUND3DBUFFER iface, LPD3DVECTOR lpvPosition)
Definition: sound3d.c:438
static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation(LPDIRECTSOUND3DBUFFER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:515

Definition at line 640 of file sound3d.c.

Referenced by IDirectSound3DBufferImpl_Create().

◆ ds3dlvt

const IDirectSound3DListenerVtbl ds3dlvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound3DListenerImpl_CommitDeferredSettings(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:1001
static HRESULT WINAPI IDirectSound3DListenerImpl_GetAllParameter(LPDIRECTSOUND3DLISTENER iface, LPDS3DLISTENER lpDS3DL)
Definition: sound3d.c:785
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDopplerFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDopplerFactor)
Definition: sound3d.c:817
static HRESULT WINAPI IDirectSound3DListenerImpl_SetDopplerFactor(LPDIRECTSOUND3DLISTENER iface, D3DVALUE fDopplerFactor, DWORD dwApply)
Definition: sound3d.c:905
static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(LPDIRECTSOUND3DLISTENER iface, REFIID riid, LPVOID *ppobj)
Definition: sound3d.c:724
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 ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:768
static HRESULT WINAPI IDirectSound3DListenerImpl_SetVelocity(LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:982
static HRESULT WINAPI IDirectSound3DListenerImpl_GetDistanceFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfDistanceFactor)
Definition: sound3d.c:807
static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface)
Definition: sound3d.c:755
static HRESULT WINAPI IDirectSound3DListenerImpl_SetRolloffFactor(LPDIRECTSOUND3DLISTENER iface, D3DVALUE fRolloffFactor, DWORD dwApply)
Definition: sound3d.c:965
static HRESULT WINAPI IDirectSound3DListenerImpl_GetRolloffFactor(LPDIRECTSOUND3DLISTENER iface, LPD3DVALUE lpfRolloffFactor)
Definition: sound3d.c:851
static HRESULT WINAPI IDirectSound3DListenerImpl_GetVelocity(LPDIRECTSOUND3DLISTENER iface, LPD3DVECTOR lpvVelocity)
Definition: sound3d.c:861
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 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 IDirectSound3DListenerImpl_SetPosition(LPDIRECTSOUND3DLISTENER iface, D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply)
Definition: sound3d.c:946

Definition at line 1010 of file sound3d.c.

Referenced by IDirectSound3DListenerImpl_Create().