Simple sound set-up not working with Mednafen
#1
My current setup: I'm using the latest testing version of OpenELEC on an Intel computer. My video is coming to the TV through an HDMI cable, but the audio is going through the headphone jack on the computer to separate speakers. The HDMI has never transmitted sound, but it was never an issue for me as I didn't want it to.

Everything else plays sound just fine, but when I try to launch a ROM in Mednafen (via Rom Collection Browser), there is no sound. I am currently using version 0.6 of Mednafen as the video was not working in 0.9 (because I possibly have a 64bit computer? Got a bit confused here but didn't pursue it because it worked). I've read other threads about this, but most are looking for ways to set-up audio to come out of two separte surround sound speaker systems and the like, I'm just interested in a super simple 2 channel analog audio output setup.

Things I have tried thus far:
- Creating an asound.conf file as per this post here http://openelec.tv/forum/128-addons/3861...=276#58575

My playback devices return with this in command line
Code:
card 0: MID [HDA Intel MID], device 0: STAC92xx Analog [STAC92xx Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

So my asound.conf file looked like this:

Code:
pcm.!default {
        type plug
        slave {
        pcm "both"
        }
}

pcm.both {
        type route
        slave {
                pcm multi
                channels 4
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

pcm.multi {
        type multi
        slaves.a {
                pcm "hdmi_hw"
                channels 2
        }
        slaves.b {
                pcm "analog_hw"
                channels 2
        }
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

pcm.hdmi_hw  {
    type dmix
    ipc_key 1001
    slave {
        pcm "hw:0,3"
        period_time 0
        period_size 512
        buffer_size 2048
    }
}

pcm.hdmi_formatted {
        type plug
        slave {
                pcm hdmi_hw
                rate 48000
                channels 2
        }
}

pcm.hdmi_complete {
        type softvol
        slave.pcm hdmi_formatted
        control.name hdmi_volume
        control.card 1
}

pcm.analog_hw  {
    type dmix
    ipc_key 1000
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 512
        buffer_size 2048
    }
}

This has the effect of changing the "Default" option in System Settings > Audio Output > Audio Output Device to the Default (HDMI device). Neither leaving it as the new default nor switching to the analog option have any effect on sound in Mednafen.

I played around with this for a while based on other posts I found here. This thread http://forum.xbmc.org/showthread.php?tid=145430 helped me understand a bit more what each of the sections of the asound.conf file mean, and I managed to trim his massive script down to a much smaller one that I thought might serve my purposes:

Code:
pcm.!default {
        type plug
        slave {
                pcm "analog"
        }
}

pcm.analog {
        type hw
        card 0
        device 0
        channels 2
}

This changed the audio output device in settings back to Default (HDA Intel MID STAC92xx Analog) (instead of the default being the HDMI device), but did nothing for Mednafen.

I also tried messing around with .asoundrc, but it never seemed to do much of anything. I guarantee there are combinations of things I didn't try though.

-Changing the launch.sh and mednafen-09x.cfg files
I'm not certain how these work, but I'm pretty sure that when launch.sh runs (when you first run the program), it creates at least one cfg file (I think the one in storage/xbmc/userdata/addon_data/emulator.mednafen/, the one in storage/.xbmc/addons/emulator.mednafen/bin/.mednafen/ never seems to update? ), so I tried updating the launch.sh script with this

Code:
ADDON_CMD="./mednafen -sound.driver alsa -sound.device plughw:0,0

For sound.driver, I tried switching it back and forth between sdl (which is what it started as) and alsa, but no effect (I'm honestly not even sure what the difference is). I also made this change in the 2 .cfg files, just in case, but still no effect. Based on some other advice I found on here, I also tried

Code:
ADDON_CMD="./mednafen -sound.driver default -sound.device sexyal-literal-default

and the corresponding changes in the .cfg fils, but still no sound. I feel like I've tried just about everything at this point. Any input would be much appreciated.
Reply
#2
Alright, so... Sound is working! I basically just deleted most of the new stuff and started from scratch. Reinstalled Mednafen 0.6, delected asound.conf, and maybe a few other things, I can't really remember. After that, on a whim, I decided to try and get the HDMI sound working, and it turned out to be spectacularly easy (again, can't remember what I did exactly). After doing this, I tried launching a game again, and had sound! ... from my Analog speakers, not HDMI. I preferred this situation to be reversed, so I made some changes in the mednafen cfg file to the sound.device (plughw;0,3 and alsa, respectively) and in the launch.sh file, switched audio output back to analog in xbmc, and voila! Mednafen sound from HDMI audio, all other XBMC sound from Analog. Not ideal (was hoping all would come through analog), but hey, close enough.

After I got sound working, I set myself to the task of programming the guide button on my XBOX 360 Wired Controller to exit emulation (I think the back button may actually do this on Linux, but I never got a chance to check). However, at some point, I managed to trigger a totally different issue. Games now launch fine from RCB, with perfect sound and video... but controllers don't work. The Xbox 360 Wired Controller I was using that worked before no longer seemed to do anything - However, I soon realized it was actually still partially controlling xbmc in the background. Certain button presses would register, such that, for example, pressing the back button while emulating would cause a gui noise, and exiting the emulation (by pressing esc on the keyboard) would take me back to the main menu, not RCB (as if I had hit previous menu). In addition, the XBMC remote app I normally use for iPhone becomes disconnected during emulation, which never used to happen. The keyboard seems to function and will enter button presses into the Emulator that are registered. The only way to end emulation is to press escape, at which point all functionality returns to all devices.

This is one problem where I have absolutely no idea where to start. I can not find a single person anywhere that has had a problem even remotely similar to this, or at least so far as my searching skills can take me. Any input at all would be much appreciated.

Taking from some advice I've seen around the forum, here is a log file

http://pastebin.com/Yd69egpD

Basically, I started XBMC. Clicked the custom "Games" button on my main menu which opens RCB, then clicked Super Mario World.smc. The game opened, I let it run for a little while, I pressed back (button 7) to see if it would work, then exited the emulator. All of this was done with the XBOX 360 Wired Controller.

Edit: Fixed broken pastebin link.
Reply
#3
Update: Button presses from the XBOX 360 controller no longer seem to affect XBMC running in the background. The Official XBMC remote app for iPhone is still disconnected on mednafen launch though. Enabling and disabling Solo Mode in RCB has no effect on this.

I have the worst feeling that this is something extremely simple and stupid. I've reinstalled both mednafen and RCB twice now, no effect.
Reply

Logout Mark Read Team Forum Stats Members Help
Simple sound set-up not working with Mednafen0