Skip to content

Commit 330c8a0

Browse files
author
xianing
committed
add android simple audio filter
1 parent edc865b commit 330c8a0

418 files changed

Lines changed: 173932 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.3"
6+
7+
defaultConfig {
8+
minSdkVersion 16
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
consumerProguardFiles "consumer-rules.pro"
15+
16+
externalNativeBuild {
17+
cmake {
18+
cppFlags "-std=c++14"
19+
abiFilters "armeabi-v7a", "arm64-v8a"
20+
arguments "-DANDROID_STL=c++_shared"
21+
}
22+
}
23+
}
24+
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29+
}
30+
}
31+
32+
externalNativeBuild {
33+
cmake {
34+
path "src/main/cpp/CMakeLists.txt"
35+
version "3.10.2"
36+
37+
}
38+
}
39+
40+
ndkVersion '21.0.6113669'
41+
}
42+
43+
dependencies {
44+
api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
45+
implementation 'androidx.appcompat:appcompat:1.1.0'
46+
testImplementation 'junit:junit:4.12'
47+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
48+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
49+
}

Android/APIExample/agora-simple-filter/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="io.agora.extension">
3+
4+
</manifest>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright (c) 2020 Agora.io. All rights reserved
2+
3+
// This program is confidential and proprietary to Agora.io.
4+
// And may not be copied, reproduced, modified, disclosed to others, published
5+
// or used, in whole or in part, without the express prior written permission
6+
// of Agora.io.
7+
#pragma once
8+
9+
#if defined(_WIN32)
10+
// clang-format off
11+
// clang formating would change include order.
12+
13+
// Include WinSock2.h before including <Windows.h> to maintain consistency with
14+
// win32.h. To include win32.h directly, it must be broken out into its own
15+
// build target.
16+
#include <WinSock2.h>
17+
#include <Windows.h>
18+
// clang-format on
19+
#endif // _WIN32
20+
21+
namespace agora {
22+
23+
class AtomicOps {
24+
public:
25+
#if defined(_WIN32)
26+
// Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64.
27+
static int Increment(volatile int* i) {
28+
return ::InterlockedIncrement(reinterpret_cast<volatile LONG*>(i));
29+
}
30+
static int Decrement(volatile int* i) {
31+
return ::InterlockedDecrement(reinterpret_cast<volatile LONG*>(i));
32+
}
33+
static int AcquireLoad(volatile const int* i) { return *i; }
34+
static void ReleaseStore(volatile int* i, int value) { *i = value; }
35+
static int CompareAndSwap(volatile int* i, int old_value, int new_value) {
36+
return ::InterlockedCompareExchange(reinterpret_cast<volatile LONG*>(i),
37+
new_value, old_value);
38+
}
39+
// Pointer variants.
40+
template <typename T>
41+
static T* AcquireLoadPtr(T* volatile* ptr) {
42+
return *ptr;
43+
}
44+
template <typename T>
45+
static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) {
46+
return static_cast<T*>(::InterlockedCompareExchangePointer(
47+
reinterpret_cast<PVOID volatile*>(ptr), new_value, old_value));
48+
}
49+
#else
50+
static int Increment(volatile int* i) { return __sync_add_and_fetch(i, 1); }
51+
static int Decrement(volatile int* i) { return __sync_sub_and_fetch(i, 1); }
52+
static int AcquireLoad(volatile const int* i) {
53+
return __atomic_load_n(i, __ATOMIC_ACQUIRE);
54+
}
55+
static void ReleaseStore(volatile int* i, int value) {
56+
__atomic_store_n(i, value, __ATOMIC_RELEASE);
57+
}
58+
static int CompareAndSwap(volatile int* i, int old_value, int new_value) {
59+
return __sync_val_compare_and_swap(i, old_value, new_value);
60+
}
61+
// Pointer variants.
62+
template <typename T>
63+
static T* AcquireLoadPtr(T* volatile* ptr) {
64+
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
65+
}
66+
template <typename T>
67+
static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) {
68+
return __sync_val_compare_and_swap(ptr, old_value, new_value);
69+
}
70+
#endif // _WIN32
71+
};
72+
73+
} // namespace agora

0 commit comments

Comments
 (0)