Pulseaudio device detection

Hi all

I’ve just run into the issue where SDL doesn’t detect devices using
pulseaudio (
https://hg.libsdl.org/SDL/file/1a1ec75b608c/src/audio/pulseaudio/SDL_pulseaudio.c#l542
)

Doing some digging, I came across
https://bugzilla.libsdl.org/show_bug.cgi?id=2730 . Now, I can see that this
patch isn’t brilliant (codestyle, tabs vs spaces, etc), but if I improve
it, is there a reasonable chance of getting it included upstream?

Thanks,

Charles

PS: I notice the Source snapshot hasn’t been updated in over a month, is
there a reason for that?

Doing some digging, I came across
https://bugzilla.libsdl.org/show_bug.cgi?id=2730 . Now, I can see that
this patch isn’t brilliant (codestyle, tabs vs spaces, etc), but if I
improve it, is there a reasonable chance of getting it included upstream?

That specific patch is sort of big and scary, but the functionality is
absolutely appropriate for inclusion. However, we really want to get
2.0.4 finished and I’d be nervous about changes to that code, since
introducing a bug there basically hoses all Linux users.

But we can put it in right after 2.0.4 ships!

–ryan.

PS: I notice the Source snapshot hasn’t been updated in over a month, is
there a reason for that?

Btw, this link is always the latest source code in revision control,
converted on the fly to a .zip file for you:

 https://hg.libsdl.org/SDL/archive/default.zip

(.tar.bz2 and .tar.gz work too).

–ryan.

Hi,

thanks for looking at my patch. It didn’t feel that much of a change when I created it.
For me SDL with my fix works well since august Mint Linux x86_64 + Pandaboard Ubuntu (Just as information, not intended as recommendation for adding it in 2.0.4).

As for the codestyle: What is the wanted SDL2 codestyle, I did not find any recommendations (I will update my eclipse auto-formatter).
I also thought about adding the same functionality to alsa, but wanted to wait if my first patch is accepted or not.

br------------------------
void (*segfault)(void) = 0;
int main(int argc, char **argv){segfault(); return 0;}
//Should not work, but does what told :slight_smile:

Hi,

I’m not entirely sure what the recommended codestyle is either - I just
looked at the existing code! Which basically seems to be - 4-spaces as
indentation, "if (…) {"
I’m also not a fan of the ThreadInit method - it loses debugging
information and just gives an “out of memory” error, which may not be the
case. (Also, the method names (for DeInit as well) don’t really describe
very well what the function does, imo).
There’s also some code that is (very nearly) duplicated in
PULSEAUDIO_OpenDevice

As I don’t know much about the PulseAudio API, I did some searches and came
across the following, maybe they are useful? Some of them seem a bit
cleaner than your solution.
http://www.ypass.net/blog/2009/10/pulseaudio-an-async-example-to-get-device-lists/
http://jan.newmarch.name/LinuxSound/Sampled/PulseAudio/palist_devices.c

Hope I’m not being too harsh :slight_smile:

CharlesOn 12 February 2015 at 11:41, Charles Pigott <@Charles_Pigott> wrote:

---------- Forwarded message ----------
From: dfrizel <dominik.frizel at gmx.at>
Date: 12 February 2015 at 09:08
Subject: Re: [SDL] Pulseaudio device detection
To: sdl at lists.libsdl.org

Hi,

thanks for looking at my patch. It didn’t feel that much of a change when
I created it.
For me SDL with my fix works well since august Mint Linux x86_64 +
Pandaboard Ubuntu (Just as information, not intended as recommendation for
adding it in 2.0.4).

As for the codestyle: What is the wanted SDL2 codestyle, I did not find
any recommendations (I will update my eclipse auto-formatter).
I also thought about adding the same functionality to alsa, but wanted to
wait if my first patch is accepted or not.

br


void (*segfault)(void) = 0;
int main(int argc, char **argv){segfault(); return 0;}
//Should not work, but does what told [image: Smile]


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It’s not to harsh for me
I’ll probably have some time this weekend to make some improvements (and maybe start with the ALSA implementation)

:)------------------------
void (*segfault)(void) = 0;
int main(int argc, char **argv){segfault(); return 0;}
//Should not work, but does what told :slight_smile:

I just put something based on your patch in revision control, so it will
ship with 2.0.4, thanks!

 https://hg.libsdl.org/SDL/rev/8d26d736af94

–ryan.On 2/12/15 5:29 PM, dfrizel wrote:

It’s not to harsh for me
I’ll probably have some time this weekend to make some improvements (and
maybe start with the ALSA implementation)