[Android Software Development] Metastable:
Beta v0.9.2

TL;DR: Time for the next beta release! More visuals*, dancing DeadMau5**, scene angle*** depending on which launcher screen you are viewing, and some work done on the LEDhead****!

------------------------

Details!

* Additional Visuals

Even spaced lights visual:

The frequency of the color change is affect by the music.

Rotating lights visual:

Colors change every frame, but the speed in which they rotate around the center is affected by music.

** Dancing DeadMau5

The Mau5head now moves back and forth. Was fairly easy to accomplish. I created 2 float[] which contain predetermined values for the movement. I then cycle through the arrays and reset back to the start when I reach the end. As so:

private float[] yRot = new float[] {1f, 2f, 3f, 3f, 2f, 1f, 0f, -1f, -2f, -3f, -3f, -2f, -1f, 0f};
private float[] zRot = new float[] {1f, 2f, 3f, 3f, 2f, 1f, 0f, -1f, -2f, -3f, -3f, -2f, -1f, 0f};
private int rotIndex = 0;

draw loop() {
gl.glRotatef(yRot[rotIndex] * 5, 0, 1, 0);
gl.glRotatef(zRot[rotIndex] * 5, 0, 0, 1);

rotIndex++;
if (rotIndex > yRot.length - 1)
rotIndex = 0;
}

Both float[] are exactly the same at the moment so I could use just one for both rotations, but I'm leaving it as such for now in case I decide to make their movements different later on.

*** Scene Angle

Android provides a method that you can use in your wallpapers to call when the user moves his launcher from screen to screen. I'm sure you have used an image as a wallpaper and when you move your screen the wallpaper will pan left/right. I use this same concept to change the angle in which you view the scene. Here's the method:

@Override
public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelset, int yPixelset) {
renderer.offsetChanged(xOffset);
super.onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep, xPixelset, yPixelset);
}

There's a lot of info that is sent to you right there. All of which I don't fully understand the need for. We'll start with the easiest one, float xOffset/yOffset gives you a value between [0.0, 1.0], brackets meaning it is inclusive. Your very left most screen, or screen 1, will return the value of 0.0. Depending on how many screens you have, you will receive a value in even increments until you reach the right most screen, with the value of 1.0.

xPixelset/yPixelset work in a very similar way, except return the pixel offset value, [0, -480]. I find this a little more difficult to work with and prefer xOffset/yOffset. As for xOffstep/yOffstep, I don't quite know what they are for. The seem to always return a value of 0.25 and only when you have fully panned to the next screen. It may be useful if you are not trying to create a smooth transition with offset, but rather want to do it in steps. You could calculate the different in xOffset/yOffset or xPixelstep/yPixelstep to get the direction and then make your movement when you get the 0.25 value.

The actual movement is rather easy to do, from the previous code you can see I can renderer.offsetChanged and only pass xOffset, since that is the only value I'm actually interested in.

public synchronized void offsetChanged(float xOffset) {
ry = -(xOffset - 0.5f) * 40f;
}

ry is my rotation value that is used in gl.glRotatef(ry, 0, 1, 0); and multiplied by 40 to get a larger movement.

**** LedHead work

I still haven't reworked the ears! I know, I know, they need to be more rounded, I'll get around to it. I did rework the actual face though. I've added additional leds to the corners because upon adding movement to the head, I noticed that the corners looked bad and didn't look it it was attached to the backing. I'm now at a total of 852 leds making up the face of the Mau5Head. it's a significant jump from the 762, but I don't think it affect performance all too much.

Final notes

With the introduction of the scene angel changes, I have gotten rid of the invisible buttons that where placed around the screen. If you were using ADW launcher, as I am, you would notice the scene rotating downward every time you pressed the drawer soft button. This wont happen anymore.

I also added some FPS logging. It gets displayed in logcat under that tag "DeadMau5" every 10 seconds. You will notice 2 different FPS getting displayed. 1) is the AudioVisual FPS, which is in charge of grabbing the audio stream, drawing onto the bitmaps, and grabbing the pixels for, 2) Renderer FPS, which does all of the OpenGL ES 1.0 calls and actually displays something onto the screen. Right now it's simply displaying the instantaneous FPS at the 10sec mark, meaning it isn't an average over the 10sec. I will probably change this later on to get a more accurate FPS count.

Enjoy!