SoundPool setOnLoadCompleteListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SoundPool setOnLoadCompleteListener method.

This code example shows how to use the following methods:setOnLoadCompleteListener
		this.mContext = pContext;
		this.initData(simultaneousStreams);
	} 
 
	private void initData(final int simultaneousStreams) {
		this.mSoundPool = new SoundPool(simultaneousStreams, AudioManager.STREAM_MUSIC, Cocos2dxSound.SOUND_QUALITY);
        this.mSoundPool.setOnLoadCompleteListener(new OnLoadCompletedListener());
		 
		this.mLeftVolume = 0.5f;
		this.simultaneousStreams = simultaneousStreams;
		this.mRightVolume = 0.5f;
		 
		this.mSemaphore = new Semaphore(0, true);
	} 
 
	// =========================================================== 
	// Getter & Setter 
	// =========================================================== 
 
	// =========================================================== 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load, setOnLoadCompleteListener
	 
	 
	private SoundPool pool;
	 
	public SoundManager(Context c){
		pool = new SoundPool(3, AudioManager.STREAM_MUSIC, 0);
		pool.setOnLoadCompleteListener(this);
		 
		loadSwap = false;
		loadRotate = false;
		loadWin = false;
		 
		swap = pool.load(c, R.raw.swap, 1);
		rotate = pool.load(c, R.raw.rotate, 2);
		win = pool.load(c, R.raw.win, 3);
	} 
	 
	public int playSound(int soundId){
		if(soundId == swap && !loadSwap
				|| (soundId == rotate && !loadRotate)
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load, setOnLoadCompleteListener
	public SoundPoolPlayer(Context mContext){
		audio = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
	} 
	 
	public void play(MusicFile song) {
		sound = new SoundPool(2, AudioManager.STREAM_MUSIC, 0);
		final int curVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
		final int soundID =sound.load(song.getFilename(), 1);
		sound.setOnLoadCompleteListener(new OnLoadCompleteListener(){
 
			public void onLoadComplete(SoundPool soundPool, int sampleId,
					int status) {
				 
				sound.play(soundID, curVolume, curVolume, 0, 0, 1f);
			}}); 
				 
	} 
 
	public void fadeIn(long fadeTime, MusicFile nextSong) {
		// TODO Auto-generated method stub 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load, setOnLoadCompleteListener
package com.greylocku.lazer.util; 
 
import android.content.Context; 
import android.media.AudioManager; 
import android.media.SoundPool; 
import android.media.SoundPool.OnLoadCompleteListener; 
 
public class SoundEffects { 
	public static void play(Context context, int RclipId) {
    	SoundPool soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 100);
    	final int soundID = soundPool.load(context, RclipId, 1);
    	soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
            @Override 
            public void onLoadComplete(SoundPool soundPool, int sampleId,
                int status) {
            	soundPool.play(soundID, 1f, 1f, 1, 0, 1f);
            } 
          }); 
	} 
} 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load, setOnLoadCompleteListener
			soundPool.release();
			soundPool = null;
		} 
		if (assetSound.length() > 0) {
			int soundID = -1;
			soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
			try { 
				AssetManager assetManager = context.getAssets();
				AssetFileDescriptor descriptor = assetManager
						.openFd(assetSound);
				soundID = soundPool.load(descriptor, 1);
 
			} catch (IOException e) {
			} 
			if (soundID != -1) {
				soundPool
						.setOnLoadCompleteListener(new OnLoadCompleteListener() {
 
							@Override 
							public void onLoadComplete(SoundPool soundPool,

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load, setOnLoadCompleteListener
		}else{			//µÚÒ»´ÎʹÓà
			newAsoundPool(); 
 
		}//end if 
		filePath = tempMp3File.getAbsolutePath();
		id = soundPool.load(filePath,1);
		//ÏÂÃ漸ÐдúÂëÓò»ÁË£¬Ä¿µÄÊÇ£ºÖظ´Ê¹ÓÃÒÑÓеÄID(ÒѾ­½â¾ö¼ûÉÏ) 
		if(idFileMap.containsKey(filePath)){//Èç¹ûÒѾ­´æÔÚ£¬ÔòÈ¡³öID
			id = idFileMap.get(filePath);
			Log.d("²¥·ÅÒÑÓÐid = ", idFileMap.get(filePath)+"");
		}else{									 
			id = soundPool.load(filePath,1);//²»´æÔÚ£¬ÔòÉú³ÉеÄID£¬¼Óµ½MAP
			idFileMap.put(filePath, id);
			Log.d("н¨ id = "+id, filePath+"");
		} 
		return soundPool;
	} 
 
	/** 
	 * ²¥·Å 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnLoadCompleteListener
        mSoundPoolMap = new HashMap();
        mPendingSoundMap = new HashMap();
        mPlayingSoundMap = new ArrayList();
        mResourceManager = resourcemanager;
        mContext = context;
        mSoundPool = new SoundPool(4, 1, 100);
        mSoundPool.setOnLoadCompleteListener(this);
        mAudioManager = (AudioManager)context.getSystemService("audio");
    } 
 
    /** 
     * @deprecated Method playSoundImp is deprecated 
     */ 
 
    private void playSoundImp(int i, boolean flag) {
        this;
        JVM INSTR monitorenter ;
        SoundPool soundpool = mSoundPool;
        if(soundpool != null) goto _L2; else goto _L1
_L1:
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnLoadCompleteListener
	private SoundPool soundPool;
	private Context activity;
	 
	public InstrumentPlayer(Instrument[] instruments, Context activity) {
		this.instruments = instruments;
		soundPool = new SoundPool(100, AudioManager.STREAM_MUSIC, 0);
		soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
			@Override 
			public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
				Log.d("SoundPool Of Nusabahana", "Completed:"+ sampleId);
				 
			} 
		}); 
		this.activity = activity;
		soundIds = new HashMap<Integer, ArrayList<Integer>>();
	} 
 
	public void prepareSound(){ 
		for(int i = 0; i < instruments.length; i++){
			Note[] notes = instruments[i].getNotes();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnLoadCompleteListener
		// Set the hardware buttons to control the music 
		activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
		// Load the sound 
		loadedIds=new HashMap<Integer,Boolean>();
		//soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); 
		soundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
		soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
			@Override 
			public void onLoadComplete(SoundPool soundPool, int sampleId,
					int status) {
				loadedIds.put(sampleId, Boolean.TRUE);
				Log.d(TAG, "loaded sound file "+sampleId+": status: "+status);
			} 
		});		 
	} 
	 
	/** 
	 * load a music resource 
	 * @param resourceName 
	 * @return 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnLoadCompleteListener
	 
	private static AudioManager mAudioManager;
    public FlywheelSound(Context context)
    { 
    	if (instance == null) {
			mSoundPool = new SoundPool(soundpoolPolyphony, AudioManager.STREAM_MUSIC, 0);
			mSoundPool.setOnLoadCompleteListener(this);
			if (mSoundPoolID > 1) {
				mSoundPoolID++;
			} else { 
				mSoundPoolID = 1;
			} 
		} 
 
    	instance = this;
    	mContext = context;
    	mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    } 
     
    public static void initialize(){ 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related SoundPool setOnLoadCompleteListener Questions & Answers:

setOnLoadCompleteListener Method Overview
Sets the callback hook for the OnLoadCompleteListener.
See Code Examples for other Android SoundPool Methods: