Commit 88687fdc authored by David Reid's avatar David Reid

Try fixing a bug with calculating the relative position of a sound.

parent 881fa606
......@@ -188,10 +188,12 @@ int main(int argc, char** argv)
}
//ma_spatializer_set_position(&g_spatializer, ma_vec3f_init_3f(posX, 0, posZ));
ma_sound_set_position(&sound, posX, 0, posZ);
ma_sound_set_velocity(&sound, step*1000, 0, 0);
ma_sound_set_position(&sound, 0, 0, -2);
ma_engine_listener_set_position(&engine, 0, 0, 0, -20);
ma_engine_listener_set_direction(&engine, 0, -1, 0, 0);
//ma_sound_set_velocity(&sound, step*1000, 0, 0);
//ma_engine_listener_set_direciton(&engine, (float)ma_cos(angle), 0, (float)ma_sin(angle));
ma_engine_listener_set_direction(&engine, 0, (float)ma_cos(angle), 0, (float)ma_sin(angle));
angle += stepAngle;
ma_sleep(1);
......
......@@ -9376,17 +9376,17 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
*/
v = pSpatializer->position;
#if 1
{
relativePos.x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * 1;
relativePos.y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * 1;
relativePos.z = m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * 1;
}
#else
{
relativePos.x = m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * 1;
relativePos.y = m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * 1;
relativePos.z = m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * 1;
}
#else
{
relativePos.x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * 1;
relativePos.y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * 1;
relativePos.z = m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * 1;
}
#endif
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment