package org.fmod.example;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        org.fmod.FMOD.init(this);
    }


    public void playSound0(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 0);
            }
        }).start();
    }

    public void playSound1(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 1);
            }
        }).start();
    }

    public void playSound2(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 2);
            }
        }).start();
    }

    public void playSound3(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 3);
            }
        }).start();
    }

    public void playSound4(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 4);
            }
        }).start();
    }

    public void playSound5(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                playSound("sound.mp3", 5);
            }
        }).start();
    }


    @Override
    protected void onDestroy() {
        org.fmod.FMOD.close();
        super.onDestroy();
    }


    public static native void playSound(String fileName, int type);

    static {
        System.loadLibrary("playsound");
    }
}
