Facepunch / garrysmod-issues

Garry's Mod issue tracker
145 stars 56 forks source link

Strange bugs and sound gliches with IGModAudioChannel and workshop #3259

Open glebqip opened 7 years ago

glebqip commented 7 years ago

Details

BASS library very much (because we need positional sound). Our sounds were placed in addon folder and all be fine. When we sent all sounds to the workshop and started using it, we got random strange sound behavior (for example, it must play sounds / testsound / sound1 but we heard sounds / testsound / sound2 from the same folder, and in debug prints we have that played sounds/testsound/sound1). Also after we uploaded all sounds to workshop, we got some random BASS BASS_ERROR_UNKNOWN errors when sound creates with errorcode 41. Maybe it

Steps to reproduce

Find any workshop addon with some sounds in 1 folder. Run this code:

timer.Create("TestSound", 0.5, 100, function()
    sound.PlayFile("sound/from/workshop/1.mp3", "3d noplay mono", function(snd, err, errName)
        if not err and (IsValid(snd)) then
            timer.Simple(0, function()
                snd:SetPos(LocalPlayer():GetPos())
                snd:Set3DFadeDistance(500, 1000)
                snd:SetVolume(0.5)
                snd:EnableLooping(false)
                snd:SetPlaybackRate(1)
                snd:Play()
                LocalPlayer():ChatPrint("Player main sound " .. tostring(snd))
            end)
        end
    end)
end)

timer.Create("TestSound2", 0.4, 100, function()
    sound.PlayFile("sound/from/workshop/2.mp3", "3d noplay mono", function(snd, err, errName)
        if not err and (IsValid(snd)) then
            timer.Simple(0, function()
                snd:SetPos(LocalPlayer():LocalToWorld(Vector(0, 20, 0)))
                snd:Set3DFadeDistance(60, 1000)
                snd:SetVolume(0.5)
                snd:EnableLooping(false)
                snd:SetPlaybackRate(1)
                snd:Play()
            end)
        end
    end)
end)

timer.Create("TestSound3", 0.6, 100, function()
    sound.PlayFile("sound/from/workshop/3.mp3", "3d noplay mono", function(snd, err, errName)
        if not err and (IsValid(snd)) then
            timer.Simple(0, function()
                snd:SetPos(LocalPlayer():LocalToWorld(Vector(0, -20, 0)))
                snd:Set3DFadeDistance(60, 1000)
                snd:SetVolume(0.5)
                snd:EnableLooping(false)
                snd:SetPlaybackRate(1)
                snd:Play()
            end)
        end
    end)
end)

You will hear, that in some plays sound 1 has be broken/replaced.

I run lua code with chatsounds workshop addon and got this: https://youtu.be/u8Kx61yNpHY

I changed code to play 3 sounds simultaneously and got more strange behavior: https://youtu.be/fStS1nXFyUo

willox commented 7 years ago

This might be related to #3210, but I can't reproduce it. Can you try again using the same sounds you tested this with originally on the dev branch.

If it's still happening, post a link to the workshop addon containing the sounds if possible.

glebqip commented 7 years ago

Tested my script in dev version - still have random sound file misses, but i don't get BASS_ERROR_UNKNOWN and sound gliches in my addon.

glebqip commented 6 years ago

No, i moved to workshop version of addon and again it gives me BASS_ERROR_UNKNOWN and mechanical noise in random sounds with last dev branch update

Grocel commented 6 years ago

There is a new version of BASS. Supposedly it has fixed those BASS_ERROR_UNKNOWN problems with some file formats. (https://github.com/Facepunch/garrysmod-requests/issues/1071)

Grocel commented 6 years ago

To investigate this issue and #3401 further could you also try to reproduce it with gm_bass3 installed (using the BASS3.PlayFile() function) and tell me if you get the same results? https://gmod.facepunch.com/f/gmodaddon/jina/gm-bass3-A-cross-plattform-shared-Lua-API-to-BASS/1/

In your error description you told us that it would just print sound1 but not sound2 or 3. Your example code can just prints sound1 as the other both callback function do not have any print calls, Maybe you should adjust that code for better testing.

By the way I'm not sure if the above code does what you intended to do, because the timer.Create calls look like they would just cause a hell of a noise. I wouldn't be able to tell if everything sounds right or not. If you want to use a delay in each cycle you should just work with timer.simple calls inside the first timer.Create.