ID:1903618
 
(See the best response by Kaiochao.)
Error:
source file: soundmob.dm,53
usr: null
src: /soundmob (/soundmob)
call stack:/soundmob (/soundmob): New(null, 0, null, 1, 0, 100)
Special1 (/mob/players/Special1): Read(players/a/aerproductions.sav (/savefile))
AERProductions (/client): base LoadMob("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Topic("menu=choosing_character;choice...", /list (/list))

runtime error: C:/Users/root/Documents/BYOND/lib/koil/soundmob/soundmob.dm:85:Assertion Failed: mob.client

proc name: updateListener (/soundmob/proc/updateListener)
source file: soundmob.dm,85
usr: AERProductions (/mob/creating_character)
src: /soundmob (/soundmob)
call stack:/soundmob (/soundmob): updateListener(AERProductions (/mob/creating_character))
AERProductions (/mob/creating_character): updateListeningSoundmobs()
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null)
AERProductions (/mob/creating_character): Read(players/a/aerproductions.sav (/savefile))
Special1 (/mob/players/Special1): Read(players/a/aerproductions.sav (/savefile))
AERProductions (/client): base LoadMob("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Topic("menu=choosing_character;choice...", /list (/list))


Problem description: I'm using Koil's Soundmob library to produce sound effects for Pondera. Unfortunately, not being a top notch programmer I am unable to figure out how to delete the sounds/clean them up during save/load/when someone quits and thus I am getting a runtime error. If you could please assist me in this it would be appreciated.

Best response
Your first runtime error is cut off; runtime errors always start with "runtime error".

It doesn't seem like Koil's Soundmob library is available anymore, but it looks like all the errors are happening in it, which means you're probably using it wrong; we just have to figure out how.

The second error says an assertion failed on mob.client. This means mob.client doesn't exist. According to the call stack, this is occurring right after you load a mob from a savefile. It's possible that you're calling updateListeningSoundmobs() on your /mob/creating_character when you should instead be calling it on the loaded mob, since your client may have already switched over to it.
Thanks for your response, unfortunately I can't seem to get a full runtime error as that was the log output and the in-game chat seems to cut it off. I can pack the library and upload it for you if you'd like (https://www.sendspace.com/file/asdq8j). I believe you're correct about the problem and I know that I am not using it 100% correct but I also do not know how to 100% utilize it either!
Progress in Pondera has been some-what mediated as my process requires Exploratory measures! I'm not a great programmer.
The whole purpose of the library was to add sound to moving mobs, but I am using it for all sound effects (including stationary things).
I'm starting to think that perhaps I should just disable the sound in the game for now so that I can keep working on releasing to the public.
Here is the full runtime error:
runtime error: C:/Users/xxxxxx/Documents/BYOND/lib/koil/soundmob/soundmob.dm:50:Assertion Failed: _attached && _file && _radius
proc name: New (/soundmob/New)
source file: soundmob.dm,50
usr: null
src: /soundmob (/soundmob)
call stack:
/soundmob (/soundmob): New(null, 0, null, 0, 0, 100)
Special1 (/mob/players/Special1): Read(players/a/aerproductions.sav (/savefile))
AERProductions (/client): base LoadMob("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Topic("menu=choosing_character;choice...", /list (/list))
runtime error: C:/Users/xxxxxxx/Documents/BYOND/lib/koil/soundmob/soundmob.dm:82:Assertion Failed: mob.client
proc name: updateListener (/soundmob/proc/updateListener)
source file: soundmob.dm,82
usr: AERProductions (/mob/creating_character)
src: /soundmob (/soundmob)
call stack:
/soundmob (/soundmob): updateListener(AERProductions (/mob/creating_character))
AERProductions (/mob/creating_character): updateListeningSoundmobs()
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null)
AERProductions (/mob/creating_character): Read(players/a/aerproductions.sav (/savefile))
Special1 (/mob/players/Special1): Read(players/a/aerproductions.sav (/savefile))
AERProductions (/client): base LoadMob("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Topic("menu=choosing_character;choice...", /list (/list))
runtime error: C:/Users/xxxxxx/Documents/BYOND/lib/koil/soundmob/soundmob.dm:82:Assertion Failed: mob.client
proc name: updateListener (/soundmob/proc/updateListener)
source file: soundmob.dm,82
usr: AERProductions (/mob/creating_character)
src: /soundmob (/soundmob)
call stack:
/soundmob (/soundmob): updateListener(AERProductions (/mob/creating_character))
AERProductions (/mob/creating_character): updateListeningSoundmobs()
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null, 0)
AERProductions (/mob/creating_character): Move(null)
AERProductions (/mob/creating_character): Read(players/a/aerproductions.sav (/savefile))
Special1 (/mob/players/Special1): Read(players/a/aerproductions.sav (/savefile))
AERProductions (/client): base LoadMob("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("AERProductions")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Topic("menu=choosing_character;choice...", /list (/list))


My apologies for not posting it before.
P.S. Everything still works even with this runtime error. Saving and loading still functions and the sound still works. I am thinking it has something to do with how I am using this "movable atom" sound lib for even stationary objects and it probably isn't being cleaned up properly for the garbage handler.
Here is the soundmob for line 50 and 82 errors:
soundmob
var
atom/movable/attached = null
list/listeners = null

file = null
autotune = FALSE
channel = 0

radius = 0

volume = 100
frequency = 0
pan = 0

priority = 0

environment = -1
list/echo = null

New(atom/movable/_attached, _radius = 0, _file, _autotune = FALSE, _channel = 0, _volume = 100)
Line50 ASSERT(_attached && _file && _radius)

attached = _attached

if(_file) file = _file
if(_radius) radius = _radius
if(_autotune) autotune = _autotune
if(_channel) channel = _channel
if(_volume) volume = _volume

_attached._attachSoundmob(src)

if(autotune) _addAutotuneSoundmob(src)

Del()
attached._detachSoundmob(src)
if(autotune) _removeAutotuneSoundmob(src)
unsetListeners()

proc
broadcast(target = world)
for(var/mob/mob in target) if(mob.client) mob.listenSoundmob(src)

unsetListeners()
if(listeners) for(var/mob/mob in listeners) unsetListener(mob)

updateListeners()
if(listeners) for(var/mob/mob in listeners) updateListener(mob)

updateListener(mob/mob)
ASSERT(attached)
ASSERT(mob)
Line82 ASSERT(mob.client)
ASSERT(src in mob._listening_soundmobs)

if(!mob._listening_soundmobs[src])
var/sound/s = new(file)
mob._listening_soundmobs[src] = s

var/sound/sound = mob._listening_soundmobs[src]

if(!sound.channel) sound.channel = mob._getAvailableChannel()
if(!(sound.channel in mob._channels_taken)) mob._lockChannel(sound.channel)

sound.repeat = TRUE

// I'm not using sound.x, y, and z because you aren't really able to set a maximum distance using those.
// You're always able to hear the sound atleast a little regardless of how far it is away.
// This could probably be improved a bit.

if(mob.x == attached.x) sound.pan = 0
if(mob.x > attached.x) sound.pan = -75
if(mob.x < attached.x) sound.pan = 75

var/distance = sqrt((mob.x - attached.x) * (mob.x - attached.x) + (mob.y - attached.y) * (mob.y - attached.y))
sound.volume = volume - (distance / radius * volume)

sound.frequency = frequency

sound.priority = priority

sound.environment = environment
sound.echo = echo

sound.status = SOUND_UPDATE

mob << sound

setListener(mob/mob)
ASSERT(mob.client)

if(!(mob in listeners))
if(!listeners) listeners = list()
listeners += mob

updateListener(mob)

unsetListener(mob/mob)
if(mob in listeners && src in mob._listening_soundmobs)
var/sound/sound = mob._listening_soundmobs[src]

for(var/i = sound.volume, i >= 0, i --)
sound.status = SOUND_UPDATE
sound.volume = i

mob << sound

sleep(1)

mob << sound(null, 0, 0, sound.channel)
mob._unlockChannel(sound.channel)

listeners -= mob
if(!length(listeners)) listeners = null




An example of how I am using the lib:
snd
parent_type = /mob
Read()
return
Write()
return
sfx
Read()
return
Write()
return
waves
icon = 'blank.dmi'
New()
..()
soundmob(src, 30, 'snd/waterfall.ogg', TRUE, 0, 80)
The read and write returns are me trying to fix the problem, haha.
When you load your player, a /soundmob gets loaded with bad arguments to New(). You should mark all of your soundmob-typed variables (e.g. mob/var/soundmob/my_soundmob) as tmp (e.g. mob/var/tmp/soundmob/my_soundmob).
Of course! I forgot about tmp, I will make the change, test, and edit this post with the result. Thanks!

No success so far.
Any hints?...
I suppose the real question is, can I even utilize the library this way? I removed the sound from the water and there are no runtime errors so clearly it is just the way I am using this library.
I would really like to modify it so that it will function the way I need it to. It really does add an extra level of depth and immersion to the game. Wondering if the built in sound is just as advanced or not? Does it have directional 3D positional sound? If so, perhaps I can just use it instead.
I can't figure out what exactly to make tmp, nothing I have tried produces results.


EDIT:
I have managed to reproduce this error with the library itself by placing a static crow, hosting the world and logging out.
runtime error: soundmob.dm:86:Assertion Failed: mob.client
proc name: updateListener (/soundmob/proc/updateListener)
usr: the crow (/mob/crow)
src: /soundmob (/soundmob)
call stack:
/soundmob (/soundmob): updateListener(AERProductions (/mob/player))
/soundmob (/soundmob): updateListeners()
the crow (/mob/crow): updateAttachedSoundmobListeners()
the crow (/mob/crow): Move(the turf (1,16,1) (/turf), 1)
the crow (/mob/crow): Move(the turf (1,16,1) (/turf), 1)
the crow (/mob/crow): movementLoop()
the crow (/mob/crow): New(the turf (10,10,1) (/turf))


Seems that the library isn't setup for stationary soundmobs. Is there a way around this? Tmps on vars, but which vars? I can't figure it out. Perhaps that is the reason the library wasn't available anymore: Fatal Flaws?
Sorry to bump again but I would really like to have this Library function the way I need it to for Pondera.
Everything works fine, the functions just need cleaned up somehow (some loose end needs tied I guess).

Is anyone interested in attempting to facilitate a fix for this library? Please, I would much rather I release the game with a little bit of sound, instead of no sound at all. I suppose I could just put up with the runtime errors but that really isn't how I roll.

Koil's Soundmob Library: https://www.sendspace.com/file/asdq8j
(I did try contact Koil but he doesn't come online so I don't know what to do about that)

Please help this project get off of the ground.

Edit: This runtime error has been corrected by Misticone.
Thank you! Very grateful and appreciated.