Attempt to fix card incompatiblities by using PA

This commit is contained in:
Ruben van de Ven 2019-04-26 18:30:16 +02:00
parent 32be5ed1f8
commit 1ccd3b194e
3 changed files with 12 additions and 6 deletions

View file

@ -12,6 +12,7 @@ voice:
input_volume: 90 input_volume: 90
output_volume: 60 output_volume: 60
file_address: "http://hugveycmd.local:8888" file_address: "http://hugveycmd.local:8888"
output_driver: pulseaudio

View file

@ -241,7 +241,7 @@ class VoiceServer(object):
class CommandHandler(object): class CommandHandler(object):
def __init__(self, hugvey_id, cmd_address, publish_address, file_address, play_audiodev = None): def __init__(self, hugvey_id, cmd_address, publish_address, file_address, play_audiodev = None, play_audiodriver=None):
self.eventQueue = [] self.eventQueue = []
self.ctx = Context.instance() self.ctx = Context.instance()
self.hugvey_id = hugvey_id self.hugvey_id = hugvey_id
@ -252,6 +252,7 @@ class CommandHandler(object):
self.file_address = file_address self.file_address = file_address
self.playingMsgId = None self.playingMsgId = None
self.play_audiodev = play_audiodev self.play_audiodev = play_audiodev
self.play_audiodriver = play_audiodriver
# self.showMyself() # queue message for connection request # self.showMyself() # queue message for connection request
def handle(self, cmd): def handle(self, cmd):
@ -302,8 +303,11 @@ class CommandHandler(object):
continue continue
playCmd.append(str(value)) playCmd.append(str(value))
environment_vars = dict(os.environ) environment_vars = dict(os.environ)
if self.play_audiodev is not None: if self.play_audiodriver is not None:
environment_vars['AUDIODRIVER'] = self.play_audiodriver
elif self.play_audiodev is not None:
environment_vars['AUDIODEV'] = self.play_audiodev environment_vars['AUDIODEV'] = self.play_audiodev
logger.debug(playCmd) logger.debug(playCmd)
t = None t = None
@ -468,7 +472,8 @@ class Hugvey(object):
cmd_address=self.config['events']['cmd_address'], cmd_address=self.config['events']['cmd_address'],
publish_address=self.config['events']['publish_address'], publish_address=self.config['events']['publish_address'],
file_address=self.config['voice']['file_address'], file_address=self.config['voice']['file_address'],
play_audiodev=self.voice_server.info['output']['device'] play_audiodev=self.voice_server.info['output']['device'],
play_audiodriver=self.config['voice']['output_driver'] if 'output_driver' in self.config['voice'] else None,
) )
logger.info('start') logger.info('start')

View file

@ -1,6 +1,6 @@
apt-get update apt-get update
apt-get install -y munin-node bc apt-get install -y munin-node bc supervisor libsox-fmt-pulse
cp installation/rpi-internal-temp /usr/share/munin/plugins cp installation/rpi-internal-temp /usr/share/munin/plugins
ln -sf /usr/share/munin/plugins/rpi-internal-temp /etc/munin/plugins/rpi-internal-temp ln -sf /usr/share/munin/plugins/rpi-internal-temp /etc/munin/plugins/rpi-internal-temp
rm /etc/munin/plugins/irqstats rm /etc/munin/plugins/irqstats
@ -8,7 +8,8 @@ chmod a+x /usr/share/munin/plugins/rpi-internal-temp
echo "allow ^\\S*\$" >> /etc/munin/munin-node.conf echo "allow ^\\S*\$" >> /etc/munin/munin-node.conf
service munin-node restart service munin-node restart
apt-get install -y supervisor # Disable internal sound
echo "blacklist snd_bcm2835" > /etc/modprobe.d/internalsnd-blacklist.conf
# Added chown=pi:pi # Added chown=pi:pi
cp installation/supervisord.conf /etc/supervisor/supervisord.conf cp installation/supervisord.conf /etc/supervisor/supervisord.conf
@ -16,4 +17,3 @@ ln -s /home/pi/hugvey/supervisor.conf /etc/supervisor/conf.d/hugvey.conf
service supervisor restart service supervisor restart
supervisorctl reread supervisorctl reread
supervisorctl update supervisorctl update