2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 07:19:24 +00:00

98_Text2Speech.pm: Added Attribute TTS_VolumeAdjust

git-svn-id: https://svn.fhem.de/fhem/trunk@5161 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tobiasfaust 2014-03-08 06:33:23 +00:00
parent aafd4c6884
commit f3cf5ee90f
2 changed files with 29 additions and 9 deletions

View File

@ -1452,11 +1452,11 @@ sub chartQuery($@) {
<ul>Count records in tables current and history and write results into readings countCurrent and countHistory.</ul><br/> <ul>Count records in tables current and history and write results into readings countCurrent and countHistory.</ul><br/>
<code>set &lt;name&gt; deleteOldDays &lt;n&gt;</code><br/><br/> <code>set &lt;name&gt; deleteOldDays &lt;n&gt;</code><br/><br/>
<ul>Delete records from history older than days. Number of deleted record will be written into reading lastRowsDeleted.</ul><br/> <ul>Delete records from history older than &lt;n&gt; days. Number of deleted record will be written into reading lastRowsDeleted.</ul><br/>
<code>set &lt;name&gt; userCommand &lt;validSqlStatement&gt;</code><br/><br/> <code>set &lt;name&gt; userCommand &lt;validSqlStatement&gt;</code><br/><br/>
<ul><b>DO NOT USE THIS COMMAND UNLESS YOU REALLY (REALLY!) KNOW WHAT YOU ARE DOING!!!</b><br/><br/> <ul><b>DO NOT USE THIS COMMAND UNLESS YOU REALLY (REALLY!) KNOW WHAT YOU ARE DOING!!!</b><br/><br/>
Perform any (!!!) sql statement on connected database. Ueercommand and result will be written into corresponding readings.<br/> Perform any (!!!) sql statement on connected database. Useercommand and result will be written into corresponding readings.<br/>
</ul><br/> </ul><br/>
</ul><br> </ul><br>
@ -1732,7 +1732,25 @@ sub chartQuery($@) {
<a name="DbLogset"></a> <a name="DbLogset"></a>
<b>Set</b> <ul>N/A</ul><br> <b>Set</b>
<ul>
<code>set &lt;name&gt; reopen </code><br/><br/>
<ul>Schlie&szlig;t die Datenbank und &ouml;ffnet sie danach sofort wieder. Dabei wird die Journaldatei geleert und neu angelegt.<br/>
Verbessert den Datendurchsatz und vermeidet Speicherplatzprobleme.</ul><br/>
<code>set &lt;name&gt; count </code><br/><br/>
<ul>Z&auml;hlt die Datens&auml;tze in den Tabellen current und history und schreibt die Ergebnisse in die Readings countCurrent und countHistory.</ul><br/>
<code>set &lt;name&gt; deleteOldDays &lt;n&gt;</code><br/><br/>
<ul>L&ouml;scht Datens&auml;tze, die &auml;lter sind als &lt;n&gt; Tage. Die Anzahl der gel&ouml;schten Datens&auml;tze wird in das Reading lastRowsDeleted geschrieben.</ul><br/>
<code>set &lt;name&gt; userCommand &lt;validSqlStatement&gt;</code><br/><br/>
<ul><b>BENUTZE DIESE FUNKTION NUR, WENN DU WIRKLICH (WIRKLICH!) WEISST, WAS DU TUST!!!</b><br/><br/>
F&uuml;hrt einen beliebigen (!!!) sql Befehl in der Datenbank aus. Der Befehl und ein zur&uuml;ckgeliefertes Ergebnis werden in entsprechende Readings geschrieben.<br/>
</ul><br/>
</ul><br>
<a name="DbLogget"></a> <a name="DbLogget"></a>
<b>Get</b> <b>Get</b>

View File

@ -64,6 +64,7 @@ sub Text2Speech_Initialize($)
" TTS_SentenceAppendix". " TTS_SentenceAppendix".
" TTS_FileMapping". " TTS_FileMapping".
" TTS_FileTemplateDir". " TTS_FileTemplateDir".
" TTS_VolumeAdjust".
" ".$readingFnAttributes; " ".$readingFnAttributes;
} }
@ -317,9 +318,9 @@ sub Text2Speech_Set($@)
} elsif($cmd eq "volume") { } elsif($cmd eq "volume") {
my $vol = join(" ", @a); my $vol = join(" ", @a);
return "volume adjusting only available in direct mode" if($hash->{MODE} ne "DIRECT"); return "volume adjusting only available in direct mode" if($hash->{MODE} ne "DIRECT");
return "volume level expects 0..100 percent" if($vol !~ m/^([0-9]{1,2})$/); return "volume level expects 0..100 percent" if($vol !~ m/^([0-9]{1,3})$/ or $vol > 100);
$hash->{VOLUME} = $vol if($vol ne 100); $hash->{VOLUME} = $vol if($vol <= 100);
delete($hash->{VOLUME}) if($vol eq 100); delete($hash->{VOLUME}) if($vol > 100);
} }
return undef; return undef;
@ -369,7 +370,7 @@ sub Text2Speech_PrepareSpeech($$) {
$t =~ s/Ä/Ae/g; $t =~ s/Ä/Ae/g;
$t =~ s/Ö/Oe/g; $t =~ s/Ö/Oe/g;
$t =~ s/Ü/Ue/g; $t =~ s/Ü/Ue/g;
$t =~ s/ß/sz/g; $t =~ s/ß/ss/g;
@text = $hash->{helper}{Text2Speech} if($hash->{helper}{Text2Speech}[0]); @text = $hash->{helper}{Text2Speech} if($hash->{helper}{Text2Speech}[0]);
push(@text, $t); push(@text, $t);
@ -455,10 +456,11 @@ sub Text2Speech_BuildMplayerCmdString($$) {
my $cmd; my $cmd;
my $TTS_MplayerCall = AttrVal($hash->{NAME}, "TTS_MplayerCall", $mplayer); my $TTS_MplayerCall = AttrVal($hash->{NAME}, "TTS_MplayerCall", $mplayer);
my $TTS_VolumeAdjust = AttrVal($hash->{NAME}, "TTS_VolumeAdjust", 110);
my $verbose = AttrVal($hash->{NAME}, "verbose", 3); my $verbose = AttrVal($hash->{NAME}, "verbose", 3);
if($hash->{VOLUME}) { # per: set <name> volume <..> if($hash->{VOLUME}) { # per: set <name> volume <..>
$mplayerOpts .= " -softvol -softvol-max 110 -volume " . $hash->{VOLUME}; $mplayerOpts .= " -softvol -softvol-max ". $TTS_VolumeAdjust ." -volume " . $hash->{VOLUME};
} }
my $AlsaDevice = $hash->{ALSADEVICE}; my $AlsaDevice = $hash->{ALSADEVICE};