ID:1421245
 
Resolved
Sounds played before being loaded by the client did not preserve their other settings.
BYOND Version:501
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Chrome 30.0.1599.101
Applies to:Dream Seeker
Status: Resolved (502.1218)

This issue has been resolved.
Descriptive Problem Summary:
New sounds added to the cache will play at a louder volume and in the wrong channel.

Numbered Steps to Reproduce Problem:
For Loud Volume :
1.) Play a song/sound, for the first time to add it to the cache.
2.) Then play the sound again, and it will be the regular volume written after its in the cache.

For Wrong Channel :
1.) Have 2 different songs and play them on the same channel, they will overlap.

Delete the cache to retry the problem.

When does the problem NOT occur?
When the song/sound is already in the cache

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? I remember this problem since I started working with BYOND.
It will be easier to investigate this with a code snippet. Your instructions were a little light on detail. Also I need to ask: Does this happen only with MIDI files, or does it happen with other sounds, or both? They're treated differently, so this distinction matters.
So sorry, the code is the whole reason this happen...

I've tested with MIDI, WAV, and OGG. The problem happens the same on all of them.

And this is the code that handles the music stuff. The Louder Volume and Wrong Channel problems only happen with these.
        ChangeBGM(mob/P, file, volume, R)
P.BGM_file = file
P.BGM_vol = volume
var/tmp/sound/S = sound("[P.BGM_file]", R,channel = 5,volume = P.BGM_vol)
src << S

Here is a game that shows the problem.
https://www.dropbox.com/s/73s22nsxgvdbkdt/alien%20city.rar

All the sound handling stuff that I use is in the soundstuff.dm, and the music is in the BGM folder.

To see all the problems
1.) run the game
2.) get near the boss
the sounds will overlap, then when the sounds are in the cache
3.) run the game again and get near the boss
it will play like normal (and the sounds should be softer)

To retry reproducing, delete the cache.
This was a terrific find. This has existed forever.

Basically, in the olden days BYOND sounds didn't worry so much about channels or other stuff. They did have channels but it was very limited. As a result our code was written so that when a sound request came in and the sound wasn't ready, it just set one of two vars saying a sound needed to play: one for an infinitely repeating sound, one for a one-time sound. But it retained no other information, like channel or volume. Your demo triggered the bug in such a way that two sounds played on top of each other when they were supposed to be on the same channel.

I've altered the code to use a proper queue. Now the sound's info is preserved entirely until it comes in, so it can start playing with the correct settings.
Ahh I see. Thankyou so much for you're help again Lummox JR! I'm looking forward to the update!
So sorry! I forgot to post back!! >_<

This glitch was fixed on update 1218, thankyou so much Lummox Jr!
Lummox JR resolved issue with message:
Sounds played before being loaded by the client did not preserve their other settings.