| 1 | package Pod::SpeakIt::MacSpeech; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use base qw(Pod::PseudoPod); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | no warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | ▶ | use subs qw(); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use vars qw($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 0 | ▶ | use Mac::Files; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 12 | use Mac::Speech; | ||
| 13 | |||
| 14 | my $voice = $Mac::Speech::Voice{Victoria}; | ||
| 15 | my $channel = NewSpeechChannel($voice); | ||
| 16 | SetSpeechPitch($channel, 0.9*GetSpeechPitch($channel) ); | ||
| 17 | SetSpeechRate( $channel, 0.7*GetSpeechRate($channel) ); | ||
| 18 | |||
| 19 | $VERSION = '0.121'; | ||
| 20 | |||
| 21 | =encoding utf8 | ||
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | Pod::SpeakIt::MacSpeech - Speak Pod | ||
| 26 | |||
| 27 | =head1 SYNOPSIS | ||
| 28 | |||
| 29 | use Pod::SpeakIt::MacSpeech; | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | ***THIS IS ALPHA SOFTWARE. MAJOR PARTS WILL CHANGE*** | ||
| 34 | |||
| 35 | This module overrides and extends C<Pod::PsuedoPod> to read | ||
| 36 | Pod aloud. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | sub DESTROY | ||
| 41 | { | ||
| 42 | $_[0]->SUPER::DESTROY; | ||
| 43 | DisposeSpeechChannel($channel) | ||
| 44 | } | ||
| 45 | |||
| 46 | sub handle_text { $_[0]{'scratch'} .= $_[1] } | ||
| 47 | |||
| 48 | sub speak_it | ||
| 49 | { | ||
| 50 | SpeakText( $channel, $_[0]->{'scratch'} ); | ||
| 51 | sleep 1 while SpeechBusy(); | ||
| 52 | $_[0]->{'scratch'} = ''; | ||
| 53 | sleep 1; | ||
| 54 | |||
| 55 | return; | ||
| 56 | } | ||
| 57 | |||
| 58 | sub document_header | ||
| 59 | { | ||
| 60 | print STDERR "HERE I AM"; | ||
| 61 | } | ||
| 62 | |||
| 63 | sub start_head0 { } | ||
| 64 | sub start_head1 { } | ||
| 65 | sub start_head2 { } | ||
| 66 | sub start_head3 { } | ||
| 67 | sub start_head4 { } | ||
| 68 | |||
| 69 | sub end_head0 { $_[0]->speak_it } | ||
| 70 | sub end_head1 { $_[0]->speak_it } | ||
| 71 | sub end_head2 { $_[0]->speak_it } | ||
| 72 | |||
| 73 | sub end_Para { $_[0]->speak_it } | ||
| 74 | |||
| 75 | sub end_Verbatim | ||
| 76 | { | ||
| 77 | sleep 1; | ||
| 78 | $_[0]->{scratch} = "Code section (skipping)"; | ||
| 79 | $_[0]->speak_it; | ||
| 80 | sleep 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | =head1 TO DO | ||
| 84 | |||
| 85 | =over 4 | ||
| 86 | |||
| 87 | =item * handle item lists | ||
| 88 | |||
| 89 | =item * different voices for headings and paras and code | ||
| 90 | |||
| 91 | =item * configure voices, pitch, and rate | ||
| 92 | |||
| 93 | =back | ||
| 94 | |||
| 95 | =head1 SEE ALSO | ||
| 96 | |||
| 97 | L<Pod::InDesign::TaggedText>, L<Pod::Simple> | ||
| 98 | |||
| 99 | =head1 SOURCE AVAILABILITY | ||
| 100 | |||
| 101 | This source is part of a Github project: | ||
| 102 | |||
| 103 | https://github.com/CPAN-Adoptable-Modules/Pod-Speakit-MacSpeech | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | brian d foy, C<< <bdfoy@cpan.org> >> | ||
| 108 | |||
| 109 | =head1 COPYRIGHT AND LICENSE | ||
| 110 | |||
| 111 | Copyright © 2007-2018, brian d foy <bdfoy@cpan.org>. All rights reserved. | ||
| 112 | |||
| 113 | You may redistribute this under the terms of the Artistic License 2.0. | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | 1; | ||