5B4AIT Calendar
June 2012
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  
HamSphere Forums

HamSphere info

Yahoo! Weather Forecasts
Cyprus Mail News

Android performance Fixes

Finally I found what caused the audio to be so gappy on TX.

First of all. All views need to be using SurfaceView with lowest Thread priority. Like this example below. The Band Scope monitor that was really draining all resources. So instead of extending View, you extend SurfaceView that implemements a callback feature.
The SurfaceView is an extension of the Android View object and it provides a set of functions to manually take control of the onDraw event that draws the things on the screen.

Basically I set up a worker thread that does the calculations and in that same thread I invoke the onDraw call.

public class ADFFTMonitor extends SurfaceView implements SurfaceHolder.Callback {

// Then start a worker Thread and pass the callback to the Thread.

getHolder().addCallback(this);
_thread = new FFTThread(getHolder(), this);
_thread.setPriority(Thread.MIN_PRIORITY);

// The override surfaceCreated and make the thread start when the object is created.

@Override
public void surfaceCreated(SurfaceHolder holder) {
_thread.setRunning(true);
_thread.start();
}

class FFTThread extends Thread {

c = _surfaceHolder.lockCanvas();
_panel.onDraw(c);
_surfaceHolder.unlockCanvasAndPost(c);

// And most importantly, wait a lot to let the audio framwork work as much as possible.

try {
Thread.sleep(100); // sleep 100 ms
} catch (InterruptedException ie) {
}

One Response to Android performance Fixes

  • WB7ECW says:

    Good work on finding the issue, Kelly! My QSO with 5B4AIT/P on June 30th was flawless. Your audio sounded strong and not gappy at all. It was my first QSO with you and I’m hoping to finally add a 5B4AIT QSL card (and first Cyprus confirmation) to my collection.

    By the way, I now have Android 4 (Ice Cream Sandwich) installed on my HP Touchpad Tablet. The mic seems to work fine, as I ‘ve used it for several voice-control apps. This tablet has a 9.7-inch screen, but it will run phone apps by utilizing only a portion of the screen. If you ever want to try a tablet-sized GUI at some point just let me know and I’d be happy to test it.

    73,
    Mike
    WB7ECW

Leave a Reply

Solar-Terrestrial Data
free counters

IP address
Tag Cloud