当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTSOUND3DLISTENER::SetVelocity方法代码示例

本文整理汇总了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);
	}
}
开发者ID:amitahire,项目名称:development,代码行数:32,代码来源:driver_sndcmp.cpp

示例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);
}
开发者ID:cbxbiker61,项目名称:nogravity,代码行数:26,代码来源:snd_ds6.cpp

示例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;
}
开发者ID:doveiya,项目名称:isilme,代码行数:66,代码来源:DirectSound.cpp

示例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;
}
开发者ID:lubomyr,项目名称:freespace2,代码行数:50,代码来源:ds3d.cpp


注:本文中的LPDIRECTSOUND3DLISTENER::SetVelocity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。