Skip to content

Commit 0e8d539

Browse files
author
chenyouwei
committed
feat:新增音频调试
1 parent bbc017b commit 0e8d539

File tree

15 files changed

+296
-27
lines changed

15 files changed

+296
-27
lines changed

.idea/markdown-navigator-enh.xml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator.xml

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66

77
defaultConfig {
88
applicationId "com.hugh.audiofun"
9-
minSdkVersion 16
9+
minSdkVersion 21
1010
targetSdkVersion 29
1111
versionCode 1
1212
versionName "1.0"

app/src/main/java/com/hugh/audiofun/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import android.widget.TextView;
1313

1414
import com.hugh.audiohome.AudioFunHomeActivity;
15+
import com.hugh.libwebrtc.AFRtcMainActivity;
1516
import com.hugh.libwebrtc.RtcActivity;
17+
import com.hugh.libwebrtc.kt.RtcFileActivity;
1618
import com.hugh.sound.SoundTouch;
1719
import com.hugh.sound.SoundTouchActivity;
1820
import com.zhl.commonadapter.BaseViewHolder;
@@ -77,6 +79,9 @@ public BaseViewHolder<Item> createViewHolder(int type) {
7779
case TYPE_GO_FUN_AUDIO:
7880
startActivity(new Intent(MainActivity.this, AudioFunHomeActivity.class));
7981
break;
82+
case TYPE_GO_WEBRTC2:
83+
startActivity(new Intent(MainActivity.this, RtcFileActivity.class));
84+
break;
8085
default:
8186
break;
8287
}
@@ -102,6 +107,7 @@ enum Item {
102107
TYPE_PLAY_3("播放颤音"),
103108
TYPE_PLAY_4("混响功能使用"),
104109
TYPE_GO_WEBRTC("进入webRtc"),
110+
TYPE_GO_WEBRTC2("进入webRtc2"),
105111
TYPE_GO_FUN_AUDIO("进入录音调节页面");
106112

107113

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
4+
ext.kotlin_version = '1.3.61'
55
repositories {
66
google()
77
jcenter()
88

99
}
1010
dependencies {
1111
classpath 'com.android.tools.build:gradle:3.6.3'
12-
12+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313

1414
// NOTE: Do not place your application dependencies here; they belong
1515
// in the individual module build.gradle files

libsoundtouch/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ android {
55
buildToolsVersion "29.0.3"
66

77
defaultConfig {
8-
minSdkVersion 16
8+
minSdkVersion 21
99
targetSdkVersion 29
1010
versionCode 1
1111
versionName "1.0"

libwebrtc/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
24

35
android {
46
compileSdkVersion 29
57
buildToolsVersion "29.0.3"
68

79
defaultConfig {
8-
minSdkVersion 16
10+
minSdkVersion 21
911
targetSdkVersion 29
1012
versionCode 1
1113
versionName "1.0"
@@ -45,7 +47,7 @@ android {
4547

4648
dependencies {
4749
implementation fileTree(dir: 'libs', include: ['*.jar'])
48-
50+
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4951
implementation 'androidx.appcompat:appcompat:1.1.0'
5052
testImplementation 'junit:junit:4.12'
5153
androidTestImplementation 'androidx.test.ext:junit:1.1.1'

libwebrtc/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<application >
44
<activity android:name=".RtcActivity"/>
55
<activity android:name=".AFRtcMainActivity"/>
6+
<activity android:name=".kt.RtcFileActivity"/>
67
</application>
78
</manifest>

libwebrtc/src/main/cpp/legacy_ns/ns-lib.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ Java_com_hugh_libwebrtc_WebRtcNsUtils_nsFree(JNIEnv *env,
6969
}
7070

7171
JNIEXPORT jlong JNICALL
72-
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNs_1Create(JNIEnv *env, jclass obj) {
72+
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNsx_1Create(JNIEnv *env, jclass obj) {
7373
return (long) WebRtcNsx_Create();
7474
}
7575

7676

7777
JNIEXPORT jint JNICALL
78-
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNs_1Init(JNIEnv *env, jclass obj, jlong nsHandler,
79-
jint frequency
78+
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNsx_1Init(JNIEnv *env, jclass obj, jlong nsHandler,
79+
jint frequency
8080
) {
8181
NsxHandle *handler = (NsxHandle *) nsHandler;
8282
if (handler == nullptr) {
@@ -101,12 +101,12 @@ Java_com_hugh_libwebrtc_WebRtcNsUtils_nsxSetPolicy(JNIEnv *env,
101101

102102

103103
JNIEXPORT jint JNICALL
104-
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNs_1Process(JNIEnv *env,
105-
jclass obj, jlong
104+
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNsx_1Process(JNIEnv *env,
105+
jclass obj, jlong
106106
nsHandler,
107-
jshortArray speechFrame,
108-
jint num_bands,
109-
jshortArray outframe) {
107+
jshortArray speechFrame,
108+
jint num_bands,
109+
jshortArray outframe) {
110110
NsxHandle *handle = (NsxHandle *) nsHandler;
111111
if (handle == nullptr) {
112112
return -3;
@@ -142,7 +142,7 @@ Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNs_1ProcessShort(JNIEnv* env, jclass
142142
}
143143

144144
JNIEXPORT jint JNICALL
145-
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNs_1Free(JNIEnv *env, jclass obj, jlong nsHandler) {
145+
Java_com_hugh_libwebrtc_WebRtcNsUtils_WebRtcNsx_1Free(JNIEnv *env, jclass obj, jlong nsHandler) {
146146
NsxHandle *handle = (NsxHandle *) nsHandler;
147147
if (handle == nullptr) {
148148
return -3;

libwebrtc/src/main/java/com/hugh/libwebrtc/RtcActivity.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.Manifest;
44
import android.app.Activity;
5-
import android.content.Intent;
65
import android.content.pm.PackageManager;
76
import android.content.res.AssetManager;
87
import android.media.AudioFormat;
@@ -125,7 +124,7 @@ public void onCheckedChanged(RadioGroup group, int checkedId) {
125124
initAudioFile();
126125
}
127126

128-
startActivity(new Intent(RtcActivity.this,AFRtcMainActivity.class));
127+
// startActivity(new Intent(RtcActivity.this,AFRtcMainActivity.class));
129128
}
130129

131130
private void initAudioFile() {
@@ -281,16 +280,16 @@ public void run() {
281280
// WebRtcUtils.webRtcAgcProcess32k(nsProcessData, processData, nsProcessData.length);
282281
// out.write(shortsToBytes(processData));
283282
} else {
284-
short[] nsProcessData;
283+
short[] nsProcessData = new short[160];
285284
if (selectId == R.id.rb_16k) {
286285
// nsProcessData = WebRtcNsUtils.webRtcNsProcess(mSampleRate, shortData.length, shortData);
287286
// WebRtcUtils.webRtcAgcProcess(nsProcessData, processData, shortData.length);
288287
// out.write(shortsToBytes(nsProcessData));
289288
} else if (selectId == R.id.rb_8k) {
290289
Log.e("aaa", "shortData.length---->" + shortData.length);
291-
// nsProcessData = WebRtcNsUtils.webRtcNsProcess(mSampleRate, shortData.length, shortData);
290+
// WebRtcNsUtils.WebRtcNsx_Process(WebRtcNs, shortData,1, nsProcessData);
292291
// WebRtcUtils.webRtcAgcProcess(nsProcessData, processData, nsProcessData.length);
293-
// out.write(shortsToBytes(nsProcessData));
292+
out.write(shortsToBytes(nsProcessData));
294293
}
295294
}
296295

0 commit comments

Comments
 (0)