exit xbmc from script

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
althekiller Offline
Team-XBMC Developer
Posts: 4,703
Joined: May 2004
Reputation: 12
Post: #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
find quote
Redsandro Offline
Skilled Python Coder
Posts: 133
Joined: Jul 2008
Reputation: 0
Location: Netherlands
Post: #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.
find quote
Redsandro Offline
Skilled Python Coder
Posts: 133
Joined: Jul 2008
Reputation: 0
Location: Netherlands
Post: #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
find quote
Post Reply