This one is easy to describe. Event sounds don’t work on Android, as far as I know any format (mp3, wav). [import]uid: 6678 topic_id: 1418 reply_id: 301418[/import]
They work for me. Wav will not work, but ogg and mp3 should. [import]uid: 54 topic_id: 1418 reply_id: 3922[/import]
I was just using mp3 and it didn’t seem to work. I’ll give ogg a try and see what happens. [import]uid: 6678 topic_id: 1418 reply_id: 3926[/import]
I haven’t been able to give ogg a try because I can’t build for Android right now…
I keep getting the error “An error occurred during the build. Please consult the Console logs (or the corresponding Terminal window) for more details.” in the simulator and:
"2010-07-16 04:12:10.165 Corona Simulator[7188:903] Connection error: (corona.get) ({
“/kWSHTTPResponseMessage” = {url = http://developer.anscamobile.com/services/xmlrpc; status = HTTP/1.1 200 OK};"
in the terminal. If this is because work is being done on Android stuff, then great! Otherwise,
[import]uid: 6678 topic_id: 1418 reply_id: 3931[/import]
Dunno about when you were trying, but I just did an Android build successfully. [import]uid: 54 topic_id: 1418 reply_id: 3940[/import]
So, a little more detail on what is going on in the code. I just walked through both ogg and mp3 cases.
In the OGG case, it just works.
In the MP3 case, if I use media.playEventSound(“foo.mp3”), I get messages in the log: “sample 8 not READY”. This is because the mp3 decoder isn’t ready by the time the sound is played. If however I use sound = media.newEventSound followed by a playEventSound( sound ), then it works fine. This gives the mp3 decoder time to catch up.
One more caveat, the Android event sound API does not have a completion listener, so the Corona event sound completion listener will never be called, if you are using that.
[import]uid: 54 topic_id: 1418 reply_id: 3941[/import]
Thanks for the information. Sounds good.
But, I’m still not able to build for Android, and I figured out why, and it’s the weirdest thing. Right after you posted about the ogg format, I set my project up to try it, and that’s when I started getting that error. I couldn’t figure out what was causing it, but finally, I did… It’s for some reason having the ogg file in my project causes that error to occur… Taking out any and all ogg files allow it to compile again.
Any idea what’s up with this? [import]uid: 6678 topic_id: 1418 reply_id: 3949[/import]
What’s the name of the file? [import]uid: 54 topic_id: 1418 reply_id: 3950[/import]
sound_lose5.ogg [import]uid: 6678 topic_id: 1418 reply_id: 3951[/import]
Oh yeah and if I try to build the same project for iPhone instead, it works. [import]uid: 6678 topic_id: 1418 reply_id: 3952[/import]
Ok, I took a look at the log. It looks like you have a .ogg and a .mp3 of the same name. The build script is barfing on that. Try removing or renaming one of them. [import]uid: 54 topic_id: 1418 reply_id: 3953[/import]
Ah, great, thanks! It works now! So does ogg sound. Thanks a ton for all the info. [import]uid: 6678 topic_id: 1418 reply_id: 3954[/import]
BTW the name collision is logged as case #199, so we will address it. It’s lower priority since there is a workaround. [import]uid: 54 topic_id: 1418 reply_id: 4197[/import]
I have a different problem with sounds on Android. When I play a sound many times in fast sequence it gets quiet sometimes and then doesn’t play that particular sound anymore (But it does play other sounds still). And there is no error in the terminal window. It happens either in a simulator or on my Android device.
Do you know how to avoid that?
Thanks [import]uid: 5411 topic_id: 1418 reply_id: 5089[/import]
My offhand guess is that something is going wrong with the sound stream. If something happens in the wrong state, it locks up. Can you provide a code and sound sample that reproduces it? Send to support at anscamobile dot com. [import]uid: 54 topic_id: 1418 reply_id: 5095[/import]
@dpavlica, can you provide some sample code that demonstrates the problem (we can’t seem to reproduce it)? You say this also happens in the Corona Simulator?
Thanks,
-Tom [import]uid: 7559 topic_id: 1418 reply_id: 5719[/import]
I am trying to build for Android 1.6 and have tried ogg, mp3, and caf - all with no luck.
They PLAY in the simulator but not on my Nexus one 2.2 device.
[import]uid: 9046 topic_id: 1418 reply_id: 5997[/import]
@MPD,
The Android only plays ogg and mp3 audio files. If you are using playEventSound, you need to preload the sound before you can play it. Have you tried the AudioPlayer in Beta8 sample code? That should work.
-Tom [import]uid: 7559 topic_id: 1418 reply_id: 6005[/import]
Preloading worked! Thanks!
[import]uid: 9046 topic_id: 1418 reply_id: 6012[/import]