Sound and music cut out after a while for no apparent reason.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DTmg
Prole
Posts: 16
Joined: Tue Apr 18, 2023 12:47 pm

Sound and music cut out after a while for no apparent reason.

Post by DTmg »

Hello everyone again :)!

I'm working on a platformer game and recently changed how music works. Currently the method is a bit overkill for what I need as right now I'm not using any specific looping points for anything but I have it in place since I plan to use that once I write better music for it. The problem I'm running into now is extremely unusual: after about 5-10 minutes of playing the game randomly stops playing music and some sound effects at random. This seems like I've got a memory leak somewhere but I can't track down where, and task manager doesn't seem to be indicating a high enough memory usage for that, so I'm at a loss as to what to do. I've attached the version of the game this is an issue with, just jump into any level (you can type "colours" on the main menu and click "ulock" to force all levels to be unlocked) and play for a while, switch screens a bunch to speed up the process. I've tried isolating this problem and I have no idea what's causing it, so if anyone has some insight that would be great.
Last edited by DTmg on Fri Oct 25, 2024 7:37 am, edited 1 time in total.
RNavega
Party member
Posts: 385
Joined: Sun Aug 16, 2020 1:28 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by RNavega »

Hi, I'm on my phone so I couldn't try your demo.
The only time I got this kind of mysterious bug where it would fail at random points each time I ran my program, it ended up being because of interactions between garbage collection and the FFI.

The solution was to store all FFI objects into a table -- into either the indices or keys, it doesn't matter. This prevented any of those objects from being collected while the code used them or used other objects created using them.

But in my case the program would actually crash, not just misbehave.
DTmg
Prole
Posts: 16
Joined: Tue Apr 18, 2023 12:47 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by DTmg »

Yeah I've had issues with FFI before, but I'm not using any FFI for my game here (mainly to keep cross platform easy)
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by BrotSagtMist »

Nice game, not the stuff i like to play tho.
I seem to be unable to trigger any bugs. Where yourself able to trigger it on more than just your own box?
obey
DTmg
Prole
Posts: 16
Joined: Tue Apr 18, 2023 12:47 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by DTmg »

I've gotten it to trigger on one other machine so far, so not a lot of variety, but this wasn't happening before at all when I was just playing the sound directly.
RNavega
Party member
Posts: 385
Joined: Sun Aug 16, 2020 1:28 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by RNavega »

Wow, this is really well made, great work.
I thought it was going to be just a standalone test to find the bug, not a full playable demo.

I managed to play this long/far:

temp.png
temp.png (42.34 KiB) Viewed 14319 times

I ran it with Love 11.4 on my notebook from 2015, it's Windows 8.1 x64, hard disk drive.
No problems with music, sound or other things, everything played fine.
DTmg
Prole
Posts: 16
Joined: Tue Apr 18, 2023 12:47 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by DTmg »

Dang it might just be me then, I don't know. It happened most often while I was using the level editor, so I'm not sure if that's connected in any way, but thanks for testing it anyway, worried I might have to rewrite the music system now...
DTmg
Prole
Posts: 16
Joined: Tue Apr 18, 2023 12:47 pm

Re: Sound and music cut out after a while for no apparent reason.

Post by DTmg »

I'm not sure what was causing it but after changing a seemingly unrelated part of the code it magically stopped? So, consider this solved I guess, still have no idea what has caused it.
User avatar
knorke
Party member
Posts: 274
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: Sound and music cut out after a while for no apparent reason.

Post by knorke »

I played the first handful of levels and then left the game running for half an hour.
The music still played.
(Linux Mint on an older Thinkpad with love 11.4)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 7 guests