我如何在android中的setAudioSource()方法中放入音乐?

时间:2017-07-29 07:32:49

标签: android audio put

我是一个Android程序员。我想录制音乐声音或将音乐放在MediaRecorder类的setAudioSource()方法中。但我不能这样做。你能救我吗?

private void startRecord() throws IllegalStateException, IOException { // 
recorder = new MediaRecorder(); 
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
//ok so I say audio source is the microphone
//is it windows/linux microphone on the emulator?
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GP‌​P); 
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
recorder.setOutputFile("/sdcard/Music/"+System.currentTimeMi‌​llis()+".amr"); 
recorder.prepare();
recorder.start(); }

0 个答案:

没有答案