Commit Graph

37026 Commits

Author SHA1 Message Date
Sergio Pérez Fernández b1244b32e3 build-release-linux.sh - revert change on default amd64 package 2025-06-22 20:47:13 -07:00
Sergio Pérez Fernández 88e2769633 build-release-linux.sh set to x86_64 as default architecture 2025-06-22 20:47:13 -07:00
Sergio Perez Fernandez 4b93499074 release/arm64: reverted Podman to Docker to not change the project toolchain 2025-06-22 20:47:13 -07:00
Sergio Perez Fernandez 45ba1873df Allow Utils/build-release-linux.sh to build releases for other targets as arm64 2025-06-22 20:47:13 -07:00
sukibaby 6409c7ec82 Temporarily disable CMake build caching in ci.yml
This is to resolve failures in Windows CI following a VS2022 update
2025-06-22 20:22:30 -07:00
sukibaby 425a8aaba8 Group: add new protections for unexpected edge cases
Early return of sDir or sGroupDirName is empty, and check the return value of ini.ReadFile instead of assuming the ini file was successfully read.
2025-06-22 20:21:15 -07:00
sukibaby 5e79df7ff1 WaveOut: clamp the value of wo_num_blocks_ 2025-06-22 19:22:14 -07:00
sukibaby 986695d2cd WaveOut: remove hardcoded bits per sample value
To derive the bit depth, we can determine the number of bytes per frame (kChannels * 2), divide by the number of channels to get bytes per sample (2), and finally convert to bits by multiplying by 8 (16 bits).
2025-06-22 19:22:14 -07:00
sukibaby d673ae5688 WaveOut: correct variable naming, style updates
Adopt Google C++ style guide naming:

m_hWaveOut → wave_out_handle
m_hSoundEvent → sound_event_handle
m_aBuffers → buffers
m_iSampleRate → sample_rate
m_bShutdown → shutdown
m_iLastCursorPos → last_cursor_pos
b_InitSuccess → init_success
NUM_CHUNKS → num_blocks
BUFFERSIZE_FRAMES → num_frames_per_block
CHUNKSIZE → block_size

I've also fixed spacing in the constructor and reorganized the list of member variables in the header for easier reading, and added context to the comment in the header file, changed a static const int to constexpr int, etc

s
2025-06-22 19:22:14 -07:00
sukibaby d1bddbd3ab WaveOut: Target a specific latency to ensure a consistent experience across different sample rates
With WaveOut, typically one defines the following values before starting a WaveOut thread: sample rate, number of blocks, and size of each block in frames. Based on these values, a particular latency will be calculated. StepMania historically follows this approach.

However, it is possible to target a specific latency instead, and extrapolate the needed number of blocks if the sample rate and block size values are known.

This PR refactors the driver to calculate the ideal number of blocks based on a pre-determined optimal target latency and block size. This allows us to guarantee a nearly-imperceptible difference in WaveOut latency (0.29 ms) between 44.1 kHz and 48 kHz.

Nothing related to driver functionality is changed. We just change the way the buffer parameters are determined. This PR only changes code which runs before the WaveOut thread is launched.

When we consider how the WaveOut API works, we need to provide three of four values and the fourth is calculated. So, at 44100 Hz, with 15 blocks of 256 frames each, 15 * 256 gives us 3840 frames of latency (3840 / 44100 = ~87 ms). If we use this same configuration with 48000 Hz, we get a latency of 80ms which is a significant difference.

However, if we increase to 16 blocks at 48000 Hz, we get 4096 frames of latency (~85 ms), which is much closer to the 87 ms when using 15 blocks at 44100 Hz.

A target latency of 118 ms allows for the smallest possible delta when using a block size of 512 frames, and testing with sample rates of 44100 and 48000. At 44100 Hz / 512 frames / 118 ms target latency, we have a calculated latency of 127.7098 ms. At 48000 Hz / 512 frames/ 118 ms target latency, we have a calculated latency of 128 ms - a 0.29 ms difference.

I determined this by simulating the CalculteNumBufferChunks calculation for a range of 100 to 300.
2025-06-22 19:22:14 -07:00
Scott Brenner 054fd4640a Correct yaml syntax in nightly.yml 2025-06-19 09:26:05 -07:00
Scott Brenner 4880231200 Generate signed build provenance attestations for nightly builds 2025-06-19 06:44:11 -07:00
sukibaby aa9ebb6c1c DSoundHelpers: directly call memset instead of using a RageUtil macro
Removes an instance of the ZERO(x) macro.
2025-06-12 02:21:33 -07:00
sukibaby d2fa795bfa GraphicsWindow: remove extraneous checkpoints 2025-06-12 02:17:56 -07:00
sukibaby 97be79cd2b GraphicsWindow: reset screen mode before destroying window
This will prevent a display flicker upon exit of the game. The display's mode should be reset by the time the graphics window has been destroyed.
2025-06-12 02:17:56 -07:00
sukibaby dad8fdec35 GraphicsWindow: remove hardcoded logic from SetScreenMode 2025-06-12 02:17:56 -07:00
sukibaby 6618903907 GraphicsWindow: add missing includes 2025-06-12 02:17:56 -07:00
Sergio Perez Fernandez c96034f605 added braces to if statement in CreateDir 2025-06-12 00:58:09 -07:00
Sergio Perez Fernandez 551356e8f2 do not try to create a directory when it exists 2025-06-12 00:58:09 -07:00
sukibaby 93b65a441b DirectSound: initialize all DSoundBuf member variables in an initializer list 2025-06-11 07:37:36 -07:00
sukibaby 4d6ffc27da DSoundHelpers: use a constant in prefetch size comparison 2025-06-11 07:36:45 -07:00
sukibaby 8f2076eea1 DSoundHelpers: use sizeof(DSBUFFERDESC) rather than sizeof(variable)
Microsoft documentation and samples always use sizeof(DSBUFFERDESC), not sizeof(variable).
2025-06-11 07:36:13 -07:00
sukibaby b933347374 DirectSound: dynamically calculate block alignment to ensure correctness with various bit depths 2025-06-11 07:35:46 -07:00
sukibaby 6eb58bbd66 DirectSound: keep the main buffer active.
This was actually already considered in the surrounding code. I just had to uncomment it. This recommendation has remained consistent in the Microsoft documentation since this code was written. It's safe to uncomment it to ensure our main buffer stays active, since shutdown of the mixer engine is unwanted.
2025-06-11 07:33:08 -07:00
sukibaby 8c6c2524bb Remove implicit conversion operator from RString to const char* (Win32)
follows up on 6a29f651c7 and ecfcb11a00
2025-06-11 07:32:24 -07:00
sukibaby d65140c6fd Static cast the buffer size 2025-06-04 18:26:04 -07:00
sukibaby 94d1bb9e99 Use constexpr for MovieTexture_FFMpeg constants 2025-06-04 18:26:04 -07:00
Patrik Nilsson 8f13335c72 Add 180hz refresh rate
Add 180hz refresh rate
2025-06-04 08:17:54 -07:00
Sergio Perez Fernandez 33095cdb64 set DisableUploadDir preference default value to 1 2025-06-01 16:25:15 -07:00
teejusb 86a26cb7cb Add missing includes for DSoundHelpers 2025-06-01 08:47:10 -07:00
Patrik Nilsson 039bede4d1 Remove one trailing whitespace 2025-06-01 08:37:19 -07:00
Patrik Nilsson 7d398919a0 Address review feedback and improve code style
- Moved end-of-line comments to preceding lines for better readability and to avoid potential line length issues across various files modified in previous commits.
- In the RageSoundReader_Chain constructor: Removed redundant initialization of m_iPreferredSampleRate. Replaced hardcoded 44100 with kFallbackSampleRate. Removed an unnecessary comment.
- Added braces consistently to single-statement if/else blocks across all recently modified sound system files. This enhances code clarity and maintainability by explicitly defining block scopes.
2025-06-01 08:37:19 -07:00
Patrik Nilsson 72c7316671 Centralize fallback sample rate with kFallbackSampleRate
Replaces hardcoded 44100Hz values (used as fallbacks or for the "Default" sample rate preference) with a new constant `constexpr int kFallbackSampleRate = 44100;` defined in RageSound.h.

This constant is now used in:
- RageSoundReader_Silence
- RageSoundManager (for unloaded driver scenarios)
- All sound drivers' initialization logic for the "Default (0)" preference (DSound, WaveOut, AU, PulseAudio, OSS, WDMKS, Null)
- DSound primary buffer setup.
2025-06-01 08:37:19 -07:00
Patrik Nilsson c42501ba65 Add "Audio Sample Rate" option with translations
The English display name for the option has been updated to "Audio Sample Rate" for better clarity. Translations for this new option title have been added for Spanish, French, German, Japanese, Korean, Dutch, Polish, Slovak, and Traditional Chinese.
2025-06-01 08:37:19 -07:00
Patrik Nilsson 2e18b57da0 Implement configurable Sample Rate in options
Key changes:
- Added "Sample Rate" to `ScreenOptionsGraphicsSound` with choices:
    - "Default" (resolves to 44100 Hz for now)
    - "44100 Hz"
    - "48000 Hz"
- Created a new ConfOption "PreferredSampleRate" in `ScreenOptionsMasterPrefs.cpp` mapping UI choices to the integer values (0, 44100, 48000) for the existing `m_iSoundPreferredSampleRate` preference.
- Updated relevant sound drivers:
    - DirectSound (RageSoundDriver_DSound_Software): Primary buffer now attempts to use the preferred rate. Secondary buffers already handled it correctly.
    - WaveOut (RageSoundDriver_WaveOut): Already handled 0 as 44.1kHz correctly.
    - PulseAudio (RageSoundDriver_PulseAudio): Ensured m_InitStream uses the constructor-initialized rate based on preference.
    - AudioUnit (RageSoundDriver_AU): Already handled 0 as 44.1kHz and attempts to set hardware rate.
    - OSS (RageSoundDriver_OSS): Updated to read and apply the preferred sample rate.
    - WDMKS (RageSoundDriver_WDMKS): Updated to pass the resolved preferred rate to its stream opening logic.
    - Null (RageSoundDriver_Null): Already handled 0 as 44.1kHz correctly.
- Updated `RageSoundReader_Chain` constructor to use the preferred system sample rate for its internal default.
- Added English localization for the new option title and explanation.

The implementation ensures that if the preference is 0 (Default), the system currently defaults to 44100 Hz across all drivers. This lays the groundwork for future dynamic hardware rate detection. A game restart is recommended for the new sample rate to take full effect.
2025-06-01 08:37:19 -07:00
Patrik Nilsson af127ca23b Audio: Update default sample rate to 48kHz to mitigate sync issues 2025-06-01 08:37:19 -07:00
Sergio Perez Fernandez 2517959050 do not write any logs in disk when LogToDisk=0 2025-05-30 13:51:09 -07:00
sukibaby b3c43c9dea link to the simply love repo from the readme 2025-05-30 13:49:03 -07:00
sukibaby 1e667de589 Use a range-based for loop to avoid manual iterator handling 2025-05-28 14:56:29 -07:00
sukibaby 281cd8cb51 Change the video looping log to Info level.
Doesn't need to be written to disk right away every time a video loops.
2025-05-27 22:27:21 -07:00
Scott Brenner 7a3fa88c7a Update src/RageSoundReader_ChannelSplit.cpp 2025-05-25 21:09:54 -07:00
Scott Brenner 6cdf64afc8 Fix for code scanning alert: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 21:09:54 -07:00
Scott Brenner 24fce53629 Update src/RageSurfaceUtils.cpp 2025-05-25 21:09:32 -07:00
Scott Brenner 146702430b Fix for code scanning alert: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 21:09:32 -07:00
Scott Brenner fc2d5dbf17 Fix for code scanning alert: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 21:09:01 -07:00
Scott Brenner 7ff2002bec Update src/RageSurfaceUtils.cpp 2025-05-25 21:08:36 -07:00
Scott Brenner f0908b58ad Fix for code scanning alert no. 479: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 21:08:36 -07:00
sukibaby b0acfb362e don't upload VS2022 Code Analysis indicators
Visual Studio filetype; is an empty file.
2025-05-25 10:48:59 -07:00
Scott Brenner 57d54a0c89 Fix for code scanning alert: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 00:31:23 -07:00
Scott Brenner 90176a1f1c Fix for code scanning alert: Multiplication result converted to larger type
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-05-25 00:29:25 -07:00