Closed niusounds closed 8 years ago
I also have the same problem.
Loading sound files from the SD card should work. Please make sure that you add
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE" />`
to your manifest and since Android N, you also need to trigger an intent to ask to user to grand external storage permission.
I tried these codes
GvrAudioEngine audioEngine = new GvrAudioEngine(getContext(), GvrAudioEngine.RenderingMode.BINAURAL_HIGH_QUALITY);
final File file = new File(Environment.getExternalStorageDirectory(), "Ambi.wav");
int ambisonicId = audioEngine.createSoundfield(file.getAbsolutePath());
but ambisonicId
is -1
. I added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
in AndroidManifest.xml. targetSdkVersion is 19.
I tried some methods, finally I found that these codes run successfully. (It plays strange distorted sound. But it may be other problem, not a bug in GVR library.)
GvrAudioEngine audioEngine = new GvrAudioEngine(getContext(), GvrAudioEngine.RenderingMode.BINAURAL_HIGH_QUALITY);
final File file = new File(Environment.getExternalStorageDirectory(), "Ambi.wav");
final String filename = file.getAbsolutePath();
audioEngine.preloadSoundFile(filename);
int ambisonicId = audioEngine.createSoundfield(file.getAbsolutePath());
API Document says Ambisonic soundfields do not need to be preloaded. I think it is not needed to call preloadSoundFile
. Is it wrong?
This issue will be the same topic with #197 so I close here.
Hello,
createSoundfield(String filename)
can only read audio from asset files in apk. I want to read external file! (somewhere in /sdcard/ like path) Is there a plan to add this feature?