Search This Blog

2012-03-22

Mute (an Adobe Native Extension):
The "Missing" API Doc

[UPDATE: As of AIR 3.4, you don't need an ANE to get the iOS mute switch to work -- just use the following:

import flash.media.AudioPlaybackMode;
import flash.media.SoundMixer;


and then

SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;

See this Adobe blog post for more.

(Original post follows anyway)]


In the interests of adding iOS mute switch functionality to Super Elk Murder 2012, I have begun digging into AIR Native Extensions, or "ANEs," a new feature as of AIR 3.

Basically, ANEs are little packages of native code that can be imported into a .swf just like an external .swc and may then be implemented like any other AS3 class. This is wonderful because it gives developers access to device-specific features that aren't included in AIR's platform-agnostic API.

Since I don't speak "native" and can't write the extension myself, I had to do what every programmer does from time to time: leech off the internets. And when it comes to the iOS mute switch (technically, Apple refers to it as the "Ring/Silent Switch"), the internets seem to agree on this ANE by a Spanish dude named Enrique David. ¡Muchas gracias, SeƱor David!

Mr. David was even kind enough to provide formal-looking API documentation for his ANE. As you can see, the class contains a single method, .Enable(), that takes one of three string parameters: SOLO_AMBIENT_SOUND (default), AMBIENT_SOUND, and MEDIA_PLAYBACK.

Unfortunately, Mr. David's English is terrible, and his descriptions of these parameters range between confusing and incomprehensible (hence "Missing" in this post's title). I decided I could give something back by posting the results of my own tests using these various options, with plain English explanations of what each one does -- YMMV.


Parameter Descriptions for
Mute ANE by Enrique David
(com.devilishgames.nativeextensions.Mute)


Test Platform = iPhone 4 running iOS 5.1
"App" = Super Elk Murder 2012, an Adobe AIR app written in ActionScript 3
"Music" = the iPhone's built-in music player app
"Switch" = the iPhone's hardware "Ringer/Silent" switch, located on the upper-left side of the device.

  1. Standard Operation (i.e., without Mute.Enable())
    • Switch has no effect on App audio
    • If Music is playing when App starts, Music audio plays simultaneously with App audio

  2. Mute.Enable(SOLO_AMBIENT_SOUND) (default):
    • Switch mutes/unmutes all App audio
    • If Music is playing when App starts, Music audio fades out and pauses

  3. Mute.Enable(AMBIENT_SOUND):
    • Switch mutes/unmutes App audio, but only works once -- it has no effect on the first sound generated after Switch is flipped, nor on any subsequent sounds
    • If Music is playing when App starts, Switch has no effect on Music audio, and behaves as described above for App audio

  4. Mute.Enable(MEDIA_PLAYBACK):
    • Same result as 1. Standard Operation (i.e., without Mute.Enable())

  5. Bugs:
    • Switch has no effect if app is "backgrounded" and then "foregrounded" again -- this is obviously a pretty serious bug, and at time of writing I have no idea if there is any ActionScript workaround.
    • MEDIA_PLAYBACK appears to be completely useless.
    • Switch has no effect when headphones are plugged in -- probably not really a bug, but I thought it was worth noting.



Anyway, there you have it -- I hope this info can prove useful for somebody out there.

ADDITIONAL POTENTIALLY HELPFUL LINKS:

Extending Adobe Air by Oliver Goldman
Native Extensions for Adobe Air
Google Translate

2011-11-29

Fight PIPA, Call Your Sentator, Save The Internet

- Do you believe in the founding principles of our country?
- Do you like using the internet?
- Do you think the government should be able to shut down the internet to protect certain corporate interests?
- Do you support innovation, creativity, and productivity?
- Do you think we have any hope of getting out of this depression if Congress clamps down on ingenuity and freedom?

Click here to phone your Senator and urge him or her to oppose PIPA. Just do it, it only takes like five minutes.

http://americancensorship.org/

2011-07-20

E3 First Impression:
Rayman Origins

Rayman Origins box artGAME:
Rayman Origins

DEVELOPER:
Ubisoft Montpellier

PUBLISHER:
Ubisoft

PLATFORM:
PS3 / Xbox 360 / Wii / 3DS / PSVita

RELEASE DATE:
15 November 2011

GENRE:
Single- and multiplayer platformer

DESCRIPTION:
Basically New Super Mario Bros Wii, but Rayman.

THOUGHTS:
The artwork in this game is super awesome. The announcement article in Game Informer made a big deal out of how they hired artists who were specialized in traditional painting methods (as opposed to so-called "digital artists"), and how most of the art in the game is actually scanned oil paintings and what-not. Definitely makes for a cool, distinctive look.

Gameplay-wise, it offers that type of same-screen, drop-in/drop-out, interactive-co-op platforming found in Little Big Planet or New Super Mario Bros Wii. Hence I take it that this game is targeted at the "casual" crowd looking to have "fun" by convincing multiple people to play a video game on the same screen in the same room.

On the one hand, that's great. It's getting back to the arcade roots of gaming, when gaming was a living, social experience. Remember Golden Axe and The Simpsons? Of course, those were brawlers. Come to think of it, I don't remember ever enjoying a platformer in an arcade setting. But whatever.

On the other hand... how often does this sort of group game play actually occur in the real world? Like those ads for Kinect showing a bunch of people all gathered together in the living room and playing Kinect Sports: who really does that? Is that a realistic expectation? Haven't shooters already figured out that sharing a screen isn't as fun as putting on a headset and playing over LAN or online? Of course, shared-screen is totally different from split-screen, but whatever.

Furthermore... there's no getting around the fact that it's a platformer. Even the best platformer of all time would still beg the question of whether or not the world needs another platformer. Another CONSOLE platformer, that is -- because we all know there are about a zillion indie, browser-based, and mobile platformers that still need to be made.

Anyways, I want to like it, at least for the zany art style.