Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial code added to Voice::Text #33

Merged
merged 1 commit into from
Mar 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -2972,9 +2972,9 @@ sub exit_pgm {
}


if ($main::Info{OS_name}=~ /darwin/i) { # Should go into Voice::Text?
Dispose_Speech_Channel();
}
#if ($main::Info{OS_name}=~ /darwin/i) { # Should go into Voice::Text?
# Dispose_Speech_Channel();
#}
&Voice_Cmd::remove_voice_cmds if $config_parms{voice_cmd};
&Exit_hooks(); # Allow user code exits
&run_kill_processes; # From handy_utilities ... kills anybody that isn't done yet
Expand Down Expand Up @@ -6067,11 +6067,11 @@ sub speak {
# print "Warning, speak control not recognized: key=$key value=$value\n"
# unless grep $key eq $_, @speak_parms;

if ($main::Info{OS_name}=~ /darwin/i) { # Should go into Voice::Text? (YES!! It should.)
print "Trying to speak $phrase\n";
speak_mac ($phrase);
return;
}
#if ($main::Info{OS_name}=~ /darwin/i) { # Should go into Voice::Text? (YES!! It should.)
# print "Trying to speak $phrase\n";
# speak_mac ($phrase);
# return;
#}

$parms{mode} = '' unless $parms{mode};
$parms{rooms} = $parms{room} if $parms{room}; # Allow for room or rooms
Expand Down
27 changes: 12 additions & 15 deletions lib/Voice_Text.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ sub init {

$web_index = 0;

# The darwin hook is currently done in the main bin/mh code
# if ($main::Info{OS_name}=~ /darwin/i) {
# &main::my_use("Mac::Sound");
# &main::my_use("Mac::Speech");
# my $voice = $main::config_parms{speak_voice};
# $voice = 'Albert' unless $voice;
# my $Mac_voice = $Mac::Speech::Voice{$voice};
# $VTxt_mac = NewSpeechChannel($Mac_voice); # Need a default voice here?
# }
# OS X
if ($main::Info{OS_name}=~ /darwin/i) {
my $voice = $main::config_parms{speak_voice};
$voice = 'Albert' unless $voice;
}

if (($main::config_parms{voice_text} =~ /festival/i or $engine and $engine eq 'festival') and
$main::config_parms{festival_host}) {
Expand Down Expand Up @@ -207,7 +203,7 @@ sub speak_text {
# $speak_pgm = "$path/bin/TTSDesktopPlayer -data $path/data -xml";
}
elsif ($main::Info{OS_name}=~ /darwin/i) {
$speak_pgm = 'MacSpeech' unless $speak_pgm;
$speak_pgm = 'say' unless $speak_pgm;
# $speak_pgm = 'osascript' unless $speak_pgm;
}
elsif ($speak_engine =~ /viavoice/i or $speak_engine =~ /vv_tts/i) {
Expand Down Expand Up @@ -521,11 +517,12 @@ sub speak_text {

$speak_pgm .= " > /dev/null" unless $main::Debug{voice} and $main::Debug{voice} > 1;
}
elsif ($speak_pgm eq 'MacSpeech') {
my $volume_reset = GetDefaultOutputVolume();
SetDefaultOutputVolume(2**$parms{volume}) if $parms{volume};
SpeakText($VTxt_mac, $parms{text});
SetDefaultOutputVolume(2**$volume_reset) if $parms{volume};
elsif ($speak_pgm eq 'say') {
system "say $parms{text}";
#my $volume_reset = GetDefaultOutputVolume();
#SetDefaultOutputVolume(2**$parms{volume}) if $parms{volume};
#SpeakText($VTxt_mac, $parms{text});
#SetDefaultOutputVolume(2**$volume_reset) if $parms{volume};
# sleep 1 while SpeechBusy();
}
elsif ($speak_pgm eq 'osascript') {
Expand Down