Android K歌软件

时间:2016-09-16 09:21:09
【文件属性】:

文件名称:Android K歌软件

文件大小:826KB

文件格式:RAR

更新时间:2016-09-16 09:21:09

Android k歌软件源码

mMediaPlayer.prepare(); Log.v(TAG,"==mRecordPath==="+mRecordPath+"=mAccompanyPath=="+mAccompanyPath); mAccompany = new FileInputStream(mAccompanyPath); mRecord = new FileOutputStream(mRecordPath); mAccompany.read(header); // mRecord.write(header); mMediaPlayer.start(); mAudioRecord.startRecording(); mUpdateProgressHandler.post(mUpdateProgressRunnable); // 边录音边混合 while (isRunning) { Log.v("H3c", "run=============================================="); int rSize = mAudioRecord.read(recordBuf, 0, RecorderParameter.bufferSizeInBytes); Log.v("H3c", "go:" + rSize); int size = mAccompany.read(accompanyBuf, 0, RecorderParameter.bufferSizeInBytes); Log.v("H3c", "s:" + size); if (size < 0) { isRunning = false; Log.v("H3c", "run======isRunning======="+isRunning); continue; } byte[] mixBuff = new byte[size]; //播放一包录音 if(null != audioTrack){ audioTrack.write(recordBuf, 0, rSize); } for (int i = 0; i < size; i++) { mixBuff[i] = (byte) Math .round((accompanyBuf[i] + recordBuf[i]) / 2); } mRecord.write(mixBuff); } } catch (IOException e) { Log.v("H3c", "=====catch==="+e); e.printStackTrace(); } finally { Log.v("H3c", "=====final====="+isRunning); if (mMediaPlayer != null) { mMediaPlayer.stop(); } if (mAudioRecord != null) { mAudioRecord.stop(); } if(null != audioTrack){ audioTrack.stop(); } try { mAccompany.close(); mRecord.close(); } catch (IOException e) { e.printStackTrace(); } mUpdateProgressHandler .removeCallbacks(mUpdateProgressRunnable); // RemoveFile(mRecordPath); } copyWaveFile(mRecordPath, SavaAudioPath); RemoveFile(mRecordPath); Log.e("H3c", "end");


网友评论

  • 不是想要的,不过还是感谢
  • 不知道怎么用,参考下
  • 不是我想要的,但还是谢谢分享了
  • 没有用啊,这个。。。
  • 很有用,谢谢分享,五分!
  • 只是解码功能,不是我想要的