[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: Voice Lister (was: Chorus)



> Oops, you forgot to dispose of $channelB...

OK; I'll clean it up a bit...

-r

#!perl

# "Voice Lister" v1.0
# by David Seay <g-s@navix.net>
# additions by Vicki Brown <vlb@cfcl.com>,
# shamelessly stolen from other samples
# shameless additions by Rich Morin <rdm@cfcl.com>

use Mac::Speech;

# Multimatthias display of alphabetized list of Mac's voices.

$i          =  4;			# Bad News
$i          = 20;			# Ralph

$text       = 'Matthias Neerawker';	# Dr. MacPerl

$count      = CountVoices();
$voice      = GetIndVoice($count - $i + 1);
$desc       = ${GetVoiceDescription($voice)};
$nameLength = ord(substr($desc, 16, 1));
$nameB      = substr($desc, 17, $nameLength);
$channelB   = NewSpeechChannel($voice) or die($^E);

for $i (1..$count) {
  	$voice      = GetIndVoice($count - $i + 1);
  	$desc       = ${GetVoiceDescription($voice)};
  	$nameLength = ord(substr($desc, 16, 1));
  	$name       = substr($desc, 17, $nameLength);
  	printf("%2d %s\n",    $i, $name);
  	SpeakText($channelB, "$i, $name");
  	while (SpeechBusy()) {}

         $channel    = NewSpeechChannel($voice) or die($^E);
  	SpeakText($channel, $text);
  	while (SpeechBusy()) {}
  	DisposeSpeechChannel($channel) if $channel;
}
DisposeSpeechChannel($channelB);
--
Rich Morin:          rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm
Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com
MacPerl: http://www.macperl.com,       http://www.ptf.com/ptf/products/MPPE
MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org