📄 alsaseq.java
字号:
// 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 getPort();// /** Returns the name of the port.// Calls snd_seq_port_info_get_name().// */// public native String getName();// public native int getCapability();// public native int getType();// public native int getMidiChannels();// public native int getMidiVoices();// public native int getSynthVoices();// public native int getReadUse();// public native int getWriteUse();// public native int getPortSpecified();// }// public static class PortSubscribe// {// /**// * 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 PortSubscribe()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.<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 getSenderClient();// public native int getSenderPort();// public native int getDestClient();// public native int getDestPort();// public native int getQueue();// public native boolean getExclusive();// public native boolean getTimeUpdate();// public native boolean getTimeReal();// public native void setSender(int nClient, int nPort);// public native void setDest(int nClient, int nPort);// public native void setQueue(int nQueue);// public native void setExclusive(boolean bExclusive);// public native void setTimeUpdate(boolean bUpdate);// public native void setTimeReal(boolean bReal);// }// public static class QueueInfo// {// /**// * Holds the pointer to snd_seq_queue_info_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public QueueInfo()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.<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 getQueue();// public native String getName();// public native int getOwner();// public native boolean getLocked();// public native int getFlags();// public native void setName(String strName);// public native void setOwner(int nOwner);// public native void setLocked(boolean bLocked);// public native void setFlags(int nFlags);// }// public static class QueueStatus// {// /**// * Holds the pointer to snd_seq_queue_status_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public QueueStatus()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.<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 getQueue();// public native int getEvents();// public native long getTickTime();// public native long getRealTime();// public native int getStatus();// }// public static class QueueTempo// {// /**// * Holds the pointer to snd_seq_queue_tempo_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public QueueTempo()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.<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 getQueue();// public native int getTempo();// public native int getPpq();// public native void setTempo(int nTempo);// public native void setPpq(int nPpq);// }// public static class QueueTimer// {// /**// * Holds the pointer to snd_seq_queue_timer_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public QueueTimer()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.<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 getQueue();// public native int getType();// // TODO:// // public native ?? getTimerId();// public native int getResolution();// public native void setType(int nType);// // TODO:// // public native void setId(???);// public native void setResolution(int nResolution);// }// public static class RemoveEvents// {// /**// * Holds the pointer to snd_seq_queue_timer_t// * for the native code.// * This must be long to be 64bit-clean.// */// /*private*/ long m_lNativeHandle;// public RemoveEvents()// {// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.RemoveEvents.<init>(): begin"); }// int nReturn = malloc();// if (nReturn < 0)// {// throw new RuntimeException("malloc of port_info failed");// }// if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.RemoveEvents.<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 getCondition();// public native int getQueue();// public native long getTime();// public native int getDestClient();// public native int getDestPort();// public native int getChannel();// public native int getEventType();// public native int getTag();// public native void setCondition(int nCondition);// public native void setQueue(int nQueue);// public native void setTime(long lTime);// public native void setDest(int nClient, int nPort);// public native void setChannel(int nChannel);// public native void setEventType(int nEventType);// public native void setTag(int nTag);// } private class ClientInfoIterator implements Iterator { private int m_nClient; private AlsaSeqClientInfo m_clientInfo; public ClientInfoIterator() { m_nClient = -1; m_clientInfo = createNextClientInfo(); } public boolean hasNext() { // TDebug.out("hasNext(): clientInfo: " + m_clientInfo); return m_clientInfo != null; } public Object next() { Object next = m_clientInfo; m_clientInfo = createNextClientInfo(); return next; } public void remove() { throw new UnsupportedOperationException(); } private AlsaSeqClientInfo createNextClientInfo() { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.createNextClientInfo(): begin"); } AlsaSeqClientInfo clientInfo = null; int[] anValues = new int[1]; int nSuccess = getNextClient(m_nClient, anValues); if (TDebug.TraceAlsaSeq) { TDebug.out("succ: " + nSuccess); } if (nSuccess == 0) { // TDebug.out("AlsaSeq.createNextClientInfo(): getNextClientInfo successful"); m_nClient = anValues[0]; clientInfo = new AlsaSeqClientInfo(); // TODO: error check getClientInfo(m_nClient, clientInfo); } if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.createNextClientInfo(): end"); } return clientInfo; } } private class PortInfoIterator implements Iterator { private int m_nClient; private int m_nPort; private AlsaSeqPortInfo m_portInfo; public PortInfoIterator(int nClient) { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.<init>(): begin"); } m_nClient = nClient; m_nPort = -1; m_portInfo = createNextPortInfo(); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.<init>(): end"); } } public boolean hasNext() { return m_portInfo != null; } public Object next() { Object next = m_portInfo; m_portInfo = createNextPortInfo(); return next; } public void remove() { throw new UnsupportedOperationException(); } private AlsaSeqPortInfo createNextPortInfo() { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): begin"); } AlsaSeqPortInfo portInfo = null; int[] anValues = new int[2]; int nSuccess = getNextPort(m_nClient, m_nPort, anValues); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): getNextPort() returns: " + nSuccess); } if (nSuccess == 0) { m_nPort = anValues[1]; portInfo = new AlsaSeqPortInfo(); // TODO: error check getPortInfo(m_nClient, m_nPort, portInfo); } if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): end"); } return portInfo; } }}/*** AlsaSeq.java ***/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -