Trine 2 for Linux - no audio

Technical support for the Linux and Mac platforms for all Trine games.
nitro322
Posts: 5
Joined: Sun Jun 10, 2012 11:00 pm

Trine 2 for Linux - no audio

Postby nitro322 » Sun Jun 10, 2012 11:27 pm

Hi. I just picked up Trine 2 for Linux, but I'm not able to get the sound working. I'm running this on Gentoo amd64, which I know is not one of the officially (or even semi-) supported distributions, but I'm generally able to get any game working on here just fine as long as I have the right libraries installed. And, as far as I'm aware, I have everything needed. I know I can't expect official support, but I'm hoping anyone familiar with the build can give me some pointers.

Note: I've seen a couple other threads about sound and music problems, but none appear to be related to this.

The problem is that I get, literally, no sound. Everything else seems to load fine (if a little slow), but I get no audio whatsoever. If I run the trine binary directly instead of using the launcher, my console gets flooded with this:

AL lib: alsa.c:368: start failed: File descriptor in bad state

And I do mean flooded - I redirected that output to a file to see if anything is was included in stdout (though nothing was), and in the process it took to launch Trine 2, start a new game, then immediately exit, that debug file gew to 850 MB. So, clearly something is unhappy. :-)

I verified that I have all of the libraries it's looking for:

Code: Select all

$ LD_LIBRARY_PATH="/home/user/Trine2/lib/lib32" ldd ~/Trine2/bin/trine2_linux_32bit
        linux-gate.so.1 =>  (0xf7702000)
        libz.so.1 => /lib32/libz.so.1 (0xf76bc000)
        libSDL-1.3.so.0 => /home/user/Trine2/lib/lib32/libSDL-1.3.so.0 (0xf75c6000)
        libGLU.so.1 => /usr/lib32/libGLU.so.1 (0xf755a000)
        libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf74d0000)
        libCg.so => /home/user/Trine2/lib/lib32/libCg.so (0xf6bef000)
        libCgGL.so => /home/user/Trine2/lib/lib32/libCgGL.so (0xf6b82000)
        libopenal.so.1 => /usr/lib32/libopenal.so.1 (0xf6b3d000)
        libogg.so.0 => /usr/lib32/libogg.so.0 (0xf6b36000)
        libvorbis.so.0 => /usr/lib32/libvorbis.so.0 (0xf6b0e000)
        libvorbisfile.so.3 => /usr/lib32/libvorbisfile.so.3 (0xf6b04000)
        libPhysXLoader.so.1 => /home/user/Trine2/lib/lib32/libPhysXLoader.so.1 (0xf6af4000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/32/libstdc++.so.6 (0xf6a06000)
        libm.so.6 => /lib32/libm.so.6 (0xf69e0000)
        libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/32/libgcc_s.so.1 (0xf69c5000)
        libc.so.6 => /lib32/libc.so.6 (0xf6861000)
        libdl.so.2 => /lib32/libdl.so.2 (0xf685d000)
        libpthread.so.0 => /lib32/libpthread.so.0 (0xf6843000)
        libGL.so.1 => /usr/lib32/libGL.so.1 (0xf676b000)
        libbz2.so.1 => /lib32/libbz2.so.1 (0xf675a000)
        /lib/ld-linux.so.2 (0xf7703000)
        librt.so.1 => /lib32/librt.so.1 (0xf6750000)
        libnvidia-tls.so.295.49 => /usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.295.49 (0xf674c000)
        libnvidia-glcore.so.295.49 => /usr/lib32/libnvidia-glcore.so.295.49 (0xf4aff000)
        libX11.so.6 => /usr/lib32/libX11.so.6 (0xf49e2000)
        libXext.so.6 => /usr/lib32/libXext.so.6 (0xf49d2000)
        libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf49b7000)
        libXau.so.6 => /usr/lib32/libXau.so.6 (0xf49b3000)
        libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf49ad000)


Since I'm on a 64-bit system, many of these are provided by 32-bit compatibility libraries. But, they should all work fine - I have many other 32-bit games installed on here and they all work fine.

So, I tracked the above error message to being generated by openal, and it's referencing this bit of code in the openal ALSA driver:

Code: Select all

        // make sure there's frames to process
        if((snd_pcm_uframes_t)avail < pDevice->UpdateSize)
        {
            if(state != SND_PCM_STATE_RUNNING)
            {
                err = psnd_pcm_start(data->pcmHandle);
                if(err < 0)
                {
                    AL_PRINT("start failed: %s\n", psnd_strerror(err));
                    continue;
                }
            }
            if(psnd_pcm_wait(data->pcmHandle, 1000) == 0)
                AL_PRINT("Wait timeout... buffer size too low?\n");
            continue;
        }
        avail -= avail%pDevice->UpdateSize;


Unfortunately, that means nothing to me. That fact that it's trying to use ALSA is right, though, as that's how I have my system setup - everything should be using ALSA, as I do not have pulseaudio or any other sound servers installed. Is there any reason Trine 2 wouldn't, or shouldn't, work with ALSA through openal? Most other discussions I see involve pulseaudio, so I'd like to make sure it's not making some assumption that puleaudio is present.

Other than that, I don't have any ideas. I tried running an strace and examining the output, but couldn't find anything helpful. I tried running an ltrace and doing the same, but it took so long to get running that I ended up closing it after a couple of minutes - it hadn't even started displaying the game yet.

Any suggestions on what else I can try? or is there any other information I can provide that may help with troubleshooting?

Thanks.

berarma
Posts: 16
Joined: Fri Apr 29, 2011 2:10 am

Re: Trine 2 for Linux - no audio

Postby berarma » Wed Jun 13, 2012 6:06 pm

I don't know for sure but this could be a problem with your alsa configuration or even your distro, so you might ask on some gentoo forum too. Post here again if you find a solution for others to know.

nitro322
Posts: 5
Joined: Sun Jun 10, 2012 11:00 pm

Re: Trine 2 for Linux - no audio

Postby nitro322 » Mon Jun 18, 2012 6:11 am

I appreciate the response berarma, but I don't think that's going to be helpful here. ALSA is working fine on my system for all of my multimedia apps as well as all of the 100 or so other games I have installed (or at least was at time of installation and is still working for a rather significant sampling I just tested). This also includes other games using openal, though most of those games are either open source games that link against my system openal library, or native 64-bit binary ports (such as Trine 1).

The reason I'm starting here is because of the error message I posted above:

Code: Select all

AL lib: alsa.c:368: start failed: File descriptor in bad state


That message floods my console when I run the game, and I've never seen anything else generate it. I'm trying to troubleshoot it, but I need assistance from someone that actually knows how this game is supposed to work - and given this is a binary game, that pretty much limits it to the Trine 2 developers. I absolutely can get help for general ALSA problems on the Gentoo forum, but in this case I'm not having a general ALSA problem - I'm having a very specific problem with a specific application. I did post on the bug report for this ebuild about my problem, hoping some Gentoo users/devs that actually have the game can help me out, but so far I haven't heard anything back.

So... Trine devs? Any pointers? Is there any other information I can provide to help with troubleshooting? I'd very much like to be able to play and enjoy this game.

Thanks.

User avatar
fb_jpk
Posts: 140
Joined: Thu Jun 16, 2005 8:05 pm

Re: Trine 2 for Linux - no audio

Postby fb_jpk » Wed Jun 20, 2012 3:23 pm

Hi,

Sorry about the audio troubles... And unfortunately, at this point, I don't think I have any clear answers on how to get past that issue... A few random suggestions that come to mind though:

Since that issue would seem to somehow relate to the OpenAL ALSA driver, it might make sense to try some other backends. I'm assuming that your distribution has the openal configuration at "/etc/openal/alsoft.conf" - Perhaps trying to limit the selected driver in that config file could give some additional clue. For example, if possible, you could try the oss or pulseaudio driver instead of the ALSA...

Code: Select all

drivers=oss,pulseaudio


Or try the wave driver output. If OpenAL manages to write a .wav file with some kind of proper audio in it, then its most certainly an issue with the OpenAL -> ALSA playplack. Note, you'll need to configure the ouput filename in the [wave] section.

Code: Select all

drivers=wave

Code: Select all

[wave]
file=/tmp/foobar.wav


Notice, that the generated .wav file won't open in some audio player software. But at least Audacity should be able to open it though.

Also, it could perhaps be related to some specific audio device you have in use in alsa. You might want to check the [alsa] section in that file too.

Additionally the most likely reason why audio in any other games would work, but fail in Trine 2, would probably have to do with the 64 bit vs 32 bit difference (or the fact that the other programs are using ALSA directly, rather than OpenAL). There could be something missing/wrong with the 32 bit OpenAL / ALSA libraries.

I'm sorry I really don't have any more specific suggestions at this time. :(
But trying something like the wave-file output might help pinpoint the issue better.

nitro322
Posts: 5
Joined: Sun Jun 10, 2012 11:00 pm

Re: Trine 2 for Linux - no audio

Postby nitro322 » Sun Jun 24, 2012 8:55 pm

fb_jpk, thanks for the reply. I only just saw it this morning (for whatever reason, the thread subscription feature for the forum doesn't seem to be working for me), so sorry for the delay.

Your suggestion for setting drivers=oss in alsoft.conf did the trick! That file actually didn't even exist on my distro, but simply creating it and adding the line worked. I can now hear Trine 2's beautiful soundtrack. :-) Though it's more a workaround than a fix (I'd really like to know why it won't work with ALSA), I'm still quite happy just to be able to get sound. Thanks a bunch.

This does open up a couple additional questions, though:

1. I prefer using ALSA, so since Trine 2 is the only game I have installed that requires this, are you aware of any way I can set this just for Trine 2? Maybe some environmental variable that I can set when launching the game?

2. Though not directly related to the issue at hand, could you tell me if there are any plans to provide native 64-bit support, like the original Trine had? Granted, 32-bit software can be made to run on most 54-bit linux distros, but it's generally much easier, and cleaner, to run native 64-bit software that can link directly against all your other system libraries instead of having to worry about pulling in bundled libraries or installing a 32-bit compatibility layer. For example, I'd be willing to bet that if Trine 2 was linked against the version of openal compiled specifically for my system instead of the generic 32-bit compatibility libraries, this wouldn't have been an issue.

Anyway, thanks again for the help. Much appreciated.

nitro322
Posts: 5
Joined: Sun Jun 10, 2012 11:00 pm

Re: Trine 2 for Linux - no audio

Postby nitro322 » Sun Jun 24, 2012 9:12 pm

FYI, for anyone else that may have this problem, I couldn't find a way to directly specific the openal backend driver through the command line like I had asked about above, but it is possible to specify the location of a custom alsoft.conf file using the ALSOFT_CONF environmental variable. So, my launch script is now:

ALSOFT_CONF=/home/user/.frozenbyte/Trine2/alsoft.conf trine2

I'm still curious to hear about any possible 64-bit plans, though. :-)

User avatar
fb_jpk
Posts: 140
Joined: Thu Jun 16, 2005 8:05 pm

Re: Trine 2 for Linux - no audio

Postby fb_jpk » Mon Jun 25, 2012 10:57 am

Glad to know you got it working with the OSS.

nitro322 wrote:I'm still curious to hear about any possible 64-bit plans, though. :-)


As far the 64 bit plans go... The game uses a middleware library that has no 64 bit linux version available (or at least it did not have it the last I asked about it). So at the moment, it's not really fully in our hands. If we get the 64 bit version of that library at some point, we might provide a 64 bit version of the Linux Trine 2. Since we do use a 64 bit Windows build of Trine 2 during development on a daily basis, there should be no major issues creating a 64 bit build for linux as well - but only as far as the actual game code goes... However, there might be some unexpected issues with some other used middleware libraries as well when creating the 64 bit linux build, so I dare not go promise anything yet.

nitro322
Posts: 5
Joined: Sun Jun 10, 2012 11:00 pm

Re: Trine 2 for Linux - no audio

Postby nitro322 » Mon Jun 25, 2012 3:05 pm

Fair enough. Thanks for the direct answer. Hopefully the situation improves in the future. And if not, perhaps Frozenbyte you can use a more Linux-friendly middleware library for the next project. :-)

In the meantime, I'll be enjoying what you were able to provide. 32-bit Linux support is definitely better than no Linux support at all, so thanks for doing what you can!


Return to “Trine Technical Support for Linux & Mac”

Who is online

Users browsing this forum: No registered users and 3 guests