• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM File IO Causing Crash

S

Sr101

Guest
Hey guys. I'm making a music game.

My background music uses audio streams. I open and close them when I need them.
My sounds also use the audio_sound_play function, but never have a stream so they aren't closed.

For some reason, when I leave the room with all the objects, even if I don't terminate all the sounds with
audio_stop_all()... it crashes my game and gives me all these errors in the compiler

audio_destroy_stream : Invalid stream id: 44
audio_destroy_stream : Invalid stream id: 29
audio_destroy_stream : Invalid stream id: 13
audio_destroy_stream : Invalid stream id: 7

It's finicky, though, sometimes this won't happen. If i wait until the only thing playing is the BGM, it doesn't do this (99.9% of the time).

I've been working on this game for 4 months, so there's a chance I screwed something up somewhere and can't remember. Can anyone give me some tips on what may be causing this? Thanks!

EDIT: I also never noticed this issue until I rebooted GMS the other day... I've been testing non-stop for months :/ I should also mention I have multiple Level Initializers with identical code... yet only some do this?
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
You seem to be trying to destroy the streams more than once. Make sure to keep track of what is destroyed and what isn't. Also watch out to not accidentally place controller object instances twice.
 
S

Sr101

Guest
You seem to be trying to destroy the streams more than once. Make sure to keep track of what is destroyed and what isn't. Also watch out to not accidentally place controller object instances twice.
Ah, will check this! Would a destroy_all possibly be causing a conflict with a manual close?

Also: is there a way to match a sound with it's "stream id"? this would be very helpful for debugging

Okay, I just tried an old compiled build from a month ago. Nothing has changed with the code, yet now it crashes. Would any updates have caused this?

It may actually be an IO issue. Larger files (the note data is stored in txt files) are causing crashes as well.
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
There is no function to destroy all audio streams, so...

If it theoretically exists, yes, deleting everything and then trying to delete some more would cause issues.
 
S

Sr101

Guest
Ah so, here's a better explanation. I play sounds with audio_play_sound

I shouldn't have to close those... right?
 
S

Sr101

Guest
Still crashing :/ if i change the text file loaded to another one... it works? The text code is uniform... so what gives? :(

EDIT:
it IS the files! some are 3kb and some are 4kb. The 4s ALWAYS crash! Why? I close them after reading...
Edit:
It isn't the size... it must be another issue with what is in the file....

EDIT: Memory usage:
Total memory used = 666188380(0x27b53a5c) bytes
 
Last edited by a moderator:
Top