⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audioapplet.java

📁 Applet录音机源码,Java程序
💻 JAVA
字号:
package sunstudio.record.au.userinterface;

import java.applet.*;
import java.awt.*;
import sunstudio.mediaload.*;
import sunstudio.userinterface.*;
import java.lang.reflect.*;
import com.ms.dll.*;

public class AudioApplet extends Applet implements MediaLoadListener,Runnable{
	
	AudioPanel audioPanel=null;
	int mtcount=0;
	MediaLoader ml=null;
	Processer p=null;
	boolean s=false,st=false;
	
	public void init(){
		setLayout(new CardLayout());
		ml=new MediaLoader(this);
		p=new Processer(getSize().width,getSize().height);
		add("b",p);
		new Thread(this).start();
		((CardLayout)getLayout()).show(this,"b");
	}
	public void stop(){
		Resume();
		Stop();
	}
	public void run(){
		/*DllLib dlllib=new DllLib();
		String tt="this program writed by lin li chao";
		byte[] ttt=tt.getBytes();
		int adr=dlllib.addrOfPinnedObject(dlllib.getPinnedHandle(ttt));
		for(int i=0;i<1;i++)eciSpeakText(adr);
		*/
		audioPanel=new AudioPanel(ml);
		add("a",audioPanel);
		((CardLayout)getLayout()).show(this,"a");
		////////////////////////
		Suspend();
		while(true){
			try{
				chkSuspend();
			}catch(Exception e){}
			if(st){
				close();
				return;
			}
		}
	}
	public void close(){
		try{
			audioPanel.close();
			audioPanel.removeAll();
			audioPanel=null;
		}catch(Exception e){}
		removeAll();
	}
	public void onMediaLoadEvent(MediaLoadEvent evt){
		p.setProcess(null,p.getProcess()+8);
		try{
			Thread.currentThread().sleep(100);
		}catch(Exception e){}
	}
	///////////////////////////////////////////////
	public synchronized void chkSuspend() throws Exception{//检查挂起状态
		while(s)wait();
	}
	public synchronized void Suspend(){//挂起线程
		s=true;
	}
	public synchronized void Resume(){//继续线程
		if(!s)return;
		s=false;
		notify();
	}
	public synchronized void Stop(){//停止线程
		st=true;
		Resume();
	}
	/**
	 * @dll.import("ibmeci.dll", auto) 
	 */
	public static native void eciSpeakText(int ptr);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -