Skip to content

Commit

Permalink
Dev/4.2.3 (#354)
Browse files Browse the repository at this point in the history
* add third player moudle

* add Audio Waveform Moudle

* Fixed an issue where remote users joined player pause when rtc and player were used at the same time

* fix ui issue

* update content inspect config

* add Feature Available On Device

* add take snapshot ex

* update beautyAPI version to 1.0.3

* add Feature Available On Device

* add snapshot ex

* fix snapshot remote bug

* [Android]Add AudioRouterPlayer case.

* [Android]Add AudioWaveform case.

* [Android][Audio]add AudioWaveform case.

* [Android]adjust content inspect case.

* [Android]Add isFeatureAvailableOnDevice api in VideoProcessExtension.

* [Android]Add takesnapshotex for JoinMultipleChannel.

* [Android]update beauty api to 1.0.3 and etc.

* [Windows]add snapshot for MultiChannel.

* [Windows]fix snapshot bug.

* fix oc crate stream data bug

* fix swift create stream data bug

* [Android]fix remote render error when rejoining channel(NMS-15581).

* [Android]perfect PushExternalVideoYUV case.

* add file sharing key

* fix title

* fix  multi channel bug

* fix conent inspect bug

* [Windows]fix media player crash.

* [Android]perfect MultiVideoSourceTracks case.

* fix input token crash bug

* fix input token crash bug

* [Android]Update readme. (#355)

* [Android]add 4K 60fps h265. (#356)

* [Android]fix ui bug.

* [Android]fix render bug(CSD-59845).

* Fix the issue of no sound during AVPlayer playback

* [Android]add cases of enableVideoImageSource and setAINSMode api and etc.

* [Android]add setAINSMode api case and etc.

* add video image push

* add AINS Mode

* iOS Add AINS Mode

* ios add video image push

* [Windows]add enableVideoImageSource and setAINSMode api case.

* [MacOS]fix audio recording path bug.

* fix startAudioRecording path bug

* fix  audio session change issue

* fix video image source issue

* ..

* fix  exit screen leave channel issue

* screen shareing auto close system interface

* [Android]update rtc verstion and etc.

* [Windows]Update rtc verstion.

* update SDK version to  4.2.3

---------

Co-authored-by: zhaoyongqiang <[email protected]>
  • Loading branch information
xgfd3 and zhaoyongqiang authored Oct 12, 2023
1 parent c0caa78 commit 66c708b
Show file tree
Hide file tree
Showing 208 changed files with 8,163 additions and 8,915 deletions.
2 changes: 1 addition & 1 deletion Android/APIExample-Audio/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar'])
}
else{
def agora_sdk_version = "4.2.2"
def agora_sdk_version = "4.2.3"
// case 1: full single lib with voice only
implementation "io.agora.rtc:voice-sdk:${agora_sdk_version}"
// case 2: partial libs with voice only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private void runOnPermissionGranted(@NonNull Runnable runnable) {
permissionList.add(Permission.WRITE_EXTERNAL_STORAGE);
permissionList.add(Permission.RECORD_AUDIO);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
permissionList.add(Manifest.permission.READ_PHONE_STATE);
permissionList.add(Manifest.permission.BLUETOOTH_CONNECT);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
package io.agora.api.example.common.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

import java.util.ArrayList;

import io.agora.api.example.R;

public class WaveformView extends View {
private ArrayList<Short> datas = new ArrayList<>();
private short max = 100;
private float mWidth;
private float mHeight;
private float space =1f;
private Paint mWavePaint;
private Paint baseLinePaint;
private int mWaveColor = Color.WHITE;
private int mBaseLineColor = Color.WHITE;
private float waveStrokeWidth = 4f;
private int invalidateTime = 1000 / 100;
private long drawTime;
private boolean isMaxConstant = false;

public WaveformView(Context context) {
this(context, null);
}

public WaveformView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}

public WaveformView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs, defStyleAttr);
}

private void init(AttributeSet attrs, int defStyle) {
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.WaveView, defStyle, 0);
mWaveColor = a.getColor(
R.styleable.WaveView_waveColor,
mWaveColor);
mBaseLineColor = a.getColor(
R.styleable.WaveView_baselineColor,
mBaseLineColor);

waveStrokeWidth = a.getDimension(
R.styleable.WaveView_waveStokeWidth,
waveStrokeWidth);

max = (short) a.getInt(R.styleable.WaveView_maxValue, max);
invalidateTime = a.getInt(R.styleable.WaveView_invalidateTime, invalidateTime);

space = a.getDimension(R.styleable.WaveView_space, space);
a.recycle();
initPainters();

}

private void initPainters() {
mWavePaint = new Paint();
mWavePaint.setColor(mWaveColor);// 画笔为color
mWavePaint.setStrokeWidth(waveStrokeWidth);// 设置画笔粗细
mWavePaint.setAntiAlias(true);
mWavePaint.setFilterBitmap(true);
mWavePaint.setStrokeCap(Paint.Cap.ROUND);
mWavePaint.setStyle(Paint.Style.FILL);
Shader shader = new LinearGradient(0, 0, 1000, 0, 0xffffffff, 0xFFe850ee, Shader.TileMode.CLAMP);
mWavePaint.setShader(shader);
baseLinePaint = new Paint();
baseLinePaint.setColor(mBaseLineColor);// 画笔为color
baseLinePaint.setStrokeWidth(1f);// 设置画笔粗细
baseLinePaint.setAntiAlias(true);
baseLinePaint.setFilterBitmap(true);
baseLinePaint.setStyle(Paint.Style.FILL);
}

public short getMax() {
return max;
}

public void setMax(short max) {
this.max = max;
}

public float getSpace() {
return space;
}

public void setSpace(float space) {
this.space = space;
}

public int getmWaveColor() {
return mWaveColor;
}

public void setmWaveColor(int mWaveColor) {
this.mWaveColor = mWaveColor;
invalidateNow();
}

public int getmBaseLineColor() {
return mBaseLineColor;
}

public void setmBaseLineColor(int mBaseLineColor) {
this.mBaseLineColor = mBaseLineColor;
invalidateNow();
}

public float getWaveStrokeWidth() {
return waveStrokeWidth;
}

public void setWaveStrokeWidth(float waveStrokeWidth) {
this.waveStrokeWidth = waveStrokeWidth;
invalidateNow();
}

public int getInvalidateTime() {
return invalidateTime;
}

public void setInvalidateTime(int invalidateTime) {
this.invalidateTime = invalidateTime;
}

public boolean isMaxConstant() {
return isMaxConstant;
}

public void setMaxConstant(boolean maxConstant) {
isMaxConstant = maxConstant;
}

/**
* 如果改变相应配置 需要刷新相应的paint设置
*/
public void invalidateNow() {
initPainters();
invalidate();
}

public void addData(short data) {

if (data < 0) {
data = (short) -data;
}
if (data > max && !isMaxConstant) {
max = data;
}
if (datas.size() > mWidth / space) {
synchronized (this) {
datas.remove(0);
datas.add(data);
}
} else {
datas.add(data);
}
if (System.currentTimeMillis() - drawTime > invalidateTime) {
invalidate();
drawTime = System.currentTimeMillis();
}

}

public void clear() {
datas.clear();
invalidateNow();
}


@Override
protected void onDraw(Canvas canvas) {
canvas.translate(0, mHeight / 2);
drawBaseLine(canvas);
drawWave(canvas);
}

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mWidth = w;
mHeight = h;
}

private void drawWave(Canvas mCanvas) {
for (int i = 0; i < datas.size(); i++) {
float x = (i) * space;
float y = (float) datas.get(i) / max * mHeight / 2;
mCanvas.drawLine(x, -y, x, y, mWavePaint);
}

}

private void drawBaseLine(Canvas mCanvas) {
mCanvas.drawLine(0, 0, mWidth, 0, baseLinePaint);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class VoiceEffects extends BaseFragment implements View.OnClickListener,
private EditText et_channel;
private Button join;
private Spinner audioProfile, audioScenario,
chatBeautifier, timbreTransformation, voiceChanger, styleTransformation, roomAcoustics, pitchCorrection, _pitchModeOption, _pitchValueOption, voiceConversion,
chatBeautifier, timbreTransformation, voiceChanger, styleTransformation, roomAcoustics, pitchCorrection, _pitchModeOption, _pitchValueOption, voiceConversion, ainsMode,
customBandFreq, customReverbKey;
private ViewGroup _voice3DLayout, _pitchModeLayout, _pitchValueLayout;
private SeekBar _voice3DCircle, customPitch, customBandGain, customReverbValue, customVoiceFormant;
Expand Down Expand Up @@ -152,6 +152,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
_pitchValueLayout = view.findViewById(R.id.audio_pitch_value_layout);
_pitchValueOption = view.findViewById(R.id.audio_pitch_value_option);
voiceConversion = view.findViewById(R.id.audio_voice_conversion);
ainsMode = view.findViewById(R.id.audio_ains_mode);

chatBeautifier.setOnItemSelectedListener(this);
timbreTransformation.setOnItemSelectedListener(this);
Expand All @@ -163,6 +164,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
_voice3DCircle.setOnSeekBarChangeListener(this);
_pitchModeOption.setOnItemSelectedListener(this);
_pitchValueOption.setOnItemSelectedListener(this);
ainsMode.setOnItemSelectedListener(this);

// Customize Voice Effects Layout
customPitch = view.findViewById(R.id.audio_custom_pitch); // engine.setLocalVoicePitch()
Expand Down Expand Up @@ -201,6 +203,7 @@ private void resetControlLayoutByJoined() {
_pitchModeLayout.setVisibility(View.GONE);
_pitchValueLayout.setVisibility(View.GONE);
voiceConversion.setEnabled(joined);
ainsMode.setEnabled(joined);

customPitch.setEnabled(joined);
customBandFreq.setEnabled(joined);
Expand All @@ -216,6 +219,7 @@ private void resetControlLayoutByJoined() {
roomAcoustics.setSelection(0);
pitchCorrection.setSelection(0);
voiceConversion.setSelection(0);
ainsMode.setSelection(0);

customPitch.setProgress(0);
customBandGain.setProgress(0);
Expand Down Expand Up @@ -615,11 +619,26 @@ public void onItemSelected(AdapterView<?> parent, View view, int position, long
return;
}


if(parent == _pitchModeOption || parent == _pitchValueOption){
int effectOption1 = getPitch1Value(_pitchModeOption.getSelectedItem().toString());
int effectOption2 = getPitch2Value(_pitchValueOption.getSelectedItem().toString());
engine.setAudioEffectParameters(PITCH_CORRECTION, effectOption1, effectOption2);
}

if(parent == ainsMode){
boolean enable = position > 0;
/*
The AI noise suppression modes:
0: (Default) Balance mode. This mode allows for a balanced performance on noice suppression and time delay.
1: Aggressive mode. In scenarios where high performance on noise suppression is required, such as live streaming
outdoor events, this mode reduces nosies more dramatically, but sometimes may affect the original character of the audio.
2: Aggressive mode with low latency. The noise suppression delay of this mode is about only half of that of the balance
and aggressive modes. It is suitable for scenarios that have high requirements on noise suppression with low latency,
such as sing together online in real time.
*/
engine.setAINSMode(enable, position - 1);
}
}

private int getVoiceConversionValue(String label) {
Expand Down
Loading

0 comments on commit 66c708b

Please sign in to comment.