Commit Graph

17 Commits

Author SHA1 Message Date
sukibaby d50ad757cb Remove useless alias
This used to be a different function than GetTimeSinceStart which returned a lower precision value but we don't do that anymore.
2025-04-29 21:42:37 -07:00
sukibaby 7b45a5f599 RageTimer bug fix
Fast data types are good for audio processing, but not so much for timekeeping. This PR should resolve a number of smaller issues.
2024-12-04 09:41:26 -08:00
sukibaby a6a60e2e56 Remove std prefix from int types
std::int* -> int*
2024-10-08 20:52:52 -07:00
sukibaby 659cd549a2 Remove std prefix from uint types
std::uint*  ->  uint*
2024-10-05 19:25:41 -07:00
sukibaby eb35a9b9af Switch from Float to Integer Time Values
- Use fast data types where possible so the compiler can optimize for speed based on platform
    - for example, 128 bits might be fastest on ARM
    - good future-proofing

- Refactor GetTimeSinceStart() to be a bit faster
    - multiplication is much faster than division

- Implement a RageTimer method to get the seconds value as a plain int, for the places which cast the seconds value to an int

- Changing from GetTimeSinceStartFast() to GetTimeSinceStart() where accuracy is important

- Changing from GetTimeSinceStart() to GetUsecsSinceStart() for timestamp diffs

- Adjust RageThreads to accomodate an unsigned timestamp value
   - a constant for the maximum value of `uint_fast64_t` replaces `-1` to accommodate the change from signed to unsigned for the `locked_at` variable
   - i have separate constants for `std::numeric_limits<std::uint_fast64_t>::max()` and `static_cast<std::uint_fast64_t>(-1)`, so the reader understands -1 represents an error code, though they evaluate to the same value, so i could remove one of the two

- Add two methods to calculate the MMSSMsMs / MMSSMsMsMs time value from usecs directly instead of inferring it from a seconds value, in RageUtil

- Use a similar counter/modulo based method for WheelNotifyIcon, similar to what i did for text_glow in NoteField in 2eeee03

- Make `g_iStartTime` static const for safety

Rename two timer functions:
GetUsecsSinceStart -> GetTimeSinceStartMicroseconds
GetMicrosecondsSinceStart -> GetSystemTimeAsMicroseconds

Remove std prefix from uint_fast64_t
2024-09-22 01:27:45 -07:00
sukibaby 53cd968b90 Removing bApproximate (part 2)
This should wrap up removing this flag from the code base.
2024-09-20 22:03:15 -07:00
sukibaby 630617ff1e Undefine macro in RageTimer.cpp 2024-08-05 14:52:59 -07:00
sukibaby 705a069400 Resolve the SM5 sync drift issue
Summary of changes

1) Fix issues in RageTimer and RageSoundPosMap
2) Calculate seconds from microseconds more accurately
3) Replace lrint(x) with static_cast<int>(x+0.5) for better performance
4) Replace C style casting with C++ style casting
5) Make important values 64-bit wide
6) Update RageUtil.cpp (timer conversion RStrings had some math which needed to be fixed after fixing RageTimer's math)
7) Ensure floating point math is done as floating point
8) Improve code commentary all around
9) Improve clarity and efficiency of RageSoundPosMap "return closest position" error logging
2024-05-12 08:05:41 -07:00
Martin Natano aa87f85eef Decouple <cstdint> 2023-04-21 22:13:41 +02:00
Martin Natano b68ca517e6 Clean up math functions
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
2023-04-19 19:31:40 +02:00
Jason Felds bec18a0d36 Fix minor windows pedantic warnings. 2016-03-27 22:03:15 -04:00
Kyzentun a2798e16f4 More aggressive caching. In general, this makes Stepmania avoid looking in the song directory at all if the song is in the cache, in order to load songs faster. All the RadarValue calculations were also rolled into one to reduce the time needed to build the cache. 2015-03-23 11:35:30 -06:00
sigatrev a038300dba added lua function for GetTimeSinceStart
Allows checking time within a single update. This can be used to halt
processes which would otherwise cause lag.
2014-03-03 20:27:46 -06:00
Jason Felds 52df8ea981 War on -Werror, part 13: hodgehodge. 2012-12-27 12:07:02 -05:00
Jason Felds a085d0d1da Line endings...be normalized! 2011-03-17 01:47:30 -04:00
AJ Kelly 3e51544930 Initial commit. 2010-01-26 21:00:30 -06:00
Devin J. Pohly 80057f53cd smsvn -> ssc-hg glue: rearrange directory structure 2013-06-10 15:38:43 -04:00