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

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

?? soundmanager6600.java

?? 一款基于java 的賽車類游戲 一款基于java 的賽車類游戲
?? JAVA
字號:
/*
 * Created on 2005-06-14
 *
 * Copyright (c) 2005 nanoGames. All Rights Reserved.
 *
 */
//package com.nano.KangooJumper;

import java.io.InputStream;
import javax.microedition.media.Manager;
import javax.microedition.media.Player;
//import com.nokia.mid.sound.Sound;


/**
 * @author plumkawka
 * SoundManager6600
 */
public class SoundManager6600
{

	public final static int	MAX_SOUNDS	= 8;
	public final static byte SNDTYPE_OTA  = 1;
	public final static byte SNDTYPE_MIDI  = 2;
	public final static byte SNDTYPE_WAV  = 3;
	

	private static Player[]	mPlayer;
	//private static Sound[]	mSound;
	private static byte[][]	mSoundData;
	private static int[] mSoundVolume;
	private byte[]			nSoundType;
	private	short[]			nSoundPlayTime;
	
	private boolean			bIsPlaying;
	private static boolean	bIsEnabled	= true;
	private int				nSoundCount;
	private int				nCurrentSound;
	private int				nCurrentLoop;
	private long			nStartPlayTime;
	private	long			nPlayTime;



	public SoundManager6600()
	{

		mPlayer = new Player[MAX_SOUNDS];
		//mSound = new Sound[MAX_SOUNDS];
		mSoundData = new byte[MAX_SOUNDS][];
		mSoundVolume = new int[MAX_SOUNDS];
		nSoundType = new byte[MAX_SOUNDS];
		nSoundPlayTime = new short[MAX_SOUNDS];
		bIsPlaying = false;
		nSoundCount = 0;
		nPlayTime = 500;
		nCurrentSound = -1;
	}



	public void releaseSounds()
	{
		if (mPlayer != null)
		{
			for (int i = 0; i < mPlayer.length; i++)
			{
				if (mPlayer[i] != null)
					mPlayer[i].deallocate();
				mPlayer[i] = null;
			}
		}
/*
		if (mSound != null)
		{
			for (int i = 0; i < mSound.length; i++)
			{
				mSound[i] = null;
				mSoundData[i] = null;
			}
		}*/
		nSoundCount = 0;
		nCurrentSound = -1;
		Utils.callGc();
	}



	public int loadSound(int name,int ms, int vol)
	{
		int ret = -1;

		if (nSoundCount >= MAX_SOUNDS)
		{
			Utils.Log("max sounds reached!");
			return -1;
		}

		if (ms > 5000)
		{
			try
			{
				InputStream in = Utils.openStream(name);
				nSoundType[nSoundCount] = SNDTYPE_MIDI;
				//nSoundPlayTime[nSoundCount] = (short)ms;
				mPlayer[nSoundCount] = Manager.createPlayer(in, "audio/midi");
				mPlayer[nSoundCount].realize();
				mPlayer[nSoundCount].prefetch();
				//mPlayer[nSoundCount].setLoopCount(1);
				//mPlayer[nSoundCount].addPlayerListener(this);
				System.gc();
				try { Thread.sleep(20); } catch (InterruptedException e) { }
				
				//all ok, give back snd index and increment snd count
				//Utils.Log("sound loaded " + name);
				ret = nSoundCount++;
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
		}
		else
		{
			try
			{
				
				//InputStream in = Utils.openStream((name - FileIds.MID_BASE) + FileIds.WAV_BASE);
				InputStream in = Utils.openStream(name); // TODO !!!!!!!!!!!
				
				nSoundType[nSoundCount] = SNDTYPE_WAV;
				//nSoundPlayTime[nSoundCount] = (short)ms;
				mPlayer[nSoundCount] = Manager.createPlayer(in, "audio/x-wav");
				//mPlayer[nSoundCount].realize();
				mPlayer[nSoundCount].prefetch();
				//mPlayer[nSoundCount].setLoopCount(1);
				//mPlayer[nSoundCount].addPlayerListener(this);
				System.gc();
				try { Thread.sleep(20); } catch (InterruptedException e) { }
				

				/*
				// recalculate ott id name from midi id nr from parameters
				int id = (name - FileIds.MID_BASE) + FileIds.WAV_BASE;
				// load OTA here
				//Utils.Log("load sound");
				nSoundType[nSoundCount] = SNDTYPE_OTA;
				mSoundData[nSoundCount] = Utils.loadByteArray(id);
				mSound[nSoundCount] = new Sound(mSoundData[nSoundCount], Sound.FORMAT_WAV);
				mSoundVolume[nSoundCount] = vol;
*/
				nSoundPlayTime[nSoundCount] = (short)ms;
				//all ok, give back snd index and increment snd count
				ret = nSoundCount++;
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}

		}

		return ret;
	}



	public void playSound(int sndidx, int loop)
	{
		if ((sndidx < 0) || (sndidx >= nSoundCount))
			return;

		if (!bIsEnabled)
			return;

		if (isPlaying())
			return;
		// stop sound if another one is playing
		//stopSound();

		if (nSoundType[sndidx] == SNDTYPE_MIDI)
		{
			try
			{
				if (nCurrentSound != sndidx)
					mPlayer[sndidx].setLoopCount(loop);
				//mPlayer[sndidx].prefetch();
				mPlayer[sndidx].start();
				bIsPlaying = true;
				nCurrentSound = sndidx;
				nCurrentLoop = loop;
				nStartPlayTime = System.currentTimeMillis();
				nPlayTime = nSoundPlayTime[sndidx];
				Utils.Log("PlaysMIDI: "+sndidx);
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
		}
		else
		if (nSoundType[sndidx] == SNDTYPE_WAV)
		{
			try
			{
				if (nCurrentSound != sndidx)
					mPlayer[sndidx].setLoopCount(loop);
				mPlayer[sndidx].prefetch();
				mPlayer[sndidx].start();
				bIsPlaying = true;
				nCurrentSound = sndidx;
				nCurrentLoop = loop;
				nStartPlayTime = System.currentTimeMillis();
				nPlayTime = nSoundPlayTime[sndidx];
				Utils.Log("PlaysWAV: "+sndidx);
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
		}
		else
		if (nSoundType[sndidx] == SNDTYPE_OTA)
		{
			/*
			if (loop == -1)
				loop = 0;

			// play OTA here
			if (nCurrentSound != sndidx)
				mSound[sndidx].setGain (mSoundVolume[sndidx]);
			
			mSound[sndidx].play(loop);
			bIsPlaying = true;
			nCurrentSound = sndidx;
			nCurrentLoop = loop;
			nStartPlayTime = System.currentTimeMillis();
			nPlayTime = nSoundPlayTime[sndidx];// + 250;
			*/
			Utils.Log("PlaysOTA: "+sndidx);
		}

	}



	public void stopSound()
	{
		if ((nCurrentSound < 0) || (nCurrentSound >= nSoundCount))
			return;

		if (!bIsEnabled)
			return;

		if ((nSoundType[nCurrentSound] == SNDTYPE_MIDI) || (nSoundType[nCurrentSound] == SNDTYPE_WAV))
		{
			try
			{
				if (mPlayer[nCurrentSound] != null)
				{
					mPlayer[nCurrentSound].stop();
					mPlayer[nCurrentSound].setMediaTime(0);
				}
			}
			catch (Exception e)
			{
			}
			//mPlayer[nCurrentSound] = null;
			Utils.Log("StopMIDI: "+nCurrentSound);
			nCurrentSound = -1;
			bIsPlaying = false;
			
		}
		else
		if (nSoundType[nCurrentSound] == SNDTYPE_OTA)
		{
			/*
			// stop OTA here
			if (mSound[nCurrentSound] != null)
			{
				mSound[nCurrentSound].stop();
			}*/
			Utils.Log("StopOTA: "+nCurrentSound);
			nCurrentSound = -1;
			bIsPlaying = false;
			
		}
	}



	public void enableSound()
	{
		bIsEnabled = true;
	}



	public void disableSound()
	{
		bIsEnabled = false;
		stopSound();
	}



	public boolean isPlaying()
	{
		if (nCurrentSound == -1)
		{
			bIsPlaying = false;
			return false;
		}
 
		if (nCurrentLoop != -1)
		{
			
			//Utils.Log("playtime: "+(System.currentTimeMillis() - nStartPlayTime)+ " / "+nPlayTime);
			if ((System.currentTimeMillis() - nStartPlayTime) > nPlayTime)
			{
				//stopSound();
				bIsPlaying = false;
			}
		}

		return bIsPlaying;
	}



	public static boolean isEnabled()
	{
		return bIsEnabled;
	}



	




}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品自拍三区| 国产丶欧美丶日本不卡视频| 精品一区二区三区视频在线观看| 成人晚上爱看视频| 欧美人牲a欧美精品| 国产精品国产三级国产三级人妇 | 精品无码三级在线观看视频| 色综合久久中文综合久久97| 久久色.com| 日韩高清一区二区| 欧美亚洲国产bt| 中文字幕一区二区三区精华液| 久久99精品久久久久久| 欧美老女人第四色| 夜夜精品视频一区二区| 91在线视频网址| 国产欧美日韩精品a在线观看| 久久不见久久见免费视频7| 精品视频色一区| 一区二区三区在线视频观看58| 成人av动漫网站| 国产精品欧美久久久久一区二区| 国产精品538一区二区在线| 日韩一区二区免费视频| 亚洲成在人线免费| 欧美在线|欧美| 亚洲在线一区二区三区| 日本大香伊一区二区三区| 中文字幕一区二区三区四区| 成人黄色在线视频| 中文字幕色av一区二区三区| 成人免费毛片片v| 国产精品久久久久久久久快鸭 | 色视频一区二区| 亚洲人吸女人奶水| 日本道色综合久久| 亚洲成人av在线电影| 这里只有精品99re| 久久成人免费电影| 久久婷婷国产综合国色天香| 国产成人综合视频| 国产精品久久久久aaaa| 色综合久久久久综合体| 亚洲午夜久久久| 91精品国产品国语在线不卡 | 亚洲图片欧美色图| 欧美日韩久久不卡| 狂野欧美性猛交blacked| 精品999久久久| 国产成人丝袜美腿| 国产精品国产三级国产aⅴ入口 | 91精品国产欧美一区二区| 美腿丝袜在线亚洲一区| 久久免费精品国产久精品久久久久| 国产凹凸在线观看一区二区| 综合欧美一区二区三区| 欧美三级乱人伦电影| 久久精品国产澳门| 成人免费小视频| 欧美日韩情趣电影| 国产美女久久久久| 亚洲乱码中文字幕| 日韩欧美区一区二| 成人av网址在线观看| 午夜久久久久久电影| 国产欧美日韩中文久久| 欧美主播一区二区三区美女| 狠狠狠色丁香婷婷综合久久五月| 中文字幕在线不卡一区二区三区| 欧美喷潮久久久xxxxx| 国产91精品精华液一区二区三区| 夜夜嗨av一区二区三区中文字幕| 精品理论电影在线| 一本大道久久a久久综合| 麻豆精品新av中文字幕| 亚洲视频一区在线| 久久久影视传媒| 欧美亚州韩日在线看免费版国语版| 国产在线播放一区| 亚洲mv在线观看| 国产精品久久久久国产精品日日| 精品国产乱码久久久久久久| 精品在线播放免费| 中文字幕精品一区二区三区精品| 在线日韩av片| 国内精品免费**视频| 亚洲不卡一区二区三区| 欧美国产1区2区| 日韩欧美国产综合一区| 欧洲av在线精品| 99免费精品视频| 国产综合久久久久影院| 日韩极品在线观看| 亚洲一级二级三级在线免费观看| 国产精品久久毛片a| 亚洲精品一区二区三区影院| 制服丝袜中文字幕一区| 欧美日韩一卡二卡| 91香蕉视频污| 成人美女视频在线观看18| 精品亚洲成a人| 蜜臀av一区二区| 免费看欧美女人艹b| 亚洲大片在线观看| 夜夜揉揉日日人人青青一国产精品 | 精品一区二区三区不卡| 视频一区中文字幕国产| 亚洲国产欧美一区二区三区丁香婷 | 秋霞国产午夜精品免费视频| 五月天激情小说综合| 亚洲乱码国产乱码精品精可以看 | 久久综合一区二区| 日韩久久免费av| 欧美一级久久久| 日韩丝袜情趣美女图片| 3d动漫精品啪啪1区2区免费| 欧美另类videos死尸| 欧美日韩国产美| 91精品国产综合久久福利软件| 欧美亚洲综合在线| 欧美另类久久久品| 日韩视频一区二区三区 | 欧美精品视频www在线观看| 欧美日韩精品欧美日韩精品一综合| 欧美日韩一区三区四区| 欧美一区二区三区的| 欧美电影免费观看高清完整版在线| 91精品国产美女浴室洗澡无遮挡| 欧美一区二区免费观在线| 欧美成人免费网站| 国产欧美一区二区精品婷婷| 亚洲日本在线观看| 五月婷婷另类国产| 欧美亚洲高清一区| 麻豆freexxxx性91精品| 日本美女视频一区二区| 蜜臂av日日欢夜夜爽一区| 久久爱www久久做| 成人一区二区三区视频| 91麻豆国产在线观看| 在线观看免费一区| 日韩精品中文字幕在线不卡尤物 | 大白屁股一区二区视频| 一本色道久久综合精品竹菊| 欧美女孩性生活视频| 2023国产精品| 一区二区三区免费观看| 久久成人久久爱| 91在线视频观看| 日韩一级片在线播放| 国产精品黄色在线观看| 亚洲国产乱码最新视频 | 久久精品一区二区三区不卡| 亚洲同性gay激情无套| 日本va欧美va欧美va精品| 国产高清久久久| 欧美日韩一区在线观看| 中文字幕欧美国产| 日韩福利视频导航| 色综合天天在线| 精品日韩在线观看| 一区二区久久久久| 国产激情偷乱视频一区二区三区| 欧美亚洲国产一区二区三区va| 久久美女艺术照精彩视频福利播放| 亚洲欧洲综合另类在线| 国产精品资源站在线| 欧美日韩国产综合视频在线观看| 国产亚洲va综合人人澡精品 | 亚洲人成网站影音先锋播放| 蜜桃久久精品一区二区| 欧美吻胸吃奶大尺度电影| 中文字幕不卡的av| 精品一区二区av| 中文字幕免费不卡在线| 丝袜国产日韩另类美女| 色吧成人激情小说| 国产农村妇女毛片精品久久麻豆 | 一区二区三区**美女毛片| 高清久久久久久| 精品欧美一区二区久久| 天堂影院一区二区| 在线观看日产精品| 亚洲免费电影在线| 99在线热播精品免费| 国产精品私人自拍| 国产乱人伦偷精品视频不卡| 日韩区在线观看| 日本伊人精品一区二区三区观看方式 | 国产精品久久久久久久久晋中 | 久久精品一级爱片| 久久激五月天综合精品| 日韩欧美高清在线| 日日摸夜夜添夜夜添国产精品| 日本精品一区二区三区高清 | 免费观看日韩电影| 制服丝袜av成人在线看| 奇米四色…亚洲| 日韩免费电影一区| 国产一区二区不卡在线|