Tomorrow’s daily build (942) is going to be action-packed!
Improved Android audio
Ask our engineers and they’ll tell you that getting audio right on devices is hard. Even Apple gets it wrong — constantly — but they just get it less wrong than everyone else.
Starting in daily build 942, we’ve upgraded our audio backend to start using OpenSL-ES on Android 2.3+ devices. (On 2.2, we’ll continue to use the less than stellar AudioTrack path.)
What does this back-end do?
For starters, it fixes a perennial problem on a small subset of devices where audio just wouldn’t work (e.g. the Vizio, one of the Samsung SII models, etc). In addition, you may notice subtle performance improvements, but because of Android issues, your mileage may vary. For example, distortions like hisses and pops due to playing too many simultaneous sounds may be slightly improved.
If you played with the ‘EggBreaker’ sample, you’ll know notice that the sound doesn’t play at the same time as the bounce. This is a longstanding latency problem that has plagued Android from the beginning, meaning it’s one of the oldest core OS issues out there. The recent changes ameliorate this ever so slightly. However, the biggest improvement (it’s not perfect) has come from a core OS change in Android, which is only available starting in JellyBean (Android 4.1).
We’ve been hard at work at revamping and cleaning up our widget framework. When we created the initial framework, we took a lot of shortcuts that made a lot of the original code brittle, fragile, and just unmaintainable.
Now, there are a lot of things we want to do with the widget framework, but the foundation simply wasn’t there. What we’ve decided to do is rethink how we want the guts of each widget to work. So we’re building a new foundation for widgets.
The danger with rewrites is that you end up burning cycles reinventing the wheel with nothing to show for it. What we decided would make more sense is to build new widgets on top of this foundation, make sure it’s solid, and then transition the old widgets to it.
Daily build 942 will offer several new widgets:
- On/Off Switch. This comes in 3 flavors: an actual on/off switch, a checkbox, and a single radio button.
- Spinner. The canonical use-case is lots of photos being download asynchronously. Note if you make a blocking API call (e.g. a luasocket call), this will not animate. For that case, you should use native.setActivityIndicator().
- Stepper. You tap ‘+’ or ‘-‘ and the values go up and down within a predefined range.
- Progress view. A bar that goes from 0% to 100% filled.
More information will be available in the daily build 942 snapshot of the API docs. That build will also include an updated WidgetDemo sample app (Note: Windows users, the sample will be updated in a daily build to follow).
The next widgets on our hit list are segmented controls and search fields.
Finally, I’m going to talk about something that I’m not really going to talk about — yet. What I mean is, this topic deserves a post of its own, so we’re saving that for next week. What am I talking about?
In daily build 942, you’re going to see this little gem:
Android: Added local/scheduled notification support.
And there’s a lot that went behind that one commit summary. It’s the kind of thing that will make you thank your lucky stars you are using a cross-platform development framework like Corona.
Suffice it to say, notifications are very different across platforms. We could have just passed the buck, pushing those differences to you, and said: “Tough, deal with it!” but as I said at the end of last week’s post, you expect more from us.
In other words, we work through the big challenges so that it’s zero work for you.