ID:2133184
 
(See the best response by Nadrew.)
Problem description:How do you delete a sound while it's playing?

playing a null sound stops it from playing but doesnt seem to delete

Best response
Sounds that aren't referenced by anything will eventually be garbage collected.
how do i un-reference it from a client? whenever i save and have a sound playing i get a runtime saying bad output
How are you playing sounds, if you're storing them in a non-tmp variable, you're obviously going to run into issues. I've never had any issues with saving causing issues when sounds are being played (MLAAS has sounds playing all the time and saves on an automatic loop with no issues)
    dead=1
animate(src,pixel_y=260,alpha=20,time=300)
src << 'BgmInDeath - play when dead.ogg'
sleep(300)
if(src)...

i have something set so if someone logs out while dead is set to 1 then it replays this. logging out saves your char and when you logout the runtime comes. it also comes when you save only AFTER this has replayed because you logged out while this was playing then logged back in. but if u save while its playing normally i.e. when you dont logout then back in while this is going on then no run times come when you save.
Have you tried using sound(), or the /sound datum to handle the sound?

There's really nothing there that would indicate a problem, though. The issue goes away entirely if you comment out just that single line? Might be an issue with the system you use for saving, and not an issue with the sound.

"Bad output" is usually caused by trying to output something to something that can't do anything with it (or null), so what I imagine is happening is that you're trying to use "<<" somewhere after the client has stopped existing, playing a sound to a mob without a client isn't going to work so well.
Yea it doesn't happen when i take out the line with sound. I just tried the sound datum and the issue is still there. I had the sound proc in before and thought switching to what i have now would maybe fix but it didn't.

my save system is pretty basic though
mob/player/Write(var/savefile/F)
src.RemoveHair()
var/oldIcon=src.icon;var/oldcolor=src.color;var/list/oldOverlays=src.overlays.Copy();var/oldBaseI=src.BaseIcon
src.overlays=null;src.icon=null;src.BaseIcon=null
src.color=null
..()
src.overlays=oldOverlays;src.icon=oldIcon;src.BaseIcon=oldBaseI;src.RebuildHair()
src.color=oldcolor
mob/proc//idunno how to tab on forums
SaveK()
if(src.cansave)
var/savefile/F = new("Saves/[src.ckey].sav")
if(!src.tosenBalloon)
src.xco=src.x
src.yco=src.y
src.zco=src.z
F << src
src<<"<b><font color=red>Your game has been saved."
Try adding an "if(client)" before trying to output the sound. The only thing I can do to make the error pop up consistently is trying to play a sound to a non-client.
Didn't work. ill just save before this starts and stop the game from saving till after
Actually this is gunna be really annoying, if i run into it again, when i add music
There's definitely something wrong happening here, but it's not really easy to pinpoint what. The fact that it happens even after the sound stops playing indicates something is hanging around that shouldn't be. You might need to boil it down into the most basic test case you can and see if it can be debugged from there. Have you tried with other types of sound files?
player dies - music plays wait 30seconds - song finishes and player undies - can save fine afterwards and during. but if a player logs out while the music is playing then bad output run time. you save when you logout.

if player logs out while music playing(when there dead) then when they log back in music plays but this time every time you try to save you will get a bad output runtime and when you try to relog you will also get the same bad output run time (you save on log out)
yikes.. looks like this was a big waste of time as it wasnt even related to the sound

it's related to my save system i guess
i'm guessing that sleep was locking the save or something cause when i switched it to a spawn i could save just fine with the music