Re: [g-a-devel]test-speech



Hi Marc,

On Wed, 2002-10-23 at 16:20, Marc Mulcahy wrote:
> Ug...  I have callbacks working in the GNOME Speech driver for Viavoice, 
> but I can't test them!  Test-speech is a console app, and I can think of a 
> way to receive callbacks.  Any ideas?

	To receive CORBA stuff you can't be stuck in a system 'read' on stdin
;-) so - you need to integrate with the main-loop.

	What you want is essentially instead of 'scanf' to read input, you need
to use something like:

	char *instr;
	set stdin to be non-blocking;
	channel = g_io_channel_unix_new (stdin);
	foo = g_io_add_watch (channel, G_IO_IN|G_IO_PRI,
			      my_callback, &instr);
	g_main_loop (...);

	Then in my_callback; use g_io_channel_read_line and whack it in instr
;-)

	It sucks - but it's the only way to integrate with the mainloop - ie.
you should have a method that does this like 'stream_readstr' or
somesuch; ideally glib would have a nice way to do this simply, perhaps
it does that I'm not aware of but ...

	Regards,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]