From ac7403a84034e237bce09c76b805513448b41570 Mon Sep 17 00:00:00 2001 From: Pmatis Date: Sun, 15 Dec 2013 23:19:00 -0500 Subject: [PATCH 1/3] Fixed Audrey and amixer code for issue #330. --- code/common/pa_control.pl | 12 ++++++------ lib/PAobj.pm | 11 ++++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/code/common/pa_control.pl b/code/common/pa_control.pl index 5ce3d7b51..bbdabb048 100644 --- a/code/common/pa_control.pl +++ b/code/common/pa_control.pl @@ -90,8 +90,8 @@ sub pa_parms_stub { my $results = $pactrl->prep_parms($parms); my %pa_zones = $pactrl->get_pa_zones(); - if (defined $pa_zones{audrey} && $pa_zones{audrey} ne '') { - print_log("PA: audrey zone detected, hooking via web_hook. (".$pa_zones{audrey}.")") if $Debug{pa}; + if (defined $pa_zones{all}{audrey} && $pa_zones{all}{audrey} ne '') { + print_log("PA: audrey zone detected, hooking via web_hook. (".$pa_zones{all}{audrey}.")") if $Debug{pa}; push(@{$parms->{web_hook}},\&pa_web_hook); } @@ -129,8 +129,7 @@ sub pa_control_stub { my $mode = $parms{pa_mode}; return if $mode eq 'mute' or $mode eq 'offline'; - my $rooms = $parms{rooms}; - print_log("PA: control_stub: rooms=$rooms, mode=$mode") if $Debug{pa}; + print_log("PA: control_stub: rooms=$parms{pa_zones}, mode=$mode") if $Debug{pa}; my $results = $pactrl->audio_hook(ON,\%parms); print_log("PA: control_stub set results: $results") if $Debug{pa} >=2; set $pa_speaker_timer $pa_timer if $results; @@ -210,9 +209,10 @@ sub pa_web_hook { used. Serial: The name of the serial port that you use for communcating to the IO device. - The default is "weeder". Note that this can be changed with an INI parm. + Leave this blank unless the "Type" of the PA control line is wdio, wdio_old or + aviosys. The default is "weeder". Note that this can be changed with an INI parm. -Other: Optional. Sets the type of PA control. Defaults to 'wdio'. Available options are: +Type: Optional. Sets the type of PA control. Defaults to 'wdio'. Available options are: wdio,wdio_old,X10,xpl,xap,audrey,amixer,object @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ diff --git a/lib/PAobj.pm b/lib/PAobj.pm index ae3f8b346..89af4acf6 100644 --- a/lib/PAobj.pm +++ b/lib/PAobj.pm @@ -150,10 +150,14 @@ sub prep_parms my $ref = &::get_object_by_name("pa_$room"); my $type = $ref->get_type(); &::print_log("PAobj: speakers_$type: Adding $room") if $main::Debug{pa} >=3; - $pa_zone_types{$type}++ unless $pa_zone_types{$type}; +# $pa_zone_types{$type}++ unless $pa_zone_types{$type}; push(@{$speakertype{$type}}, $room); } + foreach my $type (keys(%pa_zone_types)) { + undef $pa_zones{active}{$type}; + } + foreach my $type (keys(%speakertype)) { my @thespeakers = @{$speakertype{$type}}; &::print_log("PAobj: speakers_$type: ".($#thespeakers+1).": " . join(',',@thespeakers)) if $main::Debug{pa}; @@ -614,8 +618,9 @@ sub new if(lc $paz_type eq 'amixer') { #Headphone:0:L my ($mixer,$mixernum,$channel) = split(':',$self->{address}); - &main::print_log("$mixer / $mixernum / $channel"); - $self->{mixer} = "$mixer,$mixernum"; + &::print_log("$mixer / $mixernum / $channel"); + $self->{mixer} = "$mixer"; + $self->{mixer} .= ",$mixernum" if $mixernum; $self->{mixerchan} = lc $channel if $channel; } From 0dca034bfe2b65f5050e2289937be4317834e26a Mon Sep 17 00:00:00 2001 From: Pmatis Date: Sun, 18 Sep 2016 15:36:48 -0400 Subject: [PATCH 2/3] Ran perltidy --- code/common/pa_control.pl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/code/common/pa_control.pl b/code/common/pa_control.pl index 93d2470f4..e67a7d419 100644 --- a/code/common/pa_control.pl +++ b/code/common/pa_control.pl @@ -61,8 +61,7 @@ if ( said $v_pa_test) { my $state = $v_pa_test->{state}; $v_pa_test->respond('app=pa Testing PA...'); - speak - "nolog=1 rooms=all mode=unmuted volume=80 Hello. This is a PA system test."; + speak "nolog=1 rooms=all mode=unmuted volume=80 Hello. This is a PA system test."; #speak "nolog=1 rooms=downstairs mode=unmuted volume=100 Hi!"; } @@ -94,20 +93,22 @@ sub pa_parms_stub { my $results = $pactrl->prep_parms($parms); my %pa_zones = $pactrl->get_pa_zones(); - if (defined $pa_zones{all}{audrey} && $pa_zones{all}{audrey} ne '') { - print_log("[PA] audrey zone detected, hooking via web_hook. (".$pa_zones{all}{audrey}.")") if $Debug{pa}; - push(@{$parms->{web_hook}},\&pa_web_hook); + if ( defined $pa_zones{all}{audrey} && $pa_zones{all}{audrey} ne '' ) { + print_log( "[PA] audrey zone detected, hooking via web_hook. (" + . $pa_zones{all}{audrey} + . ")" ) + if $Debug{pa}; + push( @{ $parms->{web_hook} }, \&pa_web_hook ); } print_log("[PA] parms_stub set results: $results") if $Debug{pa} >= 2; } else { - #MH is already speaking, and other PA zones are already active. Delay speech. + #MH is already speaking, and other PA zones are already active. Delay speech. if ( $main::Debug{voice} ) { $parms->{clash_retry} = 0 unless $parms->{clash_retry}; - &print_log( - "[PA] SPEECH CLASH($parms->{clash_retry}): Delaying speech call for " + &print_log("[PA] SPEECH CLASH($parms->{clash_retry}): Delaying speech call for " . $parms->{text} . "\n" ) unless $parms->{clash_retry} lt 1; @@ -139,9 +140,10 @@ sub pa_control_stub { my $mode = $parms{pa_mode}; return if $mode eq 'mute' or $mode eq 'offline'; - print_log("[PA] control_stub: rooms=$parms{pa_zones}, mode=$mode") if $Debug{pa}; - my $results = $pactrl->audio_hook(ON,\%parms); - print_log("[PA] control_stub set results: $results") if $Debug{pa} >=2; + print_log("[PA] control_stub: rooms=$parms{pa_zones}, mode=$mode") + if $Debug{pa}; + my $results = $pactrl->audio_hook( ON, \%parms ); + print_log("[PA] control_stub set results: $results") if $Debug{pa} >= 2; set $pa_speaker_timer $pa_timer if $results; return $results; } From 1c5b95f99a5e3a6d897c4364eb79f31aded97501 Mon Sep 17 00:00:00 2001 From: Pmatis Date: Sun, 18 Sep 2016 16:18:46 -0400 Subject: [PATCH 3/3] Fixed remaining merge conflict --- lib/PAobj.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/PAobj.pm b/lib/PAobj.pm index 447e67a34..448c52901 100644 --- a/lib/PAobj.pm +++ b/lib/PAobj.pm @@ -727,16 +727,10 @@ sub new { if ( lc $paz_type eq 'amixer' ) { #Headphone:0:L -<<<<<<< HEAD - my ($mixer,$mixernum,$channel) = split(':',$self->{address}); - &::print_log("$mixer / $mixernum / $channel"); - $self->{mixer} = "$mixer"; - $self->{mixer} .= ",$mixernum" if $mixernum; -======= my ( $mixer, $mixernum, $channel ) = split( ':', $self->{address} ); &main::print_log("$mixer / $mixernum / $channel"); - $self->{mixer} = "$mixer,$mixernum"; ->>>>>>> hollie/master + $self->{mixer} = "$mixer"; + $self->{mixer} .= ",$mixernum" if $mixernum; $self->{mixerchan} = lc $channel if $channel; }