com.groovemanager.spi.asio
Class ASIOStaticFunctions

java.lang.Object
  extended by com.groovemanager.spi.asio.ASIOStaticFunctions

public final class ASIOStaticFunctions
extends Object

This class provides wrapper methods for native ASIO functions

Author:
Manu Robledo

Field Summary
(package private) static long MESSAGE_SELECTOR_kAsioBufferSizeChange
           
(package private) static long MESSAGE_SELECTOR_kAsioEngineVersion
           
(package private) static long MESSAGE_SELECTOR_kAsioLatenciesChanged
           
(package private) static long MESSAGE_SELECTOR_kAsioResetRequest
           
(package private) static long MESSAGE_SELECTOR_kAsioResyncRequest
           
(package private) static long MESSAGE_SELECTOR_kAsioSelectorSupported
           
(package private) static long MESSAGE_SELECTOR_kAsioSupportsTimeCode
           
(package private) static long MESSAGE_SELECTOR_kAsioSupportsTimeInfo
           
 
Constructor Summary
ASIOStaticFunctions()
           
 
Method Summary
(package private) static boolean ASIOCanSampleRate(double sampleRate)
          Wrapper for ASIOCanSampleRate()
static void ASIOControlPanel()
          Wrapper for ASIOControlPanel()
(package private) static ASIOBufferInfo[] ASIOCreateBuffers(ASIOBufferInfo[] infos, int bufferSize)
          Wrapper for ASIOCreateBuffers()
(package private) static void ASIODisposeBuffers()
          Wrapper for ASIODisposeBuffers()
(package private) static void ASIOExit()
          Wrapper for ASIOExit()
(package private) static void ASIOFuture(int selector, long pointer)
          Wrapper for ASIOFuture()
(package private) static int[] ASIOGetBufferSize()
          Wrapper for ASIOGetBufferSize()
(package private) static int ASIOGetBufferSizeGranularity()
          Wrapper for ASIOGetBufferSize()
(package private) static ASIOChannelInfo ASIOGetChannelinfo(int channel, boolean isInput)
          Wrapper for ASIOGetChannelInfo()
(package private) static int[] ASIOGetChannels()
          Wrapper for ASIOGetChannels()
(package private) static ASIOClockSource[] ASIOGetClockSources(int numSources)
          Wrapper for ASIOGetClockSources()
(package private) static int ASIOGetInputChannels()
          Wrapper for ASIOGetChannels()
(package private) static int ASIOGetInputLatency()
          Wrapper for ASIOGetLatencies()
(package private) static int[] ASIOGetLatencies()
          Wrapper for ASIOGetLatencies()
(package private) static int ASIOGetMaxBufferSize()
          Wrapper for ASIOGetBufferSize()
(package private) static int ASIOGetMinBufferSize()
          Wrapper for ASIOGetBufferSize()
(package private) static int ASIOGetOutputChannels()
          Wrapper for ASIOGetChannels()
(package private) static int ASIOGetOutputLatency()
          Wrapper for ASIOGetLatencies()
(package private) static int ASIOGetPreferredBufferSize()
          Wrapper for ASIOGetBufferSize()
(package private) static double ASIOGetSampleRate()
          Wrapper for ASIOGetSampleRate
(package private) static ASIODriverInfo ASIOInit()
          Wrapper for ASIOInit()
(package private) static void ASIOOutputReady()
          Wrapper for ASIOOutputReady()
(package private) static void ASIOSetClockSource(int index)
          Wrapper for ASIOSetClockSource()
(package private) static void ASIOSetSampleRate(double rate)
          Wrapper for ASIOSetSampleRate
(package private) static void ASIOStart()
          Wrapper for ASIOStart()
(package private) static void ASIOStop()
          Wrapper for ASIOStop()
private static ByteBuffer createBuffer(long infoPointer, int index, int capacity)
           
(package private) static ByteBuffer[] createBuffers(ASIOBufferInfo info, int asiobuffersize)
          Create two ByteBuffer objects from the buffer half addresses specified in the ASIOBufferInfo
static void disableTimeCodeReader()
          Disable the time code reader if the hardware device supports time code.
static void enableTimeCodeReader()
          Enable the time code reader if the hardware device supports time code.
(package private) static long getSystemTime()
          Get the system time reference
private static int jASIOCanSampleRate(ASIOSampleRate rate)
           
private static int jASIOControlPanel()
           
private static int jASIOCreateBuffers(long[] infos, int bufferSize)
           
private static int jASIODisposeBuffers()
           
private static int jASIOExit()
           
private static int jASIOFuture(int selector, long pointer)
           
private static int jASIOGetBufferSize(int[] data)
           
private static int jASIOGetChannelInfo(long pointer)
           
private static int jASIOGetChannels(int[] channels)
           
private static int jASIOGetClockSources(long[] clockPointers)
           
private static int jASIOGetLatencies(int[] latencies)
           
private static int jASIOGetSampleRate(ASIOSampleRate sampleRate)
           
private static int jASIOInit(long pointer)
           
private static int jASIOOutputReady()
           
private static int jASIOSetClockSource(int index)
           
private static int jASIOSetSampleRate(ASIOSampleRate sampleRate)
           
private static int jASIOStart()
           
private static int jASIOStop()
           
private static long kAsioBufferSizeChange()
           
private static long kAsioDisableTimeCodeRead()
           
private static long kAsioEnableTimeCodeRead()
           
private static long kAsioEngineVersion()
           
private static long kAsioLatenciesChanged()
           
private static long kAsioResetRequest()
           
private static long kAsioResyncRequest()
           
private static long kAsioSelectorSupported()
          ASIO message selector for asioMessage()
private static long kAsioSetInputMonitor()
           
private static long kAsioSupportsTimeCode()
           
private static long kAsioSupportsTimeInfo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_SELECTOR_kAsioSelectorSupported

static final long MESSAGE_SELECTOR_kAsioSelectorSupported

MESSAGE_SELECTOR_kAsioEngineVersion

static final long MESSAGE_SELECTOR_kAsioEngineVersion

MESSAGE_SELECTOR_kAsioResetRequest

static final long MESSAGE_SELECTOR_kAsioResetRequest

MESSAGE_SELECTOR_kAsioBufferSizeChange

static final long MESSAGE_SELECTOR_kAsioBufferSizeChange

MESSAGE_SELECTOR_kAsioResyncRequest

static final long MESSAGE_SELECTOR_kAsioResyncRequest

MESSAGE_SELECTOR_kAsioLatenciesChanged

static final long MESSAGE_SELECTOR_kAsioLatenciesChanged

MESSAGE_SELECTOR_kAsioSupportsTimeInfo

static final long MESSAGE_SELECTOR_kAsioSupportsTimeInfo

MESSAGE_SELECTOR_kAsioSupportsTimeCode

static final long MESSAGE_SELECTOR_kAsioSupportsTimeCode
Constructor Detail

ASIOStaticFunctions

public ASIOStaticFunctions()
Method Detail

ASIOInit

static ASIODriverInfo ASIOInit()
                        throws ASIOError
Wrapper for ASIOInit()

Returns:
A new ASIODriverInfo instance describing the loaded driver
Throws:
ASIOError - If ASIOInit() fails

ASIOExit

static void ASIOExit()
              throws ASIOError
Wrapper for ASIOExit()

Throws:
ASIOError - If ASIOExit() fails

ASIOStart

static void ASIOStart()
               throws ASIOError
Wrapper for ASIOStart()

Throws:
ASIOError - If ASIOStart() fails

ASIOStop

static void ASIOStop()
              throws ASIOError
Wrapper for ASIOStop()

Throws:
ASIOError - If ASIOStop() fails

ASIOGetInputChannels

static int ASIOGetInputChannels()
                         throws ASIOError
Wrapper for ASIOGetChannels()

Returns:
The number of input channels supported by the currently loaded driver
Throws:
ASIOError - If ASIOGetChannels() fails

ASIOGetOutputChannels

static int ASIOGetOutputChannels()
                          throws ASIOError
Wrapper for ASIOGetChannels()

Returns:
The number of output channels supported by the currently loaded driver
Throws:
ASIOError - If ASIOGetChannels() fails

ASIOGetChannels

static int[] ASIOGetChannels()
                      throws ASIOError
Wrapper for ASIOGetChannels()

Returns:
An int-Array with the number of input channels at position [0] and the number of output channels at position [1]
Throws:
ASIOError - If ASIOGetChannels() fails

ASIOGetInputLatency

static int ASIOGetInputLatency()
                        throws ASIOError
Wrapper for ASIOGetLatencies()

Returns:
The input latency in sample frames
Throws:
ASIOError - If ASIOGetLAtencies() fails

ASIOGetOutputLatency

static int ASIOGetOutputLatency()
                         throws ASIOError
Wrapper for ASIOGetLatencies()

Returns:
The output latency in sample frames
Throws:
ASIOError - If ASIOGetLAtencies() fails

ASIOGetLatencies

static int[] ASIOGetLatencies()
                       throws ASIOError
Wrapper for ASIOGetLatencies()

Returns:
An int-Array with the input latency on position [0] and the output latency on position [1] (in sample frames)
Throws:
ASIOError - If ASIOGetLAtencies() fails

ASIOGetMinBufferSize

static int ASIOGetMinBufferSize()
                         throws ASIOError
Wrapper for ASIOGetBufferSize()

Returns:
The minimum buffer size supported by the currently loaded driver in sample frames
Throws:
ASIOError - If ASIOGetBufferSize() fails

ASIOGetMaxBufferSize

static int ASIOGetMaxBufferSize()
                         throws ASIOError
Wrapper for ASIOGetBufferSize()

Returns:
The maximum buffer size supported by the currently loaded driver in sample frames
Throws:
ASIOError - If ASIOGetBufferSize() fails

ASIOGetPreferredBufferSize

static int ASIOGetPreferredBufferSize()
                               throws ASIOError
Wrapper for ASIOGetBufferSize()

Returns:
The preferred buffer size of the currently loaded driver in sample frames
Throws:
ASIOError - If ASIOGetBufferSize() fails

ASIOGetBufferSizeGranularity

static int ASIOGetBufferSizeGranularity()
                                 throws ASIOError
Wrapper for ASIOGetBufferSize()

Returns:
The granularity of the buffer size of the currently loaded driver in sample frames, on return will hold the granularity at which buffer sizes may differ. Usually, the buffer size will be a power of 2; in this case, granularity will hold -1 on return, signaling possible buffer sizes starting from minSize, increased in powers of 2 up to maxSize.
Throws:
ASIOError - If ASIOGetBufferSize() fails

ASIOGetBufferSize

static int[] ASIOGetBufferSize()
                        throws ASIOError
Wrapper for ASIOGetBufferSize()

Returns:
An int-Array with the minimum buffer size at position [0], the maximum buffer size az position [1], the preferred buffer size at position [2] and the buffer size granularity at position [3].
Throws:
ASIOError - If ASIOGetBufferSize() fails

ASIOCanSampleRate

static boolean ASIOCanSampleRate(double sampleRate)
                          throws ASIOError
Wrapper for ASIOCanSampleRate()

Parameters:
sampleRate - The sample rate to ask the driver for
Returns:
true if the currently loaded driver supports the given rate, false otherwise
Throws:
ASIOError - If ASIOCanSampleRate() fails

ASIOGetSampleRate

static double ASIOGetSampleRate()
                         throws ASIOError
Wrapper for ASIOGetSampleRate

Returns:
The current sample rate of the currently loaded driver
Throws:
ASIOError - If ASIOGetSampleRate fails

ASIOSetSampleRate

static void ASIOSetSampleRate(double rate)
                       throws ASIOError
Wrapper for ASIOSetSampleRate

Parameters:
rate - The new sample rate to set
Throws:
ASIOError - If ASIOSetSampleRate() fails

ASIOGetClockSources

static ASIOClockSource[] ASIOGetClockSources(int numSources)
                                      throws ASIOError
Wrapper for ASIOGetClockSources()

Parameters:
numSources - The maximum number of sources expected
Returns:
An Array of ASIOClockSource instances
Throws:
ASIOError - If ASIOGetClockSources() fails

ASIOSetClockSource

static void ASIOSetClockSource(int index)
                        throws ASIOError
Wrapper for ASIOSetClockSource()

Parameters:
index - The index of the clock source to select
Throws:
ASIOError - If ASIOSetClockSources() fails

ASIOGetChannelinfo

static ASIOChannelInfo ASIOGetChannelinfo(int channel,
                                          boolean isInput)
                                   throws ASIOError
Wrapper for ASIOGetChannelInfo()

Parameters:
channel - The number of the channel to query (zero-based)
isInput - true if querying an input channel, false otherwise
Returns:
An ASIOChannelInfo instance with infos about that channel
Throws:
ASIOError - If ASIOGetChannelinfo() fails

ASIOCreateBuffers

static ASIOBufferInfo[] ASIOCreateBuffers(ASIOBufferInfo[] infos,
                                          int bufferSize)
                                   throws ASIOError
Wrapper for ASIOCreateBuffers()

Parameters:
infos - ASIOBufferInfo-Array with information of the channels to prepare the buffers for
bufferSize - The buffersize to use
Returns:
An ASIOBufferInfo-Array with the result information
Throws:
ASIOError - If ASIOCreateBuffer() fails

ASIODisposeBuffers

static void ASIODisposeBuffers()
                        throws ASIOError
Wrapper for ASIODisposeBuffers()

Throws:
ASIOError - If ASIODisposeBuffers() fails

ASIOOutputReady

static void ASIOOutputReady()
                     throws ASIOError
Wrapper for ASIOOutputReady()

Throws:
ASIOError - If ASIOOutputReady() fails

ASIOControlPanel

public static void ASIOControlPanel()
                             throws ASIOError
Wrapper for ASIOControlPanel()

Throws:
ASIOError - If ASIOControlPanel() fails

ASIOFuture

static void ASIOFuture(int selector,
                       long pointer)
                throws ASIOError
Wrapper for ASIOFuture()

Parameters:
selector - The selector
pointer - The address of the "void* param" parameter
Throws:
ASIOError - If ASIOFuture() fails

enableTimeCodeReader

public static void enableTimeCodeReader()
                                 throws ASIOError
Enable the time code reader if the hardware device supports time code. See ASIO SDK...

Throws:
ASIOError - If the hardware doesn´t support this feature

disableTimeCodeReader

public static void disableTimeCodeReader()
                                  throws ASIOError
Disable the time code reader if the hardware device supports time code. See ASIO SDK...

Throws:
ASIOError - If the hardware doesn´t support this feature

jASIOInit

private static int jASIOInit(long pointer)

jASIOExit

private static int jASIOExit()

jASIOStart

private static int jASIOStart()

jASIOStop

private static int jASIOStop()

jASIOGetChannels

private static int jASIOGetChannels(int[] channels)

jASIOGetLatencies

private static int jASIOGetLatencies(int[] latencies)

jASIOGetBufferSize

private static int jASIOGetBufferSize(int[] data)

jASIOCanSampleRate

private static int jASIOCanSampleRate(ASIOSampleRate rate)

jASIOGetSampleRate

private static int jASIOGetSampleRate(ASIOSampleRate sampleRate)

jASIOSetSampleRate

private static int jASIOSetSampleRate(ASIOSampleRate sampleRate)

jASIOGetClockSources

private static int jASIOGetClockSources(long[] clockPointers)

jASIOSetClockSource

private static int jASIOSetClockSource(int index)

jASIOGetChannelInfo

private static int jASIOGetChannelInfo(long pointer)

jASIOCreateBuffers

private static int jASIOCreateBuffers(long[] infos,
                                      int bufferSize)

jASIODisposeBuffers

private static int jASIODisposeBuffers()

jASIOOutputReady

private static int jASIOOutputReady()

jASIOControlPanel

private static int jASIOControlPanel()

jASIOFuture

private static int jASIOFuture(int selector,
                               long pointer)

kAsioEnableTimeCodeRead

private static long kAsioEnableTimeCodeRead()

kAsioDisableTimeCodeRead

private static long kAsioDisableTimeCodeRead()

kAsioSetInputMonitor

private static long kAsioSetInputMonitor()

createBuffer

private static ByteBuffer createBuffer(long infoPointer,
                                       int index,
                                       int capacity)

getSystemTime

static long getSystemTime()
Get the system time reference

Returns:
The system reference time in nano seconds

createBuffers

static ByteBuffer[] createBuffers(ASIOBufferInfo info,
                                  int asiobuffersize)
Create two ByteBuffer objects from the buffer half addresses specified in the ASIOBufferInfo

Parameters:
info - The ASIOBufferInfo gotten from ASIOCreateBuffers()
asiobuffersize - The size of each half buffer in bytes
Returns:
An Array with the two direct ByteBuffers

kAsioSelectorSupported

private static long kAsioSelectorSupported()
ASIO message selector for asioMessage()


kAsioEngineVersion

private static long kAsioEngineVersion()

kAsioResetRequest

private static long kAsioResetRequest()

kAsioBufferSizeChange

private static long kAsioBufferSizeChange()

kAsioResyncRequest

private static long kAsioResyncRequest()

kAsioLatenciesChanged

private static long kAsioLatenciesChanged()

kAsioSupportsTimeInfo

private static long kAsioSupportsTimeInfo()

kAsioSupportsTimeCode

private static long kAsioSupportsTimeCode()