<?xml version="1.0" encoding="UTF-8"?>



<rss version="2.0">
  <channel>
    <title>jetDrone</title>
    <link>http://www.jetdrone.com/blog/1</link>
    <description>jetDrone Blog</description>
    <language>en</language>
    <copyright>Copyright 2011</copyright>
    <pubDate>Sat, 25 May 2013 19:08:38 UTC</pubDate>
    
      <item>
        <title>Vert.x and Juju</title>
        <description>&lt;p&gt;&lt;p&gt;I&apos;ve been playing with &lt;a href=&quot;https://juju.ubuntu.com/&quot;&gt;Juju&lt;/a&gt;&amp;nbsp;and Vert.x and I got a simple DEVOPS juju charm to deploy a Vert.x app with the minimal effort. Here is the required script:&lt;/p&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 6px 10px; border: 1px solid #cccccc; font-size: 13px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: #f8f8f8; line-height: 19px; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: #333333;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; border: none; font-size: 12px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;&quot;&gt;juju deploy --repository juju-charms local:vertx-app&lt;/p&gt;
&lt;p&gt;juju deploy redis-master&lt;/p&gt;
&lt;p&gt;juju deploy haproxy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/pre&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 6px 10px; border: 1px solid #cccccc; font-size: 13px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: #f8f8f8; line-height: 19px; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: #333333;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; border: none; font-size: 12px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;&quot;&gt;juju add-relation redis-master:db myapp&lt;/p&gt;
&lt;p&gt;juju add-relation myapp haproxy&lt;/code&gt;&lt;/p&gt;
&lt;/pre&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 6px 10px; border: 1px solid #cccccc; font-size: 13px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: #f8f8f8; line-height: 19px; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: #333333;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; border: none; font-size: 12px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;&quot;&gt;juju add-unit -n 10 myapp&lt;/code&gt;
&lt;/pre&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 6px 10px; border: 1px solid #cccccc; font-size: 13px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: #f8f8f8; line-height: 19px; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: #333333;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; border: none; font-size: 12px; font-family: Consolas, &apos;Liberation Mono&apos;, Courier, monospace; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;&quot;&gt;juju expose haproxy&lt;/code&gt;
&lt;/pre&gt;&lt;p&gt;Use the status command to find the public IP address and enjoy! The app at the moment is hard coded to be a Hello World but work is in progress to make it configurable.&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/39</link>
        <guid isPermaLink="false">39</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <pubDate>Thu, 14 Mar 2013 10:38:51 UTC</pubDate>
      </item>
    
      <item>
        <title>vert.x is awsome! Specially with BSON!</title>
        <description>&lt;p&gt;&lt;p&gt;Vert.x is a polyglot event-driven application framework that runs on the Java Virtual Machine.&lt;/p&gt;
&lt;p&gt;Similar environments written in other programming languages include Node.js for JavaScript that I&apos;ve been working for the last 1 and a half year.&lt;/p&gt;
&lt;p&gt;Vert.x exposes the API currently in Java, JavaScript, Groovy, Ruby and Python.&lt;/p&gt;
&lt;p&gt;Scala and Clojure support is on the roadmap.&lt;/p&gt;
&lt;p&gt;The application framework includes these features:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Polyglot. Application components can be written in Java, JavaScript, Groovy, Ruby or Python.&lt;/li&gt;&lt;li&gt;Simple concurrency model. All code is single threaded, freeing from the hassle of multi-threaded programming.&lt;/li&gt;&lt;li&gt;Simple, asynchronous programming model for writing truly scalable non-blocking applications.&lt;/li&gt;&lt;li&gt;Distributed event bus that spans the client and server side. The event bus even penetrates into in-browser JavaScript allowing to create effortless so-called real-time web applications.&lt;/li&gt;&lt;li&gt;Module system and public module repository, to re-use and share components.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I do like the freedom of being asynchronous and synchronous when needed, I like the real distributed programming model (not like the advertisement from Node.JS which in reallity is a process fork() with modules that require extra coding). With vert.x you just specify the number of instances and you&apos;re done!&lt;/p&gt;
&lt;p&gt;I disliked the fact that all internal messages were JSON. The event bus is a wonderful component but JSON is too generic. It only allows String, Boolean, Double, Null, Lists and Hashes. Therefore I started a new vert.x&amp;nbsp;&lt;a href=&quot;https://github.com/pmlopes/bson.vertx.eventbus&quot;&gt;module&lt;/a&gt;&amp;nbsp;that uses BSON. I picked BSON because it maps easily to JSON and can be a simple replacement.&lt;/p&gt;
&lt;p&gt;It turns out you will get a server&amp;nbsp;&lt;a href=&quot;https://groups.google.com/d/topic/vertx/WLyFqj6f44I/discussion&quot;&gt;33% faster&lt;/a&gt;!!! if you use my&amp;nbsp;&lt;a href=&quot;https://github.com/pmlopes/bson.vertx.eventbus&quot;&gt;module&lt;/a&gt;!!!&lt;/p&gt;
&lt;p&gt;So get it now!!!&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/38</link>
        <guid isPermaLink="false">38</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <pubDate>Mon, 14 Jan 2013 18:53:40 UTC</pubDate>
      </item>
    
      <item>
        <title>Android Clonabalt</title>
        <description>&lt;p&gt;&lt;img src=&quot;http://www.jetdrone.com/media/1/6&quot; alt=&quot;&quot; width=&quot;481&quot; height=&quot;317&quot; /&gt;
&lt;p&gt;It took a couple of days to make a basic clone of the popular game. I did not look to the original code, in fact i did not reuse any of it, and even wrote my own engine and sprites. The all game is just 50kb with resources for popular screen sizes, QVGA, HVGA and WVGA. The APK can be picked up from my &lt;a href=&quot;http://dl.dropbox.com/u/5387016/Canabalt.apk&quot;&gt;dropbox&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was a learning experience so it will not be published on any market. I might open source the minimal engine (basically 2 classes) but at the moment it is not a good idea since i haven&apos;t document anything.&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/36</link>
        <guid isPermaLink="false">36</guid>
        
        <category>android</category>
        
        <pubDate>Thu, 28 Jul 2011 19:59:29 UTC</pubDate>
      </item>
    
      <item>
        <title>SFX Audio on Android</title>
        <description>&lt;p&gt;&lt;p&gt;Once upon the time all game audio was synthesized. We were amazed with the chips that would come out from the ZX Spectrum or the commodore 64 but nowadays we can still make cool explosion sounds for small devices such as the android mobile phones.&lt;/p&gt;
&lt;p&gt;I will not diverge into much details on audio synthetising since I am not an expert myself. If you want information about that you can look here:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://designingsound.org/&quot;&gt;http://designingsound.org/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;amp;tid=11652&quot;&gt;http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;amp;tid=11652&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.procedural-audio.com/&quot;&gt;http://www.procedural-audio.com/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;So i implemented a simple SFX util class based on an old project (but very useful:&amp;nbsp;&lt;a href=&quot;http://www.drpetter.se/project_sfxr.html&quot;&gt;http://www.drpetter.se/project_sfxr.html&lt;/a&gt;) to generate sounds for Android games. The code is the following:&lt;/p&gt;
&lt;code&gt;package com.jetdrone.and2d.sfx;
import java.util.Random;
import android.util.FloatMath;
public class SFXR {
&amp;nbsp;&amp;nbsp;// 0: square, 1: sawtooth, 2: sine, 3: noise
&amp;nbsp;&amp;nbsp;private int wave_type;
&amp;nbsp;&amp;nbsp;private float p_base_freq; // Start Frequency
&amp;nbsp;&amp;nbsp;private float p_freq_limit; // Min Frequency
&amp;nbsp;&amp;nbsp;private float p_freq_ramp; // Slide
&amp;nbsp;&amp;nbsp;private float p_freq_dramp; // Delta Slide
&amp;nbsp;&amp;nbsp;private float p_duty; // Square Duty
&amp;nbsp;&amp;nbsp;private float p_duty_ramp; // Duty Sweep
&amp;nbsp;&amp;nbsp;private float p_vib_strength; // Vibrato Depth
&amp;nbsp;&amp;nbsp;private float p_vib_speed; // Vibrato Speed
&amp;nbsp;&amp;nbsp;private float p_vib_delay; // ???
&amp;nbsp;&amp;nbsp;private float p_env_attack; // Attack Time
&amp;nbsp;&amp;nbsp;private float p_env_sustain; // Sustain Time
&amp;nbsp;&amp;nbsp;private float p_env_decay; // Decay Time
&amp;nbsp;&amp;nbsp;private float p_env_punch; // Sustain Punch
&amp;nbsp;&amp;nbsp;boolean filter_on; // ???
&amp;nbsp;&amp;nbsp;private float p_lpf_resonance; // LP Filter Resonance
&amp;nbsp;&amp;nbsp;private float p_lpf_freq; // LP Filter Cutoff
&amp;nbsp;&amp;nbsp;private float p_lpf_ramp; // LP Filter Cutoff Sweep
&amp;nbsp;&amp;nbsp;private float p_hpf_freq; // HP Filter Cutoff
&amp;nbsp;&amp;nbsp;private float p_hpf_ramp; // HP Filter Cutoff Sweep
&amp;nbsp;&amp;nbsp;private float p_pha_offset; // Phaser Offset
&amp;nbsp;&amp;nbsp;private float p_pha_ramp; // Phaser Sweep
&amp;nbsp;&amp;nbsp;private float p_repeat_speed; // Repeat Speed
&amp;nbsp;&amp;nbsp;private float p_arp_speed; // Change Speed
&amp;nbsp;&amp;nbsp;private float p_arp_mod; // Change Amount
&amp;nbsp;&amp;nbsp;private float master_vol = 0.05f;
&amp;nbsp;&amp;nbsp;private float sound_vol = 0.5f;
&amp;nbsp;&amp;nbsp;private boolean playing_sample = false;
&amp;nbsp;&amp;nbsp;private int phase;
&amp;nbsp;&amp;nbsp;private float fperiod;
&amp;nbsp;&amp;nbsp;private float fmaxperiod;
&amp;nbsp;&amp;nbsp;private float fslide;
&amp;nbsp;&amp;nbsp;private float fdslide;
&amp;nbsp;&amp;nbsp;private int period;
&amp;nbsp;&amp;nbsp;private float square_duty;
&amp;nbsp;&amp;nbsp;private float square_slide;
&amp;nbsp;&amp;nbsp;private int env_stage;
&amp;nbsp;&amp;nbsp;private int env_time;
&amp;nbsp;&amp;nbsp;private int[] env_length = new int[3];
&amp;nbsp;&amp;nbsp;private float env_vol;
&amp;nbsp;&amp;nbsp;private float fphase;
&amp;nbsp;&amp;nbsp;private float fdphase;
&amp;nbsp;&amp;nbsp;private int iphase;
&amp;nbsp;&amp;nbsp;private float[] phaser_buffer = new float[1024];
&amp;nbsp;&amp;nbsp;private int ipp;
&amp;nbsp;&amp;nbsp;private float[] noise_buffer = new float[32];
&amp;nbsp;&amp;nbsp;private float fltp;
&amp;nbsp;&amp;nbsp;private float fltdp;
&amp;nbsp;&amp;nbsp;private float fltw;
&amp;nbsp;&amp;nbsp;private float fltw_d;
&amp;nbsp;&amp;nbsp;private float fltdmp;
&amp;nbsp;&amp;nbsp;private float fltphp;
&amp;nbsp;&amp;nbsp;private float flthp;
&amp;nbsp;&amp;nbsp;private float flthp_d;
&amp;nbsp;&amp;nbsp;private float vib_phase;
&amp;nbsp;&amp;nbsp;private float vib_speed;
&amp;nbsp;&amp;nbsp;private float vib_amp;
&amp;nbsp;&amp;nbsp;private int rep_time;
&amp;nbsp;&amp;nbsp;private int rep_limit;
&amp;nbsp;&amp;nbsp;private int arp_time;
&amp;nbsp;&amp;nbsp;private int arp_limit;
&amp;nbsp;&amp;nbsp;private float arp_mod;
&amp;nbsp;&amp;nbsp;private final Random rnd = new Random();
&amp;nbsp;&amp;nbsp;public void init(long seed) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rnd.setSeed(seed);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playing_sample = true;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void init() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playing_sample = true;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;private final float frnd(float v) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return rnd.nextFloat() * v;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;private static final float fpow(float a, float b) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (float) Math.pow(a, b);
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;private static final float fsin(float a) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return FloatMath.sin(a);
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;private final int rnd(int v) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return rnd.nextInt(v+1);
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void resetParams() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.3f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_limit = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_dramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_strength = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_speed = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_delay = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = 0.3f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = 0.4f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filter_on = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_resonance = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_freq = 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_offset = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_repeat_speed = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_speed = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_mod = 0.0f;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void resetSample(boolean restart) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!restart)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phase = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fperiod = 100.0f / (p_base_freq * p_base_freq + 0.001f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;period = (int) fperiod;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fmaxperiod = 100.0f / (p_freq_limit * p_freq_limit + 0.001f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fslide = 1.0f - fpow(p_freq_ramp, 3.0f) * 0.01f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fdslide = -fpow(p_freq_dramp, 3.0f) * 0.000001f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;square_duty = 0.5f - p_duty * 0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;square_slide = -p_duty_ramp * 0.00005f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_arp_mod &amp;gt;= 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_mod = 1.0f - fpow(p_arp_mod, 2.0f) * 0.9f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_mod = 1.0f + fpow(p_arp_mod, 2.0f) * 10.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_time = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_limit = (int) (fpow(1.0f - p_arp_speed, 2.0f) * 20000 + 32);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_arp_speed == 1.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_limit = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!restart) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// reset filter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltw = fpow(p_lpf_freq, 3.0f) * 0.1f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltw_d = 1.0f + p_lpf_ramp * 0.0001f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdmp = 5.0f / (1.0f + fpow(p_lpf_resonance, 2.0f) * 20.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* (0.01f + fltw);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (fltdmp &amp;gt; 0.8f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdmp = 0.8f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltphp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flthp = fpow(p_hpf_freq, 2.0f) * 0.1f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flthp_d = 1.0f + p_hpf_ramp * 0.0003f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// reset vibrato
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vib_phase = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vib_speed = fpow(p_vib_speed, 2.0f) * 0.01f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vib_amp = p_vib_strength * 0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// reset envelope
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_vol = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_stage = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_time = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_length[0] = (int) (p_env_attack * p_env_attack * 100000.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_length[1] = (int) (p_env_sustain * p_env_sustain * 100000.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_length[2] = (int) (p_env_decay * p_env_decay * 100000.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fphase = fpow(p_pha_offset, 2.0f) * 1020.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_pha_offset &amp;lt; 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fphase = -fphase;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fdphase = fpow(p_pha_ramp, 2.0f) * 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_pha_ramp &amp;lt; 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fdphase = -fdphase;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iphase = Math.abs((int) fphase);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ipp = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int i = 0; i &amp;lt; 1024; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phaser_buffer[i] = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int i = 0; i &amp;lt; 32; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;noise_buffer[i] = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rep_time = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rep_limit = (int) (fpow(1.0f - p_repeat_speed, 2.0f) * 20000 + 32);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_repeat_speed == 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rep_limit = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public float synthSample() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!playing_sample)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rep_time++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rep_limit != 0 &amp;amp;&amp;amp; rep_time &amp;gt;= rep_limit) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rep_time = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetSample(true);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// frequency envelopes/arpeggios
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_time++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (arp_limit != 0 &amp;amp;&amp;amp; arp_time &amp;gt;= arp_limit) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arp_limit = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fperiod *= arp_mod;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fslide += fdslide;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fperiod *= fslide;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (fperiod &amp;gt; fmaxperiod) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fperiod = fmaxperiod;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_freq_limit &amp;gt; 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playing_sample = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float rfperiod = fperiod;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (vib_amp &amp;gt; 0.0f) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vib_phase += vib_speed;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rfperiod = fperiod * (1.0f + fsin(vib_phase) * vib_amp);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;period = (int) rfperiod;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (period &amp;lt; 8)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;period = 8;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;square_duty += square_slide;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (square_duty &amp;lt; 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;square_duty = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (square_duty &amp;gt; 0.5f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;square_duty = 0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// volume envelope
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_time++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (env_time &amp;gt; env_length[env_stage]) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_time = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_stage++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (env_stage == 3)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playing_sample = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (env_stage == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_vol = (float) env_time / env_length[0];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (env_stage == 1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_vol = 1.0f
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ fpow(1.0f - (float) env_time / env_length[1], 1.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* 2.0f * p_env_punch;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (env_stage == 2) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;env_vol = 1.0f - (float) env_time / env_length[2];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// phaser step
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fphase += fdphase;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iphase = Math.abs((int) fphase);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (iphase &amp;gt; 1023)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iphase = 1023;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (flthp_d != 0.0f) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flthp *= flthp_d;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (flthp &amp;lt; 0.00001f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flthp = 0.00001f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (flthp &amp;gt; 0.1f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flthp = 0.1f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float ssample = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int si = 0; si &amp;lt; 8; si++) // 8x supersampling
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float sample = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phase++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (phase &amp;gt;= period) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// phase=0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phase %= period;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wave_type == 3) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int j = 0; j &amp;lt; 32; j++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;noise_buffer[j] = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// base waveform
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float fp = (float) phase / period;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (wave_type) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 0: // square
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (fp &amp;lt; square_duty)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = 0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = -0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 1: // sawtooth
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = 1.0f - fp * 2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 2: // sine
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = fsin(fp * 2 * (float) Math.PI);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 3: // noise
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = noise_buffer[phase * 32 / period];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// lp filter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float pp = fltp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltw *= fltw_d;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (fltw &amp;lt; 0.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltw = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (fltw &amp;gt; 0.1f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltw = 0.1f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_lpf_freq != 1.0f) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdp += (sample - fltp) * fltw;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdp -= fltdp * fltdmp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltp = sample;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltdp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltp += fltdp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// hp filter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltphp += fltp - pp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fltphp -= fltphp * flthp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample = fltphp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// phaser
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phaser_buffer[ipp &amp;amp; 1023] = sample;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sample += phaser_buffer[(ipp - iphase + 1024) &amp;amp; 1023];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ipp = (ipp + 1) &amp;amp; 1023;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// final accumulation and envelope application
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssample += sample * env_vol;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssample = ssample / 8 * master_vol;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssample *= 2.0f * sound_vol;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (ssample &amp;gt; 1.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssample = 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (ssample &amp;lt; -1.0f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssample = -1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return ssample;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// }
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void random(int i) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (i) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 0: // pickup/coin
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.4f + frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = frnd(0.1f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = 0.1f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch = 0.3f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_speed = 0.5f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_mod = 0.2f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 1: // laser/shoot
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = rnd(2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wave_type == 2 &amp;amp;&amp;amp; rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = rnd(1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.5f + frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_limit = p_base_freq - 0.2f - frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_freq_limit &amp;lt; 0.2f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_limit = 0.2f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -0.15f - frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(2) == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.3f + frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_limit = frnd(0.1f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -0.35f - frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty_ramp = frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = 0.4f + frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty_ramp = -frnd(0.7f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = 0.1f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch = frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(2) == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_offset = frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_ramp = -frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 2: // explosion
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = 3;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.1f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -0.1f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.2f + frnd(0.7f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -0.2f - frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq *= p_base_freq;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(4) == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(2) == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_repeat_speed = 0.3f + frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = 0.1f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = frnd(0.5f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_offset = -0.3f + frnd(0.9f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_ramp = -frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch = 0.2f + frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_strength = frnd(0.7f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_speed = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(2) == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_speed = 0.6f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_mod = 0.8f - frnd(1.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 3: // powerup
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.2f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = 0.1f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_repeat_speed = 0.4f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.2f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = 0.05f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_strength = frnd(0.7f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_speed = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = 0.1f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 4: // hit/hurt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = rnd(2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wave_type == 2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = 3;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wave_type == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.2f + frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -0.3f - frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = frnd(0.1f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = 0.1f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 5: // jump
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.3f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = 0.1f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = 0.1f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = 0.1f + frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_freq = 1.0f - frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 6: // blip/select
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetParams();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wave_type = rnd(1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wave_type == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(0.6f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = 0.2f + frnd(0.4f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = 0.1f + frnd(0.1f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = frnd(0.2f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = 0.1f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void randomize() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = fpow(frnd(2.0f) - 1.0f, 2.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq = fpow(frnd(2.0f) - 1.0f, 3.0f) + 0.5f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_limit = 0.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = fpow(frnd(2.0f) - 1.0f, 5.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_base_freq &amp;gt; 0.7f &amp;amp;&amp;amp; p_freq_ramp &amp;gt; 0.2f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -p_freq_ramp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_base_freq &amp;lt; 0.2f &amp;amp;&amp;amp; p_freq_ramp &amp;lt; -0.05f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp = -p_freq_ramp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_dramp = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty_ramp = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_strength = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_speed = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_delay = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain = fpow(frnd(2.0f) - 1.0f, 2.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch = fpow(frnd(0.8f), 2.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_env_attack + p_env_sustain + p_env_decay &amp;lt; 0.2f) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain += 0.2f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay += 0.2f + frnd(0.3f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_resonance = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_freq = 1.0f - fpow(frnd(1.0f), 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_ramp = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (p_lpf_freq &amp;lt; 0.1f &amp;amp;&amp;amp; p_lpf_ramp &amp;lt; -0.05f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_ramp = -p_lpf_ramp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq = fpow(frnd(1.0f), 5.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_ramp = fpow(frnd(2.0f) - 1.0f, 5.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_offset = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_ramp = fpow(frnd(2.0f) - 1.0f, 3.0f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_repeat_speed = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_speed = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_mod = frnd(2.0f) - 1.0f;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;public void mutate() {
&lt;/code&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_base_freq += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_ramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_freq_dramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_duty_ramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_strength += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_speed += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_vib_delay += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_attack += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_sustain += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_decay += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_env_punch += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_resonance += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_freq += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_lpf_ramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_freq += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_hpf_ramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_offset += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_pha_ramp += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_repeat_speed += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_speed += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (rnd(1) &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p_arp_mod += frnd(0.1f) - 0.05f;
&amp;nbsp;&amp;nbsp;}
}&lt;/code&gt;
&lt;p&gt;This class lets you generate sounds, but this is not enough since you also wants to listen to them. For this i created another helper class (AudioClip) that will let you play the sound on your Android device:&lt;/p&gt;
&lt;code&gt;package com.jetdrone.and2d;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
public class AudioClip {
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;private AudioTrack track;
&amp;nbsp;&amp;nbsp;private int sampleRateInHz = 22050;
&amp;nbsp;&amp;nbsp;private short[] audioData;
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;public AudioClip(int sampleRateInHz) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.sampleRateInHz = sampleRateInHz;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;public AudioClip(int sampleRateInHz, short[] audioData) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.sampleRateInHz = sampleRateInHz;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setData(audioData);
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;public void setData(short[] audioData) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(track != null) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.release();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;final int bufSize = Math.max(sampleRateInHz, audioData.length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.audioData = new short[bufSize];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRateInHz, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize, AudioTrack.MODE_STATIC);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(track.getState() == AudioTrack.STATE_NO_STATIC_DATA) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.arraycopy(audioData, 0, this.audioData, 0, audioData.length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.write(audioData, 0, audioData.length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;public void play() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(track != null) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.play();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.stop();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.reloadStaticData();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;public void release() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(track != null) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;track.release();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;@Override
&amp;nbsp;&amp;nbsp;public void finalize() throws Throwable {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;release();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;super.finalize();
&amp;nbsp;&amp;nbsp;}
}&lt;/code&gt;
&lt;p&gt;Now you can generate your sound in background and play the in the foreground, pretty neat! :)&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/35</link>
        <guid isPermaLink="false">35</guid>
        
        <category>android</category>
        
        <category>code</category>
        
        <pubDate>Tue, 28 Jun 2011 11:24:07 UTC</pubDate>
      </item>
    
      <item>
        <title>PLAYPOWER</title>
        <description>&lt;p&gt;&lt;p&gt;Learning Games for Radically Affordable Computers&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/34</link>
        <guid isPermaLink="false">34</guid>
        
        <pubDate>Wed, 18 May 2011 12:29:34 UTC</pubDate>
      </item>
    
      <item>
        <title>X-Muppets!</title>
        <description>&lt;p&gt;&lt;p&gt;[[photo:http://www.jetdrone.com/media/1/5]]&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/33</link>
        <guid isPermaLink="false">33</guid>
        
        <pubDate>Wed, 18 May 2011 12:24:32 UTC</pubDate>
      </item>
    
      <item>
        <title>Quick fixes for annoyances on my Ubuntu 11.04</title>
        <description>&lt;p&gt;&lt;p&gt;&lt;strong&gt;Unity slow with ATI drivers?&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;sudo apt-get install compizconfig-settings-manager
&lt;/pre&gt;&lt;p&gt;Then Disable VSYNC on OpenGL tab.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Eclipse acts wierd with new scrollbars?&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;sudo nano /usr/share/applications/eclipse.desktop
&lt;/pre&gt;&lt;p&gt;change the Exec with:&lt;/p&gt;&lt;pre&gt;sh -c &quot;LIBOVERLAY_SCROLLBAR=0 eclipse&quot;
&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Need several instances of one app?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;middle click on the launcher&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WebGL does not work on chromium because your ATI card is blacklisted?&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;sudo nano /usr/share/applications/chromium-browser.desktop&lt;/pre&gt;&lt;p&gt;change Exec with:&lt;/p&gt;&lt;pre&gt;Exec=/usr/bin/chromium-browser --ignore-gpu-blacklist %U&lt;/pre&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/32</link>
        <guid isPermaLink="false">32</guid>
        
        <pubDate>Wed, 18 May 2011 12:20:49 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSP 11.2 HotFix (only Win32)</title>
        <description>&lt;p&gt;&lt;span style=&quot;text-decoration: line-through;&quot;&gt;If you are on windows and faced a issue with missing DLLs, you can grab then here: &lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpsp-11.2-hotfix.zip/download&quot;&gt;minpsp-11.2-hotfix.zip&lt;/a&gt;&lt;/span&gt;
 &lt;span style=&quot;text-decoration: line-through;&quot;&gt; &lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpsp-11.2-hotfix.zip/download&quot;&gt;&lt;/a&gt;You need to unpack the 2 DLLs on C:\pspsdk\libexec\gcc\psp\4.3.5 Change C:\pspsdk to whatever you choose to install the SDK to. By default it should be Ok.&lt;/span&gt;
A proper fix with a new build has been added. This fixes both broken GCC due to missing DLL and as well PSPSH.exe Get it here:&amp;nbsp;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/pspsdk-setup-0.11.2r2.exe/download&quot;&gt;pspsdk-setup-0.11.2r2.exe&lt;/a&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/31</link>
        <guid isPermaLink="false">31</guid>
        
        <pubDate>Fri, 13 May 2011 14:41:30 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSP 11.2</title>
        <description>&lt;p&gt;&lt;p&gt;This is the second build of 2011, in this build there are only a few changes, i changed the build of oslib to build with its internal libs (do not rely on the SDK ones), DEB files for Debian/Ubuntu have been reduced from 150Mb to 32Mb (Changed from the standard compression to LZMA). On linux there is no mpfr/gmp dependency it caused problems with different versions of Ubuntu.&lt;/p&gt;
&lt;p&gt;From the community i added a couple of patches, one that adds a pack to the SceModule struct and sync with the gentoo scripts for build fixes and better support on other environments.&lt;/p&gt;
&lt;p&gt;Enjoy and happy coding :) get it &lt;a href=&quot;https://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/&quot;&gt;here&lt;/a&gt;!&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/30</link>
        <guid isPermaLink="false">30</guid>
        
        <category>psp</category>
        
        <pubDate>Fri, 13 May 2011 07:38:27 UTC</pubDate>
      </item>
    
      <item>
        <title>ActionScript to Java</title>
        <description>&lt;p&gt;&lt;p&gt;One of these days I wanted to convert some AS2/3 to Java. It was obvious that it was simple since ActionScript and Java share lots of language constructs, however it is a tedious task so i created a simple helper application:&lt;/p&gt;
&lt;code&gt;package com.jetdrone.as2j;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class AS2J {
&amp;nbsp; private static final Map AS2JTYPES = new HashMap();
&amp;nbsp; public static void main(String[] args) throws Exception {
&amp;nbsp; &amp;nbsp; // e.g.: &quot;~/Flixel2/as/AdamAtomic-flixel-348b55f&quot;
&amp;nbsp; &amp;nbsp; File asSourceDir = new File(args[0]);
&amp;nbsp; &amp;nbsp; String skip = &quot;docs&quot;;
&amp;nbsp; &amp;nbsp; // e.g.: &quot;~/src&quot;
&amp;nbsp; &amp;nbsp; File outSourceDir = new File(args[1]);
&amp;nbsp; &amp;nbsp; AS2JTYPES.put(&quot;uint&quot;, &quot;int&quot;);
&amp;nbsp; &amp;nbsp; AS2JTYPES.put(&quot;Boolean&quot;, &quot;boolean&quot;);
&amp;nbsp; &amp;nbsp; AS2JTYPES.put(&quot;Number&quot;, &quot;float&quot;);
&amp;nbsp; &amp;nbsp; AS2JTYPES.put(&quot;Array&quot;, &quot;java.util.List&quot;);
&amp;nbsp; &amp;nbsp; &amp;nbsp;processFile(asSourceDir, asSourceDir.getAbsolutePath(), outSourceDir, skip);
&amp;nbsp; }
&amp;nbsp; private static String getType(String type) {
&amp;nbsp; &amp;nbsp; String t = AS2JTYPES.get(type.trim());
&amp;nbsp; &amp;nbsp; if(t != null) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; return t;
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return type;
&amp;nbsp; }
&amp;nbsp; private static void processFile(File src, String prefix, File target, String skip)
&amp;nbsp; &amp;nbsp; &amp;nbsp; throws Exception {
&amp;nbsp; &amp;nbsp; for(File f : src.listFiles()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; if(!f.getName().equals(skip)) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(f.isDirectory()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; processFile(f, prefix, target, skip);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(f.getName().endsWith(&quot;.as&quot;)) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String fname = f.getAbsolutePath();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String sourceFileName = fname.substring(prefix.length(), fname.length() - 3) + &quot;.java&quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; convertFile(f, new File(target, sourceFileName));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; private static void convertFile(File src, File dest) throws Exception {
&amp;nbsp; &amp;nbsp; String l;
&amp;nbsp; &amp;nbsp; BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(src)));
&amp;nbsp; &amp;nbsp; PrintWriter out = new PrintWriter(dest);
&amp;nbsp; &amp;nbsp; int i=1;
&amp;nbsp; &amp;nbsp; while((l = in.readLine()) != null) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; try {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processPackage(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processConst(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processVariable(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processMethod(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processConstructor(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processGetter(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processSetter(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = processCast(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; } catch(RuntimeException e) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.err.println(&quot;ERR (&quot; + i + &quot;): [&quot; + src.getAbsolutePath() + &quot;]&quot;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.err.println(&quot;  --&amp;gt; &quot; + l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; out.println(l);
&amp;nbsp; &amp;nbsp; &amp;nbsp; i++;
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; in.close();
&amp;nbsp; &amp;nbsp; out.close();
&amp;nbsp; }
&amp;nbsp; private static final Pattern PACKAGE = Pattern.compile(&quot;^\\s*package\\s+(.+)&quot;);
&amp;nbsp; private static String processPackage(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = PACKAGE.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + &quot;package &quot; + matcher.group(1) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;;&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // public var exists:Boolean;
&amp;nbsp; &amp;nbsp; private static final Pattern VARIABLE = Pattern.compile(&quot;var\\s+(\\w+?)\\s*:\\s*(.+?);&quot;);
&amp;nbsp; private static String processVariable(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = VARIABLE.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; if(matcher.group(2).indexOf(&apos;=&apos;) != -1) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String type = matcher.group(2).substring(0, matcher.group(2).indexOf(&apos;=&apos;));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String defaultValue = matcher.group(2).substring(matcher.group(2).indexOf(&apos;=&apos;));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + getType(type) + &quot; &quot; + matcher.group(1)&amp;nbsp;+
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot; &quot; + defaultValue + &quot;;&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + getType(matcher.group(2)) + &quot; &quot; +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; matcher.group(1) + &quot;;&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // static public const A_LIST:uint = 0;
&amp;nbsp; private static final Pattern CONST = Pattern.compile(&quot;const\\s+(\\w+?)\\s*:\\s*(\\w+?)\\s*=\\s*(.+);&quot;);
&amp;nbsp; private static String processConst(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = CONST.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + &quot;final &quot; + getType(matcher.group(2)) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot; &quot; + matcher.group(1) + &quot; = &quot; + matcher.group(3) + &quot;;&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // public function destroy():void
&amp;nbsp; private static final Pattern METHOD = Pattern.compile(&quot;function\\s+(\\w+?)\\s*\\((.*?)\\)\\s*:(\\w+)&quot;);
&amp;nbsp; private static String processMethod(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = METHOD.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + getType(matcher.group(3)) + &quot; &quot; +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; matcher.group(1) + &quot;(&quot; + processArgs(matcher.group(2)) + &quot;)&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // public function destroy()
&amp;nbsp; private static final Pattern CONSTRUCTOR = Pattern.compile(&quot;function\\s+(\\w+?)\\s*\\((.*?)\\)&quot;);
&amp;nbsp; private static String processConstructor(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = CONSTRUCTOR.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + matcher.group(1) + &quot;(&quot; +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; processArgs(matcher.group(2)) + &quot;)&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; private static final String processArgs(String line) {
&amp;nbsp; &amp;nbsp; StringBuffer sb = new StringBuffer();
&amp;nbsp; &amp;nbsp; for(String p : line.split(&quot;,&quot;)) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; sb.append(processArg(p));
&amp;nbsp; &amp;nbsp; &amp;nbsp; sb.append(&quot;, &quot;);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; if(sb.length() &amp;gt; 0) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; sb.setLength(sb.length() - 2);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return sb.toString();
&amp;nbsp; }
&amp;nbsp; // Fixed:Boolean
&amp;nbsp; private static final Pattern PARAM = Pattern.compile(&quot;\\s*(\\w+?)\\s*:\\s*(.+)&quot;);
&amp;nbsp; private static final String processArg(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = PARAM.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; if(matcher.group(2).indexOf(&apos;=&apos;) != -1) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // java has no default values
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String defaultValue = matcher.group(2).substring(matcher.group(2).indexOf(&apos;=&apos;) + 1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return getType(matcher.group(2).substring(0, matcher.group(2).indexOf(&apos;=&apos;))) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot; &quot; + matcher.group(1) + &quot; /*&quot; + defaultValue + &quot;*/&quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; return getType(matcher.group(2)) + &quot; &quot; + matcher.group(1);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // public get right():Number
&amp;nbsp; private static final Pattern GETTER = Pattern.compile(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;function\\s+get\\s+(\\w+?)\\s*\\(.*\\)\\s*:\\s*(\\w+)&quot;);
&amp;nbsp; private static String processGetter(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = GETTER.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; String methodName = matcher.group(1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + getType(matcher.group(2)) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot; get&quot; + methodName.substring(0, 1).toUpperCase() + methodName.substring(1) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;()&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp; // public get right():Number
&amp;nbsp; private static final Pattern SETTER = Pattern.compile(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;function\\s+set\\s+(\\w+?)\\s*\\((.*)\\)\\s*:\\s*(\\w+)&quot;);
&amp;nbsp; private static String processSetter(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = SETTER.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; String methodName = matcher.group(1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + getType(matcher.group(3)) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot; set&quot; + methodName.substring(0, 1).toUpperCase() + methodName.substring(1) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;(&quot; + processArgs(matcher.group(2)) + &quot;)&quot; + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
&amp;nbsp;
&amp;nbsp; // var members:Array = (Object as FlxGroup).members;
&amp;nbsp; private static final Pattern CAST = Pattern.compile(&quot;\\s*(\\S+?)\\s+as\\s+(\\w+)&quot;);
&amp;nbsp; private static String processCast(String line) {
&amp;nbsp; &amp;nbsp; Matcher matcher = CAST.matcher(line);
&amp;nbsp; &amp;nbsp; if (matcher.find()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; if(matcher.group(1).indexOf(&apos;=&apos;) != -1) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String prefix = matcher.group(1).substring(0, matcher.group(1).indexOf(&apos;=&apos;) + 1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String value = matcher.group(1).substring(matcher.group(1).indexOf(&apos;=&apos;) + 1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + prefix + &quot; (&quot; +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getType(matcher.group(2)) + &quot;)&quot; + value + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; &amp;nbsp; } else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(matcher.group(1).charAt(0) == &apos;(&apos;) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + &quot; ((&quot; + getType(matcher.group(2)) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;) &quot; + matcher.group(1).substring(1) + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return line.substring(0, matcher.start()) + &quot; (&quot; + getType(matcher.group(2)) +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;) &quot; + matcher.group(1) + line.substring(matcher.end());
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; return line;
&amp;nbsp; }
}
&lt;/code&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/29</link>
        <guid isPermaLink="false">29</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <pubDate>Fri, 06 May 2011 13:25:26 UTC</pubDate>
      </item>
    
      <item>
        <title>Ubuntu 11.04</title>
        <description>&lt;p&gt;&lt;p&gt;Just installed it on my laptop and am enjoying unity, still need to get used to it but it looks like a nice alternative to the old gnome 2 window manager.&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/28</link>
        <guid isPermaLink="false">28</guid>
        
        <pubDate>Fri, 29 Apr 2011 19:10:05 UTC</pubDate>
      </item>
    
      <item>
        <title>Updates on minpsp project</title>
        <description>&lt;p&gt;&lt;p&gt;Development has slowed down but it is not stalled, for the next release 11.2 you can expect better oslib_mod packages and a diet on the deb files, tests have shown that from more than 150Mb the new deb packages are about 50Mb...&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/27</link>
        <guid isPermaLink="false">27</guid>
        
        <pubDate>Wed, 09 Mar 2011 15:35:58 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSP Eclipse Plugin @ Google Code</title>
        <description>&lt;p&gt;&lt;p&gt;I&apos;ve been using the MinPSP Eclipse plugin for a while and several people have downloaded it. I see that people are interested in the plugin and I get also requests for new features, such as project templates and better GDB support with the latest Eclipse. Since I don&apos;t have much time to work on this myself, I&apos;ve open sourced the source code of the plugin.&lt;/p&gt;
&lt;p&gt;You can get the source code here: &lt;a title=&quot;minpsp-eclipse-plugin&quot; href=&quot;http://code.google.com/p/minpsp-eclipse-plugin&quot;&gt;minpsp-eclipse-plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to participate and make this plugin better just request it on the project site and I will work out a way for you to help.&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/26</link>
        <guid isPermaLink="false">26</guid>
        
        <category>code</category>
        
        <category>psp</category>
        
        <pubDate>Wed, 09 Mar 2011 15:32:13 UTC</pubDate>
      </item>
    
      <item>
        <title>New MinPSP plugin 1.0.0</title>
        <description>&lt;p&gt;&lt;p&gt;A total refactoring of the plugin is complete, this time the plugin can discover compiler flags and default includes, in order to get it working properly, make sure your minpsp installation is on the path. On windows the installer does this automatically but for other platforms you need to do it yourself.&lt;/p&gt;
&lt;p&gt;Once you do this and create a MinPSP lib project/or Makefile project, you will see that default includes get automatically indexed and it can compile out of the box lib projects.&lt;/p&gt;
&lt;p&gt;Also a nice addition is that MinPSP debugger gets listed automatically on the debuggers panel.&lt;/p&gt;
&lt;p&gt;I will plan to write a new tutorial with the new plugin soon :)&lt;/p&gt;
&lt;p&gt;As usual get the plugin from the update site:&amp;nbsp;&lt;a href=&quot;http://www.jetdrone.com/static/eclipse/update&quot;&gt;http://www.jetdrone.com/static/eclipse/update&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;
</description>
        <link>http://www.jetdrone.com/post/1/25</link>
        <guid isPermaLink="false">25</guid>
        
        <category>research</category>
        
        <category>psp</category>
        
        <pubDate>Thu, 03 Feb 2011 19:55:54 UTC</pubDate>
      </item>
    
      <item>
        <title>Sorry, Your Top Speed Wasn&apos;t Enough For A High Score</title>
        <description>&lt;p&gt;[[photo:http://cache.gawker.com/assets/images/kotaku/2011/01/34.jpg]]&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/24</link>
        <guid isPermaLink="false">24</guid>
        
        <pubDate>Thu, 27 Jan 2011 13:00:44 UTC</pubDate>
      </item>
    
      <item>
        <title>Today is KDE 4.6 release day</title>
        <description>&lt;p&gt;[[bookmark:http://www.kde.org/announcements/4.6]]&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/23</link>
        <guid isPermaLink="false">23</guid>
        
        <pubDate>Wed, 26 Jan 2011 14:16:08 UTC</pubDate>
      </item>
    
      <item>
        <title>Ken Thompson, Dennis Ritchie win Japan Prize</title>
        <description>&lt;p&gt;[[bookmark:http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2011/01/25/BUTI1HDJSA.DTL]]&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/22</link>
        <guid isPermaLink="false">22</guid>
        
        <pubDate>Wed, 26 Jan 2011 11:44:29 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSP Eclipse Plugin 0.0.1</title>
        <description>&lt;p&gt;In order to make your game development environment even more friendly with Eclipse, I am pleased to announce the initial release of the MinPSP Eclipse Plugin. This plugin will allow you to create:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Executable Projects&lt;/li&gt;&lt;li&gt;Static Library Projects&lt;/li&gt;&lt;li&gt;Makefile Projects&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;It is still very primitive and depends on having the Eclipse C/C++ Development Tools installed. To get started install the plugin by going to its update site:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.jetdrone.com/static/eclipse/update&quot;&gt;http://www.jetdrone.com/static/eclipse/update&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;You should be seeing something like this:&lt;/p&gt;&lt;div&gt;&lt;img src=&quot;http://www.jetdrone.com/media/1/3&quot; alt=&quot;Eclipse Plugin Update Site&quot; /&gt;&lt;/div&gt;&lt;p&gt;Once the install process completes and Eclipse is restarted you can start creating your projects:&lt;/p&gt;&lt;div&gt;&lt;img src=&quot;http://www.jetdrone.com/media/1/4&quot; alt=&quot;Create new C Project&quot; /&gt;&lt;/div&gt;</description>
        <link>http://www.jetdrone.com/post/1/21</link>
        <guid isPermaLink="false">21</guid>
        
        <category>code</category>
        
        <category>psp</category>
        
        <pubDate>Fri, 14 Jan 2011 10:36:13 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSPW 0.11 is out for Windows Linux and Mac</title>
        <description>&lt;p&gt;New release is out, not so many features this time:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;openTRI engine devpak&lt;/li&gt;&lt;li&gt;reverted binutils to 2.16 since 2.18 generates bad assembly for Daedalus&lt;/li&gt;&lt;li&gt;supports Mac as a development platform thanks to autilio&lt;/li&gt;&lt;li&gt;Fixed pspsh on win32 when run inside eclipse&lt;/li&gt;&lt;li&gt;added PRXTool&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/minpspw_0.11.1-1ubuntu0_i386.deb/download&quot;&gt;get it for linux (ubuntu 32bit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/minpspw_0.11.1-1ubuntu0_amd64.deb/download&quot;&gt;get it for linux (ubuntu 64bit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/minpspw-pspsdk-0.11.1-1.i386.rpm/download&quot;&gt;get it for linux (rpm 32bit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/minpspw-pspsdk-0.11.1-1.x86_64.rpm/download&quot;&gt;get it for linux (rpm 64bit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/pspsdk-setup-0.11.1.exe/download&quot;&gt;get it for windows (32bit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.1/MinPSP%200.11%20Mac.mpkg/download&quot;&gt;get it for Mac&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Thanks for the bug reports and enjoy.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/20</link>
        <guid isPermaLink="false">20</guid>
        
        <category>psp</category>
        
        <pubDate>Tue, 11 Jan 2011 15:46:15 UTC</pubDate>
      </item>
    
      <item>
        <title>binutils 2.18 are broken :(</title>
        <description>&lt;p&gt;There is a subtle bug on the binutils 2.18 it is possible to reproduce if you build for example Daedalus PSP emulator, with the current SDK it fails to run, but with the old 0.9.5 or downgraded binutils the generated binary works... This is a very obscure bug that i will try to isolate but if any of the users of MinPSPW can help it would be welcome :)&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/19</link>
        <guid isPermaLink="false">19</guid>
        
        <category>psp</category>
        
        <pubDate>Sun, 02 Jan 2011 17:41:58 UTC</pubDate>
      </item>
    
      <item>
        <title>newlib patches</title>
        <description>&lt;p&gt;Lately i have been looking into newlib, although there is again a new release 1.19 i am still looking at 1.18. What is so interesting about it? Well, i have noticed that the pspsdk is using integer math for all it&apos;s floating point operations, after studying the documentation is was simple to enable hardware floating point math just by using a configuration flag:&amp;nbsp;--enable-newlib-hw-fp.

After this point i&apos;ve noticed that using the -fast-math with gcc does nothing, why? Apparently&amp;nbsp;newlib only has support (or so it seems to me) for NEC processors, so after a couple of hacking i added basic support for fast math function replacements. I did not add all functions but just some basic ones:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;sinf(float x)&lt;/li&gt;&lt;li&gt;cosf(float x)&lt;/li&gt;&lt;li&gt;asinf(float x)&lt;/li&gt;&lt;li&gt;acosf(float x)&lt;/li&gt;&lt;li&gt;atanf(float x)&lt;/li&gt;&lt;li&gt;absf(float x)&lt;/li&gt;&lt;li&gt;sqrtf(float x)&lt;/li&gt;&lt;li&gt;expef(float x)&lt;/li&gt;&lt;li&gt;logef(float x)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The idea here is that just by enabling the -fast-math flag you can benefit from some performance improvement. It is obvious to say that this is all experimental stuff it might work or not with your code, we need to test and see how it behaves.

Now, It may be already lots of changes, but something that has been puzzling me for a while is why does ODE (Open Dynamics Engine) work on the PSP, after changing some mails on the ODE mailing list i got some info that NaNs and Infs do not work as expected, so i decided to patch again new lib for that too. Now here is a thing that is more complicated than it sounds. Newlib floating point math has several implementations, ISO, IEEE, X... so which one to change? i opted for the default one, math.h defines 2 functions:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;isnan&lt;/li&gt;&lt;li&gt;isinf&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;These were functions that were changed and remained on math.h as macros, that expand to fpclassify&amp;nbsp;comparisons, however there are 2 extra functions:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;__isnanf&lt;/li&gt;&lt;li&gt;__isinff&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;These ones are real implementations, so i patched these 2 to use the PSP fpu processor to check if a number is NaN or INF.

I will be testing this changes but if some of the users of minpsp, you for example :) would like to help to test just build the toolchain and try it out or let me know and i will build a test toolchain for alpha testers.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/18</link>
        <guid isPermaLink="false">18</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <category>psp</category>
        
        <pubDate>Fri, 31 Dec 2010 17:39:09 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSP is comming to Mac OS X</title>
        <description>&lt;p&gt;Well, people who know me know that Mac&apos;s are really not my thing, i am not a fan of Apple products, i never found my iPod easy to use or even iTunes, they always do what Apple wants, not me... anyway this is no reason for ignore the platform and now with help of a very patient ps2dev community we are getting MinPSP also running on that platform. As of today the same toolchain script can build the binutils, gcc, newlib, sdk, gdb and is stopping on usbpsplink, once we solve this devpaks are next and we are done...&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/17</link>
        <guid isPermaLink="false">17</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <category>psp</category>
        
        <pubDate>Thu, 09 Dec 2010 18:37:53 UTC</pubDate>
      </item>
    
      <item>
        <title>Checking the availability of input on stdin</title>
        <description>&lt;p&gt;One of the things &lt;a href=&quot;http://www.jetdrone.com/minpspw&quot;&gt;MinPSP&lt;/a&gt; is looking for, is native port of the homebrew SDK for their respective native platforms, so on Windows we have Windows native executables, on Linux we have Linux native executables, on Linux 64bit... you got the idea...

One of the annoying things about this is that not all OSes are POSIX, and not all OSes are from Redmond, so there are quite some quirks that need to be fixed with the crancky #ifdef preprocessor statement. In my last revisit to the MinPSP code I tried to work around the lack of select on file descriptors on windows and converted the pspsh.exe binary from a cygwin binary to a 100% windows native. I isolated all socket code, sockets use select to verify the data availability and for the stdin i assumed that using _kbhit() would be enough. And it has been enough for me since for my tests i always used it from the command prompt, however a long time ago i wrote a small booklet explaining how to plug Eclipse IDE with MinPSP to make it easier to fully develop homebrew applications and there i showed how to invoke pspsh.exe from the eclipse tools.

So what was the problem with Eclipse and MinPSP pspsh.exe? Well... i totally forgot that eclipse will just start the process and communicate with it via pipes!!! When you have pipes the _kbhit() function will never return a value other than 0. Having this in mind pspsh would never read anything from stdin since all I/O in the application is non blocking. So after long time of googling and testing i found this piece of code:&lt;/p&gt;&lt;pre&gt;
static int is_pipe = 0;
static HANDLE input_handle = 0;
int input_available()
{
  DWORD nchars;
  /* When using Standard C input functions, also check if there
   is anything in the buffer. After a call to such functions,
   the input waiting in the pipe will be copied to the buffer,
   and the call to PeekNamedPipe can indicate no input available.
   Setting stdin to unbuffered was not enough, IIRC */
  if (stdin-&amp;gt;_cnt &amp;gt; 0)
    return 1;
  if (is_pipe)
  {
    /* When running under a GUI, you will end here. */
    if (!PeekNamedPipe(input_handle, NULL, 0, NULL, &amp;amp;nchars, NULL))
      /* Something went wrong. Probably the parent program exited.
         Could call exit() here. Returning 1 will make the next call
         to the input function return EOF, where this should be
         catched then. */
      return 1;

    return (nchars != 0);
  }
  else
    return _kbhit() != 0; /* In &quot;text-mode&quot; without GUI */
}
&lt;/pre&gt;&lt;p&gt;Amazingly this code works for me, and lets me pool stdin from pipe for data available to be read. The only thing missing here is how is the is_pipe variable initialized. I&apos;ve found 2 ways one using the function _isatty( _fileno(stdin)) or using Win32 API, I&apos;ve chosen this way:&lt;/p&gt;&lt;pre&gt;
  DWORD dw;
  input_handle = GetStdHandle(STD_INPUT_HANDLE);
  is_pipe = !GetConsoleMode(input_handle, &amp;amp;dw);
&lt;/pre&gt;&lt;p&gt;And that was it, now you can handle non blocking input from console and from pipes!!! Hurray!!!&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/16</link>
        <guid isPermaLink="false">16</guid>
        
        <category>research</category>
        
        <category>code</category>
        
        <category>psp</category>
        
        <pubDate>Mon, 29 Nov 2010 09:01:44 UTC</pubDate>
      </item>
    
      <item>
        <title>Experimenting with OpenCL and Java</title>
        <description>&lt;p&gt;High Performance Computing has been always a research topic for me. I&apos;ve been looking into it for a while and now that i have upgraded my laptop i own a ATI Radeon HD 4570 I can play with OpenCL. OpenCL looks very nice but it does not really integrates well with Java. I mean there are several bindings but their APIs do not seem natural to Java. It was until a few weeks ago that I found the &lt;a title=&quot;AMD Java Zone&quot; href=&quot;http://developer.amd.com/zones/java/Pages/default.aspx&quot;&gt;AMD Java Zone&lt;/a&gt; Research &lt;a title=&quot;Aparapi&quot; href=&quot;http://developer.amd.com/zones/java/aparapi/Pages/default.aspx&quot;&gt;Aparapi&lt;/a&gt; project.

I decided to give Aparapi a try and installed it on my Kubuntu 10.10. Honestly I was impressed with the simplicity of the installation. I&apos;ve downloaded:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a title=&quot;AMD Stream SDL 2.2 (64bit Linux)&quot; href=&quot;http://developer.amd.com/Downloads/ati-stream-sdk-v2.2-lnx64.tgz&quot;&gt;AMD Stream SDK 2.2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a title=&quot;icd-registration&quot; href=&quot;http://developer.amd.com/Downloads/icd-registration.tgz&quot;&gt;AMD icd-registration&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a title=&quot;Aparapi SDK alpha&quot; href=&quot;http://developer.amd.com/Downloads/aparapi-alpha-Linux-amd64-2010-09-28.zip&quot;&gt;Aparapi SDK alpha&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Since i already had the proprietary driver from AMD installed with Kubuntu, i just unziped the Stream SDK into my home, the icd-registration to the root of the file system and the Aparapi SDK to my home. And it just works!!!

I gave it a try and here is my Kernel for a bitonic sort using Aparapi:&lt;/p&gt;&lt;pre&gt;public class BitonicSortKernel extends Kernel {

  int[] theArray;
  int stage;
  int passOfStage;
  int width;
  int direction;

  @Override
  public void run() {
    int sortIncreasing = direction;
    int threadId = getGlobalId();

    int pairDistance = 1 &amp;lt;&amp;lt; (stage - passOfStage);
    int blockWidth   = 2 * pairDistance;

    int leftId = (threadId % pairDistance)
        + (threadId / pairDistance) * blockWidth;

    int rightId = leftId + pairDistance;

    int leftElement = theArray[leftId];
    int rightElement = theArray[rightId];

    int sameDirectionBlockWidth = 1 &amp;lt;&amp;lt; stage;

    if((threadId/sameDirectionBlockWidth) % 2 == 1)
        sortIncreasing = 1 - sortIncreasing;

    int greater = rightElement;
    int lesser = leftElement;

    if(leftElement &amp;gt; rightElement)
    {
      greater = leftElement;
      lesser  = rightElement;
    }

    if(sortIncreasing != 0)
    {
      theArray[leftId]  = lesser;
      theArray[rightId] = greater;
    }
    else
    {
      theArray[leftId]  = greater;
      theArray[rightId] = lesser;
    }
  }
}
&lt;/pre&gt;&lt;p&gt;This was a good exercise to experiment with Aparapi, the SDK contains more samples, a squares compute and a mandelbrot fractal.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/13</link>
        <guid isPermaLink="false">13</guid>
        
        <category>research</category>
        
        <pubDate>Mon, 01 Nov 2010 10:21:23 UTC</pubDate>
      </item>
    
      <item>
        <title>Confiscated video game machines used for gambling (China)</title>
        <description>&lt;p&gt;[[photo:http://www.jetdrone.com/media/2]]&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/11</link>
        <guid isPermaLink="false">11</guid>
        
        <pubDate>Fri, 08 Oct 2010 10:29:55 UTC</pubDate>
      </item>
    
      <item>
        <title>Allegro 4.4 will be on the next MinPSPW release</title>
        <description>&lt;p&gt;You can start porting your &lt;a href=&quot;http://www.allegro.cc/&quot;&gt;allegro&lt;/a&gt; games to the PSP, allegro 4.4.1.1 will be part of the next MinPSPW release, although AllegroGL is not included.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/10</link>
        <guid isPermaLink="false">10</guid>
        
        <category>psp</category>
        
        <pubDate>Sun, 29 Aug 2010 09:09:13 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSPW has gone to Mars</title>
        <description>&lt;p&gt;Long time ago it was possible to write homebrew code for the PlayStation Portable using the &lt;a href=&quot;http://www.digitalmars.com/d/index.html&quot;&gt;D&lt;/a&gt; Programming Language, however with the upgrade of GCC to the 4.1, 4.2 and later on to 4.3 the patch didn&apos;t work anymore. During the last month I&apos;ve been studying the &lt;a href=&quot;http://bitbucket.org/goshawk/gdc/wiki/Home&quot;&gt;GDC bitbucket&lt;/a&gt; project and trying to port it back to the MinPSPW toolchain. Although it seemed trivial, because the new GDC project has updated the patch for GCC 4.3 it proven not practical for the cross toolchain. After patching a lot of stuff I finally have a build for now only on Linux that can compile and link a simple Hello World example.&lt;/p&gt;
&lt;p&gt;So for now on it will be possible to write code such as:&lt;/p&gt;
&lt;pre&gt;// imports
// extern (C) allows D to call C functions directly, no need to wrap
extern (C) void pspDebugScreenInit();
extern (C) void pspDebugScreenPrintf(char*,...);
extern (C) int SetupCallbacks();
extern (C) int sceKernelSleepThread();

import std.string;

class HelloPsp
{
public:
&amp;nbsp;&amp;nbsp;&amp;nbsp; void sayHello()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; pspDebugScreenPrintf(toStringz(m_msg));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; char[] m_msg = &quot;Hello D on Psp\n&quot;;
}

int main()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; SetupCallbacks();

&amp;nbsp;&amp;nbsp;&amp;nbsp; pspDebugScreenInit();
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; auto hello = new HelloPsp();
&amp;nbsp;&amp;nbsp;&amp;nbsp; hello.sayHello();

&amp;nbsp;&amp;nbsp;&amp;nbsp; sceKernelSleepThread();
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;
}
&lt;/pre&gt;
&lt;p&gt;So why D? D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability. 
&lt;/p&gt;&lt;p&gt;The D language is statically typed and compiles directly to machine code. It&apos;s multiparadigm, supporting many programming styles:  imperative, object oriented, and metaprogramming. It&apos;s a member of the C  syntax family, and its appearance is very similar to that of C++.&lt;/p&gt;&lt;p&gt;I am planning to update the toolchain and start testing with Windows to be released once the new Ubuntu version is out.
&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/9</link>
        <guid isPermaLink="false">9</guid>
        
        <category>psp</category>
        
        <category>research</category>
        
        <pubDate>Fri, 27 Aug 2010 17:38:05 UTC</pubDate>
      </item>
    
      <item>
        <title>MinPSPW project update</title>
        <description>&lt;p&gt;It has been a long while since the last update 
to the MinPSPW. I haven&apos;t stop it, although if you really want to start 
an indy game studio you can subscribe to the PSP minis. But for the kick
 and for the people who are just amateurs you can use the Homebrew SDK. 
The upcoming release 0.9.6 will contain:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;pspsh does not depend on cygwin and is native&lt;/li&gt;&lt;li&gt;remotejoy SDL is also included as a native binary (no cygwin)&lt;/li&gt;&lt;li&gt;win32 dependencies updated&lt;/li&gt;&lt;li&gt;zlib 1.2.5&lt;/li&gt;&lt;li&gt;SDL 1.2.14&lt;/li&gt;&lt;li&gt;readline 5.1 (same as gdb)&lt;/li&gt;&lt;li&gt;libiconv 1.13.1&lt;/li&gt;&lt;li&gt;pthreads 2.8.0&lt;/li&gt;&lt;li&gt;updated
 the fpulib trig functions can use the FPU processor but we either use 
vfpu or software impl using libm. This can help to make a bit faster 
code if we do not need vectors.&lt;/li&gt;&lt;li&gt;Updated newlib to 1.18&lt;/li&gt;&lt;li&gt;wide-char enhancements&lt;/li&gt;&lt;li&gt;long double math routines added for platforms where LDBL == DBL&lt;/li&gt;&lt;li&gt;long long math routines added&lt;/li&gt;&lt;li&gt;math cleanup&lt;/li&gt;&lt;li&gt;major locale charset overhaul including added charsets&lt;/li&gt;&lt;li&gt;various cleanups&lt;/li&gt;&lt;li&gt;various bug fixes&lt;/li&gt;&lt;li&gt;Updated the dev environment to build under Windows Vista and Windows 7
&lt;/li&gt;&lt;li&gt;Updated binutils to 2.18 (for better integration with gcc 4.3.x)&lt;/li&gt;&lt;li&gt;removed the patch that defines long as 64bit back to 32bit. This can lead to faster code but breaks old compiled libraries&lt;/li&gt;&lt;li&gt;Disabled CDT-5.0.x bug fix&lt;/li&gt;&lt;li&gt;gcov builds properly but not fully tested if works as expected&lt;/li&gt;&lt;li&gt;added fixes from Luqman Aden in TinyXML&lt;/li&gt;&lt;li&gt;added libmpeg2 devpak&lt;/li&gt;&lt;li&gt;added bullet physics devpak&lt;/li&gt;&lt;li&gt;windows tools are linked against pthreads, if thereads are used it can improved performance on the development side.
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;This has been an incredible exercise since I&apos;ve learned a lot of the 
win32 API while porting the network code from pspsh and remotejoy to 
windows. I still need time or help to port the psplinkusb_pc to use 
winusb API.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/8</link>
        <guid isPermaLink="false">8</guid>
        
        <category>psp</category>
        
        <pubDate>Sat, 19 Jun 2010 17:59:26 UTC</pubDate>
      </item>
    
      <item>
        <title>Performance performance performance!!!</title>
        <description>&lt;p&gt;&lt;img src=&quot;http://www.jetdrone.com/media/1/1&quot; /&gt;So as I
have written before I&apos;ve been playing with maps and renderers and found
this very interesting thing. My old home laptop which is a 5 year old
Sony VAIO FE11S with a intel T2400 CoreDuo 1.86GHz CPU, 2GB ram and a
NVIDIA GeForce Go 7400 256MB is as fast a Intel XEON E5520 with 8GB ram
and ATI FirePro v5700 video card. I&apos;ve run the code on both machines and
 the difference is minimal, so what is wrong here? Well after testing
there is nothing wrong on the code, there are no dead locks or threads
waiting for each other. What is wrong is the video card drivers. On my
VAIO I still have Windows XP SP3 and a NVIDIA driver from 2006 (because
Sony doesn&apos;t allows me to install the latest from NVIDIA). On the fast
desktop I have Ubuntu 64 bit with the crappy ATI proprietary driver.
This ATI driver is the key here since on Windows all my rendering is
done using Java2D with the DirectDraw pipeline on and it is amazingly
fast, it is also true if I use the OpenGL pipeline but the OpenGL driver
 is not as good as DirectX. On linux the driver is so crap that all
rendering is done in software and a machine which I expected to be say
10x faster (it has 6x more cores, it is 64bit and the OS is also 64bit)
it just sucks.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/7</link>
        <guid isPermaLink="false">7</guid>
        
        <category>research</category>
        
        <pubDate>Fri, 19 Mar 2010 22:46:01 UTC</pubDate>
      </item>
    
      <item>
        <title>Fast 2D render</title>
        <description>&lt;p&gt;In the last couple of weeks I started a 
research activity around map rendering. I know that there is plenty of 
map renderers, and that &lt;a href=&quot;http://www.mapnik.org/&quot;&gt;Mapnik &lt;/a&gt;is 
pretty good, however I wanted to experiment so I need something simple 
yet fast. This lead me to research on 2D rendering libraries. Libraries 
that are free since I have to budget and portable since I work mostly 
with Linux and sometimes with Windows.&lt;/p&gt;&lt;p&gt;After googling for a while I found 2 big libraries:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.cairographics.org/&quot;&gt;Cairo Graphics&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.antigrain.com/&quot;&gt;AntiGrain&lt;/a&gt; Geometry&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The
 first one is C and the second C++ of course I&apos;d go with the first, I do
 prefer C over C++ but that could be a topic for other post. These 
libraries are pretty impressive but I wanted something portable and that
 is when I have found &lt;a href=&quot;http://www.khronos.org/openvg/&quot;&gt;OpenVG&lt;/a&gt;.
 The concepts behind OpenVG made me think, WOW I want it, so I started a
 quest for a implementation that was not software based... and I 
couldn&apos;t find one... at least for free.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Facing this setback
 I decided to research how does java and the jvm fix this problem. 
Having seen the latest versions of Netbeans they must have some 
optimized code to make all that swing code fast, so I started looking 
into Java2D. Searching the web I found lots of opinion pages saying that
 Java is slow, Java2D is slow but still I wanted to give it a try. After
 going over the 2D tutorial I found out that in fact Java2D can benefit 
from hardware acceleration. On Windows acceleration is achieved through 
DirectDraw and on Linux through OpenGL. According to the tutorial one 
can request accelerated rendering operations by hinting the jvm that our
 target image should be accelerated like this:&lt;/p&gt;&lt;pre&gt;GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage img = gc.createCompatibleImage(width, height, Transparency.TRANSLUCENT);
img.setAccelerationPriority(1);&lt;/pre&gt;&lt;p&gt;We create a BufferedImage that 
matches our graphic configuration so the chances that we end up this 
image on VRAM are bigger and then hint the JVM that it should accelerate
 it. This by itself already brings performance improvement but if we 
really want fast images there is another kind of image, the 
VolatileImage. This kind of image is saved in a OpenGL pbuffer and on 
windows it can be really volatile. This means that even though you are 
drawing into it it may end up clobbered by other application that needed
 to write into the VRAM. This kind of image is really fast but has the 
inconvenient that it cannot be used directly with the ImageIO class to 
write to disk, you still need to create a BufferedImage to write to and 
then you can save.&lt;/p&gt;&lt;pre&gt;GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
VolatileImage vImage = gc.createCompatibleVolatileImage(width, height, Transparency.TRANSLUCENT);&lt;/pre&gt;&lt;p&gt;It is up to you how fast you need your images to be...
&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/6</link>
        <guid isPermaLink="false">6</guid>
        
        <category>code</category>
        
        <category>research</category>
        
        <pubDate>Sat, 13 Mar 2010 20:31:51 UTC</pubDate>
      </item>
    
      <item>
        <title>New blog, new life</title>
        <description>&lt;p&gt;This site is run by Paulo Lopes. I used to run 
jetcube.eu blog but due to a series of inconvenient accidents, the old 
blog, post and comments got lost. I will try to dump here knowledge that
 I acquire from my daily software development actions in video game and 
systems software hacking.&lt;/p&gt;</description>
        <link>http://www.jetdrone.com/post/1/5</link>
        <guid isPermaLink="false">5</guid>
        
        <category>appengine</category>
        
        <pubDate>Sat, 13 Mar 2010 20:03:58 UTC</pubDate>
      </item>
    
  </channel>
</rss>
