diff --git a/AndroidMP3RecorderLibrary/src/com/czt/mp3recorder/DataEncodeThread.java b/AndroidMP3RecorderLibrary/src/com/czt/mp3recorder/DataEncodeThread.java index cc8fe7c..cdd0472 100644 --- a/AndroidMP3RecorderLibrary/src/com/czt/mp3recorder/DataEncodeThread.java +++ b/AndroidMP3RecorderLibrary/src/com/czt/mp3recorder/DataEncodeThread.java @@ -103,8 +103,14 @@ private int processData() { if (mTasks.size() > 0) { Task task = mTasks.remove(0); short[] buffer = task.getData(); + short[] rightData = task.getRightData(); int readSize = task.getReadSize(); - int encodedSize = LameUtil.encode(buffer, buffer, readSize, mMp3Buffer); + if(task.getRightData() != null && task.getRightData().length > 0){ + rightData = task.getRightData(); + }else{ + rightData = task.getData(); + } + int encodedSize = LameUtil.encode(buffer, rightData, readSize, mMp3Buffer); if (encodedSize > 0){ try { mFileOutputStream.write(mMp3Buffer, 0, encodedSize); @@ -116,6 +122,7 @@ private int processData() { return 0; } + /** * Flush all data left in lame buffer to file */ @@ -143,16 +150,30 @@ private void flushAndRelease() { public void addTask(short[] rawData, int readSize){ mTasks.add(new Task(rawData, readSize)); } + public void addTask(short[] rawData,short[] rightData, int readSize){ + mTasks.add(new Task(rawData, rightData,readSize)); + } private class Task{ private short[] rawData; private int readSize; + private short[] rightData; public Task(short[] rawData, int readSize){ this.rawData = rawData.clone(); this.readSize = readSize; } + public Task(short[] leftData, short[] rightData,int readSize){ + this.rawData = leftData.clone(); + this.rightData = rightData.clone(); + this.readSize = readSize; + } public short[] getData(){ return rawData; } + + public short[] getRightData(){ + return rightData; + } + public int getReadSize(){ return readSize; } diff --git a/RecordTest/AndroidManifest.xml b/RecordTest/AndroidManifest.xml new file mode 100644 index 0000000..b845282 --- /dev/null +++ b/RecordTest/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + diff --git a/RecordTest/proguard-project.txt b/RecordTest/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/RecordTest/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/RecordTest/project.properties b/RecordTest/project.properties new file mode 100644 index 0000000..888961c --- /dev/null +++ b/RecordTest/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-21 +android.library.reference.1=../AndroidMP3RecorderLibrary diff --git a/RecordTest/res/drawable-hdpi/ic_launcher.png b/RecordTest/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 Binary files /dev/null and b/RecordTest/res/drawable-hdpi/ic_launcher.png differ diff --git a/RecordTest/res/drawable-mdpi/ic_launcher.png b/RecordTest/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b Binary files /dev/null and b/RecordTest/res/drawable-mdpi/ic_launcher.png differ diff --git a/RecordTest/res/drawable-xhdpi/ic_launcher.png b/RecordTest/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd Binary files /dev/null and b/RecordTest/res/drawable-xhdpi/ic_launcher.png differ diff --git a/RecordTest/res/drawable-xxhdpi/ic_launcher.png b/RecordTest/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 Binary files /dev/null and b/RecordTest/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/RecordTest/res/layout/main.xml b/RecordTest/res/layout/main.xml new file mode 100644 index 0000000..80d2831 --- /dev/null +++ b/RecordTest/res/layout/main.xml @@ -0,0 +1,38 @@ + + + +