Exemplo n.º 1
0
//===========================================================================
// DS_Setv
//	SFXBP_POSITION
//	SFXBP_VELOCITY
//	Coordinates specified in world coordinate system, converted to DSound's: 
//	+X to the right, +Y up and +Z away (Y and Z swapped, i.e.).
//===========================================================================
void DS_Setv(sfxbuffer_t *buf, int property, float *values)
{
	if(!DSBuf3(buf)) return;

	switch(property)
	{
	case SFXBP_POSITION:
		IDirectSound3DBuffer_SetPosition(DSBuf3(buf),
			values[VX], values[VZ], values[VY], DS3D_DEFERRED);
		break;

	case SFXBP_VELOCITY:
		IDirectSound3DBuffer_SetVelocity(DSBuf3(buf),
			values[VX], values[VZ], values[VY], DS3D_DEFERRED);
		break;
	}
}
Exemplo n.º 2
0
int dsound_set_buffer_3d_position ( LPDIRECTSOUND3DBUFFER buffer, vec3d *position )
{

	unsigned int
		dsrval;
#ifdef _WIN32
	dsrval = IDirectSound3DBuffer_SetPosition ( buffer, position->x, position->y, position->z, DS3D_DEFERRED );

	if ( dsrval != DS_OK )
	{

		debug_log ( "Unable to set position of 3d buffer: %s", get_dsound_error_message ( dsrval ) );

		return ( FALSE );
	}
	else
	{

		return ( TRUE );
	}
#endif
}
Exemplo n.º 3
0
void I2_UpdateSource(sndsource_t *buf, sound3d_t *desc)
{
    int     i;
    float   temp[3];

    if(desc->flags & DDSOUNDF_VOLUME)
    {
        I2_SetVolume(buf, desc->volume/1000.0f);
    }
    if(desc->flags & DDSOUNDF_PITCH)
    {
        I2_SetPitch(buf, desc->pitch/1000.0f);
    }
    if(desc->flags & DDSOUNDF_POS)
    {
        for(i=0; i<3; i++) temp[i] = FIX2FLT(desc->pos[i]);
        IDirectSound3DBuffer_SetPosition(buf->source3D, temp[VX], temp[VY], temp[VZ], DS3D_DEFERRED);
    }
    if(desc->flags & DDSOUNDF_MOV)
    {
        for(i=0; i<3; i++) temp[i] = FIX2FLT(desc->mov[i]);
        IDirectSound3DBuffer_SetVelocity(buf->source3D, temp[VX], temp[VY], temp[VZ], DS3D_DEFERRED);
    }
}