/**
* org.hermit.android.core: useful Android foundation classes.
*
* These classes are designed to help build various types of application.
*
* <br>Copyright 2009-2010 Ian Cameron Smith
*
* <p>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation (see COPYING).
*
* <p>This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
package org.hermit.android.core;
import org.hermit.utils.CharFormatter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* Common base for applications with an animated view. This class can be
* used in games etc. It handles all the setup states of a SurfaceView,
* and provides a Thread which the app can use to manage the animation.
*
* <p>When using this class in an app, the app context <b>must</b> call
* these methods (usually from its corresponding Activity methods):
*
* <ul>
* <li>{@link #onStart()}
* <li>{@link #onResume()}
* <li>{@link #onPause()}
* <li>{@link #onStop()}
* </ul>
*
* <p>The surface is enabled once it is created and sized, and
* {@link #onStart()} and {@link #onResume()} have been called. You then
* start and stop it by calling {@link #surfaceStart()} and
* {@link #surfaceStop()}.
*/
public abstract class SurfaceRunner
extends SurfaceView
implements SurfaceHolder.Callback
{
// ******************************************************************** //
// Public Constants.
// ******************************************************************** //
/**
* Surface runner option: handle configuration changes dynamically.
* If set, configuration changes such as screen orientation changes
* will be passed up to the app; otherwise, it is assumed that we
* will re-start for these.
*/
public static final int SURFACE_DYNAMIC = 0x0001;
/**
* Surface runner option: use a Looper to drive animations.
* This allows asynchronous updates to be posted by the app.
*/
public static final int LOOPED_TICKER = 0x0002;
// ******************************************************************** //
// Constructor.
// ******************************************************************** //
/**
* Create a SurfaceRunner instance.
*
* @param app The application context we're running in.
*/
public SurfaceRunner(Context app) {
super(app);
init(app, 0);
}
/**
* Create a SurfaceRunner instance.
*
* @param app The application context we're running in.
* @param options Options for this SurfaceRunner. A bitwise OR of
* SURFACE_XXX constants.
*/
public SurfaceRunner(Context app, int options) {
super(app);
init(app, options);
}
/**
* Create a SurfaceRunner instance.
*
* @param app The application context we're running in.
* @param attrs Layout attributes for this SurfaceRunner.
*/
public SurfaceRunner(Context app, AttributeSet attrs) {
super(app, attrs);
init(app, 0);
}
/**
* Initialize this SurfaceRunner instance.
*
* @param app The application context we're running in.
* @param options Options for this SurfaceRunner. A bitwise OR of
* SURFACE_XXX constants.
*/
private void init(Context app, int options) {
appContext = app;
errorReporter = Errors.getInstance(app);
surfaceOptions = options;
animationDelay = 0;
// Register for events on the surface.
surfaceHolder = getHolder();
surfaceHolder.addCallback(this);
setFocusable(true);
setFocusableInTouchMode(true);
// Workaround for edge fading -- sometimes after repeated orientation
// changes one edge will fade; this fixes it.
setHorizontalFadingEdgeEnabled(false);
setVerticalFadingEdgeEnabled(false);
}
// ******************************************************************** //
// Configuration.
// ******************************************************************** //
/**
* Check whether the given option flag is set on this surface.
*
* @param option The option flag to test; one of SURFACE_XXX.
* @return true iff the option is set.
*/
public boolean optionSet(int option) {
return (surfaceOptions & option) != 0;
}
// ******************************************************************** //
// State Handling.
// ******************************************************************** //
/**
* Set the delay in ms in each iteration of the main loop.
*
* @param delay The time in ms to sleep each time round the main
* animation loop. If zero, we will not sleep,
* but will run continuously.
*
* <p>If you want to do all your animation under
* direct app control using {@link #postUpdate()},
* just set a large delay. You may want to consider
* using 1000 -- i.e. one second -- to make sure
* you get a refresh at a decent interval.
*/
public void setDelay(long delay) {
Log.i(TAG, "setDelay " + delay);
animationDelay = delay;
}
/**
* This is called immediately after the surface is first created.
* Implementations of this should start up whatever rendering code
* they desire.
*
* Note that only one thread can ever draw into a Surface, so you
* should not draw into the Surface here if your normal rendering
* will be in another thread.
*
* @param holder The SurfaceHolder whose surface is being created.
*/
@Override
public void surfaceCreated(SurfaceHolder holder) {
setEnable(ENABLE_SURFACE, "surfaceCreated");
}
/**
* This is called immediately after any structural changes (format or
* size) have been made to the surface. This method is always
* called at least once, after surfaceCreated(SurfaceHolder).
*
* @param holder The SurfaceHolder whose surface has changed.
* @param format The new PixelFormat of the surface.
* @param width The new width of the surface.
* @param height The new height of the surface.
*/
@Override
public void surfaceChanged(SurfaceHolder holder,
int format, int width, int height)
{
// On Droid (at least) this can get called after a rotation,
// which shouldn't happen as we should get shut down first.
// Ignore that, unless we're handling config changes dynamically.
if (!optionSet(SURFACE_DYNAMIC) && isEnable(ENABLE_SIZE)) {
Log.e(TAG, "ignored surfaceChanged " + width + "x" + height);
return;
}
setSize(format, width, height);
setEnable(ENABLE_SIZE, "set size " + width + "x" + height);
}
/**
* This is called immediately before a surface is destroyed.
* After returning from this call, you should no longer try to
* access this surface. If you have a
没有合适的资源?快使用搜索试试~ 我知道了~
Audio analyzer source code
共308个文件
class:119个
png:104个
java:48个
4星 · 超过85%的资源 需积分: 9 14 下载量 104 浏览量
2013-03-21
14:13:58
上传
评论
收藏 1.05MB RAR 举报
温馨提示
Android audio analyzer源代碼 提供實現分析 waveform、frequency spectrum、sonagram等功能。 學習代碼更上一層樓!!!
资源推荐
资源详情
资源评论
收起资源包目录
Audio analyzer source code (308个子文件)
resources.ap_ 128KB
Audalyzer.apk 365KB
jarlist.cache 119B
proguard.cfg 1KB
SurfaceRunner.class 13KB
DbSchema.class 12KB
TouchListView.class 11KB
TimeZoneActivity.class 9KB
TableProvider.class 9KB
NumberPicker.class 9KB
InstrumentPanel.class 9KB
Audalyzer.class 8KB
WebBasedData.class 8KB
AudioAnalyser.class 8KB
Gauge.class 7KB
PowerGauge.class 7KB
CachedFile.class 7KB
WebFetcher.class 7KB
SpectrumGauge.class 7KB
TableFetcher.class 6KB
SonagramGauge.class 6KB
Errors.class 6KB
TimeoutPicker.class 6KB
TextGauge.class 5KB
InfoBox.class 5KB
MainActivity.class 5KB
Player.class 5KB
InstrumentSurface.class 4KB
Ticker.class 4KB
AudioReader.class 4KB
HelpActivity$HelpView.class 4KB
TextInputDialog.class 4KB
HelpActivity.class 4KB
Player$PoolPlayer.class 4KB
TimeoutPickerDialog.class 4KB
FileFetcher.class 4KB
AppUtils.class 3KB
TableSchema.class 3KB
OneTimeDialog.class 3KB
DatabaseHelper.class 3KB
WaveformGauge.class 3KB
SurfaceRunner$LoopTicker.class 3KB
HelpActivity$TitleView.class 3KB
SplashActivity.class 2KB
R$string.class 2KB
Effect.class 2KB
MultistateImageButton.class 2KB
YesNoDialog.class 2KB
NumberPicker$NumberRangeKeyListener.class 2KB
NumberPickerButton.class 2KB
SurfaceRunner$ThreadTicker.class 2KB
Ticker$1.class 2KB
TableSchema$FieldType.class 2KB
TouchListView$1.class 2KB
ErrorDialog.class 2KB
LinedEditText.class 2KB
TimeoutPicker$SavedState.class 2KB
HelpActivity$BodyView.class 1KB
SurfaceRunner$LoopTicker$1.class 1KB
NumberPicker$4.class 1KB
Ticker$ClientData.class 1KB
InstrumentPanel$Instruments.class 1KB
R$drawable.class 1KB
NumberPicker$2.class 1KB
WebFetcher$Runner.class 1KB
DbRow.class 1KB
TableFetcher$State.class 1KB
Instrument.class 1KB
MultistateImageButton$1.class 1KB
NumberPicker$NumberPickerInputFilter.class 1KB
AppUtils$Detail.class 1KB
NumberPicker$1.class 1KB
MainActivity$ActivityListener.class 1KB
R$array.class 1KB
WebFetcher$FetchException.class 1KB
Ticker$ClientData$1.class 1KB
TimeoutPicker$2.class 1KB
TimeoutPicker$3.class 1KB
TimeoutPicker$4.class 1KB
TableSchema$FieldDesc.class 1KB
R$id.class 1KB
AudioAnalyser$1.class 1KB
Errors$1.class 1008B
NumberPicker$3.class 1008B
TextInputDialog$1.class 988B
TextInputDialog$2.class 980B
YesNoDialog$1.class 964B
YesNoDialog$2.class 956B
ErrorDialog$1.class 940B
Ticker$Listener.class 918B
Audalyzer$1.class 878B
OneTimeDialog$1.class 871B
InfoBox$2.class 869B
SplashActivity$1.class 836B
Errors$2.class 831B
InfoBox$1.class 819B
R$styleable.class 806B
TimeoutPicker$1.class 799B
R.class 793B
CachedFile$Entry.class 789B
共 308 条
- 1
- 2
- 3
- 4
asd012vr
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页