correct yaw sent to audio-mixer in Audio

This commit is contained in:
Stephen Birarda 2013-04-26 11:21:34 -07:00
parent 1884bfc17e
commit fbdcd57529
3 changed files with 11 additions and 5 deletions

View file

@ -160,7 +160,7 @@ int audioCallback (const void *inputBuffer,
*(currentPacketPtr++) = 255;
// memcpy the corrected render yaw
float correctedYaw = fmodf(data->linkedAvatar->getRenderYaw(), 360);
float correctedYaw = fmodf(data->linkedAvatar->getAbsoluteHeadYaw(), 360);
if (correctedYaw > 180) {
correctedYaw -= 360;

View file

@ -275,13 +275,16 @@ void Avatar::UpdateGyros(float frametime, SerialInterface * serialInterface, glm
addLean(-measured_lateral_accel * frametime * HEAD_LEAN_SCALE, -measured_fwd_accel*frametime * HEAD_LEAN_SCALE);
}
float Avatar::getAbsoluteHeadYaw() {
return _bodyYaw + _headYaw;
}
void Avatar::addLean(float x, float z) {
// Add Body lean as impulse
_head.leanSideways += x;
_head.leanForward += z;
}
void Avatar::setLeanForward(float dist){
_head.leanForward = dist;
}

View file

@ -167,18 +167,21 @@ public:
void reset();
void UpdateGyros(float frametime, SerialInterface * serialInterface, glm::vec3 * gravity);
void setNoise (float mag) { _head.noise = mag; }
void setScale(float s) {_head.scale = s; };
void setRenderYaw(float y) {_renderYaw = y;}
void setRenderPitch(float p) {_renderPitch = p;}
float getRenderYaw() {return _renderYaw;}
float getRenderPitch() {return _renderPitch;}
void setLeanForward(float dist);
void setLeanSideways(float dist);
void addLean(float x, float z);
float getLastMeasuredHeadYaw() const {return _head.yawRate;}
float getBodyYaw() {return _bodyYaw;};
void addBodyYaw(float y) {_bodyYaw += y;};
float getAbsoluteHeadYaw();
void setLeanForward(float dist);
void setLeanSideways(float dist);
void addLean(float x, float z);
const glm::vec3& getHeadLookatDirection() const { return _orientation.getFront(); };
const glm::vec3& getHeadLookatDirectionUp() const { return _orientation.getUp(); };