• HomeBoards
  • RulesRules
  • HelpHelp
  • WikiWiki
  • Donate

Author Topic: SDL Audio  (Read 5683 times)

DiegoSLTS (OP)

  • Posts: 365
SDL Audio
« on: February 24, 2012, 10:33:04 pm »
I'm trying to port an app to OpenDingux that uses SDL for video and audio, and I'm having problems with audio. In the wiki i found that "As the integrated SDL library has been compiled to use ALSA, all the programs which are using SDL for sound should work just fine on OpenDingux", but I just have segmentation faults. If I use SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO); it crashes there, if I remove SDL_INIT_AUDIO it keeps working until it reaches SDL_OpenAudio(&desired, &obtained).

I'm not really sure if the SDL_INIT_AUDIO is needed (in my pc the game works the same with or without it).

I tried to change the library, using libAO, but SDL uses a "callback" method that libAO doesn't have, and I don't want to reimplement that method with semaphores or something like that.

Any ideas? Does SDL audio work? Would it work in the final release of OD?

pcercuei

  • Posts: 1709
    • My devblog
Re: SDL Audio
« Reply #1 on: February 25, 2012, 01:15:59 am »
SDL audio has always been working fine, you're using developer version 2?

Oh, and make sure you're not linking statically, that could explain your problem.
« Last Edit: February 25, 2012, 01:47:40 am by Ayla »

DiegoSLTS (OP)

  • Posts: 365
Re: SDL Audio
« Reply #2 on: February 26, 2012, 03:43:31 am »
Thanks, it wasn't the static linking, but knowing that SDL sound should work I found that I wasn't using the toolchain in the right way. Now it works fine.

protomank

  • Posts: 96
    • Rockbot Game Engine
Re: SDL Audio
« Reply #3 on: July 24, 2012, 01:55:12 pm »
Hey Diago, can you please tell me how you solved this?
My game, built for Dingux, does not have audio in openDingux even if it only uses SDL_Audio and SDL_Mixer. I tryied to build it using the opendingux toolchain/libraries, but the result was the same (probally I need to completaly clean my toolchain enviroenment).
Rockbot Lead game designer.

DiegoSLTS (OP)

  • Posts: 365
Re: SDL Audio
« Reply #4 on: July 24, 2012, 04:26:18 pm »
I have the toolchain uncompressed in /opt, then in the Makefile I put something like this:

Quote
TOOLCHAIN = /opt/opendingux-toolchain
BINDIR = $(TOOLCHAIN)/usr/bin
CXX = $(BINDIR)/mipsel-linux-g++
etc ...

Or you can add /opt/opendingux-toolchain/usr/bin to your PATH environment variable and ignore the TOOLCHAIN line. Also, I had to go in some folders of the toolchain to set the permissions of the executables because "make" couldn't execute them.

Then, for SDL you have to use sdl-config to get the available flags, but if you use only 'sdl-config --cflags' it runs the sdl-config file from your OS. What I had to do is this:
Quote
SDL_CFLAGS = `/opt/opendingux-toolchain/usr/bin/sdl-config --cflags`
SDL_LIBS = `/opt/opendingux-toolchain/usr/bin/sdl-config --libs`

That way it runs sdl-config from the toolchain and gets the correct flags. That solved my sound problem, hope it works.

Another option is opening "/opt/opendingux-toolchain/usr/bin/sdl-config" from the toolchain in a text editor and look there what's returning if "--cflags" or "--libs" is passed as a parameter, then you can just copy that in your Makefile instead, but it's not a good practice.

Anyway, it sounded like you mixed some files from an older toolchain with some of the latest, I don't think it's a good idea.

protomank

  • Posts: 96
    • Rockbot Game Engine
Re: SDL Audio
« Reply #5 on: July 24, 2012, 04:28:55 pm »
Yeah, good chance that the problem is due to sdl-config, I did not tought on that. Tonight I'll give it a try, thanks a lot.
But still is strange that sound isn't working as the app should be compatible, even if compiled for Dingux.
Rockbot Lead game designer.

 

Post a new topic