exit xbmc from script
#31
It's not a bug so much as we couldn't be bothered to put much thinking into how to handle multiple autoexec.py (ie. one in ~/xbmc other in /usr/local/share/xbmc). It will be fixed eventually, file a ticket on track so we don't forget.
Reply
#32
Duduke Wrote:I did some digging around, and it seems that ALSA has issues with multiple parallel sound sources.

I think it's one of the reasons Ubuntu is trying to push the PulseAudio subsystem (which does support multiple sound sources).

So, try to switch your Audio Mixer from ALSA to PulseAudio.

Let me know if it works...

Hi,

I think your note is closest to the issue after all.. but I thought the entire system was in one *sound system* (alsa/oss/pulseaudio) or the other, not both at the same time. But my system makes you think so and here's why:

If I run rhythmbox, gngeo/zsnes/xbmc has no sound but I can run as many vlc instances as I want.
If I run gxine, vlc has no sound but gngeo/zsnes/xbmc has.
If I run xbmc, nothing else has sound (gxine has though), and if it's started by the same process that kills xbmc, it also has no sound.

You see, some apps can play sound together and others don't, and I do have the ALSA sound system. So I need to figure out if I can override this somehow.
Reply
#33
Please have a look here: Play multiple sound sources.

Basically, it suggests that ALSA by default tries to use hardware sound mixing to mix several sound sources. as the only cards that support hardware sound mixing completely are the SB Live/Audigy all other (mostly onboard) will need to resort to some sort of software mixing (which is detailed in the article).

I do have an old SBLive available, if you want you can send me your scripts and i'll test them to see if they work with Hardware sound mixing.
Reply
#34
More information about dmix.
Reply
#35
Thanks.

Ubuntu 8.04 (and 7 also IIRC) has dmix and alsa-oss enabled by default. Also just in case, I tried replacing every command (xbmc, zsnes, etc) to aoss [command], but it didn't change a thing. The fact that brings perspective, though, is that some apps (rhythmbox + 3 VLCs) mix their sound perfectly together. So even if I don't fully understand how the soundsystem works, it does for certain apps.

My scripts are like unprepared food, exchanged for this simple textscript until I get the sound to work.

/home/sander/.xbmc/scripts/My Scripts/Arcade Browser/default.py
Code:
import os
os.system('start.sh')

/home/sander/.xbmc/scripts/My Scripts/Arcade Browser/start.sh
Code:
pidof xbmc.bin|xargs kill # Shutdown
sleep 1
# Launch zsnes with a rom just to check sound
aoss zsnes -ad sdl -m /usr/local/emulators/SNES/ROMs/Super\ Mario\ Kart\ \(U\)\ \[\!\].smc

# Done? Restart XBMC
aoss xbmc

aoss or not, sound won't work in 'chained' programs. And thanks for the offer, but I'm not sure if finding out if the SB Live does the mixing will help me or not. I do think the output might be of some help if I start xbmc through a console:

Code:
sander@MC-RED:~$ [b]xbmc[/b]
The XBMC_HOME environment variable is not set. [color=red]# ??[/color]
The XBMC_HOME environment variable is not set.
25890 [color=red]#pidof xbmc.bin[/color]
Killed
sander@MC-RED:~$ ZSNES v1.51, (c) 1997-2007, ZSNES Team
[color=red]# zsnes blah blah (...)[/color]
File opened successfully !
ALSA lib pcm_dmix.c:874:(snd_pcm_dmix_open) unable to open slave [color=red]# hmmm..[/color]
ZSNES could not find any joysticks.
The XBMC_HOME environment variable is not set.
The XBMC_HOME environment variable is not set.
ALSA lib pcm_dmix.c:874:(snd_pcm_dmix_open) unable to open slave [color=red]# and here's why this time xbmc has no sound either[/color]
/home/sander/.xbmc/scripts/Arcade Browser/start.sh: line 7: 25924 Segmentation fault      aoss xbmc[color=red] # ?? - Weird but I think this error is irrelevant[/color]

I don't know what exactly happens when the ALSA slave fails to open, but I must say it's NOT obvious that it happens due to lack of hw mixing, because once again, SOME apps manage to do it, and I DO have alsa-oss and dmix installed. :confused2:
Reply
#36
textscript = testscript
Reply
#37
-Strange update-

When I play a movie in VLC, meanwhile start xbmc, run the script..
THEN sound WORKS! It's like xbmc tries to shut down every audio hardware, and if it cannot (because it is in use by VLC) then xbmc never minds, and there is no problem, only a problem solved!

So .. xbmc bug?
Reply
#38
I also found this thread to describe the same problem.. it's xbmc deliberately making software-mixing impossible for no apparent reason.
Reply
#39
Redsandro Wrote:I also found this thread to describe the same problem.. it's xbmc deliberately making software-mixing impossible for no apparent reason.

How did you deduce that conclusion from that thread. I helped alphacube out a bit on IRC and one of my tests that proved your statement wrong was opening 3 instances of XBMC each with different songs playing. It worked fine.
Reply
#40
uhh.. read my post before my previous post?

I didn't deduce it from the linked thread, it just describes sort of the exact same thing. Alphacube also experienced a problem solved by having prior software play sound - something impractical but it proves a point.

All xbmc developers should be praised, so I'm sorry to say I think you have trouble reading. This is not about being able to run multiple xbmc's with sound. What's that good for anyway? The point is that xbmc with a non-modern or non-expensive sound card locks up the sound system for any follow-up software that requests it. Now if you want to go ahead and have some kind of explanation about how this is linux' fault and not xbmc's, thats okay but you don't just say "I proved you wrong" when my ears confirm what I'm saying.

I have to admid though that my previous post could do with the word "like" between "it's" and "xbmc".
Reply
#41
Running multiple XBMC instances w/ independent sound shows that it isn't XBMC's fault the audio hardware is locked. Alphacubes problem was that his card (or its driver, can't remember which) didn't support mixing, he swapped the card and all was well.

Also, maybe if you would compile all thoughts into one clean concise post instead of posting every 20m. It would be more clear what you're talking about
Reply
#42
-Workaround-

To all people resurrecting old hardware in their livingroom; to all people buying $15 sound cards for their media center, here's the workaround that you've been looking for. A small script you need to run for launching xbmc that prevents the sound lockup bug from happening. Now you don't need hardware mixing for all your emulators and other sound-enabled software you start from within xbmc.

xbmc-softmix.py
Code:
# XBMC-starter for older or cheaper soundcards that don't support hardware audiomixing
# Redsandro, 2008-07-29

import os, threading

class KeepAlsaBusy (threading.Thread):
    def run (self):
        os.system('mplayer -ao alsa -input file=[color=darkred]/path/to/[/color]mplayer.cmd /usr/share/xbmc/skin/Project\ Mayhem\ III/sounds/back.wav')

KeepAlsaBusy().start()
os.system('xbmc')

# [Command to kill the thread here] if you want mplayer to quit together with xbmc
# I just don't know how to do that.. yet. So please tell me :)

mplayer.cmd
Code:
pause

Now replace
xbmc
in your desktop environment's autostarted apps section with
python /path/to/xbmc-softmix.py
(or change the shortcut if you run xbmc manually)

Pay attention to the marked parts, you need to adjust them. If it doesn't work, you probably got a path or slash wrong. Try running it from a console so you can see the errors.

-How this works-
You probably figured it out; the script starts and pauses a (random) sound file in a separate thread so that the alsa slave cannot get locked by xbmc. This way it stays available for every app. After that, xbmc is started.
Reply
#43
Sorry allthekiller, you're right.

This is the only forum in my personal universe that does not allow me to edit my own posts, or that function is hidden away and I'm too stupid to find it and then I am sorry. But I keep forgetting so I add to my own posts.

Maybe it's not XBMC's fault the audio hardware gets locked, but the fact is it gets locked for certain apps started after XBMC. If I was an alien set out to research XBMC's behavior, I would report it locks the audio hardware for any app except fellow XBMC instances. Sort of like facism.

Thanks for looking into it anyway. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
exit xbmc from script0