iqaudio / tools

Sample CLI tools for IQaudio products
http://www.iqaudio.com
35 stars 11 forks source link

error on running #1

Closed alidaf closed 9 years ago

alidaf commented 9 years ago

Latest PiCorePlayer (1.21, Linux kernel 4.1.*). Compiles fine, after finding all of the libraries (phew!). Runs with error:IQ_rot: simple.c:282: snd_mixer_selem_get_playback_volume_range: Assertion `elem' failed. No function.

Any suggestions?

iqaudio commented 9 years ago

The mixer name used in the source code is different to the mixer name used by the driver on the version of Linux you are using.

Use alsamixer to determine the master volume control's mixer name. It'll either be pcm / playback digital / digital or similar.

Change source of IR_rot.c to match this name and recompile.

HTH

Gordon

On 8 Sep 2015, at 20:01, alidaf notifications@github.com wrote:

Latest PiCorePlayer (1.21, Linux kernel 4.1.*). Compiles fine, after finding all of the libraries (phew!). Runs with error:IQ_rot: simple.c:282: snd_mixer_selem_get_playback_volume_range: Assertion `elem' failed. No function.

Any suggestions?

— Reply to this email directly or view it on GitHub.

alidaf commented 9 years ago

Thanks. I've changed it to PCM and it runs. I can see the gain changing in alsamixer, albeit reversed in polarity and very small changes. It doesn't affect the headphone volume though. Switching tabs to the IQAudio card and manipulating "digital" by hand does change the volume but using "digital" in the code doesn't work.

iqaudio commented 9 years ago

The mixer name needs to be the driver's mixer name to adjust the on-chip volume control / headphone and line out.

I'd check on the mixer name.

alidaf commented 9 years ago

I can't figure it out. I've tried every name that I can find in the alsamixer display and /proc/asound/* with a variety of different cases but nothing works. "Digital" should be the correct name according to alsamixer but it doesn't recognise it unless it is abstracted because the IQaudioDAC card needs to be selected to see it.

iqaudio commented 9 years ago

Digital is the name used in Linux 4.1.6-v7+ #810 and the code has been tested on this version.

Are you using latest WiringPi?

alidaf commented 9 years ago

The latest for the distro, although the header gives a date of 2012.

Digital is the name used in Linux 4.1.6-v7+ #810 and the code has been tested on this version.

Are you using latest WiringPi?

— Reply to this email directly or view it on GitHub https://github.com/iqaudio/tools/issues/1#issuecomment-138855628.

alidaf commented 9 years ago

2.26

Digital is the name used in Linux 4.1.6-v7+ #810 and the code has been tested on this version.

Are you using latest WiringPi?

— Reply to this email directly or view it on GitHub https://github.com/iqaudio/tools/issues/1#issuecomment-138855628.

alidaf commented 9 years ago

I think the problem is that card is set to "default" but both cards are identified as default so elem only points to the first one, which is the bcm2835 rather than the DAC. Either I need to reorder the cards somehow, or redefine *card to the explicit name. I've tried "IQaudIODAC" but that didn't work.

iqaudio commented 9 years ago

You can remove the bcm audio card from /etc/modules.

Best regards,

Gordon

Sent from my iPhone

On 11 Sep 2015, at 08:43, Darren notifications@github.com wrote:

I think the problem is that card is set to "default" but both cards are identified as default so elem only points to the first one, which is the bcm2835 rather than the DAC. Either I need to reorder the cards somehow, or redefine *card to the explicit name. I've tried "IQaudIODAC" but that didn't work.

— Reply to this email directly or view it on GitHub.

alidaf commented 9 years ago

I removed audio=on from the config.txt and using "Digital" now addresses the correct control. Could you please tell me which distro you tested with so I can check whether both are set to default with that one. That will give me some good information.

There has been a suggestion that I fork this code to add command line parameters for GPIO pins, card and control names. Would that be ok? I am not too familiar with c++ but I'd like to give it a go. It could always be pulled back in if I succeed.

iqaudio commented 9 years ago

Great, fork away!

Happy to take pull requests too. It's there for everyone so let's make it better.

First thing to do is have a mixer name override... :-)

I just used what was pushed to my sd card with a. Rpi-upgrade / Apt get update / etc.

Will see if I can dig out details later.

Gordon

Sent from my iPhone

On 11 Sep 2015, at 14:32, Darren notifications@github.com wrote:

I removed audio=on from the config.txt and using "Digital" now addresses the correct control. Could you please tell me which distro you tested with so I can check whether both are set to default with that one. That will give me some good information.

There has been a suggestion that I fork this code to add command line parameters for GPIO pins, card and control names. Would that be ok? I am not too familiar with c++ but I'd like to give it a go. It could always be pulled back in if I succeed.

— Reply to this email directly or view it on GitHub.

alidaf commented 9 years ago

Great, thanks.

cube48 commented 6 years ago

Adding my solution for posterity. I had the same issue, IQ_rot threw at me that Assertion: elem error too. Mixer name was correct (Digital). I tried to compile it with different names too. Problem was that IQ_rot expects that name from 'default' card which from ALSA's view is always the card with index 0. Card with index 0 appears right after launching 'alsamixer'. To see the index number of your card you can check 'aplay -l' and it should be the first number after card word. I.e.:

pi@raspberrypi:~$ aplay -l List of PLAYBACK Hardware Devices card 0: IQaudIODAC [IQaudIODAC], device 0: IQaudIO DAC HiFi pcm512x-hifi-0 [] Subdevices: 0/1 Subdevice #0: subdevice #0

My PiDAC+ was semi-randomly appearing on different positions when other USB sound devices (USB MIDI controllers) were plugged in therefore the encoder utility couldn't detect it.

Trick is to stick the sound card to 'default' position - index 0. I had to create the /etc/modprobe.d/alsa-base.conf file and add the slot option to keep PiDAC+ on first position.

pi@raspberrypi:~$ more /etc/modprobe.d/alsa-base.conf options snd slots=snd_soc_iqaudio_dac

Slots value is actually comma separated list of sound cards where you define the order. I defined only PiDAC+ to have it on the first position. To get the name of your interface for slots you can do:

cat /proc/asound/modules

Having PiDAC+ in the first 'slot' makes sure it will act as 'default' card and the encoder utility should work.