Simulator crashes on media.playSound()

Hello!

I just tried to “simulate” a program which uses “media.playSound” in order to play an MP3 file - but the simulator always crashes because it can’t find that file. The code is simple:

media.playSound(system.pathForFile("Zarathustra.mp3",system.ResourceDirectory));

and -surprisingly (or not) - the error message displayed by the “Terminal” version of the simulator shows exactly the same (full) path to the file as (another) terminal into which I dragged the file itself. Thus, the file path looks correct as well…and it’s present…and iTunes can play it.

Thus, I don’t know how to proceed :frowning:

Additionaly, it’s quite annoying having to restart the simulator over and over again just because it can’t find a single resource file!

For your records, here is the crash report

[code]Process: Corona Simulator [6947]
Path: /Applications/Corona/Corona Simulator.app/Contents/MacOS/Corona Simulator
Identifier: com.anscamobile.Corona_Simulator
Version: ??? (1.0)
Code Type: X86 (Native)
Parent Process: bash [6945]

Interval Since Last Report: 28450 sec
Crashes Since Last Report: 4
Per-App Interval Since Last Report: 96518 sec
Per-App Crashes Since Last Report: 3

Date/Time: 2010-02-02 11:27:32.592 +0100
OS Version: Mac OS X 10.5.8 (9L31a)
Report Version: 6
Anonymous UUID: 549D72F2-ED77-441F-A361-9F3C673F0D2A

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0

Thread 0 Crashed:
0 libSystem.B.dylib 0x9523cf30 strlen + 16
1 …nscamobile.Corona_Simulator 0x0002aef0 0x1000 + 171760
2 …nscamobile.Corona_Simulator 0x0003e9d1 0x1000 + 252369
3 …nscamobile.Corona_Simulator 0x0004e02c 0x1000 + 315436
4 …nscamobile.Corona_Simulator 0x0003ea8a 0x1000 + 252554
5 …nscamobile.Corona_Simulator 0x000346fd 0x1000 + 210685
6 …nscamobile.Corona_Simulator 0x0003e14b 0x1000 + 250187
7 …nscamobile.Corona_Simulator 0x0003ed0e 0x1000 + 253198
8 …nscamobile.Corona_Simulator 0x000370c5 0x1000 + 221381
9 …nscamobile.Corona_Simulator 0x0001ec93 0x1000 + 122003
10 …nscamobile.Corona_Simulator 0x0001efe6 0x1000 + 122854
11 …nscamobile.Corona_Simulator 0x0001f2bd 0x1000 + 123581
12 …nscamobile.Corona_Simulator 0x0001a85c 0x1000 + 104540
13 …nscamobile.Corona_Simulator 0x00031b5a 0x1000 + 199514
14 …nscamobile.Corona_Simulator 0x0001a056 0x1000 + 102486
15 …nscamobile.Corona_Simulator 0x0000e360 0x1000 + 54112
16 …nscamobile.Corona_Simulator 0x0000726c 0x1000 + 25196
[import]uid: 4331 topic_id: 431 reply_id: 300431[/import]

Hello again!

I just tried to build the app for my device and run it there:

  • the .mp3 file seems to get bundled with the application (because the size increases by the size of the MP3)
  • but I can’t here anything

Too bad… [import]uid: 4331 topic_id: 431 reply_id: 819[/import]

Hmmm…

I also tried with other MP3 files - but can’t convince the simulator/device to play ANY of them

I also added artifical event handlers for “enterFrame” in order to keep the application running in any case - but that did not help either.

Any ideas?

Thanks in advance for any help!

Andreas Rozek [import]uid: 4331 topic_id: 431 reply_id: 820[/import]

Oh,

I just realized that the code samples shipped with Corona do not work on the simulator either!

It therefore seems to be a bigger problem…sigh! [import]uid: 4331 topic_id: 431 reply_id: 821[/import]

Oops,

it seems as if the simulator does not find ANY documents or resources (not even PNG files) on my machine!

That’s bad! [import]uid: 4331 topic_id: 431 reply_id: 824[/import]

Well,

I am now able to load images - by avoiding the system.pathForFile call! It seems as if Corona does not support directories yet!

Thus: always use file names directly! Do not use “system.pathForFile”!

Needless to mention, that playSound isalso working now!

Kind regards,

Andreas Rozek [import]uid: 4331 topic_id: 431 reply_id: 825[/import]

Did it fix your media.playSound() problem as well?

– Walt Sterdan [import]uid: 4329 topic_id: 431 reply_id: 826[/import]

Walt,

yes - I did (as mentioned in the “needless to mention” phrase)

Nevertheless, playSound should NOT crash when the sound file does not exist: when a null Image object is created, an internal assertion fails (which is still somewhat cryptic, but - by scrolling back - the actual reason for this failure can be seen in clear text).

For that reason, the bug report is still meaningful!

Kind regards,

Andreas Rozek [import]uid: 4331 topic_id: 431 reply_id: 827[/import]

Oops, right you are; my apologies, trying to do too many things too early in the morning.

Agreed, not finding a file should not cause a crash.

– Walt Sterdan [import]uid: 4329 topic_id: 431 reply_id: 830[/import]

Walt,

don’t worry - I make such mistakes throughout the whole day, not just early in the morning :wink:

Let’s hope, that the Ansca staff is fixing that bug soon (should not be too complicated)

Kind regards,

Andreas Rozek [import]uid: 4331 topic_id: 431 reply_id: 834[/import]

I’m new to this and am having the same trouble, what is the alternative to system.pathForFile?

Cheers

Gary [import]uid: 4523 topic_id: 431 reply_id: 1269[/import]

the sound file should be in the same root directory of your .lua

calling playSound(“filename”) or eventSound(filename) should work unless you are doing something else.

Carlos [import]uid: 24 topic_id: 431 reply_id: 1273[/import]

I don’t get any sound from the simulator at all. I’ve tried all the sample files that include sound. No errors
in the terminal. The demo apps work correctly apart from not playing sound. [import]uid: 5897 topic_id: 431 reply_id: 1595[/import]

can you all fwd me the sound files?

support@anscamobile.com

carlos [import]uid: 24 topic_id: 431 reply_id: 1617[/import]

For the record, there was a bug where if the sound file was missing, the simulator would crash. This has been fixed (in the latest beta). I can build the Zarathustra hello world and it plays sound just fine, in the simulator and on device. So additional info or specifics would be most welcome. [import]uid: 54 topic_id: 431 reply_id: 1625[/import]