diff --git a/client_config.yml b/client_config.yml index 5628853..b176ef3 100644 --- a/client_config.yml +++ b/client_config.yml @@ -12,6 +12,7 @@ voice: input_volume: 90 output_volume: 60 file_address: "http://hugveycmd.local:8888" + output_driver: pulseaudio diff --git a/hugvey/client.py b/hugvey/client.py index 6bf74db..408b2ba 100644 --- a/hugvey/client.py +++ b/hugvey/client.py @@ -241,7 +241,7 @@ class VoiceServer(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.ctx = Context.instance() self.hugvey_id = hugvey_id @@ -252,6 +252,7 @@ class CommandHandler(object): self.file_address = file_address self.playingMsgId = None self.play_audiodev = play_audiodev + self.play_audiodriver = play_audiodriver # self.showMyself() # queue message for connection request def handle(self, cmd): @@ -302,8 +303,11 @@ class CommandHandler(object): continue playCmd.append(str(value)) 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 + logger.debug(playCmd) t = None @@ -468,7 +472,8 @@ class Hugvey(object): cmd_address=self.config['events']['cmd_address'], publish_address=self.config['events']['publish_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') diff --git a/install_server.sh b/install_server.sh index fb049dc..d009e02 100755 --- a/install_server.sh +++ b/install_server.sh @@ -1,6 +1,6 @@ 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 ln -sf /usr/share/munin/plugins/rpi-internal-temp /etc/munin/plugins/rpi-internal-temp 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 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 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 supervisorctl reread supervisorctl update -