Difference between revisions of "Zynthian Emulator"

From ZynthianWiki
Jump to navigation Jump to search
(add image)
m
Line 1: Line 1:
Developing software for Zynthian is slighty more complex than developing software for a desktop platform. You need a Zynthian Box (ZBox) over your desk running all the time and connected to the network. You must login by ssh everytime 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.
+
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.
  
 
[[File:Zynthian_emuface_control_screenshot.png||zynthian_emuface_control_screenshot]]
 
[[File:Zynthian_emuface_control_screenshot.png||zynthian_emuface_control_screenshot]]
  
This cycle makes development slower than normal, and although you use scripts and tools to agilize the process, finally you realize that there is a better way 😉
+
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.
+
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 [[https://discourse.zynthian.org/t/zynthian-kits/150|build it by yourself]], spending some time and euros.
  
The problem is that the ZUI depends on 4 rotary encoders and 4 switches. These elements are physical in the real ZBox, but can be easily emulated by software, so …
+
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 encoders and the 4 switches by using standard widgets. The emulator call the ZUI, that is embbeded inside, simulating the look & feel of a real ZBox.
+
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.
 
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 its own ZBox, now can do it. Enjoy!!
+
Furthermore, people that want to explore the ZUI, or have a first Zynthian Experience before building their own ZBox, now can do it. Enjoy!!
  
 
=How does it work?=
 
=How does it work?=
Line 21: Line 21:
 
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.
 
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 this signals from a external program, when a button widget is clicked, or when a rotary control widget is turned.
+
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!! 😉
 
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!! 😉
Line 27: Line 27:
 
=Links/Enlaces:=
 
=Links/Enlaces:=
  
Zynthian Emulator (GitHub)
+
Zynthian Emulator (GitHub) https://github.com/zynthian/zynthian-emuface
Zyncoder Library (GitHub)
+
 
Wiki: Setting Up a Zynthian Development/Emulation Environment
+
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

Revision as of 23:30, 15 August 2017

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.

zynthian_emuface_control_screenshot

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 [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