如何在 Android 中包含外部 WAV 文件
我的应用程序使用的一些 WAV 文件当前位于 res/raw
中。安装应用程序后,用户需要可以访问这些文件。因此,理想情况下,我的应用程序应该在设备上创建一个文件夹并将文件放入其中。关于如何做到这一点有什么想法/建议吗?
soundIds[0] = soundPool.load(test2Activity, R.raw.snare, 1);
soundIds[1] = soundPool.load(test2Activity, R.raw.snare2, 1);
A few WAV files used by my app are currently located in res/raw
. These files need to be accessible by the user after the app is installed. So ideally my app should create a folder on the device and put the files in it. Any idea/suggestions on how to do this?
soundIds[0] = soundPool.load(test2Activity, R.raw.snare, 1);
soundIds[1] = soundPool.load(test2Activity, R.raw.snare2, 1);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以访问 sd_card,因此您可以创建一个目录并将文件放在那里
输出文件应该是您从 res/raw 加载的声音。
我的建议是将声音复制到文件夹中,并仍然使用应用程序中 res/raw 中的声音,因为
1) 它更容易,因为您可以将其作为资源访问
2) 您确定用户没有删除了目录。
请记住将用户权限“android.permission.WRITE_EXTERNAL_STORAGE”放入清单中
You can access the sd_card, so you can create a directory and put there your files
The output file should be your sound that you have loaded from res/raw.
My advice would be to just copy the sound to the folder, and still use the sound from res/raw from within your app because
1) it is easier since you can access it as a resources
2) you are sure the user didn't deleted the directory.
Remember to put the user permission "android.permission.WRITE_EXTERNAL_STORAGE" in the manifest