No sound effects!
Moderator: OpenTTD Developers
No sound effects!
I recently installed OpenTTD on a system that has had no end of video and sound problems. The video works fine and the music appears to work OK after installing Timidity (though it stops every time it hit the 14th track for some reason) but I'm still getting absolutely no sound effects.
I think this may be related to an inexplicable quirk this system has. If I set my system or any applications to use ALSA as their audio output, I get no sound whatsoever (no one I've met can tell me why this happens). I've had to set everything to OSS in order to make it work. This means I get no mixing of sound from different applications, and Flash gives me nothing because it expects ALSA and won't work with anything else, but it's acceptable. I do wonder if OpenTTD is using ALSA for the output and if I need to change that.
I think this may be related to an inexplicable quirk this system has. If I set my system or any applications to use ALSA as their audio output, I get no sound whatsoever (no one I've met can tell me why this happens). I've had to set everything to OSS in order to make it work. This means I get no mixing of sound from different applications, and Flash gives me nothing because it expects ALSA and won't work with anything else, but it's acceptable. I do wonder if OpenTTD is using ALSA for the output and if I need to change that.
Re: No sound effects!
When you say "I get no sound whatsoever" you mean no sound with OpenTTD, but music is still playing, right? I came across this, as well, and this is what I found: SDL will try, by default, to directly open the audio device for sound effects. However, the audio device cannot be opened concurrently (only one open at a time), so this will block other users. The same works the other way around, so once an application has opened the audio device, SDL will not be able to use it. ALSA applications do not have this problem, because the ALSA library manages to open the audio device only once for all users, and then mixes their sound data. In your case (as it was in mine), some app has already started using ALSA, and therefore SDL will fail to open the audio device; on the other hand, timidity probably uses ALSA and does get its output through.Rhapsody wrote:I recently installed OpenTTD on a system that has had no end of video and sound problems. The video works fine and the music appears to work OK after installing Timidity (though it stops every time it hit the 14th track for some reason) but I'm still getting absolutely no sound effects.
I think this may be related to an inexplicable quirk this system has. If I set my system or any applications to use ALSA as their audio output, I get no sound whatsoever (no one I've met can tell me why this happens). I've had to set everything to OSS in order to make it work. This means I get no mixing of sound from different applications, and Flash gives me nothing because it expects ALSA and won't work with anything else, but it's acceptable. I do wonder if OpenTTD is using ALSA for the output and if I need to change that.
There is a (not very well documented) way to make an SDL app use another audio driver. Try
Code: Select all
SDL_AUDIODRIVER=alsa openttd
Re: No sound effects!
I specifically stated that music is working, I said I get no sound whatsoever if I set any application to use ALSA as the audio output. Autodetect for most apps also seems screwed-up as they select the (non-functional) ALSA output by default and I have to manually specify OSS.cirdan wrote:When you say "I get no sound whatsoever" you mean no sound with OpenTTD, but music is still playing, right?
This is all totally pointless as I already stated than any application that uses ALSA for audio output will not produce any sound. I have found no exception to this. So not only does ALSA not get on well with SDL, it doesn't get on at all with my sound card.cirdan wrote:I came across this, as well, and this is what I found: SDL will try, by default, to directly open the audio device for sound effects. However, the audio device cannot be opened concurrently (only one open at a time), so this will block other users. The same works the other way around, so once an application has opened the audio device, SDL will not be able to use it. ALSA applications do not have this problem, because the ALSA library manages to open the audio device only once for all users, and then mixes their sound data. In your case (as it was in mine), some app has already started using ALSA, and therefore SDL will fail to open the audio device; on the other hand, timidity probably uses ALSA and does get its output through.
There is a (not very well documented) way to make an SDL app use another audio driver. Tryto start OpenTTD. This will instruct SDL to use ALSA for sound effects, and it should make it cooperate nicely with the rest of the system. Unfortunately, SDL itself does not get on very well with ALSA, and you're likely to get worse sound than with the direct driver; for instance, effects are usually delayed by half a second or so (I found this mildly annoying). There isn't much that can be done about this in OpenTTD, as it is an SDL problem.Code: Select all
SDL_AUDIODRIVER=alsa openttd
There is actually an error that OpenTTD produces when started on the command-line.
Code: Select all
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'defaults.pcm.dmix.device'
ALSA lib conf.c:3510:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:3982:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM default
Ideally I would love to find out why the hell ALSA won't give my any sound, but that seems to be a lost cause now.
Edit: The above error actually seems directly related to Timidity, as installing Timidity gives the same error. I've no idea what to do about it though.
Re: No sound effects!
Aren't you overreacting a bit here? I misunderstood you and thought that you meant "If any application is set to use ALSA, i get no sound in OpenTTD", that's all. You see, I was actually trying to help.Rhapsody wrote:This is all totally pointless as I already stated than any application that uses ALSA for audio output will not produce any sound. I have found no exception to this. So not only does ALSA not get on well with SDL, it doesn't get on at all with my sound card.
Anyway, if you had read my post with a bit of care, you would have drawn at least one conclusion. As I said, the audio device cannot be opened twice simultaneously. If you set your apps to use OSS, the first one will get access, the second one will not. OpenTTD and (background) timidity are different processes, so only one will make it. You're not likely to get music and sound effects with OSS. And if any other process has already opened the device, you will get neither.
By the way, this error message
Code: Select all
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'defaults.pcm.dmix.device'
ALSA lib conf.c:3510:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:3982:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM default
Re: No sound effects!
Which is exactly what I removed Timidity, set SDL to use OSS, then restarted OpenTTD. Still no sound effects, making me suspect that whatever's making the sound effects not work is unrelated to this. They'll probably not work anyway because of the mixing problem, as you said, but I'd like to be sure there's not two problems at work here.cirdan wrote:Anyway, if you had read my post with a bit of care, you would have drawn at least one conclusion. As I said, the audio device cannot be opened twice simultaneously. If you set your apps to use OSS, the first one will get access, the second one will not. OpenTTD and (background) timidity are different processes, so only one will make it. You're not likely to get music and sound effects with OSS. And if any other process has already opened the device, you will get neither.
Well then how do I reconfigure ALSA to work? I've now been trying to trace this problem with ALSA for no less than ten months and in all that time no one's even been able to tell me why ALSA isn't working, nevermind suggesting a solution. My last PC actually did use ALSA for all sound it worked perfectly, so I would love very much to get that back so I can finally put this one behind me.cirdan wrote:By the way, this error messagehardly qualifies as "an inexplicable quirk this system has". It is very clearly saying that ALSA is not properly configured, so it's no surprise that you get no sound if you set an app to use ALSA.Code: Select all
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'defaults.pcm.dmix.device' ALSA lib conf.c:3510:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:3982:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM default
Re: No sound effects!
You go to #alsa on Freenode IRC and ask for help.
Who is online
Users browsing this forum: No registered users and 1 guest