资源简介
工厂测试音频回路
代码片段和文件信息
package com.zte.engineer;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.media.AudioSystem;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import android.view.WindowManager;
import android.media.AudioRecord;
import android.media.AudioTrack;
import android.util.Log;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
//import com.mediatek.audioprofile.AudioProfile;
//import com.mediatek.audioprofile.AudioProfileImpl;
//import com.mediatek.audioprofile.AudioProfileManagerImpl;
public class AudioLoopTest extends ZteActivity {
/*
* Define some aliases to make these debugging flags easier to refer to.
*/
private final static String LOGTAG = “ZTEAudioLoopTest“;
private int isHeadsetConnect;
private AudioManager mAudioManager = null;
// private AudioProfileImpl mProfile;
private boolean soundeffect = false;
private boolean running = false;
int BUF_SIZE = 2048;
int SAMPLE_RATE = 8000;
AudioManager am;
byte[] buffer = new byte[this.BUF_SIZE];
int buffersize;
int index = 0;
boolean m_isRun = true;
AudioRecord m_record;
Thread m_thread;
AudioTrack m_track;
private SharedPreferences sharedPreferences;
private Editor editor;
public void onCreate(Bundle savedInstanceState) {
// Turn screen on and show above the keyguard for emergency alert
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
super.onCreate(savedInstanceState);
// mProfile =
// (AudioProfileImpl)AudioProfileManagerImpl.getInstance(this).getActiveProfile();
// soundeffect = mProfile.getSoundEffectEnabled();
// if(soundeffect == true)
// {
// mProfile.setSoundEffectEnabled(false);
// }
// hide title bar
requestWindowFeature(Window.FEATURE_NO_title);
setContentView(R.layout.singlebuttonview);
sharedPreferences = getSharedPreferences(this.getPackageName()Context.MODE_PRIVATE);
editor = sharedPreferences.edit();
TextView mTextView = (TextView) findViewById(R.id.singlebutton_textview);
mTextView.setText(R.string.audio_loop);
mAudioManager = (AudioManager) this
.getSystemService(Context.AUDIO_SERVICE);
((Button) findViewById(R.id.singlebutton_pass_button))
.setonclickListener(this);
((Button) findViewById(R.id.singlebutton_false_button))
.setonclickListener(this);
this.am = ((AudioManager)getSystemService(“audio“));
}
@Override
public void onResume() {
super.onResume();
do_loopback();
/*running = true;
new Thread() {
public void run() {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6192 2018-04-24 17:14 AudioLoopTest.java
- 上一篇:GPS开发资料
- 下一篇:TM1638 Proteus仿真库
评论
共有 条评论