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

📄 asequencer0.java

📁 java处理声音文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	public static final String SND_SEQ_GROUP_SYSTEM =	"system";	public static final String SND_SEQ_GROUP_DEVICE =	"device";	public static final String SND_SEQ_GROUP_APPLICATION =	"application";	public static final boolean	DEBUG = false;	static	{		if (TDebug.TraceASequencer)		{			System.out.println("ASequencer0.<clinit>(): loading native library tritonusalsa");		}		System.loadLibrary("tritonusalsa");	}	/*	 *	This holds a pointer for the native code - do not touch!	 */	private long		m_lNativeSeq;		/*	 *	The client Id assigned by the sequencer to this objects	 *	connection.	 */	private int		m_nClientId;	public ASequencer0()	{		if (DEBUG)		{			System.out.println("ASequencer0.<init>:");			Thread.dumpStack();		}		m_nClientId = open();	}	public int getClientId()	{		return m_nClientId;	}	/**	Opens the sequencer.	 *	Calls snd_seq_open() and snd_seq_client_id(). Returns the	 *	client id.	 */	public native int open();	/**	Closes the sequencer.	 *	Calls snd_seq_close().	 */	public native void close();	public native int createPort(String strName, int nCapabilities, int nGroupPermissions, int nType, int nMidiChannels, int nMidiVoices, int nSynthVoices);	public native int allocQueue();	/*	 *	nResolution: ticks/beat	 *	nTempo: microseconds/beat	 */	public native void setQueueTempo(int nQueue, int nResolution, int nTempo);	/**	Get the current tempo of a queue.	 *	Calls snd_seq_get_queue_tempo()	 *	and put the data elements of the returned struct	 *	into the passed arrays.	 *	anValues[0]	tempo (us/tick)	 *	anValues[1]	resolution (ticks/quarter)	 */	public native void getQueueTempo(int nQueue,					  int[] anValues);	/**	Get information about a queue.	 *	Calls snd_seq_get_queue_status()	 *	and put the data elements of the returned struct	 *	into the passed arrays.	 *	anValues[0]	number of events (= queue size)	 *	anValues[1]	running flag	 *	anValues[2]	flags	 *	 *	alValues[0]	tick	 *	alValues[1]	time	 */	public native void getQueueStatus(int nQueue,					  int[] anValues,					  long[] alValues);	public native void subscribePort(		int nSenderClient, int nSenderPort,		int nDestClient, int nDestPort,		int nQueue, boolean bExclusive, boolean bRealtime, boolean bConvertTime,		int nMidiChannels, int nMidiVoices, int nSynthVoices);	public native void sendNoteEvent(		int nType, int nFlags, int nTag, int nQueue, long lTime,		int nSourcePort, int nDestClient, int nDestPort,		int nChannel, int nNote, int nVelocity, int nOffVelocity, int nDuration);	public native void sendControlEvent(		int nType, int nFlags, int nTag, int nQueue, long lTime,		int nSourcePort, int nDestClient, int nDestPort,		int nChannel, int nParam, int nValue);	public native void sendQueueControlEvent(		int nType, int nFlags, int nTag, int nQueue, long lTime,		int nSourcePort, int nDestClient, int nDestPort,		int nControlQueue, int nControlValue, long lControlTime);	/**	 *	Encapsulates a Java object reference in an ALSA event.	 *	As type, use SND_SEQ_EVENT_USR9. This one is detected by	 *	getEvent() and the object reference is returned in the	 *	passed object array.	 */	public native void sendObjectEvent(		int nType, int nFlags, int nTag, int nQueue, long lTime,		int nSourcePort, int nDestClient, int nDestPort,		Object objectReference);	/**	 *	Transmits arbitrary data in an ALSA event.	 *	In getEvent(), a reference to a byte array is returned	 *	in the passed object array.	 */	public native void sendVarEvent(		int nType, int nFlags, int nTag, int nQueue, long lTime,		int nSourcePort, int nDestClient, int nDestPort,		byte[] abData, int nOffset, int nLength);	/**	Wait for an event.	 *	Calls snd_seq_event_input().	 *	and put the data elements of the returned event	 *	into the passed arrays.	 *	anValues[0]	type	 *	anValues[1]	flags	 *	anValues[2]	tag	 *	 *	anValues[3]	queue	 *	 *	anValues[4]	source client	 *	anValues[5]	source port	 *	 *	anValues[6]	dest client	 *	anValues[7]	dest port	 *	 *	The values starting with index 8 depend on the type of event.	 *	 *	SND_SEQ_EVENT_NOTE,	 *	SND_SEQ_EVENT_NOTEON,	 *	SND_SEQ_EVENT_NOTEOFF:	 *	anValues[08]	channel	 *	anValues[09]	note	 *	anValues[10]	velocity	 *	anValues[11]	off_velocity	 *	anValues[12]	duration	 *	 *	SND_SEQ_EVENT_KEYPRESS,	 *	SND_SEQ_EVENT_CONTROLLER,	 *	SND_SEQ_EVENT_PGMCHANGE,	 *	SND_SEQ_EVENT_CHANPRESS,	 *	SND_SEQ_EVENT_PITCHBEND,	 *	SND_SEQ_EVENT_CONTROL14, ??	 *	SND_SEQ_EVENT_NONREGPARAM, ??	 *	SND_SEQ_EVENT_REGPARAM: ??	 *	anValues[08]	channel	 *	anValues[09]	param	 *	anValues[10]	values	 *	 *	SND_SEQ_EVENT_USR9:	 *	aValues[0]	object reference	 *	 *	alValues[0]	(schedule) time (in ticks or nanoseconds)	 *	 *	 *	returns true if an event was received. Above values are	 *	only valid if this is true!	 *	 *	Throws RuntimeExceptions in certain cases.	 */	public native boolean getEvent(int[] anValues, long[] alValues, Object[] aValues);	/**	Gets "system" information.	 *	Calls snd_seq_system_info() and puts the relevant values into	 *	the passed array.	 */	public native void getSystemInfo(int[] anValues);	/**	Gets information about this client.	 *	Calls snd_seq_get_client_info() [nClient <= -1]	 *	or snd_seq_get_any_client_info() [nClient >= 0]	 *	and put the returned values	 *	into the passed arrays.	 *	anValues[0]	client id	 *	anValues[1]	client type	 *	anValues[2]	filter flags	 *	anValues[3]	num ports	 *	astrValues[0]	name	 *	astrValues[1]	group name	 *	 *	Returns 0 if successful.	 */	public native int getClientInfo(int nClient, int[] anValues, String[] astrValues);	/**	Gets information about the next client.	 *	Calls snd_seq_query_next_client().	 *	and put the returned values	 *	into the passed arrays.	 *	 *	nClient has to be -1 to start, or a client id returned by	 *	a previous call to this method.	 *	 *	anValues[0]	client id	 *	anValues[1]	client type	 *	anValues[2]	filter flags	 *	anValues[3]	num ports	 *	astrValues[0]	name	 *	astrValues[1]	group name	 *	 *	Returns 0 if successful.	 */	public native int getNextClientInfo(int nClient, int[] anValues, String[] astrValues);	/**	Gets information about the next port.	 *	Calls snd_seq_query_next_port().	 *	and put the returned values	 *	into the passed arrays.	 *	 *	nClient has to be a valid client.	 *	nPort has to be -1 to start, or a port returned by	 *	a previous call to this method.	 *	 *	anValues[0]	client	 *	anValues[1]	port	 *	anValues[2]	capabilities	 *	anValues[3]	group capabilities	 *	anValues[4]	type	 *	anValues[5]	midi channels	 *	anValues[6]	midi voices	 *	anValues[7]	synth voices	 *	anValues[8]	read use	 *	anValues[9]	write use	 *	astrValues[0]	name	 *	astrValues[1]	group name	 *	 *	Returns 0 if successful.	 */	public native int getNextPortInfo(int nClient, int nPort, int[] anValues, String[] astrValues);	public native void setQueueLocked(int nQueue, boolean bLocked);	public native void setClientName(String strName);}/*** ASequencer0.java ***/

⌨️ 快捷键说明

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