// empty constructor
SGSoundSample::SGSoundSample() :
_absolute_pos(SGVec3d::zeros()),
- _relative_pos(SGVec3f::zeros()),
+ _relative_pos(SGVec3d::zeros()),
_direction(SGVec3d::zeros()),
_velocity(SGVec3d::zeros()),
_base_pos(SGGeod()),
// constructor
SGSoundSample::SGSoundSample( const char *path, const char *file ) :
_absolute_pos(SGVec3d::zeros()),
- _relative_pos(SGVec3f::zeros()),
+ _relative_pos(SGVec3d::zeros()),
_direction(SGVec3d::zeros()),
_velocity(SGVec3d::zeros()),
_base_pos(SGGeod()),
// constructor
SGSoundSample::SGSoundSample( unsigned char *data, int len, int freq, int format ) :
_absolute_pos(SGVec3d::zeros()),
- _relative_pos(SGVec3f::zeros()),
+ _relative_pos(SGVec3d::zeros()),
_direction(SGVec3d::zeros()),
_velocity(SGVec3d::zeros()),
_base_pos(SGGeod()),
}
void SGSoundSample::set_relative_position( SGVec3f pos ) {
- _relative_pos = pos;
+ _relative_pos = toVec3d(pos);
update_absolute_position();
_changed = true;
}
SGQuatd orient = SGQuatd::fromLonLat(_base_pos) * _orientation;
_orivec = -toVec3f(orient.rotate(_direction));
- _absolute_pos = -SGVec3d::fromGeod(_base_pos);
- // TODO: add relative position
+ orient = SGQuatd::fromRealImag(0, _relative_pos) * _orientation;
+ _absolute_pos = -SGVec3d::fromGeod(_base_pos) -orient.rotate(SGVec3d::e1());
}