Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Input from HiFiBerry DAC2 ADC Pro
#1
Hello Forum,

I have a new HiFiBerry DAC2 ADC Pro using the "hifiberry-dacplusadcpro" dtoverlay.

I was hoping to enable the analog input by changing line 38 of the inp-config.php script from:
Code:
if ($_SESSION['i2sdevice'] == 'HiFiBerry DAC+ ADC') {

to:
Code:
if ($_SESSION['i2soverlay'] == 'hifiberry-dacplusadcpro') {

This does enable the input device selector in the configuration menu but capture (ie: Fixed volume (0dB), analog input, local audio output) does not appear in the library menu.

Unless it is named under some poetic label ;-)

I can verify with
Code:
sox -r 48k -b 32 -c 2 -t alsa hw:sndrpihifiberry -t alsa hw:sndrpihifiberry
that the system plays the audio.

How do I play this source in moOde ?

Regards,

moOde  release is: 9.3.3 2025-04-29
Reply
#2
More code would need to be changed to support that device but b4 any of that could be done there needs to be a complete explanation of what comand(s) are used to actually switch the input on the board. For example the earlier DAC+ ADC just used the "alsaloop" command.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Hello Tim,

I understand your comment.

For your information, the command 
Code:
alsaloop -C hw:sndrpihifiberry,0 -P hw:sndrpihifiberry,0 -t 50000

works perfectly in a SSH session (just as sox does).
In fact, this is why I edited line 38 of the inp-config script: I expected this to work just as it works for the plain DAC / ADC board.
Can you point me towards the script that does the input switching so I can test ?
Regards,
Reply
#4
Hello Tim,

I am happy to report that analog input works fine with the HiFiBerry DAC2 ADC PRO.

Note changes in HiFiBerry drivers are documented here: Change in HiFiBerry drivers. My understanding is that their device name is always 'sndrpihifiberry'.

In audio.php, line 113 was changed from:
Code:
if ($_SESSION['i2sdevice'] == 'HiFiBerry DAC+ ADC') {
to:
Code:
if (0 === strpos($_SESSION['i2soverlay'], 'hifiberry-dacplusadc')) {
in order to support those cards with an ADC port. The new devices names are not in the 'Named I2S device' list.

In the same script, lines 146-147 were changed from:
Code:
        if ($_SESSION['i2sdevice'] == 'HiFiBerry DAC+ ADC') {
            sysCmd('alsaloop > /dev/null 2>&1 &');
to:
Code:
        if (0 === strpos($_SESSION['i2soverlay'], 'hifiberry-dacplusadc')) {
            sysCmd('alsaloop -C hw:sndrpihifiberry,0 -P hw:sndrpihifiberry,0 -t 50000 > /dev/null 2>&1 &');
in order to support a numbered card. I am surprised the original code produced any output at all.

In inp-config.php, line 38 was changed from:
Code:
if ($_SESSION['i2sdevice'] == 'HiFiBerry DAC+ ADC') {
to:
Code:
// Either version of HiFiBerry DAC+ADC
if (0 === strpos($_SESSION['i2soverlay'], 'hifiberry-dacplusadc')) {
in order to allow the input selector in the configuration page.

I can switch from analog input to MPD without any issue. Actual capture parameters (frequency, bit depth, etc.) are of no concern at this time. I probably should specify 32 bits, 2 channels, 48/96 kHz in real life but right now, I just wanted this to work.

Thank you for your support.
Reply


Forum Jump: