factor/examples/cocoa/speech.factor

17 lines
522 B
Factor
Raw Normal View History

2006-01-11 00:22:01 -05:00
! Copyright (C) 2006 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
! This example requires Mac OS X. It has only been tested on
! 10.4. It must be run from a Factor runtime linked against the
! Cocoa library; you can obtain one with the 'macosx-sdl' target
! in the Makefile.
IN: cocoa-speech
2006-02-09 22:11:22 -05:00
USING: cocoa kernel objc-NSObject objc-NSSpeechSynthesizer ;
2006-01-11 00:22:01 -05:00
2006-02-09 22:11:22 -05:00
: say ( string -- )
NSSpeechSynthesizer [alloc] f [initWithVoice:]
swap <NSString> [startSpeakingString:] ;
2006-02-09 22:11:22 -05:00
"Hello from Factor" say