Hi,
I am attempting to use the Speech Synthesis Audio Unit for a project I am
working on, and I am having an issue with the callbacks. I am using Swift
2.2. I am trying to get the per word callback to work, which the function
does get called, but it runs too quickly through the callback and doesn't
follow the words from the speech. I have tried all the callbacks available
and they all do the same thing. When I establish a new channel, without the
AU this callback works just fine, but I cannot set that new channel to the
AU since it is only a {get}. Here is an example of how I have set it up:
I get my channel from the Audio Unit
checkError(AudioUnitGetProperty(speechAU, kAudioUnitProperty_SpeechChannel,
kAudioUnitScope_Global, 0, &channel, &propSize), "Getting CH",nil)
Set up a type alias for the function
typealias speechWordCallBackType = @convention(c) (SpeechChannel, SRefCon,
CFString, CFRange) -> Void
Set the Speech property of the kSpeechWordCFCallback to the global function
err(SetSpeechProperty(channel, kSpeechWordCFCallBack, unsafeBitCast(
speechWordDoneCallBack as speechWordCallBackType, Int.self)))
func speechWordDoneCallBack(_: SpeechChannel, _: SRefCon, a:CFString,b:
CFRange) {Swift.print("Per Word Callback")} // Doesnt work! Calls all
the words faster than it is speaking them
When I set up a new speech channel without using an audio unit, this same
callback works fine. NewSpeechChannel(&voice, &channel)
Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]