From 46ed56325dc12cddce70bdf1e23214174d4fdbad Mon Sep 17 00:00:00 2001 From: ideastudios <815106625@qq.com> Date: Tue, 26 Feb 2019 16:31:12 +0800 Subject: [PATCH] add callback on worker thread --- .idea/compiler.xml | 22 ------------- .idea/copyright/profiles_settings.xml | 3 -- .idea/misc.xml | 31 ++++++------------- README.md | 3 +- .../tech/oom/idealrecorder/IdealRecorder.java | 3 ++ .../oom/idealrecorder/StatusListener.java | 10 ++++++ 6 files changed, 25 insertions(+), 47 deletions(-) delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index cc72de3..e0d5b93 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,45 +5,34 @@ - + - - - - - 1.8 - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 88d6a84..2b815f6 100644 --- a/README.md +++ b/README.md @@ -89,10 +89,11 @@ statusListener为回调是的listener 重写需要用到的回调即可 } } ``` + 2. Add the dependency ``` dependencies { - compile 'com.github.ideastudios:IdealRecorder:1.0.3' + implementation 'com.github.ideastudios:AndroidPcmResample:v1.1.1' } ``` diff --git a/library/src/main/java/tech/oom/idealrecorder/IdealRecorder.java b/library/src/main/java/tech/oom/idealrecorder/IdealRecorder.java index f405ba8..1d3e5f5 100644 --- a/library/src/main/java/tech/oom/idealrecorder/IdealRecorder.java +++ b/library/src/main/java/tech/oom/idealrecorder/IdealRecorder.java @@ -235,6 +235,9 @@ public void onRecorded(final short[] wave) { audioFileHelper.save(bytes, 0, bytes.length); } byteArrayOutputStream.write(bytes, 0, bytes.length); + if (statusListener != null) { + statusListener.onRecordDataOnWorkerThread(wave, wave == null ? 0 : wave.length); + } runOnUi(new Runnable() { @Override public void run() { diff --git a/library/src/main/java/tech/oom/idealrecorder/StatusListener.java b/library/src/main/java/tech/oom/idealrecorder/StatusListener.java index 1853b3d..ce6edb2 100644 --- a/library/src/main/java/tech/oom/idealrecorder/StatusListener.java +++ b/library/src/main/java/tech/oom/idealrecorder/StatusListener.java @@ -22,6 +22,16 @@ public void onStartRecording() { public void onRecordData(short[] data, int length) { } + /** + * 录音时的buffer回调 在工作线程中 + * + * @param data PCM Data + * @param length 长度 + */ + public void onRecordDataOnWorkerThread(short[] data, int length) { + + } + /** * 录音时的音量