Sound problems with SDL Audio
#11
Yes I will but I don't have much info to give besides "it worked before". I should probably test with another SDL2 application that has sound.

I looked at the difference between SDL2.0.3 and 2.0.4 and seems like this a major release with 22 months of commits difference between the two... Smile https://hg.libsdl.org/SDL

Code:
5 days ago     release-2.0.4
22 months ago     release-2.0.3
Reply

Sponsored links

#12
A regression is already an information. Maybe they just broke the API. We used to have bad sound due to a not cleared buffer after the SDL1->SDL2 port. Maybe somethings change again.

The number of commit in the sound section is likely much lower. And you could bisect the issue (time to learn how to compile SDL Wink ).
Reply
#13
Yea, it could be not so bad, if I'm looking in the right place:

https://hg.libsdl.org/SDL/log/e12c387305...lseaudio.c
https://hg.libsdl.org/SDL/log/e12c387305...lseaudio.h

Compiling is no problem, I was early Gentoo adopter (in 2002, Gentoo glory days) Tongue2 And funny thing is lib32-sdl2 already gets compiled on our system for us Arch users, because it's not in standard Multilib repos, so it's actually needs to be build via AUR Smile I think this is because pcsx2 in Arch official repos is quite old and only has deps to SDL1.2 and no other multilib applications need lib32-sdl2 (yet).
Reply
#14
So all is well Tongue2
Reply
#15
For future reference: https://bugzilla.libsdl.org/show_bug.cgi?id=3228

If any one can try adding their experience with libsdl 2.0.4 and spu2x settings as in the screenshot ^, it would be appreciated!
Reply
#16
If it can help, you can post this file https://github.com/PCSX2/pcsx2/blob/mast...ut_SDL.cpp

The file is rather small and I think we only use the SDL_MixAudio function from SDL (i.e. to play sound).

Good jobs Smile
Reply
#17
Added Smile

Meanwhile I was playing with some code I found online, because I was bored and maybe to solve this problem. And I use this code:

https://paste.debian.net/364673/

( the wav from http://download.wavetlan.com/SVV/Media/HTTP/HugeWAV.wav )

And well this works perfectly on my system with 2.0.4. (I compiled with -m32 also just to be sure). So the only thing spu2x does differently (I think, because I can't read C++ code at all), is read from buffer instead of this SDL_delay call (which makes sense since in pcsx2 you have continuous audio). But well with this code I can't reproduce the bad sound. So maybe we should zoom in on callback_fillBuffer. Of course I could be on the wrong track here.
Reply
#18
Callback mechanism is much more efficient. Anyway, yes I know the issue is on the callback. That the only SDL code called (remaining is open/close). Hum, did you try a debug build, in case there is an issue with the assertion.

Code:
    void callback_fillBuffer(void *userdata, Uint8 *stream, int len) {
        // Length should always be samples in bytes.
        assert(len / sizeof(StereoOut_SDL) == samples);
#if SDL_MAJOR_VERSION >= 2
        memset(stream, 0, len);
#endif

        for(Uint16 i = 0; i < samples; i += SndOutPacketSize)
            SndBuffer::ReadSamples(&buffer[i]);
        SDL_MixAudio(stream, (Uint8*) buffer.get() , len, SDL_MIX_MAXVOLUME);
    }
As you can see, code read SPU2X sound data and then mix them into the SDL stream buffer. Nothing more.
Reply
#19
I confirm this problem, downgrading sdl2 also fixed it for me.
Reply
#20
(01-19-2016, 07:03 PM)mac1202 Wrote: I confirm this problem, downgrading sdl2 also fixed it for me.

Interesting, I was waiting for another confirm, what distro are you using?

@gregory: Still have to try a DEBUG build to see if the assert triggers or not, I'll let you know.
Reply




Users browsing this thread: 1 Guest(s)