sandrymhb / andar

Automatically exported from code.google.com/p/andar
0 stars 0 forks source link

help need!! can't play audio(sound file) with AndAR.... #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dear Everybody,

I am trying to play a sound file in AndAR program. but it looks some conflict.I 
am trying to follwoing two way to solve conflict.

option :1 

package edu.dhbw.andar.sample;
public class CustomObject extends ARObject {
private Context context;
    @Override
    public final void draw(GL10 gl) {
        super.draw(gl);

       MediaPlayer mp = MediaPlayer.create (this,context.raw.coconut);
    mp.start();
    ......................
    ........................    
        //draw the box
        box.draw(gl);
    }

here the problem is, when marker detct the program is auto exit. I think the 
problem is context.

option 2: 

package edu.dhbw.andar.pub;
public class CustomActivity extends AndARActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    CustomRenderer renderer = new CustomRenderer        super.setNonARRenderer(renderer);
        try {
....................................
MediaPlayer mp = MediaPlayer.create(this,R.raw.coconut);
....}

here I used parameter "this" instead of "context" in create function. now 
program not crash/auto exit. But in draw function, how i can execute folowing 
line to play sound?

    public final void draw(GL10 gl) {
        super.draw(gl);
                box.draw(gl);
                mp.start(); 

because in draw function, mp is unresloved as the declaration problem.

So plese help me to solve this conflict/declaration problem to play sound..

Thanks
Rassall

Original issue reported on code.google.com by rassall....@gmail.com on 18 Aug 2010 at 7:58

GoogleCodeExporter commented 9 years ago
Yes Solved..Thanks Tdomhan for pingpong game where I get the idea to solve...

thanks

Original comment by rassall....@gmail.com on 19 Aug 2010 at 7:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
 Please help me..... how did u solve this issue?

Original comment by jaiv...@gmail.com on 9 Jan 2011 at 11:51