亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mp3towav.java

?? j2me音樂播放
?? JAVA
字號:
/** *  * Mp3ToWav DataSource *  * JavaLayerME and MMAPI * */package javazoom.jlme.decoder;import java.io.*;import javax.microedition.media.*;import javax.microedition.media.protocol.*;import java.io.IOException;/* Audio datasource for converting mp3 to wav */ public class Mp3ToWav extends DataSource implements SourceStream, Runnable {	// DataSource fields    String locator = null;    boolean connected = false;    String contentType = null;    // Comments field    private boolean comments;        // Defaults    private int sampleRate = 44100;    private int sampleSize = 16;    private int channels = 2;    private int endian = 0; // 0 for any, 1 for "little", 2 for "big"    private int signed = 1; // 0 for any, 1 for "signed", 2 for "unsigned"	// Productor	Thread prodThread;	public boolean stop=true;	private byte[] fifo;	private Object lock;	private int getAskFor=0;	private boolean locked=false;	private int f_g=0;	private int f_p=0;	private int f_size=0;	//private int FIFO_SIZE = 5000000;	private int FIFO_SIZE = 50000;		// Decoder JavaLayer    private Decoder decoder;     	private Header header;   	private BitStream bitstream;		private int dataLength=0;   	private int lengthFrame;	private byte[] bArray;	private String file;	private Object lock2;	private boolean locked2=false;        // The WAVe header    private byte [] hdr = new byte[44];    private int hdrSize;    private int hdrOfs;    private static final String[] headerComments= {"Chunk RIFF","Chunk RIFF","Chunk RIFF","Chunk RIFF","Check Size (Length unbounded)","Check Size (Length unbounded)","Check Size (Length unbounded)","Check Size (Length unbounded)","FCC Type - WAVE","FCC Type - WAVE","FCC Type - WAVE","FCC Type - WAVE","Chunk Format - fmt","Chunk Format - fmt","Chunk Format - fmt","Chunk Format - fmt","Check Size","Check Size","Check Size","Check Size","1 means PCM","1 means PCM","Nb of Channels","Nb of Channels","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Frequence byte/sec","Quantification - bytes","Quantification - bytes","Quantification - bits","Quantification - bits","Chunk Data","Chunk Data","Chunk Data","Chunk Data","Check Size","Check Size","Check Size","Check Size"};    /****************************************************************     * Runnable implementation     ****************************************************************/    /**     * Main process loop driving the media flow.     */    public void run() {		boolean endOfFile=false;		int toCopy=0;		int lap=0;		// First transfer the header		for (int i=0; i<hdr.length;i++) {			push(hdr[i]);				if (comments) System.out.println("-- Mp3Decoder Comments -- WRITING -- WAV header = " + hdr[i] + " - " + headerComments[i]);		}			    if (comments) System.out.println("-- Mp3Decoder Comments -- DataSource connected and ready for streaming");					while(!endOfFile && connected) {			if (stop) {					if (comments) 				System.out.println("-- Mp3Decoder Comments -------> Synchro : DataSource locked");				locked2=true;				synchronized( lock2 ){	    			// here is where you'd check obj's state			     	while (locked2) {							    try {						lock2.wait();					    }					    catch( InterruptedException e ){							if (comments) e.printStackTrace();					    }					}				}			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : DataSource unlocked ");			}						lap++;	      try		      {		      			      	SampleBuffer output = (SampleBuffer)decoder.decodeFrame();		      	lengthFrame = output.size();	     		if (lengthFrame <= 0) {					if (comments) System.out.println("-- Mp3Decoder Comments -- Mp3ToWav DataSource -- End Of File");	     			endOfFile=true;break;     			}		      	bArray=output.getBuffer();		 						if (f_size+lengthFrame<FIFO_SIZE) {					if (f_p+lengthFrame<FIFO_SIZE) {						// copy en un bloc					   	System.arraycopy(bArray, 0,					     fifo, f_p,					     lengthFrame);}					else {						// copy en deux blocs						// 1er bloc : FIFO_SIZE-f_p bytes copied					   	System.arraycopy(bArray, 0,					     fifo, f_p,					     FIFO_SIZE-f_p);						// 2eme bloc : lengthFrame-(FIFO_SIZE-f_p) bytes copied from the byte FIFO_SIZE-f_p   					   	System.arraycopy(bArray, FIFO_SIZE-f_p,					     fifo, 0,					     lengthFrame-FIFO_SIZE+f_p);					}    					f_p=(f_p+lengthFrame)%FIFO_SIZE;					f_size=f_size+lengthFrame;					if (f_size>getAskFor && locked==true) {						getAskFor=0;						locked=false;					   	synchronized(lock){    						if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Notify buffer ready for reading");							lock.notifyAll(); 						}					}				}				else {					// buffer full					if (comments) System.out.println ("-- Mp3Decoder Comments -- CANT WRITE ANYMORE DATA -- Buffer Full -----");				}									 		if (comments) System.out.println("-- Mp3Decoder Comments -- WRITING -- lap "+lap+" -- buffering "+ f_size*100/FIFO_SIZE + " % -- "  + f_size + "/" + FIFO_SIZE + " --"  );		      	bitstream.closeFrame();				header = bitstream.readFrame();			} catch (Exception e) {		 		System.out.println("Mp3ToWav::run:Exception in thread prodthread");			}					    			} 		if (comments) System.out.println("-- Mp3Decoder Comments -- End of the thread used by Mp3ToWav for writing in the buffer");   		}        /****************************************************************     * DataSource implementation     ****************************************************************/    public Mp3ToWav(String l, boolean c) {    	super(l);				System.out.println("Enter Mp3ToWav Constructor>>" + l);		    	locator=l;    	comments=c;		// Captures audio and wraps it into WAV content type		contentType = "audio/x-wav";		fifo=new byte[FIFO_SIZE];		lock=new Object();		lock2=new Object();    }     public void setLocator(String ml) {	locator = ml;    }    public String getLocator() {	return locator;    }    public String getContentType() {	if (!connected)	    return null;	return contentType;    }    public void setContentType(String type) {	contentType = type;    }    public Control[] getControls() {	return new Control[0];    }    public Control getControl(String controlType) {	return null;    }    /**     * Parse the protocol part of the locator string.     */    static public String getProtocol(String loc) {	String proto = "";	int idx = loc.indexOf(':');	if( idx != -1) {	    proto = loc.substring(0,idx);	}	return proto;    }   /* return the numeric value for a property */    private int tryParam(String tok, String prop, int def) {	if (tok.startsWith(prop)) {	    tok = tok.substring(prop.length(), tok.length());	    	    if (prop.equals("signed=")) {		if (tok.equals("signed"))		    return 1; // SIGNED		else if (tok.equals("unsigned"))		    return 2; // UNSIGNED	    } else if (prop.equals("endian=")) {		if (tok.equals("little"))		    return 1; // LITTLE_ENDIAN		else if (tok.equals("big"))		    return 2; // BIG_ENDIAN	    } else {		try {		    return Integer.parseInt(tok);		} catch (Exception e) {		}	    }	}	return def;    }    /* Parse the URL, extract and validate the properties */    private boolean parseLocator() {		String loc = getLocator();			if (comments) System.out.println("-- Mp3Decoder Comments -- Parse Locator : " + loc);			if (!loc.endsWith(".mp3"))		    return false;				return true;    }    public void connect() throws IOException {				System.out.println("Enter connect");				if (!parseLocator())			throw new IOException("Invalid locator");		// open the file and create the header		// throw an exception if the file has not been opened		// Open the file		try {		    if (comments) 				System.out.println("-- Mp3Decoder Comments -- Create decoder and connect the dataSource (Push the wav header)");			InputStream in = null;			in = getClass().getResourceAsStream(getLocator());			if(in == null)			{				System.out.println("無法獲取music數據源!");				return;			}			else			{			   	bitstream = new BitStream(in);	 			   			    	header = bitstream.readFrame();	    		decoder = new Decoder(header,bitstream);	      		if (comments) 					System.out.println("-- Mp3Decoder Comments -- WAV Stream mode : Frequency: "							+decoder.getOutputFrequency() + ",Channels: " 							+ decoder.getOutputChannels());			}    		System.gc();		  }		catch (Exception e) {			if (comments) 				System.out.println("Couldn't open audio input");			System.out.println("異常原因為:" + e.getMessage() + "/" + e.getClass());	   		throw new IOException("Couldn't open audio input");		}   					// Generate the WAV header		createHeader(sampleRate, sampleSize, channels);		connected = true;		System.out.println("Generate the WAV header:okay");        	// Start the playback loop.		prodThread = new Thread(this);		prodThread.start();    }    public void disconnect() {		//stop();		if (comments) System.out.println("-- Mp3Decoder Comments -- Mp3ToWav DataSource -- Disconnected");   			locked2=false;	   	synchronized(lock2){			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Notify DataSource");			lock2.notifyAll(); 		}		connected = false;				fifo=null;		System.gc();    }    public void start() throws IOException { 		if (comments) System.out.println("-- Mp3Decoder Comments -- Mp3ToWav DataSource -- Started");   	 		stopProd(false);		locked2=false;	   	synchronized(lock2){			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Notify DataSource");			lock2.notifyAll(); 		}    }    public void stop() { 		if (comments) System.out.println("-- Mp3Decoder Comments -- Mp3ToWav DataSource -- Stopped");   			locked=false;	   	synchronized(lock){			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Notify Buffer");			lock.notifyAll(); 		}	 	stopProd(true);    }    public SourceStream[] getStreams() {	return new SourceStream[] { this };    }        /****************************************************************     * SourceStream implementation     ****************************************************************/    public ContentDescriptor getContentDescriptor() {	return new ContentDescriptor(getContentType());    }    public long getContentLength() {	return -1;    }    public int read(byte[] buffer, int offset, int length) throws IOException {		if (comments) System.out.println("-- Mp3Decoder Comments -- ASK FOR READING -- offset =>"  + offset + ", length asked =>"  + length  );         	int totalCopy=length;		while (f_size<=totalCopy && connected) {			// waiting			getAskFor=totalCopy;			locked=true;			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Buffer Locked  (empty)");					wait_get();			if (comments) System.out.println("-- Mp3Decoder Comments -------> Synchro : Buffer Unlocked  (ready for reading)");		}		//if (f_size<=totalCopy) return 0;							if (comments) System.out.println("-- Mp3Decoder Comments -- READING -- " + totalCopy + " -- f_size : " + f_size);						if (f_g+totalCopy<FIFO_SIZE) {				// copy en un bloc			   	System.arraycopy(fifo, f_g,			     buffer, offset,			     totalCopy);}			else {				// copy en deux blocs				// 1er bloc : FIFO_SIZE-f_g bytes copi閟			   	System.arraycopy(fifo, f_g,			     buffer, offset,			    FIFO_SIZE-f_g);				// 2eme bloc : totalCopy-(FIFO_SIZE-f_g) bytes copi閟 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线观看电影| 国产精品久久精品日日| 欧美亚洲动漫另类| 成人国产精品免费观看动漫| 极品美女销魂一区二区三区| 精品一区二区三区不卡| 久草这里只有精品视频| 国产一区美女在线| 国产黄人亚洲片| 成人性生交大片免费看在线播放| 国产在线精品一区在线观看麻豆| 久久99久久99小草精品免视看| 久久精品99国产国产精| 激情另类小说区图片区视频区| 久久精品国产一区二区| 国产成人免费在线| 91在线一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 国产成人午夜精品影院观看视频 | 国产目拍亚洲精品99久久精品| 久久免费午夜影院| 欧美韩日一区二区三区四区| 亚洲国产精品成人综合| 一区2区3区在线看| 麻豆国产精品官网| 风流少妇一区二区| 在线精品观看国产| 精品国产人成亚洲区| 中文字幕一区av| 麻豆成人在线观看| 色综合天天狠狠| 久久综合中文字幕| 亚洲美女电影在线| 久久66热re国产| 欧美亚洲综合另类| 国产婷婷色一区二区三区四区| 成人免费一区二区三区在线观看| 日本欧美在线观看| 一本色道久久综合亚洲aⅴ蜜桃| 日韩午夜精品电影| 亚洲欧美aⅴ...| 精品在线免费视频| 欧美体内she精视频| 国产欧美一区二区精品婷婷| 亚洲综合色成人| 国产老肥熟一区二区三区| 色婷婷av一区二区三区大白胸| 91精品国产综合久久精品图片| 国产精品麻豆一区二区| 日韩av一二三| 色综合夜色一区| 中文字幕国产一区二区| 日韩黄色在线观看| 色婷婷香蕉在线一区二区| 久久网站最新地址| 美女视频黄久久| 欧美精品久久一区二区三区| 亚洲色图欧美在线| 成人美女视频在线观看18| 日韩一区二区三| 一区二区不卡在线播放 | 日本怡春院一区二区| 色拍拍在线精品视频8848| 欧美韩国日本一区| 国产一区不卡视频| 欧美精品一区二区三区很污很色的| 日韩精品一卡二卡三卡四卡无卡| 欧美中文字幕一区| 亚洲线精品一区二区三区八戒| 91在线精品一区二区| 国产精品婷婷午夜在线观看| 国产大陆精品国产| 国产日韩欧美精品一区| 国产成人在线色| 久久久国产精华| 国产精品亚洲专一区二区三区 | 国产精品三级电影| 国产99精品视频| 国产精品久久久久久久久免费樱桃| 国产一区二区三区免费| 国产欧美一区二区精品久导航| 国产成人午夜99999| 亚洲桃色在线一区| 91蝌蚪porny| 一区二区三区四区激情| 欧美日韩视频不卡| 日日摸夜夜添夜夜添亚洲女人| 欧美视频完全免费看| 日韩成人一区二区| 日韩精品最新网址| 高清不卡一区二区在线| 亚洲色大成网站www久久九九| 欧洲色大大久久| 视频一区视频二区在线观看| 欧美精品777| 精品一区二区在线观看| 国产精品久久久久毛片软件| 在线免费观看成人短视频| 爽好多水快深点欧美视频| 欧美tickling挠脚心丨vk| 国产精品一二三| 一区二区三区精品视频在线| 欧美日韩高清一区| 国产老女人精品毛片久久| 日韩一区中文字幕| 欧美一级免费大片| 丰满亚洲少妇av| 亚洲高清免费一级二级三级| 精品美女在线观看| 欧美性感一类影片在线播放| 久久99精品视频| 国产精品久久毛片| 欧美调教femdomvk| 成人性生交大片免费看在线播放 | 日韩avvvv在线播放| 久久久久久久av麻豆果冻| 91国偷自产一区二区使用方法| 免费美女久久99| 亚洲手机成人高清视频| 欧美一区二区福利视频| 91色porny蝌蚪| 国产91在线|亚洲| 蜜臀av亚洲一区中文字幕| 亚洲精选在线视频| 欧美极品美女视频| 精品久久久久av影院| 欧美日本在线播放| 色综合久久88色综合天天| 麻豆精品视频在线观看免费| 亚洲一区二区三区三| 亚洲婷婷国产精品电影人久久| 久久久综合九色合综国产精品| 欧美一区二区三区在线观看视频 | 日韩理论电影院| 国产欧美一区二区在线| 26uuu久久天堂性欧美| 欧美性生活大片视频| 色综合久久天天| 91视视频在线观看入口直接观看www | 国产99精品国产| 久久成人久久鬼色| 日韩专区欧美专区| 丝袜诱惑制服诱惑色一区在线观看| 亚洲美女视频在线| 亚洲欧洲av在线| 国产精品网站在线观看| 日本一区二区综合亚洲| 亚洲国产精品成人综合色在线婷婷| 日韩精品一区在线观看| 日韩视频免费观看高清完整版| 欧美丰满高潮xxxx喷水动漫| 欧美美女直播网站| 欧美一区在线视频| 欧美成人性福生活免费看| 欧美白人最猛性xxxxx69交| 欧美一区二区视频在线观看| 欧美日韩国产高清一区二区 | 国产精品理伦片| 亚洲欧美一区二区不卡| 亚洲免费在线看| 亚洲午夜免费电影| 亚洲成人免费视| 日本美女一区二区| 国产另类ts人妖一区二区| 高清成人在线观看| 在线观看91精品国产入口| 777午夜精品免费视频| 欧美日韩美女一区二区| 91精品国产一区二区三区香蕉| 7777女厕盗摄久久久| 欧美大尺度电影在线| 久久久久久麻豆| 亚洲欧美影音先锋| 一区二区三区波多野结衣在线观看| 中文字幕永久在线不卡| 性久久久久久久久久久久| 精品一区二区三区影院在线午夜| 国产精品自产自拍| 91麻豆自制传媒国产之光| 在线播放日韩导航| 亚洲国产高清在线观看视频| 亚洲欧美另类小说| 久久99精品国产91久久来源| 国产.欧美.日韩| 欧美日韩一区二区三区四区五区| 欧美一二三在线| 成人欧美一区二区三区在线播放| 日韩黄色小视频| 99久久免费国产| 日韩欧美一级片| 一区二区三区国产精品| 国产麻豆精品在线| 精品污污网站免费看| 欧美国产禁国产网站cc| 亚洲国产日产av| 国产91精品精华液一区二区三区 | 色屁屁一区二区| 国产亚洲福利社区一区| 日本午夜一区二区| 91免费看`日韩一区二区|