lib/gloo/objs/snd/say.rb in gloo-0.6.1 vs lib/gloo/objs/snd/say.rb in gloo-0.7.0

- old
+ new

@@ -11,10 +11,11 @@ KEYWORD = 'say'.freeze KEYWORD_SHORT = 'say'.freeze VOICE = 'voice'.freeze MSG = 'message'.freeze + DEFAULT_MSG = 'talk to me'.freeze # # The name of the object type. # def self.typename @@ -50,24 +51,28 @@ # --------------------------------------------------------------------- # Children # --------------------------------------------------------------------- + # # Does this object have children to add when an object # is created in interactive mode? # This does not apply during obj load, etc. + # def add_children_on_create? return true end + # # Add children to this object. # This is used by containers to add children needed # for default configurations. + # def add_default_children fac = $engine.factory fac.create_string VOICE, '', self - fac.create_string MSG, 'talk to me', self + fac.create_string MSG, DEFAULT_MSG, self end # --------------------------------------------------------------------- # Messages # --------------------------------------------------------------------- @@ -77,43 +82,16 @@ # def self.messages return super + [ 'run' ] end - # Run the system command. + # + # Have the computer 'speak' the message. + # def msg_run v = voice_value.empty? ? '' : "-v '#{voice_value}'" cmd = "say #{v} '#{msg_value}'" system cmd - end - - # --------------------------------------------------------------------- - # Help - # --------------------------------------------------------------------- - - # - # Get help for this object type. - # - def self.help - return <<~TEXT - SAY OBJECT TYPE - NAME: say - SHORTCUT: say - - DESCRIPTION - Use the Mac text to speach function to say the . - From the Mac CLI, run this to get a list of voices: - say -v '?' - - CHILDREN - voice - string - The Voice to use. If left blank, the default voice will be used. - message - string - 'talk to me' - The message to speak. - - MESSAGES - run - Speak the message, optionally in the voice specified. - TEXT end end end end