Android Open Source - beatbox Sound Box






From Project

Back to project page beatbox.

License

The source code is released under:

Copyright 2014 Giovanni Arroyo

If you think the Android project beatbox listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package gio.beatboxer;
/*from w  w  w  .j av a  2s  .c  om*/
import java.io.IOException;
import java.util.Vector;

import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.media.AudioManager;
import android.media.SoundPool;
import android.util.Log;

public class SoundBox 
{
  int currentSoundEffectId;
  Vector<Integer> soundpoolIDS;
  SoundPool soundPool;
  
  AssetManager assetsManager;
  AssetFileDescriptor descriptor;
  
  Context context;
  
  public SoundBox(Context context)
  {
    this.context = context;
    this.assetsManager = context.getAssets();
    this.soundPool = new SoundPool(12, AudioManager.STREAM_MUSIC, 0);
    this.descriptor = null;
    this.soundpoolIDS = new Vector<Integer>(100);
  }
  
  public void loadEffect(String fileName)
  {
    try
    {
    descriptor = assetsManager.openFd(fileName);
      soundpoolIDS.add(new Integer(soundPool.load(descriptor, 1))); 
    }
    catch(IOException ex)
    {
      Log.v("BeatsPallete", "FILE WAS NOT LOADED");
    }
  }
  

}




Java Source Code List

gio.beatboxer.BeatBoxerActivity.java
gio.beatboxer.BeatsControls.java
gio.beatboxer.BeatsGrid.java
gio.beatboxer.BeatsPallete.java
gio.beatboxer.Grid12Runnable.java
gio.beatboxer.Grid4Runnable.java
gio.beatboxer.Grid8Runnable.java
gio.beatboxer.SoundBox.java