Skip to content

Commit

Permalink
Clamp some more signaling object sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed Sep 8, 2024
1 parent f4c79f9 commit 9ff71b6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/src/cavg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cavg::solve_electronics()
this->value = f * this->value + (1.f - f)*v;
}

this->s_out[0].write(this->value);
this->s_out[0].write(tclampf(this->value, 0.f, 1.f));

return 0;
}
2 changes: 1 addition & 1 deletion src/src/ceilgate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ceilgate::solve_electronics()

float v = ceilf(this->s_in[0].get_value());

this->s_out[0].write(v);
this->s_out[0].write(tclampf(v, 0.f, 1.f));

return 0;
}
2 changes: 1 addition & 1 deletion src/src/floorgate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ integergate::solve_electronics()

float v = (float)((int)this->s_in[0].get_value());

this->s_out[0].write(v);
this->s_out[0].write(tclampf(v, 0.f, 1.f));

return 0;
}
6 changes: 3 additions & 3 deletions src/src/i2o1gate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ emin::solve_electronics()
float a = this->s_in[0].get_value();
float b = this->s_in[1].get_value();

this->s_out[0].write(!(b<a)?a:b);
this->s_out[0].write(tclampf(!(b < a) ? a : b, 0.f, 1.f));

return 0;
}
Expand All @@ -242,7 +242,7 @@ emax::solve_electronics()
float a = this->s_in[0].get_value();
float b = this->s_in[1].get_value();

this->s_out[0].write((a<b)?b:a);
this->s_out[0].write(tclampf((a < b) ? b : a, 0.f, 1.f));

return 0;
}
Expand Down Expand Up @@ -308,7 +308,7 @@ hp_control::solve_electronics()
}
}

this->s_out[0].write(hp / this->target->get_max_hp());
this->s_out[0].write(tclampf(hp / this->target->get_max_hp(), 0.f, 1.f));
} else {
this->s_out[0].write(0.f);
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/mavg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mavg::solve_electronics()

float f = this->properties[0].v.f;
this->value = f * this->value + (1.f - f)*v;
this->s_out[0].write(this->value);
this->s_out[0].write(tclampf(this->value, 0.f, 1.f));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/snapgate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ snapgate::solve_electronics()
v = roundf(v);
v *= snap;

this->s_out[0].write(v);
this->s_out[0].write(tclampf(v, 0.f, 1.f));

return 0;
}
Expand Down

0 comments on commit 9ff71b6

Please sign in to comment.