📄 alsaseq.java
字号:
* anValues[1] port * * Returns 0 if successful. */ public native int getNextPort(int nClient, int nPort, int[] anValues); // TODO: use structure public native int createPort(String strName, int nCapabilities, int nGroupPermissions, int nType, int nMidiChannels, int nMidiVoices, int nSynthVoices); /** Allocates (reserves) a sequencing queue. Calls snd_seq_alloc_queue(). @return the queue number (>= 0), if successful. A negative value otherwise. */ public native int allocQueue(); /** Frees a sequencing queue. Calls snd_seq_free_queue(). @param nQueue a queue number that has previously been allocated with allocQueue(). @return 0 if successful. A negative value otherwise. */ public native int freeQueue(int nQueue); /** Get the queue usage flag. Calls snd_seq_get_queue_usage(). @param nQueue a queue number that has previously been allocated with allocQueue(). @return true if the client is allowed to access the queue. false otherwise. */ public native boolean getQueueUsage(int nQueue); /** Set the queue usage flag. Calls snd_seq_set_queue_usage(). @param nQueue a queue number that has previously been allocated with allocQueue(). @param bUsageAllowed true to allow the client access to this queue. false to deny it. @return 0 if successful. A negative value otherwise. */ public native int setQueueUsage(int nQueue, boolean bUsageAllowed); /** Get the queue information. This method fills a QueueInfo instance with information from the given queue. Internally, snd_seq_get_queue_info() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueInfo(int nQueue, AlsaSeqQueueInfo queueInfo); /** Set the queue information. This method sets the information for the given queue from the QueueInfo instance. Internally, snd_seq_set_queue_info() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueInfo(int nQueue, AlsaSeqQueueInfo queueInfo); /** Get the queue status. This method fills a QueueStatus instance with information from the given queue. Internally, snd_seq_get_queue_status() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueStatus(int nQueue, AlsaSeqQueueStatus queueStatus); /** Get the queue tempo. This method fills a QueueTempo instance with information from the given queue. Internally, snd_seq_get_queue_tempo() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueTempo(int nQueue, AlsaSeqQueueTempo queueTempo); /** Set the queue tempo. This method sets the information for the given queue from the QueueTempo instance. Internally, snd_seq_set_queue_tempo() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueTempo(int nQueue, AlsaSeqQueueTempo queueTempo); /** Get the queue timer. This method fills a QueueTimer instance with information from the given queue. Internally, snd_seq_get_queue_timer() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueTimer(int nQueue, AlsaSeqQueueTimer queueTimer); /** Set the queue timer. This method sets the timer for the given queue from the QueueTimer instance. Internally, snd_seq_set_queue_timer() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueTimer(int nQueue, AlsaSeqQueueTimer queueTimer); public native int getPortSubscription(AlsaSeqPortSubscribe portSubscribe); public native int subscribePort(AlsaSeqPortSubscribe portSubscribe); public native int unsubscribePort(AlsaSeqPortSubscribe portSubscribe); private static native void setTrace(boolean bTrace); public Iterator getClientInfos() { return new ClientInfoIterator(); } public Iterator getPortInfos(int nClient) { return new PortInfoIterator(nClient); } //////////////////////////////////////////////////////////////// // // Events // //////////////////////////////////////////////////////////////// public native int eventOutput(AlsaSeqEvent event); public native int eventOutputBuffer(AlsaSeqEvent event); public native int eventOutputDirect(AlsaSeqEvent event); public native int eventInput(AlsaSeqEvent event); public native int eventInputPending(int nFetchSequencer); public native int drainOutput(); public native int eventOutputPending(); public native int extractOutput(AlsaSeqEvent event); public native int dropOutput(); public native int dropOutputBuffer(); public native int dropInput(); public native int dropInputBuffer(); ///////////////////////////////////////////////////////////// /** Event for the sequencer.// * This class encapsulates an instance of// * snd_seq_event_t.// */// public static class Event// {// /**// * Holds the pointer to snd_seq_event_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public Event()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of event failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.<init>(): end"); }// }// public void finalize()// {// // TODO: call free()// // call super.finalize() first or last?// // and introduce a flag if free() has already been called?// }// /** Allocates memory for a snd_seq_event_t.// The native part of this method uses calloc() to// allocate the memory (so the allocated memory is// zero'ed). The memory reference is stored in {@link// #m_lNativeHandle m_lNativeHandle}. Memory allocated// with this call should be freed by calling {@link// #free() free()}.// */// private native int malloc();// /** Frees memory for a snd_seq_event_t.// */// public native void free();// // TODO: implement natively// public native int getLength();// public native int getType();// public native int getFlags();// public native int getTag();// public native int getQueue();// public native long getTimestamp();// public native int getSourceClient();// public native int getSourcePort();// public native int getDestClient();// public native int getDestPort();// /* Retrieves the parameters of a note event.// * This method is suitable for the following event types:// * SND_SEQ_EVENT_NOTE// * SND_SEQ_EVENT_NOTEON// * SND_SEQ_EVENT_NOTEOFF// * SND_SEQ_EVENT_KEYPRESS// *// * After return, the array will contain:// * anValues[0] channel// * anValues[1] note// * anValues[2] velocity// * anValues[3] off_velocity// * anValues[4] duration// */// public native void getNote(int[] anValues);// /* Retrieves the parameters of a control event.// * This method is suitable for the following event types:// * 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// * SND_SEQ_EVENT_SONGPOS// * SND_SEQ_EVENT_SONGSEL// * SND_SEQ_EVENT_QFRAME// * SND_SEQ_EVENT_TIMESIGN// * SND_SEQ_EVENT_KEYSIGN// *// * After return, the array will contain:// * anValues[0] channel// * anValues[1] param// * anValues[2] value// */// public native void getControl(int[] anValues);// /* Retrieves the parameters of a queue control event.// * This method is suitable for the following event types:// * SND_SEQ_EVENT_START// * SND_SEQ_EVENT_CONTINUE// * SND_SEQ_EVENT_STOP// * SND_SEQ_EVENT_SETPOS_TICK// * SND_SEQ_EVENT_SETPOS_TIME// * SND_SEQ_EVENT_TEMPO// * SND_SEQ_EVENT_CLOCK// * SND_SEQ_EVENT_TICK// * SND_SEQ_EVENT_SYNC// * SND_SEQ_EVENT_SYNC_POS// *// * After return, the array will contain:// * anValues[0] queue// * anValues[1] value// * alValues[0] time// */// public native void getQueueControl(int[] anValues, long[] alValues);// /* Retrieves the parameters of a variable-length event.// * This method is suitable for the following event types:// * SND_SEQ_EVENT_SYSEX// * SND_SEQ_EVENT_BOUNCE// * SND_SEQ_EVENT_USR_VAR0// * SND_SEQ_EVENT_USR_VAR1// * SND_SEQ_EVENT_USR_VAR2// * SND_SEQ_EVENT_USR_VAR3// * SND_SEQ_EVENT_USR_VAR4// *// */// public native byte[] getVar();// public native void setCommon(int nType, int nFlags, int nTag, int nQueue, long lTimestamp, int nSourceClient, int nSourcePort, int nDestClient, int nDestPort);// public native void setTimestamp(long lTimestamp);// public native void setNote(int nChannel, int nKey, int nVelocity, int nOffVelocity, int nDuration);// public native void setControl(int nChannel, int nParam, int nValue);// public native void setQueueControl(int nControlQueue, int nControlValue, long lControlTime);// public native void setVar(byte[] abData, int nOffset, int nLength);// }// /** General information about the sequencer.// * This class encapsulates the information of// * snd_seq_system_info_t.// */// public static class SystemInfo// {// /**// * Holds the pointer to snd_seq_system_info_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public SystemInfo()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of system_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.<init>(): end"); }// }// public void finalize()// {// // TODO: call free()// // call super.finalize() first or last?// // and introduce a flag if free() has already been called?// }// private native int malloc();// public native void free();// public native int getQueues();// public native int getClients();// public native int getPorts();// public native int getChannels();// public native int getCurrentClients();// public native int getCurrentQueues();// }// public static class ClientInfo// {// /**// * Holds the pointer to snd_seq_port_info_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public ClientInfo()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.<init>(): begin"); }// int nReturn = malloc();// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.<init>(): malloc() returns: " + nReturn); }// if (nReturn < 0)// {// throw new RuntimeException("malloc of client_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.<init>(): end"); }// }// public void finalize()// {// // TODO: call free()// // call super.finalize() first or last?// // and introduce a flag if free() has already been called?// }// private native int malloc();// public native void free();// public native int getClient();// public native int getType();// public native String getName();// public native int getBroadcastFilter();// public native int getErrorBounce();// // TODO: event filter// public native int getNumPorts();// public native int getEventLost();// public native void setClient(int nClient);// public native void setName(String strName);// public native void setBroadcastFilter(int nBroadcastFilter);// public native void setErrorBounce(int nErrorBounce);// // TODO: event filter// }// public static class PortInfo// {// /**// * Holds the pointer to snd_seq_port_info_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public PortInfo()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.<init>(): end"); }// }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -