rsi/macspeech.lua

20 lines
388 B
Lua
Raw Permalink Normal View History

2023-08-27 12:32:38 +00:00
objc=require "objc/objc"
local synth=objc.NSSpeechSynthesizer:alloc():init()
local function output(text)
if type(text) ~="string" then
text=tostring(text)
end
synth:startSpeakingString(text)
end
local function isSpeaking()
if synth:isSpeaking()==1 then
return true
else
return false
end
end
return {output=output, isSpeaking=isSpeaking}