Following the discovery of the underlying bugs in BitmapText causing issues with performance of Step Statistics, I wanted to revisit some changes I made to ActorMultiVertex in ae6d7cecb5. Some things were reverted to prefer original behavior.
Ideally this would also have an option to allow AutoSync, AutoPlay, and Assist Tick with the debug overlay disabled, but that would require migrating that functionality elsewhere.
Minor cleanup on `GetMainAndSubTitlesFromFullTitle` to use a range-based for loop, and also is slightly improved so that separators of any length will work, whereas the original code only works when the separator is one character long.
Migrate some very frequently called macros from global.h to global.cpp. This reduces Windows release executable size by 43 KB.
After moving ASSERT_M and FAIL_M into void functions, these two virtuals in RageFileBasic.h won't compile as they don't return a value. This changes them to return a default value.
The value was determined by profiling the `Cleanup` function as well as monitoring how frequent "Audio frame out of range" errors occurred. This provides an ideal balance of low latency and prevention of out-of-range errors.
Without this here, GCC 11 and 12 will print a warning during compilation about a possible fallthrough, but we're doing that on purpose, so this simply adds an indicator to the compiler that we know what we're doing.
SAFE_DELETE -> RageUtil::SafeDelete
SAFE_DELETE_ARRAY -> RageUtil::SafeDeleteArray
Update JsonUtil.h to include RageUtil.h - MSVC doesn't need it included for some reason, but GCC and XCode does.
This function indirectly determines the amount of average audio latency, this is why changes to BitmapText can affect global offset significantly. Aim to make the function as fast as possible to minimize latency.
1) make BitmapText::DrawPrimitives noexcept
- note: RollingNumbers::DrawPrimitives has to also become noexcept as a consequence
2) Define repeated calculations as constexpr functions defined within an anonymous namespace
3) Fix some formatting stuff
Currently we are storing the default driver lists as a macro, and splitting them into RString vectors every time they are needed. This commit changes the macros in `arch_default.h` into vectors of RStrings, so that they do not need to be split each time.
I have updated all references where the default driver lists are being called so that the vector is used directly.
A new function is added to RageUtil to make a compatible vector of RStrings from user input which may be separated with a comma.
RageSoundDriver was refactored to check user input in Preferences.ini against the default driver list, and in case of incorrect spelling or failure, provides a detailed error message (including a list of valid options) in logs so the user can resolve the problem.
`fix_bogus_sound_driver_pref` is no longer needed, since we are now telling the user what their valid options are if the user provides an incorrect entry for the `SoundDrivers` preference, instead of silently attempting to guess what the user wanted. Since I think it's rare that someone wants to specify a driver to begin with, we should let them know their exact options if they put something wrong here, instead of silently failing or using an unwanted driver.
I tested this on Windows by specifying `DirectSound-sw` in Preferences.ini, and it worked as expected. I also tried putting an unusable value in, and got the error in logs letting me know what my valid driver options were. Of course, input and movies all work as expected too.
- 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
Increasing security and efficiency of math in order to prevent potential errors from occurring.
1. L is a macro made to equal 8. It's only used in conjunction with other `int`'s, so it's safe to make into a constant called FILTER_LENGTH.
2. Define a very tiny number to avoid a potential mistake in ApplyKaiserWindow.
3. Define constants for BesselI0, making the functions easier to read but also improve security of the math.
4. Make some variables const and prevent redundant calculations or variable creations in ApplyKaiserWindow and GenerateSincLowPassFilter.
5. Use `double` interally in GenerateSincLowPassFilter