Create Audio Sound Pool - Android Media

Android examples for Media:Sound

Description

Create Audio Sound Pool

Demo Code


// Licensed under the Apache License, Version 2.0 (the "License");
import android.media.AudioManager;
import android.media.SoundPool;
import android.util.Log;

public class Main {
  private static final int MAX_SOUND_STREAMS = 10;
  private static final String TAG = "AudioHelper";
  private SoundPool Sounds = null;

  void Initialise() {
    Sounds = new SoundPool(MAX_SOUND_STREAMS, AudioManager.STREAM_MUSIC, 0);

    if (Sounds == null) {
      Log.e(TAG, "failed to create soundpool instance");
    }//from  www  . j  av a2s  . co m

    Log.i(TAG, "created sound pool");
  }
}

Related Tutorials