diff --git a/src/monocoque/devices/hapticeffect.c b/src/monocoque/devices/hapticeffect.c index 506fcf1..2501a37 100644 --- a/src/monocoque/devices/hapticeffect.c +++ b/src/monocoque/devices/hapticeffect.c @@ -340,6 +340,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, wheelslip[i] = 0; } } + slogt("wheelslip values are %f %f %f %f", simdata->tyrediameter[0], simdata->tyrediameter[1], simdata->tyrediameter[2], simdata->tyrediameter[3]); } break; @@ -357,6 +358,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[0] < -threshold) { play += fabs(wheelslip[0]) - fabs(threshold); + slogt("slip is %f", play); } } if (tyre == FRONTRIGHT || tyre == FRONTS || tyre == ALLFOUR) @@ -364,6 +366,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[1] < -threshold) { play += fabs(wheelslip[1]) - fabs(threshold); + slogt("slip is %f", play); } } if (tyre == REARLEFT || tyre == REARS || tyre == ALLFOUR) @@ -371,6 +374,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[2] < -threshold) { play += fabs(wheelslip[2]) - fabs(threshold); + slogt("slip is %f", play); } } if (tyre == REARRIGHT || tyre == REARS || tyre == ALLFOUR) @@ -378,11 +382,11 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[3] < -threshold) { play += fabs(wheelslip[3]) - fabs(threshold); + slogt("slip is %f", play); } } - - break; + case (EFFECT_TYRELOCK): if (tyre == FRONTLEFT || tyre == FRONTS || tyre == ALLFOUR) { diff --git a/src/monocoque/devices/sounddevice.c b/src/monocoque/devices/sounddevice.c index c60c3a4..b649436 100644 --- a/src/monocoque/devices/sounddevice.c +++ b/src/monocoque/devices/sounddevice.c @@ -42,7 +42,8 @@ int sounddev_tyreslip_update(SimDevice* this, SimData* simdata) { SoundDevice* sounddevice = (void *) this->derived; - int play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); + double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); + slogt("Updating sound device frequency from original effect %f", play); if (play > 0) { @@ -54,13 +55,14 @@ int sounddev_tyreslip_update(SimDevice* this, SimData* simdata) sounddevice->sounddata.curr_frequency = 0; sounddevice->sounddata.curr_duration = 0; } + } int sounddev_tyrelock_update(SimDevice* this, SimData* simdata) { SoundDevice* sounddevice = (void *) this->derived; - int play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); + double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); if (play > 0) { @@ -77,10 +79,11 @@ int sounddev_tyrelock_update(SimDevice* this, SimData* simdata) int sounddev_absbrakes_update(SimDevice* this, SimData* simdata) { SoundDevice* sounddevice = (void *) this->derived; + double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); - if (simdata->abs > 0) + if (play > 0) { - sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency; + sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency * play; sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration; } else