Sonntag, 14. Juni 2009

simond: Thread Termination

Some users told us that when simon crashed / closed under certain conditions, the simond would be trapped in an infinite loop.

To accept any new connections, simond had to be restarted.

This was caused by the implementation of the TCP/IP adin. Once a client would be connected (data connection to synchronize the model), a new socket would be opened for the audio stream. This was implemented using the accept() method which blocks until a connection is made.

While this was in a different thread as the main event loop this was no problem most of the time. However, when the client connected through the data channel but didn't establish an audio connection this socket would be blocking in accept(). When the client exited, the thread should by terminated by the main event loop but the thread event loop would still block waiting for a connection.

This resulted in the debug output "QThread::start: Thread termination error" which was printed over and over again.

Because I really don't want to modify too much of Julius to keep it synchronized to the SVN version I added a little workaround in the stop() routine: I simply connected to the socket and disconnected immediately.

So starting with revision 862 simond should not hang any longer and should be more stable in general.

Samstag, 13. Juni 2009


The manuals for simon, simond and ksimond are now also available as PDF files at our wiki.

Also, I managed to get khelpcenter on windows working. Sadly this really blows up our windows package as this adds the whole khtml library to it... Anyways: Say hello to F1 in the simon 0.2 final!

Freitag, 12. Juni 2009

Overcoming Limitations

Remember the post a couple of days ago about the limitations of the event simulation?


Well they are history now :)


To fix the problem with the dead keys, I added a hash table to the CoreEvents class (the plattform independent part of the event simulation backends) containing the unicode characters ('â', 'é', etc.) and what characters it consits of (in case of 'â': '^' and 'a').


After implementing this and finding all the common dead keys (there are a lot of them!) I had to restructure things anyway in the XEvents backend (to allow for AltGr+Shift at the same time) so the event simulation on X11 should now work better and faster too!


Long story short, simon now supports the following dead keys:





























I told you there are a lot of them...

Dienstag, 9. Juni 2009

French Translation

Quick update: The user yanncantin translated simon to French.


The translations are not yet checked in but I hope to get that done by tonight.

Limitations of the Event Simulation

simon provides the possibility to simulate user input like keystrokes or mouse clicks.

This functionality is provided by the simoneventsimulation library. The library internally uses plattform dependant backends for X11 (xtst) and Microsoft Windows (WinAPI).

The backends need to provide a common sendKey(unsigned int /*unicode*/) method mandated by the shared interface. Since neither Xtst nor WinAPI provide a way to "write" such a character directly we first need to find out how the user would generate such a key.

Internally both methods use a simple switch / case to first determine if this is a special key (like the "Home" key) and if not try to dertmine the keycode by extracting the "base character" (for example: The base character of € is e) and then trying to find out which modifiers (shift, altgr, control) were pressed to get to the keycode given.

This works fine for "normal" characters and special characters like €. However one group of "keys" is missing: The dead keys.

Dead keys are used to generate characters like â or é. They are generated by first pressing one key like ^, releasing it, and then pressing the next key. This is substantially different from modifier keys as there the modifier key is not released until the combination is complete.

This is why simon in the current form does not know how to handle characters that need dead keys. I hope to get this integrated before simon goes stable as this is a substantial feature for languages like French.

Freitag, 5. Juni 2009

Portaudio and Pulseaudio

So as I already said yesterday, I seemed to have missed the gamechanging "make-portaudio-work-with-pulseaudio" patch. So I went back, updated the sources and created new packages for the portaudio snapshot of yesterday.

Guess what? It didn't help a bit. simon still crashes seemingly random and nowhere (no backtraces) when you use portaudio and pulseaudio is active.

I give up. There is apparently no real way to have portaudio and pulseaudio coexist together peacfully.

So if you are using pulseaudio (which is the default of Ubuntu and apparently also on Fedora) expect ugly crashes from simon.

The only workaround I could find is to launch simon over padsp and select OSS devices in simon. That seemed to work fine (no crashes there).

Using pasuspender doesn't help at all.

If you do experience a crash due to pulseaudio it is usually bad enough (catastrophic) that it somehow manages to get simond in an infinite loop so you will want to restart that too if simon crashes.

I am sorry for the inconvenience but sadly there is little that I can do within a realistic timeframe. I don't want to get involved into either portaudio nor pulseaudio development so I keep hoping for phonon to develop a recording API.

Maybe for simon 0.3.

Donnerstag, 4. Juni 2009

Bad Timing

Ok this has to be bad karma or something.

I just finished packaging a portaudio snapshot because the stock Ubuntu-Version of portaudio is just too old.

So I upload them to the ubuntu bugtracker after careful testing on Kubuntu 32-bit and Kubuntu 64-bit. Everything works fine.

Yesterday I tested the whole setup (simon and the portaudio snapshot) on Ubuntu 32-bit and with it the Pulseaudio soundserver. simon crashes instantly when I deactivate it (which happens to happen all the time).

Back to square one. First I try to debug the problem but even when building every package I can find with debug information I get no valid backtraces at all. Valgrind doesn't help. Pasuspender? Crash. OSS devices? Crash. Nothing. The only thing that kind-of-works is using padsp and then using OSS devices in simon. But thats not good enough IMO.

So I start to look around and after quite some discouraging "there was some effort but now it is dead" posts on mailing lists and a lot of pushing the blame around (portaudio support in pulseaudio or pulseaudio support in portaudio?) I finally find light at the end of the tunnel. Apparently the problem annoyed enough audacity users that they integrated a patch into the audacity fork of portaudio that allows to use non-mmap devices which is apparently needed by pulseaudio.

David, It works!!!!!!!!!

Good enough for me. So I download the patch and a new portaudio snapshot and try to apply it. It fails. Of course.

So after going through it line by line and double checking the portaudio code I realize that the patch was already integrated. So why doesn't it work? Is the Audacity fork of portaudio just so much more advanced?

But then I look at the portaudio svn log and see this:

r1412 | aknudsen | 2009-05-24 18:54:22 +0200 (Son, 24. Mai 2009) | 2 Zeilen

Apply Kevin Kofler's non-mmap patch

Checking back to the date of the snapshot I used for packaging: 2009-05-19. I made the packages over the course of the last 3 days but used the "old" code, mind you.

So in an effort to update the stock version that is 2 years too old, I updated it with packages of a newer portaudio version that is ... 5 days too old. Oh the irony.

Ok I am off packaging portaudio again. And this time I am using the SVN version.

Dienstag, 2. Juni 2009

simon 0.2 and KDE 4.1

simon and KDE backward compatibility has always been an issue. Because I use KDE/trunk to develop simon, I tend to use new classes as they appear.

However, OpenSUSE still has KDE 4.2 only in the factory respository and *buntu 8.10 only has it in its backports repository from jaunty.

So while we will not support 4.0 (Ubuntu Hardy), we decided support KDE >= 4.1. This means that users of all major distributions should have no problem installing simon 0.2.

simon 0.2 on KDE 4.1

Portaudio Snapshot Packages

After I realized that a lot of the sound issues on *buntu can be traced back to the very old portaudio version used.

I packaged a snapshot from a couple of days ago and uploaded it to the Launchpad bugtracker.

Just uninstall the libportaudio2 and portaudio19-dev packages if they are already installed from the universe repository and install the new packages. This should fix a lot of sound issues (all of them if you are running Kubuntu and thus don't use pulseaudio) instantly.