* Can't get speechSynthesizer:didFinishSpeaking: to run on OS X
@ 2010-06-22 23:26 Ivan Andrus
2010-06-23 7:42 ` Adrian Robert
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Andrus @ 2010-06-22 23:26 UTC (permalink / raw)
To: emacs-devel
I would like to add GNUstep/Cocoa speech synthesis to my local copy of emacs. I know this is an GNUstep/OS X only feature and that it will probably never make it into emacs. I also know about emacspeak and such, but I just want something very simple to play around with.
So far I can start and stop speech, but I have been unable to get the didFinishSpeaking callback to work. I have implemented an ObjC class (in nsfns.m) which implements
- (void)speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL)success
and I have set an instance as a delegate to an NSSpeechSynthesizer object, but it never fires. If I call it manually as
[[speech_synthesizer delegate] speechSynthesizer: speech_synthesizer didFinishSpeaking: YES];
it works, so I don't think there is a problem with the callback, or the delegate. I read at
http://lists.apple.com/archives/cocoa-dev/2009/Feb/msg00624.html
that asynchronous callbacks rely on the runloop. I think Emacs.app does some weird things with the runloop, so my question is, what must I do to get this to work? Is it even possible? Does Emacs.app even use the runloop? Is it worth the effort? I'm not an expert in either Cocoa/GNUstep or emacs development.
I can send the code if it's helpful, but I thought someone might know offhand what the problem is and and could point me in the right direction to fix it.
Thanks,
Ivan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can't get speechSynthesizer:didFinishSpeaking: to run on OS X
2010-06-22 23:26 Can't get speechSynthesizer:didFinishSpeaking: to run on OS X Ivan Andrus
@ 2010-06-23 7:42 ` Adrian Robert
2010-06-23 21:30 ` Ivan Andrus
0 siblings, 1 reply; 4+ messages in thread
From: Adrian Robert @ 2010-06-23 7:42 UTC (permalink / raw)
To: emacs-devel
Ivan Andrus <darthandrus <at> gmail.com> writes:
>
> I would like to add GNUstep/Cocoa speech synthesis to my local copy of emacs.
I know this is an GNUstep/OS X
> only feature and that it will probably never make it into emacs.
It's not impossible -- features for the X11 interface at least, whether
implemented/implementable elsewhere, often make it in. I can't speak to what
the criteria are for these kinds of things. Anyway it sounds like an
interesting project.
> and I have set an instance as a delegate to an NSSpeechSynthesizer object, but
it never fires. If I call it
> manually as
>
> [[speech_synthesizer delegate] speechSynthesizer: speech_synthesizer
didFinishSpeaking: YES];
>
> it works, so I don't think there is a problem with the callback, or the
delegate. I read at
> http://lists.apple.com/archives/cocoa-dev/2009/Feb/msg00624.html
> that asynchronous callbacks rely on the runloop. I think Emacs.app does some
weird things with the
> runloop, so my question is, what must I do to get this to work? Is it even
possible? Does Emacs.app even use
> the runloop?
Emacs.app activates the run loop in a kind of stutter-step fashion using [NSApp
run] followed by [NSApp stop] repeatedly. Certain asynchronous events work,
like open-file requests to the NSApplication delegate, and NSTextInput
callbacks. I cannot recall any that positively DON'T work at the moment. I
don't know if the system is handling the ones I mention differently from the
callback you're trying to get, but anyway it seems worth looking into a bit more.
One thing to check -- I have no idea how the speech synth subsystem works, but
if system events are involved you can intercept and print those in the
-sendEvent: method in nsterm.m.
-Adrian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can't get speechSynthesizer:didFinishSpeaking: to run on OS X
2010-06-23 7:42 ` Adrian Robert
@ 2010-06-23 21:30 ` Ivan Andrus
2010-06-23 22:44 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Andrus @ 2010-06-23 21:30 UTC (permalink / raw)
To: emacs-devel; +Cc: Adrian Robert
I don't know what my problem was yesterday, perhaps incomplete builds, because after a fresh start today everything seems to be working as expected.
Of course now I am crashing intermittently in my callback (I want to run a lisp hook from the callback and I have no idea what I am doing). That's certainly my fault however, and I will look into it. Sorry for the noise, and thanks for the suggestions.
-Ivan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can't get speechSynthesizer:didFinishSpeaking: to run on OS X
2010-06-23 21:30 ` Ivan Andrus
@ 2010-06-23 22:44 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-06-23 22:44 UTC (permalink / raw)
To: Ivan Andrus; +Cc: Adrian Robert, emacs-devel
> Of course now I am crashing intermittently in my callback (I want to
> run a lisp hook from the callback and I have no idea what I am doing).
> That's certainly my fault however, and I will look into it. Sorry for
> the noise, and thanks for the suggestions.
You cannot safely run Elisp code asynchronously. So the way to trigger
Elisp code from an async callback is to queue an event into the
event_queue and then add code to run the corresponding Elisp code when
that event is unqueued.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-23 22:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-22 23:26 Can't get speechSynthesizer:didFinishSpeaking: to run on OS X Ivan Andrus
2010-06-23 7:42 ` Adrian Robert
2010-06-23 21:30 ` Ivan Andrus
2010-06-23 22:44 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.