开发者

Android R Id to type File

开发者 https://www.devze.com 2023-03-18 20:50 出处:网络
I\'m making an app that must slow down the playback of audio files.The audio files\' ids are in an int[] array (like R.raw.one, R.raw.two).Here\'s my problem, I\'m trying to iterate through this array

I'm making an app that must slow down the playback of audio files. The audio files' ids are in an int[] array (like R.raw.one, R.raw.two). Here's my problem, I'm trying to iterate through this array, pick out an id to get the audio file, and put it in a FileInputStream so I can even开发者_如何学Ctually read it to an AudioTrack and slow the audio down. The problem is that FileInputStream only takes File type, not int (the ID is hexadecimal).

I can't think of another way to do this. Can I slow down playback with MediaPlayer? Because that would be way easier.

Thanks


getResources().openRawResource(R.raw.one);

will return an input stream of the file. not that getResources is a context method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号