f2e-spec icon indicating copy to clipboard operation
f2e-spec copied to clipboard

Hang In game/audio.cc due to aubio processing

Open OznOg opened this issue 2 years ago • 1 comments

Bug

I have a quite old laptop and when entering the play menu (when all songs are displayed) the music hangs and alsa complains about underruns.

This bug is very old but I once thought I could fix it, but I must say I did not manage.

It seems that the aubio processing should not happen in the main loop (and should probaby not be recomputed each time we change song).

What did you expect to see?

no hang and pass smoothly between songs without hangs.

What did you see instead?

hangs and underruns

What is your environment & configuration (arguments, platform, ...)?

Using linux fedora 34 x86_64 performous 1.2.0

FYI I workaround local for playing by applying the patch (which disable the whole aubio thing):

diff --git a/game/audio.cc b/game/audio.cc
index da810488..d3b107f0 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -198,6 +198,7 @@ bool Music::prepare() {
        for (auto& kv: tracks) {
                auto& audioBuffer = kv.second->audioBuffer;
                if (audioBuffer.prepare(m_pos)) {
+                #if 0
                        if (kv.first == "background" && m_preview && m_pos > 0) {
                                auto previewSamples = audioBuffer.makePreviewBuffer();
                                fvec_t* previewBeats = ScreenSongs::previewBeatsBuffer.get();
@@ -235,6 +236,7 @@ bool Music::prepare() {
                                        }
                                }
                        }
+                        #endif
                continue;  // Buffering done
                }
                ready = false;  // Need to wait for buffering

OznOg avatar Apr 01 '22 17:04 OznOg

I can't see a real solution, though.

Is this really an issue in relatively-recent hardware, though? I mean, I used to play performous on 2011 MacBook pro (that's an 11 year old machine).

We could return to what we had earlier, using the songs' stated BPM but we all know that value is mostly just a measure of time resolution and wildly inaccurate.

We could also just remove the blinking altogether. Or maybe, something I've suggested before: Since this is just a cosmetic feature, make it toggable so people can turn it off if it's an issue for them.

Lord-Kamina avatar Apr 01 '22 17:04 Lord-Kamina