RPI3 Bugfix proposal for mpd.conf generation (SB11040)

Raspberry Pi related support

RPI3 Bugfix proposal for mpd.conf generation (SB11040)

Postby uwedamm » 03 May 2017, 20:12

Hello,
within /var/www/app/libs/runeaudio.php
in the function wrk_audioOutput
The following lines for the mpd.conf are generated:
> device "hw:x,y"
The code fails for my sound-card like follows:
$description = sysCmd("aplay -l -v | grep \"\[".$card."\]\"");
error_log($description[0]);
> card 0: U0x41e0x30d3 [USB Device 0x41e:0x30d3], device 0: USB Audio [USB Audio]

$subdeviceid = explode(':', $description[0]);
error_log($subdeviceid[1]);
> U0x41e0x30d3 [USB Device 0x41e
---> The problem is the additional ":" for my USB sound-card (0x41e:0x30d3)
$desc = array();
$subdeviceid = explode(',', trim($subdeviceid[1]));
error_log($subdeviceid[1]);
> empty, because of "',' not found"
$subdeviceid = explode(' ', trim($subdeviceid[1]));
error_log($subdeviceid[1]);
> empty again
$data['device'] = 'hw:'.$card_index.','.$subdeviceid[1];
error_log($data['device']);
> hw:0,
Result--> the trailing "0" is missing in the mpd.conf and I cannot use the soundcard

Proposal:
proposal: instead of first explode'ing by ':', start with ','
$description = sysCmd("aplay -l -v | grep \"\[".$card."\]\"");
error_log('UWE: '.$description[0]);
$subdeviceid = explode(',', $description[0]);
error_log('UWE: '.$subdeviceid[1]);
$subdeviceid = explode(':', $subdeviceid[1]);
error_log('UWE: '.$subdeviceid[0]);
$subdeviceid = explode(' ', trim($subdeviceid[0]));
error_log('UWE: '.$subdeviceid[1]);
$data['device'] = 'hw:'.$card_index.','.$subdeviceid[1];
error_log('UWE: '.$data['device']);

Anybody here, who can check, if my proposal works fine for all the other vendors?
If YES, you may update the runeaudio.php in the next release?
thank you

Uwe
uwedamm
 
Posts: 10
Joined: 03 May 2017, 12:23

support RuneAudio Donate with PayPal

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 24 guests