本文整理汇总了C++中LPDIRECTSOUND3DLISTENER::SetVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUND3DLISTENER::SetVelocity方法的具体用法?C++ LPDIRECTSOUND3DLISTENER::SetVelocity怎么用?C++ LPDIRECTSOUND3DLISTENER::SetVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTSOUND3DLISTENER
的用法示例。
在下文中一共展示了LPDIRECTSOUND3DLISTENER::SetVelocity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DS_Listenerv
//===========================================================================
// DS_Listenerv
// Call SFXLP_UPDATE at the end of every channel update.
//===========================================================================
void DS_Listenerv(int property, float *values)
{
if(!dsListener) return;
switch(property)
{
case SFXLP_POSITION:
dsListener->SetPosition(values[VX], values[VZ], values[VY],
DS3D_DEFERRED);
break;
case SFXLP_VELOCITY:
dsListener->SetVelocity(values[VX], values[VZ], values[VY],
DS3D_DEFERRED);
break;
case SFXLP_ORIENTATION:
ListenerOrientation(values[VX]/180*PI, values[VY]/180*PI);
break;
case SFXLP_REVERB:
ListenerEnvironment(values);
break;
default:
DS_Listener(property, 0);
}
}
示例2: UserSetParms
static void RLXAPI UserSetParms(V3XMATRIX *lpMAT, V3XVECTOR *lpVEL,
float*lpDistanceF, float*lpDopplerF, float*lpRolloffF)
{
HRESULT hr;
if (!g_lpDS3DListener)
return;
if (lpMAT)
{
V3XVECTOR *ps = &lpMAT->v.Pos;
hr = g_lpDS3DListener->SetPosition(ps->x, ps->y, ps->z, DS3D_DEFMODE);
g_lpDS3DListener->SetOrientation(
lpMAT->v.K.x, lpMAT->v.K.y, lpMAT->v.K.z, // 3D engine use a other orientation (right hand)
lpMAT->v.J.x, lpMAT->v.J.y, lpMAT->v.J.z,
DS3D_DEFMODE);
}
if (lpVEL)
g_lpDS3DListener->SetVelocity(lpVEL->x, lpVEL->y, lpVEL->z, DS3D_DEFMODE);
if (lpDistanceF)
g_lpDS3DListener->SetDistanceFactor(*lpDistanceF, DS3D_DEFMODE);
if (lpDopplerF)
g_lpDS3DListener->SetDopplerFactor( *lpDopplerF, DS3D_DEFMODE);
if (lpRolloffF)
g_lpDS3DListener->SetRolloffFactor( *lpRolloffF, DS3D_DEFMODE);
}
示例3: ds_SetAllListenerParameters
//-----------------------------------------------------------------------------
// Установка всех параметров слушателя
// на входе : listener - указатель на интерфейс слушателя
// data - указатель на структуру в которой содержатся
// параметры слушателя
// на выходе : успешность установки параметров слушателя
//-----------------------------------------------------------------------------
int ds_SetAllListenerParameters(LPDIRECTSOUND3DLISTENER listener,
LPDS3DLISTENER data, DWORD def)
{
int ret = false;
// проверка наличия слушателя
if (!listener)
return ret;
// установка позиции
ret = (listener->SetPosition(data->vPosition.x,
data->vPosition.y,
data->vPosition.z,
def) == DS_OK) ?
true :
false;
// установка скорости слушателя
if (ret)
ret = (listener->SetVelocity(data->vVelocity.x,
data->vVelocity.y,
data->vVelocity.z,
def) == DS_OK) ?
true :
false;
// установка ориентации
if (ret)
ret = (listener->SetOrientation(data->vOrientFront.x,
data->vOrientFront.y,
data->vOrientFront.z,
data->vOrientTop.x,
data->vOrientTop.y,
data->vOrientTop.z,
def) == DS_OK) ?
true :
false;
// установка дистанции
if (ret)
ret = (listener->SetDistanceFactor(data->flDistanceFactor, def) ==
DS_OK) ?
true :
false;
// установка фактора удаления
if (ret)
ret = (listener->SetRolloffFactor(data->flRolloffFactor, def) == DS_OK) ?
true :
false;
// установка эффекта допплера
if (ret)
ret = (listener->SetDopplerFactor(data->flDopplerFactor, def) == DS_OK) ?
true :
false;
return ret;
}
示例4: ds3d_update_listener
// ---------------------------------------------------------------------------------------
// ds3d_update_listener()
//
// returns: 0 => success
// -1 => failure
//
int ds3d_update_listener(vector *pos, vector *vel, matrix *orient)
{
HRESULT hr;
if (DS3D_inited == FALSE)
return 0;
if ( pDS3D_listener == NULL )
return -1;
// set the listener position
if ( pos != NULL ) {
hr = pDS3D_listener->SetPosition(pos->x, pos->y, pos->z, DS3D_DEFERRED);
}
// set the listener veclocity
if ( vel != NULL ) {
hr = pDS3D_listener->SetVelocity(vel->x, vel->y, vel->z, DS3D_DEFERRED);
}
if ( orient != NULL ) {
hr = pDS3D_listener->SetOrientation( orient->fvec.x, orient->fvec.y, orient->fvec.z,
orient->uvec.x, orient->uvec.y, orient->uvec.z,
DS3D_DEFERRED );
}
float rolloff_factor = 1.0f;
if (ds_using_a3d() == true) {
rolloff_factor = 3.0f; // A3D rolloff
} else {
rolloff_factor = 3.0f; // EAX rolloff
}
hr = pDS3D_listener->SetRolloffFactor( rolloff_factor, DS3D_DEFERRED );
hr = pDS3D_listener->SetDopplerFactor( 1.0f, DS3D_DEFERRED );
hr = pDS3D_listener->CommitDeferredSettings();
if ( hr != DS_OK ) {
nprintf(("SOUND","Error in pDS3D_listener->CommitDeferredSettings(): %s\n", get_DSERR_text(hr) ));
return -1;
}
return 0;
}