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

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

?? basicplayer.java

?? WINAMP的JAVA版本
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package javazoom.jlGui;

/**
 * BasicPlayer.
 *
 *-----------------------------------------------------------------------
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */
import java.io.*;
import java.util.*;
import	java.net.URL;

import	javax.sound.sampled.AudioFormat;
import  javax.sound.sampled.AudioFileFormat;
import	javax.sound.sampled.AudioInputStream;
import	javax.sound.sampled.AudioSystem;
import	javax.sound.sampled.DataLine;
import	javax.sound.sampled.LineUnavailableException;
import	javax.sound.sampled.SourceDataLine;
import	javax.sound.sampled.UnsupportedAudioFileException;
import	javax.sound.sampled.FloatControl;
import	javax.sound.sampled.Control;
import 	javazoom.Util.Debug;

/**
 * BasicPlayer implements basics features of a player. The playback is done
 * with a thread.
 * BasicPlayer is the result of jlGui 0.5 from JavaZOOM and BaseAudioStream
 * from Matthias Pfisterer JavaSound examples.
 *
 * @author	E.B from JavaZOOM
 *
 * Homepage : http://www.javazoom.net
 *
 */
public class BasicPlayer implements Runnable
{

	private static final int		EXTERNAL_BUFFER_SIZE = 4000 * 4;

	private Thread					m_thread = null;
	private Object					m_dataSource;
	private AudioInputStream		m_audioInputStream;
	private AudioFileFormat			m_audioFileFormat;
	private SourceDataLine			m_line;
	private FloatControl			m_gainControl;
	private FloatControl			m_panControl;

	/**
	 * These variables are used to distinguish stopped, paused, playing states.
	 * We need them to control Thread.
	 */
	private static final int		PLAYING=0;
	private static final int		PAUSED=1;
	private static final int		STOPPED=2;
	private static final int		READY=3;
	private int						m_status = READY;
	private	long					doSeek = -1;
	private File					_file = null;
	private BasicPlayerListener		m_bpl = null;

	/**
	 * Constructs a Basic Player.
	 */
	public BasicPlayer()
	{
		m_dataSource = null;
		m_audioInputStream = null;
		m_audioFileFormat = null;
		m_line = null;
		m_gainControl = null;
		m_panControl = null;
	}

	/**
	 * Constructs a Basic Player with a BasicPlayerListener.
	 */
	public BasicPlayer(BasicPlayerListener bpl)
	{
		this();
		m_bpl = bpl;
	}

	/**
	 * Sets the data source as a file.
	 */
	protected void setDataSource(File file) throws UnsupportedAudioFileException, LineUnavailableException, IOException
	{
		if (file != null)
		{
			m_dataSource = file;
			initAudioInputStream();
		}
	}


	/**
	 * Sets the data source as an url.
	 */
	protected void setDataSource(URL url) throws UnsupportedAudioFileException, LineUnavailableException, IOException
	{
		if (url != null)
		{
			m_dataSource = url;
			initAudioInputStream();
		}
	}


	/**
	 * Inits Audio ressources from the data source.<br>
	 * - AudioInputStream <br>
	 * - AudioFileFormat
	 */
	private void initAudioInputStream() throws UnsupportedAudioFileException, LineUnavailableException, IOException
	{
		if (m_dataSource instanceof URL)
		{
			initAudioInputStream((URL) m_dataSource);
		}
		else if (m_dataSource instanceof File)
		{
			initAudioInputStream((File) m_dataSource);
		}
	}

	/**
	 * Inits Audio ressources from file.
	 */
	private void initAudioInputStream(File file) throws	UnsupportedAudioFileException, IOException
	{
		_file = file;
		m_audioInputStream = AudioSystem.getAudioInputStream(file);
		m_audioFileFormat = AudioSystem.getAudioFileFormat(file);
	}

	/**
	 * Inits Audio ressources from URL.
	 */
	private void initAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException
	{
		m_audioInputStream = AudioSystem.getAudioInputStream(url);
		m_audioFileFormat = AudioSystem.getAudioFileFormat(url);
	}

	/**
	 * Inits Audio ressources from AudioSystem.<br>
	 * DateSource must be present.
	 */
	protected void initLine() throws LineUnavailableException
	{
		if (m_line == null)
		{
			createLine();
			trace(1,getClass().getName(), "Create Line OK ");
			openLine();
		}
		else
		{
			AudioFormat	lineAudioFormat = m_line.getFormat();
			AudioFormat	audioInputStreamFormat = m_audioInputStream == null ? null : m_audioInputStream.getFormat();
			if (!lineAudioFormat.equals(audioInputStreamFormat))
			{
				m_line.close();
				openLine();
			}
		}
	}

	/**
	 * Inits a DateLine.<br>
	 *
	 * We check if the line supports Volume and Pan controls.
	 *
	 * From the AudioInputStream, i.e. from the sound file, we
	 * fetch information about the format of the audio data. These
	 * information include the sampling frequency, the number of
	 * channels and the size of the samples. There information
	 * are needed to ask JavaSound for a suitable output line
	 * for this audio file.
	 * Furthermore, we have to give JavaSound a hint about how
	 * big the internal buffer for the line should be. Here,
	 * we say AudioSystem.NOT_SPECIFIED, signaling that we don't
	 * care about the exact size. JavaSound will use some default
	 * value for the buffer size.
	 */
	private void createLine() throws LineUnavailableException
	{
		if (m_line == null)
		{
			AudioFormat	sourceFormat = m_audioInputStream.getFormat();
			trace(1,getClass().getName(), "Source format : ", sourceFormat.toString());
			AudioFormat	targetFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED,
														sourceFormat.getSampleRate(),
														16,
														sourceFormat.getChannels(),
														sourceFormat.getChannels() * 2,
														sourceFormat.getSampleRate(),
														false);

			trace(1,getClass().getName(), "Target format: " + targetFormat);
			m_audioInputStream = AudioSystem.getAudioInputStream(targetFormat, m_audioInputStream);
			AudioFormat audioFormat = m_audioInputStream.getFormat();
			trace(1,getClass().getName(), "Create Line : ", audioFormat.toString());
			DataLine.Info	info = new DataLine.Info(SourceDataLine.class, audioFormat, AudioSystem.NOT_SPECIFIED);
			m_line = (SourceDataLine) AudioSystem.getLine(info);

			/*-- Display supported controls --*/
			Control[] c = m_line.getControls();
			for (int p=0;p<c.length;p++)
			{
				trace(2,getClass().getName(), "Controls : "+c[p].toString());
			}
			/*-- Is Gain Control supported ? --*/
			if (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))
			{
				m_gainControl = (FloatControl) m_line.getControl(FloatControl.Type.MASTER_GAIN);
				trace(1,getClass().getName(), "Master Gain Control : ["+m_gainControl.getMinimum()+","+m_gainControl.getMaximum()+"]",""+m_gainControl.getPrecision());
			}

			/*-- Is Pan control supported ? --*/
			if (m_line.isControlSupported(FloatControl.Type.PAN))
			{
				m_panControl = (FloatControl) m_line.getControl(FloatControl.Type.PAN);
				trace(1,getClass().getName(), "Pan Control : ["+ m_panControl.getMinimum()+","+m_panControl.getMaximum()+"]",""+m_panControl.getPrecision());
			}
		}
	}


	/**
	 * Opens the line.
	 */
	private void openLine() throws LineUnavailableException
	{
		if (m_line != null)
		{
			AudioFormat	audioFormat = m_audioInputStream.getFormat();
			trace(1,getClass().getName(), "AudioFormat : "+audioFormat);
			m_line.open(audioFormat, m_line.getBufferSize());
		}
	}

	/**
	 * Stops the playback.<br>
	 *
	 * Player Status = STOPPED.<br>
	 * Thread should free Audio ressources.
	 */
	protected void stopPlayback()
	{
		if ( (m_status == PLAYING) || (m_status == PAUSED) )
		{
			if (m_line != null)
			{
				m_line.flush();
				m_line.stop();
			}
			m_status = STOPPED;
			trace(1,getClass().getName(), "Stop called");
		}
	}

	/**
	 * Pauses the playback.<br>
	 *
	 * Player Status = PAUSED.
	 */
	public void pausePlayback()
	{
		if (m_line != null)
		{
			if (m_status == PLAYING)
			{
				m_line.flush();
				m_line.stop();
				m_status = PAUSED;
				trace(1,getClass().getName(), "Pause called");
			}
		}
	}

	/**
	 * Resumes the playback.<br>
	 *
	 * Player Status = PLAYING.
	 */
	public void resumePlayback()
	{
		if (m_line != null)
		{
			if (m_status == PAUSED)
			{
				m_line.start();
				m_status = PLAYING;
				trace(1,getClass().getName(), "Resume called");
			}
		}
	}

	/**
	 * Starts playback.
	 */
	public String startPlayback()
	{
		if ((m_status == STOPPED) || (m_status == READY))
		{
			trace(1,getClass().getName(), "Start called");
			if (!(m_thread == null || !m_thread.isAlive()))
			{
				trace(1,getClass().getName(), "WARNING: old thread still running!!");
				while (m_status != READY)
				{
					try
					{
						if (m_thread != null) m_thread.sleep(1000);
					} catch (Exception e)
					  {
						  trace(1,getClass().getName(), "Waiting Error : "+e.getMessage());
					  }
					trace(1,getClass().getName(), "Waiting ...");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级日韩三级国产三级| 久久你懂得1024| 亚洲欧美另类综合偷拍| thepron国产精品| 亚洲品质自拍视频网站| 91久久香蕉国产日韩欧美9色| 国产精品久久久久久久第一福利 | 欧美一卡2卡三卡4卡5免费| 精品久久久久一区二区国产| 美女一区二区三区| 久久精品一区二区三区av| 成人免费视频免费观看| 亚洲天天做日日做天天谢日日欢 | 99久久99久久精品国产片果冻| 国产精品青草综合久久久久99| 国产一区二区三区在线观看免费视频| www一区二区| 色素色在线综合| 麻豆精品视频在线观看免费 | 亚洲电影激情视频网站| 色999日韩国产欧美一区二区| 天天综合天天做天天综合| 欧美成人性福生活免费看| jlzzjlzz亚洲女人18| 亚洲国产精品综合小说图片区| 精品日韩99亚洲| 在线观看精品一区| 国产成人午夜视频| 久久精品国产免费| 偷拍自拍另类欧美| 亚洲三级视频在线观看| 国产日韩av一区二区| 欧美一区二区三区公司| 欧美中文字幕一区| 99re这里都是精品| 成人国产精品免费观看视频| 裸体一区二区三区| 五月激情丁香一区二区三区| 亚洲午夜久久久久久久久电影网 | 轻轻草成人在线| 亚洲永久免费av| 亚洲一区二区三区四区五区黄| 免费久久99精品国产| 日本欧美肥老太交大片| 亚洲国产精品天堂| 日韩精品成人一区二区三区| 亚洲精品乱码久久久久久久久| 最新成人av在线| 亚洲自拍偷拍欧美| 亚洲国产日韩在线一区模特| 一区二区三区四区蜜桃| 亚洲国产中文字幕在线视频综合| 亚洲制服丝袜av| 日本欧美一区二区在线观看| 日本免费新一区视频| 激情五月激情综合网| 激情成人午夜视频| 91色乱码一区二区三区| 欧美日韩国产123区| 久久你懂得1024| 精品福利视频一区二区三区| 加勒比av一区二区| 成人av综合一区| 91黄色免费看| 亚洲精品一线二线三线| 国产精品天美传媒| 日韩电影一区二区三区| 欧美日韩国产首页| 亚洲国产精华液网站w| 亚洲国产日日夜夜| 国产盗摄女厕一区二区三区| 色婷婷综合久久| 久久这里只有精品视频网| 亚洲美女在线一区| 国产高清不卡二三区| 欧美日韩一二三区| 国产精品免费看片| 欧美国产成人精品| 亚洲欧美电影一区二区| 精品一区二区三区免费视频| 日本国产一区二区| 国产精品视频一区二区三区不卡| 亚洲第一主播视频| 在线欧美一区二区| 亚洲少妇最新在线视频| 成人av小说网| 国产欧美日韩激情| 国产一区二区三区免费播放| 欧美男男青年gay1069videost | 久久麻豆一区二区| 青青草精品视频| 日韩限制级电影在线观看| 亚洲成年人网站在线观看| 偷窥少妇高潮呻吟av久久免费| 国产不卡视频一区二区三区| 精品美女在线观看| 国产一区二区不卡在线| 日韩女优av电影在线观看| 奇米色777欧美一区二区| 欧美日韩成人综合| 视频一区二区三区入口| 欧美一区二区视频在线观看2020 | 高清久久久久久| 国产精品久久久久一区二区三区共| 国产sm精品调教视频网站| 国产精品久久影院| 欧美亚洲尤物久久| 亚洲国产美女搞黄色| 国产91丝袜在线观看| 亚洲欧洲精品一区二区精品久久久| 国产成人精品三级| 亚洲国产成人av好男人在线观看| 在线成人av影院| jlzzjlzz国产精品久久| 一二三四区精品视频| 91精品一区二区三区在线观看| 国产精品亚洲午夜一区二区三区| 亚洲欧洲精品一区二区精品久久久 | 麻豆91免费观看| 国产精品短视频| 欧美男生操女生| 波多野结衣亚洲| 久久国产福利国产秒拍| 亚洲女女做受ⅹxx高潮| 欧美国产日本视频| 日韩欧美一二三区| 日本久久一区二区三区| 成人精品鲁一区一区二区| 蜜臀av性久久久久av蜜臀妖精| 国产精品福利电影一区二区三区四区| 欧美蜜桃一区二区三区| 色综合久久久久久久久久久| 国产一区二区调教| 日本一区二区三区久久久久久久久不| 色综合久久久久久久久| 成人午夜视频在线观看| 精品一区二区三区视频在线观看| 亚洲午夜精品网| 亚洲免费观看高清完整版在线| 国产精品视频麻豆| 亚洲欧美怡红院| 一区二区在线免费| 一区二区三区中文字幕精品精品 | 蜜臀av性久久久久蜜臀aⅴ | 国产精品久久久久久久久搜平片 | 日韩精品中午字幕| 精品国精品国产尤物美女| 欧美电视剧免费全集观看| 日韩一区二区三区免费看| 日韩一级片在线观看| 日韩区在线观看| 久久婷婷一区二区三区| 久久久久久黄色| 国产欧美日本一区二区三区| 久久午夜老司机| 青青草97国产精品免费观看 | 国产原创一区二区三区| 日本视频一区二区| 91麻豆免费视频| 日本一区二区三区在线不卡| 久久精品国产免费| 麻豆91精品91久久久的内涵| 国产成人啪午夜精品网站男同| 欧美挠脚心视频网站| 亚洲午夜久久久久| 成人av手机在线观看| 欧美最新大片在线看| 欧美精品一区二区三区高清aⅴ | 精品少妇一区二区三区在线视频 | 久久精品理论片| 91香蕉视频mp4| 中文字幕免费不卡在线| 天堂精品中文字幕在线| 99久久婷婷国产| 日韩免费性生活视频播放| 亚洲一区视频在线观看视频| 国内精品免费**视频| 91精品国产综合久久久久久漫画 | 久久久综合激的五月天| 日产欧产美韩系列久久99| 6080yy午夜一二三区久久| 亚洲最新视频在线观看| 91首页免费视频| 亚洲一区二区偷拍精品| 欧美性受xxxx黑人xyx性爽| 亚洲国产视频一区二区| 欧美日韩国产在线观看| 日韩精品亚洲一区| 日韩一区国产二区欧美三区| 亚洲大片在线观看| 日韩一区二区三区在线| 激情丁香综合五月| 国产精品久久久久久妇女6080| 粉嫩av一区二区三区在线播放| 国产精品久久久久aaaa樱花| 91麻豆精品秘密| 日韩高清不卡在线| 国产欧美日韩一区二区三区在线观看| 国产凹凸在线观看一区二区| 亚洲免费观看视频|