You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
double t = soloud.getStreamTime(h); // get time
if (t == hammertime) hammer();
Even if you match frames this will likely fail. As you describe in the paragraph below it, you can't use '==' to compare floating-point values.
Maybe adding this macro will help
// Check to see if pos is within xtol of xval
#define _m_Is_Around( pos, xval, xtol ) \
( ( ( (pos) >= ( (xval) - (xtol) ) ) && ( (pos) <= ( (xval) + (xtol) ) ) ) ? 1 : 0 )
So now you could say:
double delta_Tolerance = 0.02; // 20ms (a 50hz frametime)
double t = soloud.getStreamTime(h); // get time
if ( _m_Is_Around( t, hammertime, delta_Tolerance ) ) hammer();
Just a thought... I love the library.
The text was updated successfully, but these errors were encountered:
In the core.misc documentation
you put the following code:
Even if you match frames this will likely fail. As you describe in the paragraph below it, you can't use '==' to compare floating-point values.
Maybe adding this macro will help
So now you could say:
Just a thought... I love the library.
The text was updated successfully, but these errors were encountered: