package net.avs234;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.SeekBar.OnSeekBarChangeListener;
import net.avs234.iconifiedlist.IconifiedText;
import net.avs234.iconifiedlist.IconifiedTextListAdapter;
public class AndLess extends Activity implements Comparator<File> {
// Current directory **OR** current cue/playlist file
private File cur_path = null;
// File/dir names together with their icons displayed in the list widget
private ArrayList<IconifiedText> directoryEntries = new ArrayList<IconifiedText>();
// Full paths to files in current dir/playlist/cue
private ArrayList<String> files = new ArrayList<String>();
// Track names in cue file
private ArrayList<String> track_names = new ArrayList<String>();
// Track start times (seconds) in cue file
private ArrayList<Integer> start_times = new ArrayList<Integer>();
// Index of 1st audio file in directoryEntries list (below directories, cues, and playlists)
private int first_file_pos;
// At the start, set this flag and emulate the pause if the last file was bookmarked
private boolean pause_on_start = false;
// Changed to true in playlists/settings dialogs
private boolean playlist_changed = false;
private void log_msg(String msg) {
Log.i(getClass().getSimpleName(), msg);
}
private void log_err(String msg) {
Log.e(getClass().getSimpleName(), msg);
}
// UI elements defined in layout xml file.
private Button buttPause, buttPrev, buttNext, buttVMinus, buttVPlus, ButtonVolume;
private TextView nowTime, allTime;
private ListView fileList;
private SeekBar pBar;
private String curWindowTitle = null;
private static final String resume_bmark = "/resume.bmark";
// Interface which is an entry point to server functions. Returned upon connection to the server.
private IAndLessSrv srv = null;
// If we're called through intent
private String startfile = null;
// Callback for server to report track/state changes. Invokes the above handler to set window title.
private IAndLessSrvCallback cBack = new IAndLessSrvCallback.Stub() {
public void playItemChanged(boolean error, String name) {
log_msg(String.format("track name changed to %s", name));
Message msg = new Message();
Bundle data = new Bundle();
data.putString("filename", name);
data.putBoolean("error", error);
msg.setData(data);
hdl.sendMessage(msg);
}
public void errorReported(String name) {
log_msg(String.format("error \"%s\" received", name));
Message msg = new Message();
Bundle data = new Bundle();
data.putString("errormsg", name);
msg.setData(data);
hdl.sendMessage(msg);
}
public void playItemPaused(boolean paused) {
pauseResumeHandler.sendEmptyMessage(paused ? 1 : 0);
}
};
IBinder.DeathRecipient bdeath = new IBinder.DeathRecipient() {
public void binderDied() {
log_err("Binder died, trying to reconnect");
conn = new_connection();
Intent intie = new Intent();
intie.setClassName("net.avs234", "net.avs234.AndLessSrv");
if(!stopService(intie)) log_err("service not stopped");
if(startService(intie)== null) log_msg("service not started");
else log_msg("started service");
if(!bindService(intie, conn,0)) log_err("cannot bind service");
else log_msg("service bound");
}
};
// On connection, obtain the service interface and setup screen according to current server state
private ServiceConnection conn = null;
ServiceConnection new_connection() {
return new ServiceConnection() {
public void onServiceConnected(ComponentName cn,IBinder obj) {
srv = IAndLessSrv.Stub.asInterface(obj);
if(srv == null) {
log_err("failed to get service interface");
errExit(R.string.strErrSrvIf);
return;
}
try{
// if(!srv.initialized()) {
// log_err("Server failed to initialize, exiting");
// errExit(getString(R.string.strSrvInitFail));
// }
obj.linkToDeath(bdeath,0);
if(startfile != null) { // we've been called via intent.VIEW
log_msg("connection using "+startfile);
File f = new File(startfile);
if(f.exists() && !f.isDirectory() && hasAudioExt(startfile)) {
int i = startfile.lastIndexOf('/');
f = new File(startfile.substring(0, i));
if(setAdapter(f) && i > 0) {
log_msg("starting from \"" + startfile + "\" in \"" + f.toString() + "\"");
srv.registerCallback(cBack);
update_headset_mode(null);
playDir(f,startfile);
return;
}
} else if(f.exists() && (f.isDirectory() || hasPlistExt(startfile) || hasCueExt(startfile))) {
if(setAdapter(f)) {
srv.registerCallback(cBack);
update_headset_mode(null);
playPath(f);
return;
}
}
}
String s = srv.get_cur_dir();
if(s != null) {
File f = new File(s);
if(f.exists() && (f.isDirectory() || hasPlistExt(s) || hasCueExt(s))) {
try {
if(setAdapter(f)) {
log_msg("restored previous playlist");
int i = srv.get_cur_pos() + 1;
if(i >= 0 && first_file_pos + i < directoryEntries.size()) {
fileList.setSelection(first_file_pos+i);
}
if(srv.is_paused()) {
cBack.playItemChanged(true,getString(R.string.strPaused));
buttPause.setBackgroundDrawable(getResources().getDrawable(R.drawable.s_play));
} else if(srv.is_running()) {
cBack.playItemChanged(false,directoryEntries.get(first_file_pos+i).getText());
buttPause.setBackgroundDrawable(getResources().getDrawable(R.drawable.s_pause));
} else cBack.p
没有合适的资源?快使用搜索试试~ 我知道了~
android 使用 audiotrack和audiorecord c++代码
共763个文件
svn-base:380个
h:158个
png:53个
4星 · 超过85%的资源 需积分: 49 76 下载量 161 浏览量
2012-12-23
12:30:25
上传
评论 1
收藏 2.14MB ZIP 举报
温馨提示
android 使用 audiotrack和audiorecord jni层的开源代码
资源推荐
资源详情
资源评论
收起资源包目录
android 使用 audiotrack和audiorecord c++代码 (763个子文件)
IAndLessSrv.aidl 992B
IAndLessSrvCallback.aidl 187B
all-wcprops 7KB
all-wcprops 4KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 961B
all-wcprops 802B
all-wcprops 776B
all-wcprops 674B
all-wcprops 657B
all-wcprops 373B
all-wcprops 331B
all-wcprops 321B
all-wcprops 283B
all-wcprops 268B
all-wcprops 248B
all-wcprops 212B
all-wcprops 198B
all-wcprops 197B
all-wcprops 186B
all-wcprops 178B
all-wcprops 178B
all-wcprops 162B
all-wcprops 158B
all-wcprops 75B
all-wcprops 71B
all-wcprops 67B
all-wcprops 67B
mpc_decoder.c 46KB
alac_decoder.c 33KB
unpack.c 28KB
words.c 27KB
wputils.c 25KB
main.c 25KB
synth_filter.c 23KB
demux.c 22KB
pack.c 17KB
flac_decoder.c 17KB
main.c 16KB
main.c 14KB
parser.c 13KB
entropy.c 13KB
m4a.c 12KB
huffsv7.c 10KB
main.c 9KB
predictor.c 9KB
streaminfo.c 9KB
demac.c 8KB
main.c 8KB
main.c 8KB
filter.c 7KB
ape_decoder.c 6KB
main.c 6KB
huffsv46.c 6KB
metadata.c 5KB
crc.c 4KB
requant.c 4KB
mpc_reader.c 3KB
idtag.c 3KB
bitstream.c 2KB
float.c 1KB
filter_1280_15.c 867B
filter_256_13.c 865B
filter_64_11.c 863B
filter_32_10.c 863B
filter_16_11.c 863B
tables.c 742B
.classpath 388B
COPYING 26KB
COPYING 18KB
COPYING 2KB
std_audio.cpp 10KB
sample.cpp 9KB
dir-prop-base 157B
dir-prop-base 31B
entries 9KB
entries 7KB
entries 5KB
entries 4KB
entries 4KB
entries 2KB
entries 2KB
entries 2KB
entries 2KB
entries 2KB
entries 2KB
entries 1KB
entries 1KB
entries 1KB
entries 1KB
entries 1KB
entries 708B
共 763 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
wanggenggz
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页