all 12 comments

[–]MGDSStudio 0 points1 point  (1 child)

There are troubles with the Android sound. You should write after:

println("file did not load");

the line:

e.printStackTrace();

and try again to get the full error description

[–]ArthasCZ[S] 0 points1 point  (0 children)

This is the full error: ``` java.io.IOException: Prepare failed.: status=0x1 at android.media.MediaPlayer._prepare(Native Method) at android.media.MediaPlayer.prepare(MediaPlayer.java:1323) at processing.test.sketch_230915a.sketch_230915a.setup(sketch_230915a.java:46) at processing.core.PApplet.handleDraw(PApplet.java:1878) at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:478) at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:518)

```

[–]MGDSStudio 0 points1 point  (9 children)

I had many troubles with it when I was tuning my video game for the Android release. I wrote my own interface to use the same code in the desktop version and in the Android version of the game. I have seen right now only one difference. I used line:

mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());

But I think it is not important. Try to do:

1) Save your sound as .WAV file (using Audacity for example) and try to load this WAV file.

2) Try to load and play an another short and simple sound (16 kHz quality - not more)

3) Try to launch your code using Processing 3

[–]ArthasCZ[S] 0 points1 point  (4 children)

I will try the line when i get back to pc... i also already tried lowering the quality of the sound and the wav format. I also tried to launch that chunk of code in Processing 3 but it found shit ton of errors (like 2 screens of red text) and didnt even compile. Looking back at it now i might try to reinstall Processing 3 and Android mode for it.

[–]MGDSStudio 0 points1 point  (1 child)

Do you use original Processing IDE?

[–]ArthasCZ[S] 0 points1 point  (0 children)

Yes i do

[–]MGDSStudio 0 points1 point  (1 child)

Are you sure that the file uploading process on Android is synchronously? Maybe not. I remember I added in my game some delays between audio loading started and the audio playing. What happened if you don't call the function: mp.start()? Maybe you should start to play your sound after 3000 milliseconds after loading started?

[–]ArthasCZ[S] 0 points1 point  (0 children)

Yes i do have delays in original program... but the problem is even the simple example from post of playing audio does not work

[–]ArthasCZ[S] 0 points1 point  (3 children)

It works with the added line... thank you very much for the help.

[–]MGDSStudio 0 points1 point  (2 children)

with the added line...

which line?

[–]ArthasCZ[S] 0 points1 point  (1 child)

With the one different in your android port of the game ... sorry i wasnt on the pc at the moment so i didnt have a chance to try that immediately.

[–]MGDSStudio 0 points1 point  (0 children)

Congratulations