I store all my sounds in the res folder. I'm wondering if there is a way to store them in the assets folder and play them from there?
This is the code I'm using now:
void StartSound(int id) {
if (id==0)
return;
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
float actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
float maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
// float volume = actualVolume / maxVolume;
float volume=(float) ( .01*(double)cGlobals.iVol);
// Is the sound loaded already?
if (nLastSound!=0)
soundPool.stop(nLastSound);
int t=soundPool.play(id, volume, volume, 1, 0, 1f);
nLastSound=t;
}
I want to change this to avoid a memory error when the APK tries to load. If I remove some of the files from the res folder it works fine. I'm hopping I want have the same issue if they are saved as a file.