Zynthian Emulator
Developing software for Zynthian is slighty more complex than developing software for a desktop platform. You need a Zynthian Box (ZBox) on your desk running all the time and connected to the network. You must login by ssh every time you reboot the ZBox. Every time you want to test your changes, you have to copy the modified files into the ZBox, compile if needed, and run the program from the shell.
This cycle makes development slower than normal, and although you use scripts and tools to make the process easier, finally you realize that there is a better way 😉
On the other hand, it would be nice if people could try Zynthian easily. Until now, you needed a ZBox to run the Zynthian User Interface (ZUI), and to be honest, currently it’s a little difficult to obtain a ZBox. You have to [build it by yourself], spending some time and euros.
The problem is that the ZUI depends on 4 rotary encoder/switches. These elements are physical in the real ZBox, but can be easily emulated by software, so …
I’ve developed a Zynthian Emulator. A standard desktop application (mouse driven GUI) that emulates the 4 rotary encoder/switches by using standard widgets. The emulator calls the ZUI, that is embbeded inside, simulating the look & feel of a real ZBox.
The ZUI doesn’t perceive the difference, and you can play with it in the same way that you play with the real thing. You can test your changes faster and easier, and the development process is improved a lot.
Furthermore, people that want to explore the ZUI, or have a first Zynthian Experience before building their own ZBox, now can do it. Enjoy!!
1 How does it work?
Well, the secret of the emulation is the new emulation layer added recently to the Zyncoder library. This emulation layer implements the wiringPi API over a virtual GPIO with 15 pins. These virtual pins are simulated using POSIX signals. It uses the 30 signals from SIGRTMIN to SIGRTMAX. Two signals by every pin (ON/OFF).
In that way, when Zynthian UI can’t detect a real GPIO, it uses the emulation layer, awaiting for RT signals that simulate the virtual pins of the virtual GPIO.
Then, you can send these signals from a external program, when a button widget is clicked, or when a rotary control widget is turned.
I know that this method has limitations (only 15 pins) and that the emulation could be better achieved using a more powerful IPC method, some kind of messaging protocol, like OSC. I’ve used this method (signals) by simplicity but i hope to improve it in a near future. By the moment, is enough … and it works like a charm!! 😉
2 Links/Enlaces:
Zynthian Emulator (GitHub) https://github.com/zynthian/zynthian-emuface
Zyncoder Library (GitHub) https://github.com/zynthian/zyncoder
Wiki: Setting Up a Zynthian Development/Emulation Environment http://wiki.zynthian.org/index.php/Zynthian_Devel_Setup