On Mon, Apr 11, 2011 at 11:39 AM, Yann Leboulanger <aste...@lagaule.org> wrote: > On 04/11/2011 06:30 PM, Zhihao Yuan wrote: >> >> On Mon, Apr 11, 2011 at 11:17 AM, Yann Leboulanger<aste...@lagaule.org> >> wrote: >>> >>> On 04/11/2011 06:14 PM, Zhihao Yuan wrote: >>>> >>>> On Mon, Apr 11, 2011 at 11:13 AM, Yann Leboulanger<aste...@lagaule.org> >>>> wrote: >>>>> >>>>> On 04/11/2011 06:09 PM, Zhihao Yuan wrote: >>>>>> >>>>>> On Mon, Apr 11, 2011 at 11:06 AM, Yann >>>>>> Leboulanger<aste...@lagaule.org> >>>>>> wrote: >>>>>>> >>>>>>> On 04/11/2011 05:55 PM, Zhihao Yuan wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> Maybe for a Linux user, aplay is always available; but for many >>>>>>>> FreeBSD users like me, we don't have any soundplay (even ossplay) >>>>>>>> installed by default. Our own oss implementation is much better than >>>>>>>> 4Front's, and we don't use esound or arts. >>>>>>>> >>>>>>>> This patch make use of wave and ossaudiodev which where built into >>>>>>>> python, and it deal with little endian wav sound. >>>>>>> >>>>>>> I see 2 problems with that: >>>>>>> 1/ it's blocking, so playing a sound blocks UI. We need to run that >>>>>>> in >>>>>>> a >>>>>>> thread >>>>>>> 2/ What happens if you try to play 2 sounds at the same time? (2 >>>>>>> contacts >>>>>>> connects at the same time) >>>>>> >>>>>> Blocking can be solved by thread. >>>>>> Mixing depends on your OSS implementation. For BSDs, our kernel OSS >>>>>> driver has the mixing support. Linux is the only distro (AFAIK) that >>>>>> come with a OSS which does not support mixing. >>>>> >>>>> So we need to use your code only under BSD >>>>> >>>> >>>> Because Linux user have aplay, so the code won't run on their systems. >>>> >>> >>> They may not have. That doesn't hurt to adf a test. >>> >>> Could you look at running that in a thread? there is a >>> gajim.thread_interface() function that will do it. >> >> This class requires a GTK callback, but I don't need one here. Is >> there a null callback for this, or can I modify this class to allow >> such case? > > Yes, we can pass callback=None, and then do: > if callback: > gobject.idle_add(callback, output, *callback_args) >
How about this? I used thread module instead of threading. Tested, OK. -- Zhihao Yuan The best way to predict the future is to invent it.
patch-oss-fallback.py
Description: Binary data
_______________________________________________ Gajim-devel mailing list Gajim-devel@gajim.org http://lists.gajim.org/cgi-bin/listinfo/gajim-devel