Browse Source

Set BASS_STREAM_AUTOFREE on sample channels

Because getChannel() sets BASS_SAMCHAN_STREAM on samples, it always
returns a non-reusable stream. As such, we need to free it!
This small oversight is the reason the sound engine started choking
after a while.
kiwec 2 months ago
parent
commit
d62c95c979

+ 13 - 7
src/App/Osu/Changelog.cpp

@@ -29,16 +29,22 @@ Changelog::Changelog() : ScreenBackable() {
     CHANGELOG latest;
     latest.title =
         UString::format("%.2f (%s, %s)", convar->getConVarByName("osu_version")->getFloat(), __DATE__, __TIME__);
-    latest.changes.push_back("- Changed \"Open Skins folder\" button to open the currently selected skin's folder");
-    latest.changes.push_back("- Fixed master volume control not working on exclusive WASAPI");
-    latest.changes.push_back("- Fixed screenshots failing to save");
-    latest.changes.push_back("- Fixed skins with non-ANSI folder names failing to open on Windows");
-    latest.changes.push_back("- Fixed sliderslide and spinnerspin sounds not looping");
     latest.changes.push_back("- Improved sound engine reliability");
-    latest.changes.push_back("- Re-added strain graphs");
-    latest.changes.push_back("- Removed sliderhead fadeout animation (set osu_slider_sliderhead_fadeout to 1 for old behavior)");
+    latest.changes.push_back("- Removed herobrine");
     changelogs.push_back(latest);
 
+    CHANGELOG v35_04;
+    v35_04.title = "35.04 (2024-06-11)";
+    v35_04.changes.push_back("- Changed \"Open Skins folder\" button to open the currently selected skin's folder");
+    v35_04.changes.push_back("- Fixed master volume control not working on exclusive WASAPI");
+    v35_04.changes.push_back("- Fixed screenshots failing to save");
+    v35_04.changes.push_back("- Fixed skins with non-ANSI folder names failing to open on Windows");
+    v35_04.changes.push_back("- Fixed sliderslide and spinnerspin sounds not looping");
+    v35_04.changes.push_back("- Improved sound engine reliability");
+    v35_04.changes.push_back("- Re-added strain graphs");
+    v35_04.changes.push_back("- Removed sliderhead fadeout animation (set osu_slider_sliderhead_fadeout to 1 for old behavior)");
+    changelogs.push_back(v35_04);
+
     CHANGELOG v35_03;
     v35_03.title = "35.03 (2024-06-10)";
     v35_03.changes.push_back("- Added SoundEngine auto-restart settings");

+ 10 - 9
src/App/Osu/MainMenu.cpp

@@ -204,22 +204,23 @@ MainMenu::MainMenu() : OsuScreen() {
 
     // check if the user has never clicked the changelog for this update
     m_bDidUserUpdateFromOlderVersion = false;
-    m_bDidUserUpdateFromOlderVersionLe3300 = false;
-    m_bDidUserUpdateFromOlderVersionLe3303 = false;
+    m_bDrawVersionNotificationArrow = false;
     {
-        m_bDrawVersionNotificationArrow = false;
         if(env->fileExists(NEOSU_NEWVERSION_NOTIFICATION_TRIGGER_FILE)) {
             File versionFile(NEOSU_NEWVERSION_NOTIFICATION_TRIGGER_FILE);
             if(versionFile.canRead()) {
                 float version = std::stof(versionFile.readLine());
                 if(version < Osu::version->getFloat() - 0.0001f) m_bDrawVersionNotificationArrow = true;
-
-                if(version < 33.01f - 0.0001f) m_bDidUserUpdateFromOlderVersionLe3300 = true;
-                if(version < 33.04f - 0.0001f) m_bDidUserUpdateFromOlderVersionLe3303 = true;
-            } else
+                if(version < 34.05) {
+                    // SoundEngine choking issues have been fixed, option has been removed from settings menu
+                    // We leave the cvar available as it could still be useful for some players
+                    convar->getConVarByName("restart_sound_engine_before_playing")->setValue(false);
+                    osu->getOptionsMenu()->save();
+                }
+            } else {
                 m_bDrawVersionNotificationArrow = true;
-        } else
-            m_bDrawVersionNotificationArrow = false;
+            }
+        }
     }
     m_bDidUserUpdateFromOlderVersion = m_bDrawVersionNotificationArrow;  // (same logic atm)
 

+ 0 - 2
src/App/Osu/MainMenu.h

@@ -124,8 +124,6 @@ class MainMenu : public OsuScreen, public MouseListener {
 
     bool m_bDrawVersionNotificationArrow;
     bool m_bDidUserUpdateFromOlderVersion;
-    bool m_bDidUserUpdateFromOlderVersionLe3300;
-    bool m_bDidUserUpdateFromOlderVersionLe3303;
 
     // custom
     float m_fMainMenuAnimTime;

+ 0 - 7
src/App/Osu/OptionsMenu.cpp

@@ -761,13 +761,6 @@ OptionsMenu::OptionsMenu() : ScreenBackable() {
         for(auto i = asio_idx; i < asio_end_idx; i++) {
             m_elements[i].render_condition = RenderCondition::ASIO_ENABLED;
         }
-
-        // Jank
-        addCheckbox("Restart SoundEngine before every song",
-            "Useful if music or sounds start lagging/glitching after a while.\n"
-            "You probably also want to set a start delay, to make sure SoundEngine had time to reinitialize fully.",
-            convar->getConVarByName("restart_sound_engine_before_playing"));
-        addSlider("Song start delay:", 0.0f, 5.0f, convar->getConVarByName("snd_ready_delay"))->setKeyDelta(0.5f);
     }
 
     addSubSection("Volume");

+ 1 - 1
src/App/Osu/Osu.cpp

@@ -57,7 +57,7 @@ Osu *osu = NULL;
 
 // release configuration
 ConVar auto_update("auto_update", true, FCVAR_DEFAULT);
-ConVar osu_version("osu_version", 35.04f, FCVAR_DEFAULT | FCVAR_HIDDEN);
+ConVar osu_version("osu_version", 35.05f, FCVAR_DEFAULT | FCVAR_HIDDEN);
 
 #ifdef _DEBUG
 ConVar osu_debug("osu_debug", true, FCVAR_DEFAULT);

+ 1 - 5
src/Engine/SoundEngine.cpp

@@ -712,11 +712,7 @@ bool SoundEngine::play(Sound *snd, float pan, float pitch) {
 
     if(BASS_Mixer_ChannelGetMixer(channel) != 0) return false;
 
-    auto flags = BASS_MIXER_DOWNMIX | BASS_MIXER_NORAMPIN;
-    if(snd->isStream()) {
-        flags |= BASS_STREAM_AUTOFREE;
-    }
-
+    auto flags = BASS_MIXER_DOWNMIX | BASS_MIXER_NORAMPIN | BASS_STREAM_AUTOFREE;
     if(!BASS_Mixer_StreamAddChannel(g_bassOutputMixer, channel, flags)) {
         debugLog("BASS_Mixer_StreamAddChannel() failed (%i)!\n", BASS_ErrorGetCode());
         return false;