haxenme / nme

A cross-platform native backend for Haxe projects
MIT License
480 stars 123 forks source link

SDL can't find audio target #501

Open ibilon opened 7 years ago

ibilon commented 7 years ago

With haxelib run nme demo 16 cppia I get (and a quick flash of opening and closing window):

Running command: RUN
 chmod u+x /home/ibilon/Code/nme/bin/Linux/Acadnme/Acadnme
 - Changing directory: /home/ibilon/Code/nme/bin/Linux/Acadnme
 ./Acadnme /home/ibilon/16-Memory/cppia/Sample16/Sample16.nme
Could not initialize SDL : Audio target 'pulse' not available
Acadnme.hx:227: Run file /home/ibilon/16-Memory/cppia/Sample16/Sample16.nme
Could not open sound: Audio target 'pulse' not available
Error : Null Function Pointer

the used target can be changed with the SDL_AUDIODRIVER env var, for instance SDL_AUDIODRIVER=alsa haxelib run nme demo 16 cppia. But I can't find one that work, most likely I'm missing something.

Not sure if NME can do something about that? No idea how SDL work, but I guess it's used by at least one of the games I play, which don't have any issue about that.

Small thing but that would be awesome if the Error : Null Function Pointer could not be printed (it is with cppia but not linux), at first I thought it was an error with the code and not my os.

ibilon commented 7 years ago

Tried some things, I found that if you do SDL_InitSubSystem (SDL_INIT_AUDIO) separately instead of within SDL_Init it allows the application to keep running (without sound if it doesn't init ofc). But only on cppia not cpp.

cppia:

Error creating sound from  157279 bytes
Lib.hx:91: Error creating window: ({ width => 640, height => 480, flags => 12, title => Acadnme, icon => null, color => 16777215 })
Not Sound
NME done.

The changes: https://pastebin.com/BpEfihed

@hughsando what's your though on allowing an app to run without sound support?

hughsando commented 7 years ago

Better than nothing I guess, but I might be able to get to the bottom of why there is no sound.