hollie/misterhouse — pull request #257 by pmatis (2013-09-23 04:41:21+00:00)
Title: Mh sound master volume

I have several voice notifications that play all day long at various volume levels. However, later in the evening I want all volumes of each notification to be slightly lower than during the day. So, I wrote this modification to handle that.

I added the following to my mh.private.ini file:
```INIFile
volume_master_get_cmd=amixer get Master | grep % | sed -e 's/%\].*$//' -e 's/^.*\[//'
volume_master_set_cmd=amixer -q set Master $volume%
volume_wav_get_cmd=amixer get PCM | grep % | sed -e 's/%\].*$//' -e 's/^.*\[//'
volume_wav_set_cmd=amixer -q set PCM $volume%
volume_wav_default_volume=70
```
I then added my own user code to handle the various volume levels:
```UserCode
if($state = state_now $mh_volume) {
print_log "mh_volume set to: $mh_volume";
}

##### Auto Volume Control ######
if($Reload) {set $mh_volume 80 unless $mh_volume;}
if($New_Minute) {
my $desired_volume=80;
if(time_greater_than '8:30 am') {$desired_volume = 88;}
if(time_greater_than '9:30 am') {$desired_volume = 95;}
if(time_greater_than '11:00 am') {$desired_volume = 100;}
if(time_greater_than '8:00 pm') {$desired_volume = 95;}
if(time_greater_than '10:30 pm') {$desired_volume = 80;}
set $mh_volume $desired_volume unless state $mh_volume == $desired_volume;
}
```

Now, I have various speak events that speak av different levels. The main volume level of MH can be overrided on a per-event basis by using mhvolume=xx as well:
```
speak "volume=100 mhvolume=100 WARNING! You have triggered the security system. The authorities are being notified.";
```

The above speaks with both "sliders" of the mixer at full volume.

I hope others have some use for this! :)