Ralph Hauwert put a very interesting blog post up no his blog about Adobe Alchemy. Basically he was reading my mind with this post.
I want to a step further now. But please keep in mind that I am definitly not a compiler expert or have deep knowledge of the Flash Player. Everything I write about is in my opinion common sense and comes from a long time of reverse engineering and autodidactic learning.
Continue reading ‘Alchemy, ActionScript and the ASC’
Share This
The FOTB Miami website is now up and running. Yes, that’s right! John Davey will bring the FOTB spirit to Miami.
I think John has choosen a perfect location. I am excited to meet new people and to be a part of a fantastic speaker line-up. More information available at http://www.flashonthebeach.com/.
Share This
Everyone who worked with Java and MIDI was having problems when it comes to MIDI support on Mac OS X. It is simply not supported. So we were running into the same issue. Luckily Java has two nice features. The first is called Service Provider Interface (SPI) which allows you to create your own provider of MIDI devices for instance. The second feature is called Java Native Interface (JNI) which allows you to execute platform specific code.
Now I do not really know why there is no MIDI support on the Mac because the implementation is fairly simple. OS X comes with a lot of easy-to-use system libraries. One of those libraries is CoreMIDI. Now the only thing you have to do is wire everything together. Use SPI to talk over JNI with CoreMIDI and you are set.
I am not a Java programmer and not a Mac user at all. But I think I learned some common things during the last days.
- Synergy is awesome. A good friend told me about it half a year ago and now I finally tried it. One mouse and keyboard to control four screens which are connected to my Laptop and Macbook is pure luxury — but for free! Synergy is open-source and absolutely superior to a VNC solution.
- JNI is not hard to handle. It was not my first time using it but when it comes to threading you have to keep in mind that references to Java objects have to be marked global and everything from the call to your JNI method becomes invalid. Keeping a reference to the JVM and attaching the thread to it works very well.
- The Ant Jar task has a bug. Defining a service using the <service/> tag does not work because the folder in the jar will be named “service” and not “services“.
I am definitly not an expert when it comes to this kind of stuff but I had my problems especially with the Ant bug and calling a Java method from a different thread. The result is very nice on the one hand because it works for all kinds of MIDI messages now but on the other hand I still have to ask myself why nobody included this feature for the OS X Java VM in the first place.
The good news is that we will have a very robust MIDI implementation which will work crossplatform without the need to install any additional libraries.
Share This
At one point André Michelle, Kai-Philipp Schöllmann and I really thought that we had success after a long time of struggle. We had the audio hack back in the popforge days. It became more and more unstable. Then we used a Java server to have a stable output. We got rid of that one because we had the ultimate solution in our hands: Flash Player 10 with dynamic audio support.
Last week I was on holidays — no laptop, no internet, no mobile. Just wanted to get fresh eyes, relax a little bit — you name it. Yes, that’s right: I missed the launch of the Flash Player 10.
Continue reading ‘David vs. Goliath’
Share This
PixelBender Outline is a simple view for Eclipse. It allows you to browse through compiled PixelBender kernel files (pbj). Usually it is quite annoying when working with PixelBender. You always have to debug the shader if you did not write it yourself to know about parameters and stuff. The PixelBender Outline view allows you to navigate through that information in a comfortable way.
PixelBender Outline is working with FDT only. Just grab the JAR file and place it into your Eclipse plugins folder (…/Eclipse/plugins/) to install it. After restarting Eclipse you can open the view using Window->Show View->Other->PixelBender->PixelBender Outline.
The outline is updated everytime you select a *.pbj file in the Flash Explorer.
Share This
At the end of my FOTB session I wanted to show you my latest tool called AS3V. Time was short and there was a small glitch so I could not show it. But now I can explain what AS3V really is without having to rush.
AS3V is basically a tool that can check for syntactical correctness. It will do with your code what a compiler does but it keeps formatting metadata. That way it can generate an XML skeleton of your code and apply rules on the XML.
You can have a look at the first output AS3V produces here. The original source code is included in the comment at the top.
As you can see it will be possible to force coding standards for instance and to warn if code could be optimized. I hope that it will be possible to have a first version of a stable parser soon. ANTLR is still giving me a lot of trouble but it is the first time for me working with such a tool as well.
Share This
Here are the slides from my Flash On The Beach 2008 session “AudioTool’s Private Parts”. 2mb without a prelaoder. You will need Flash Player 10 to pass through to version detection or you can save the SWF directly to disk and watch it with Flash Player 9.
Share This
I wrote a while ago about our tween engine at Hobnox but I did not post any performance demos.
Here are the results for 1000 DisplayObjects with manipulation on their scaleX, scaleY, alpha, x, y and rotation properties. It is also very important that you take a look at the memory behaviour. A click starts the tweening.
As you can see it makes a lot of sense to stay type-safe and to manage the memory you are using on your own.
I will talk about those concepts in my next session AudioTool’s Private Parts in Brighton and Boston. Since optimization on a code level is trivial the main performance boost is achieved by re-thinking algorithms, structures and concepts. I guess one of the most interesting topics will be the optimization of our cable solver which was running O(n^2) (really!), then O(n(n+1)/2) and could be minimized to a rare O(n(n-4)/2) worst-case.
Share This
Tinic posted today his PixelBender assembler and disassembler. This makes me happy, because now I can post an experiment I could not show for a while.
If you know PixelBender, than you know that you can not create loops. What you could do is unroll all constant loops with a fixed length. If you know simple convolution filters like a blur, you know that you need an xy-loop and you know it should not be possible with PixelBender at all. Let me prove you wrong and have a look at dynamic loop unrolling with PixelBender (be careful with high values!).
I built a library to assemble and disassemble PixelBender kernels at runtime. I wrapped it also in a high level API so basically you can create a new Kernel by doing var kernel: Kernel = new Kernel();. Then when you need your shader as a ByteArray you simple call kernel.compile(). There are still some glitches here and there but I hope that I can release the source code pretty soon.
Share This
Last night I spent about 9 hours writing a build script for the AudioTool allowing us to compile each plugin into its own SWF container. I think it is the first time a Flash project is taking more than 5 minutes for me to compile completly.
I figured out that it is definitly not easy to handle the mxmlc or compc in a way we needed it to be. The point is that we have for each plugin three modules A, B, C and a library D. A depends on D. B depends on A and D. C depends on A, B and D. Now to make it even more complex we have A, B, C and D in one project so that developing in this environment stays still simple. The solution to compile all modules in a way we need them to be was first generating unique entry points for the SWF files because we do not want to work with SWC libraries (or the SWF inside the SWC package). After having the unique entry points we compile D (and its dependencies as well) without including the source of A, B or C. Afterwards we can compile A. But B is dependent on A so we have to compile a SWF for A and then a SWC for A so B can link to A as an external library. C is also analog to this but needs B as a library as well. In the end it was 5am and I was happy to have the complete build working which generates a lot of SWF files and SWC libraries.
Since it is very hard to configure Ant for this (I was using XSL in the beginning for automated code generation) I started developing my own Ant tasks. I have to say that it is really simple and saved us hours of work. We have now one single XML file containing the dependencies and the Ant task will do the rest (code generation, compile tasks, etc.).
Share This