EmulationStation icon indicating copy to clipboard operation
EmulationStation copied to clipboard

On RPI2 with USB sound adapter, ES always reports VolumeControl::init() - Failed to find mixer elements!

Open andrewsil1 opened this issue 11 years ago • 18 comments

This didn't happen when I was using the built-in analog or HDMI sound from the Pi, but in an otherwise successful attempt to improve sound quality, I added a USB sound adapter and made that the default in ALSA. It works perfectly with all of the various ES emulators provided by Retropie, but everytime the emulators start up, or return to ES, the console spits out that message.

Any clue how to cure it?

andrewsil1 avatar Mar 31 '15 03:03 andrewsil1

Did you ever find a solution to this problem? I'm having the same issue. I wonder if our alsa config is wrong (I followed these instructions: https://learn.adafruit.com/usb-audio-cards-with-a-raspberry-pi/updating-alsa-config).

thomasgoldstein avatar Aug 12 '15 21:08 thomasgoldstein

Nope, still happens, no solution found.

andrewsil1 avatar Aug 12 '15 21:08 andrewsil1

I also have this issue. I managed to select the right sound card by manipulating the SDL environment variables like this: AUDIODEV=hw:1,0 emulationstation. Still doesn't fix the problem though. This bug makes EmulationStation a non-starter for many of those with USB sound cards.

TwoLeaves avatar Oct 22 '15 09:10 TwoLeaves

It’s not really a non-starter, so much as it is a nuisance… everything still seems to work fine, but the repeated error messages are a little annoying.


Andy Silverman Principal Program Manager, Microsoft Manufacturing Test Engineering “Another day with no plans to use calculus.”

From: TwoLeaves [mailto:[email protected]] Sent: Thursday, October 22, 2015 2:36 AM To: Aloshi/EmulationStation [email protected] Cc: Andrew Silverman [email protected] Subject: Re: [EmulationStation] On RPI2 with USB sound adapter, ES always reports VolumeControl::init() - Failed to find mixer elements! (#433)

I also have this issue. I managed to select the right sound card by manipulating the SDL environment variables like this: AUDIODEV=hw:1,0 emulationstation. Still doesn't fix the problem though. This bug makes EmulationStation a non-starter for many of those with USB sound cards.

— Reply to this email directly or view it on GitHubhttps://github.com/Aloshi/EmulationStation/issues/433#issuecomment-150162133.

andrewsil1 avatar Oct 22 '15 17:10 andrewsil1

Ah so the sound works for you? For me I get no sound at all. I assumed the problem was to do with this error message, but perhaps it's unrelated.

TwoLeaves avatar Oct 24 '15 02:10 TwoLeaves

Yes, after editing the ALSA config to enable making USB audio devices the default audio rather than the HDMI or analog output built in to the Pi, it works just fine.

From: TwoLeaves [mailto:[email protected]] Sent: Friday, October 23, 2015 7:49 PM To: Aloshi/EmulationStation [email protected] Cc: Andrew Silverman [email protected] Subject: Re: [EmulationStation] On RPI2 with USB sound adapter, ES always reports VolumeControl::init() - Failed to find mixer elements! (#433)

Ah so the sound works for you? For me I get no sound at all. I assumed the problem was to do with this error message, but perhaps it's unrelated.

— Reply to this email directly or view it on GitHubhttps://github.com/Aloshi/EmulationStation/issues/433#issuecomment-150745360.

andrewsil1 avatar Oct 24 '15 03:10 andrewsil1

I'm having this same issue. I replied to a similar post here:

https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=124652&p=881343#p881343

jdeltoft avatar Jan 11 '16 01:01 jdeltoft

It's due to EmulationStation's assumption that your default ALSA mixer is named "PCM" on the Raspberry Pi...which is the name of the Raspberry Pi's onboard mixer. When using my Plugable USB sound card, the mixer is named "Speaker." You can find the name by running 'amixer'.

As a workaround, you can download the EmulationStation source, and modify the value of VolumeControl::mixerName in VolumeControl.cpp to match your mixer name. Tried it myself, and the error went away, and volume control inside ES works against the USB sound card.

This should probably be made a configuration value in ES, as the default mixer name can vary between sound cards.

jcoutch avatar May 12 '16 05:05 jcoutch

Hi JCoutch..... Can you please let me know how you are able to "modify the value of VolumeControl" in VolumeControl.cpp? I'm not 100% with Linux so any help is greatly appreciated. Thanks, Nick

N-BALA avatar May 23 '16 13:05 N-BALA

@N-BALA - Assuming you've already set the USB sound card as the default in Alsa, you should be able to do the following: Open up a terminal prompt, and run:

amixer -l

Note the name of your mixer. Mine was named "Speaker".

Now run:

git clone https://github.com/Aloshi/EmulationStation.git
nano EmulationStation/es-app/src/VolumeControl.cpp

Change line 8 from:

const char * VolumeControl::mixerName = "PCM";

to match the name of your mixer ("Speaker" in my case):

const char * VolumeControl::mixerName = "Speaker";

Press Ctrl+O and Enter to save the file, then Ctrl+X to exit Nano.

Then, follow the instructions for building the code from the main Github page:

sudo apt-get install libsdl2-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libboost-locale-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl4-openssl-dev libasound2-dev libgl1-mesa-dev build-essential cmake fonts-droid

cd EmulationStation
cmake .
make
make install

Restart Emulation Station, and now you should be able to control your volume.

jcoutch avatar May 23 '16 17:05 jcoutch

Wow. That's great info. Thank you very much for this. I'll try after work tonight.

Cheers Nick On 24 May 2016 3:36 am, "jcoutch" [email protected] wrote:

@N-BALA https://github.com/N-BALA - Assuming you've already set the USB sound card as the default in Alsa, you should be able to do the following: Open up a terminal prompt, and run:

amixer -l

Note the name of your mixer. Mine was named "Speaker".

Now run:

git clone https://github.com/Aloshi/EmulationStation.git nano EmulationStation/es-app/src/VolumeControl.cpp

Change line 8 from:

const char * VolumeControl::mixerName = "PCM";

to match the name of your mixer ("Speaker" in my case):

const char * VolumeControl::mixerName = "Speaker";

Press Ctrl+O and Enter to save the file, then Ctrl+X to exit Nano.

Then, follow the instructions for building the code from the main Github page:

sudo apt-get install libsdl2-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libboost-locale-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl4-openssl-dev libasound2-dev libgl1-mesa-dev build-essential cmake fonts-droid

cd EmulationStation cmake . make make install

Restart Emulation Station, and now you should be able to control your volume.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Aloshi/EmulationStation/issues/433#issuecomment-221040077

N-BALA avatar May 23 '16 23:05 N-BALA

I use retropie with a Pi3 and Pi-DigiAMP+ from IQAudio. I had the same problem. I changed it to: const char * VolumeControl::mixerName = "Digital";

that worked for me, many thanks.

PS: I also had to change /usr/share/alsa/alsa.conf defaults.ctl.card 1 defaults.pcm.card 1

Because aplay -l showed me that my soundcard is card 1

petersteger avatar Dec 29 '16 21:12 petersteger

I am having the same issue. Will this ever be made configurable in ES? RPI has such bad audio that using a USB-AUDIO card is essentially necessary.

alexruffell avatar Mar 17 '17 14:03 alexruffell

I suggest cloning the RetroPie EmulationStation repo. It has the most recent updates and is continually updated. The Aloshi repo is out of date and is dead.

crewtaylor avatar Apr 13 '17 02:04 crewtaylor

@crewtaylor - Thanks, I did not realize I was looking at the incorrect repository. I use whatever comes with RetroPie so I am guessing I am already using what you suggested. By changing the emulator for MAME I was able to launch most of the ROMs that were launching with the default one before adding the USB Audio card... so although not fixed, I can live with it.

alexruffell avatar Apr 13 '17 13:04 alexruffell

I created an /etc/asound.conf file containing

pcm.!default {
  type hw card 1
}
ctl.!default {
  type hw card 1
}
pcm.dummy {
    type            softvol
    slave.pcm       "default"
    control.name    "PCM"
    control.card    1
}

And pointed audio_device in retroarch.cfg to dummy:

audio_device = dummy

No "VolumeControl::init() - Failed ..." messages anymore!

mrvanes avatar Jul 16 '17 18:07 mrvanes

Hmm... moments later I find this post: https://retropie.org.uk/forum/topic/984/update-usb-audio-setup-on-retropie-wiki

It can be even simpler with only this /etc/asound.conf:

pcm.card1 {
  type hw card 1
}

ctl.card1 {
  type hw card 1
}

pcm.!default card1

mrvanes avatar Jul 16 '17 18:07 mrvanes

Thanks for the heads up. I tried the simpler solution. It didn't work for me. Even though I've created that file, I see no behavior change after having restarted my Pi.

thomasgoldstein avatar Jul 16 '17 19:07 thomasgoldstein