Created
September 13, 2014 19:07
-
-
Save chrissound/b357e3cafff8b27b77b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void waitTillLoaded() { | |
| try { | |
| Log.d("hmm", "abc"); | |
| soundLoadedSemaphore.acquire(counter.i); | |
| Log.d("hmm", "xyz"); | |
| } catch (Exception e) | |
| { | |
| } | |
| } | |
| public void loadSound(AssetFileDescriptor assetFile, String soundIndex) | |
| { | |
| counter.i++; | |
| soundIndexes.put(soundIndex, soundPool.load(assetFile, 1)); | |
| soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() { | |
| @Override | |
| public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { | |
| soundLoadedSemaphore.release(); | |
| // if I 'load' a single file, and put the following line below it does not hang | |
| // soundLoadedSemaphore.acquire(); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment