com.groovemanager.spi.asio
Class ASIOMixer

java.lang.Object
  extended by com.groovemanager.spi.asio.ASIOMixer
All Implemented Interfaces:
ASIOListener, javax.sound.sampled.Line, javax.sound.sampled.Mixer

public class ASIOMixer
extends java.lang.Object
implements javax.sound.sampled.Mixer, ASIOListener

An ASIOMixer represents an ASIO driver

Author:
Manu Robledo

Nested Class Summary
 
Nested classes inherited from class javax.sound.sampled.Mixer
javax.sound.sampled.Mixer.Info
 
Field Summary
private  ASIODataLine[] activeLines
          Lines that have been opened simultanously and must be started and stopped simultaneously.
private  java.util.HashMap allLines
          The lines associated to this mixer
private  ASIOBufferInfo[] asioBufferInfos
          ASIOBufferInfo objects used for ASIOPrepare()
private  java.util.ArrayList asioListeners
          List of ASIOListeners
(package private)  int bufferIndex
          The bufferIndex of the buffer half which should be filled right now and will be copied next to the asio buffers
private  int buffersize
          buffersize
private  ASIODriverInfo driverInfo
          The ASIODriverInfo of the ASIO driver represented by this Mixer
(package private) static int INITIALIZED
          Status constants
private  long initSeq
          Sequence number from ASIOInit()-call
private  long lastSample
          Variable for getMicrosecondPosition() and getSamplePosition()
private  long lastTime
          Variable for getMicrosecondPosition() and getSamplePosition()
private  java.util.ArrayList linesToSync
          Lines that have to be opened simultaneously.
private  java.util.ArrayList listeners
          List of LineListeners
(package private) static int LOADED
          Status constants
private  ASIOMixerProvider.ASIOMixerInfo mixerInfo
          The Mixer.Info corresponding to this Mixer
private  long nanosSinceOpen
          Variable for getMicrosecondPosition() and getSamplePosition()
(package private) static double[] POSSIBLE_RATES
          Because the ASIO driver can only say if he supports specific rates or not, we have to ask him before we can define the ASIOFormats it supports.
(package private) static int PREPARED
          Status constants
(package private) static int RUNNING
          Status constants
private  long samplesSinceOpen
          Variable for getMicrosecondPosition() and getSamplePosition()
private  javax.sound.sampled.Line.Info[] sourceInfo
          The info objects for getSourceLineInfo()
private  int status
          The current status of this ASIO driver
private  long stopFrame
          Variable for getMicrosecondPosition() and getSamplePosition()
private  long stopTime
          Variable for getMicrosecondPosition() and getSamplePosition()
private  javax.sound.sampled.Line.Info[] targetInfo
          The info objects for getTargetLineInfo()
(package private)  byte[] tempBuffer
          Temporary byte buffer for compy operations
(package private) static int UNLOADED
          Status constants
 
Constructor Summary
ASIOMixer(ASIOMixerProvider.ASIOMixerInfo i)
          Constructs a new ASIOMixer
 
Method Summary
 void addASIOListener(ASIOListener listener)
          Adds an ASIOListener that will be notified of callbacks from this ASIO driver
 void addLineListener(javax.sound.sampled.LineListener listener)
           
(package private)  void ASIOExit(long seq)
          Calls ASIOExit(), ASIODisposeBuffers() and ASIOStop() for this Mixer if needed.
(package private)  long ASIOInit()
          Try to initialize the ASIO driver.
private  long ASIOPrepare(ASIOBufferInfo[] infos, int buffersize)
          Calls ASIOCreateBuffers() and ASIO Init() for this Mixer if needed and returns a sequence number for the use with ASIOExit()
private  long ASIOStart(ASIOBufferInfo[] infos, int buffersize)
          Calls ASIOStart(), ASIOCreateBuffers and ASIOInit() for this mixer if needed and returns a sequence number for the use with ASIOExit()
private  boolean ASIOStop()
          Calls ASIOStop() for this Mixer if needed
(package private)  boolean ASIOUnPrepare()
          Calls ASIODisposeBuffers() and ASIOStop() for this Mixer if needed
 boolean bufferSizeChanged(ASIOMixer mixer, int newSize)
          Indicates that the preferred buffer size of the driver has changed.
(package private)  void bufferSwitchTimeInfo(ASIOTime time, int index, boolean processNow, boolean internal)
          ASIOīs bufferSwitchTimeInfo() callback
 void close()
           
(package private)  void close(long seq)
          Closes this Mixer only if the sequence number matches the one which was generated by ASIOInit()
(package private)  void closeLine(ASIODataLine line, long seq)
          Request from an ASIODataLine to be closed
private  void createLines()
          create the lines that correspond to this Mixer.
private  void freeVM()
          Free all references in the native code
(package private)  javax.sound.sampled.AudioFormat[] getAudioFormats(ASIOChannelInfo cInfo)
          Get all AudioFormats supported by an ASIODataLine.
private  int getBufferSizeGranularity()
          Get the granularity of the driverīs buffersize in sample frames
 javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
          No Controls are supported by ASIOMixer.
 javax.sound.sampled.Control[] getControls()
          No Controls are supported by ASIOMixer.
(package private)  int getDriverVersion()
          Get the version of the ASIO driver
 int getInputLatency()
          Get the current input Latency in sample frames
 javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line.Info getLineInfo()
           
(package private)  int getMaxBufferSize()
          Get the maximum buffersize supported by this driver
(package private) static int getMaxFrameSize(javax.sound.sampled.AudioFormat[] formats)
          Get the maximum frame size out of some given AudioFormats.
private  int getMaxInChannels()
          Get the number of input channels on this device
 int getMaxLines(javax.sound.sampled.Line.Info info)
           
private  int getMaxOutChannels()
          Get the number of output channels on this device
(package private)  long getMicrosecondPosition()
          Is used for DataLine.getMicrosencondposition()
(package private)  int getMinBufferSize()
          Get the minimum buffersize supported by this driver
(package private) static int getMinFrameSize(javax.sound.sampled.AudioFormat[] formats)
          Get the minimum frame size out of some given AudioFormats.
 javax.sound.sampled.Mixer.Info getMixerInfo()
           
(package private)  java.lang.String getName()
          Get the name of the ASIO driver
 int getOutputLatency()
          Get the current output Latency in sample frames
(package private)  int getPreferredBufferSize()
          Get the preferreed buffersize of the ASIO driver
(package private)  long getSamplePosition()
          Is used by ASIODataLine.getFramePosition()
(package private)  double getSampleRate()
          Get the current sample rate of this ASIO driver
 javax.sound.sampled.Line.Info[] getSourceLineInfo()
          Returns one ASIOLineInfo object for each mono output channel of this device.
 javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getSourceLines()
           
(package private)  int getStatus()
          Get the status of the ASIO driver
 javax.sound.sampled.Line.Info[] getTargetLineInfo()
          Returns one ASIOLineInfo object for each mono input channel of this device.
 javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getTargetLines()
           
private  void initVM()
          Initialize some variables in the native code for being able to accept callbacks from native code
 boolean isControlSupported(javax.sound.sampled.Control.Type control)
          No Controls are supported by ASIOMixer.
 boolean isLineSupported(javax.sound.sampled.Line.Info info)
           
private  boolean isLineSupported(javax.sound.sampled.Line l)
          Indicate whether a Line object is belonging to this ASIOMixer instance
 boolean isOpen()
           
 boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines, boolean maintainSync)
          Synchronization is supported for all Lines of this Mixer.
(package private)  void jBufferSwitchTimeInfo(long asioTime, int index, boolean directProcess)
          This method is called from the native bufferSwitchTimeInfo callback
 boolean latenciesChanged(ASIOMixer mixer)
          Indicates that the input - and/or output-latencies have changed.
private  void notifyListeners(javax.sound.sampled.LineEvent e)
          Notify the LineListeners of a LineEvent
 void open()
           
(package private)  void openLine(ASIODataLine line)
          A request from an ASIOdataLine to be opened with default buffersize
(package private)  void openLine(ASIODataLine line, int buffersize)
          A request from an ASIODataLine to be opened with the given buffersize
private  void prepare(ASIODataLine[] lines, int buffersize)
          Prepare all Lines, buffers etc. for being able to start.
 void removeASIOListener(ASIOListener listener)
          Removes a registeres ASIOListener
 void removeLineListener(javax.sound.sampled.LineListener listener)
           
 void resetRequest(ASIOMixer mixer)
          Is called when the driver needs a reset.
 boolean resyncRequest(ASIOMixer mixer)
          Indicates that the driver has lost its sync because of some reason and needs resyncing (usually stop and restart)
 void sampleRateChanged(ASIOMixer mixer, double newRate)
          Indicates that the sample rate has changed.
(package private)  void setDriverInfo(ASIODriverInfo driverInfo)
          Set the driver info of this ASIOMixer instance.
(package private)  void setStatus(int i)
          Set the status of this Mixer.
 void showControlPanel()
          Open the ASIO Control Panel for this driver
(package private)  void startLine(ASIODataLine line)
          A request from an ASIODataLine to be started
(package private)  void stopLine(ASIODataLine line)
          Request from an ASIODataLine to be stopped
 boolean supportsBufferSizeChange()
          Ask if this ASIOListener will react to the bufferSizeChanged() call.
 boolean supportsLatenciesChanged()
          Ask if this ASIOListener will react to the latenciesChanged() call.
 boolean supportsResyncRequest()
          Ask if this ASIOListener will react to the resyncRequest() call.
 void synchronize(javax.sound.sampled.Line[] lines, boolean maintainSync)
          ASIO automatically synchronizes all DataLines on one Mixer.
 void unsynchronize(javax.sound.sampled.Line[] lines)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeLines

private ASIODataLine[] activeLines
Lines that have been opened simultanously and must be started and stopped simultaneously.


allLines

private java.util.HashMap allLines
The lines associated to this mixer


asioBufferInfos

private ASIOBufferInfo[] asioBufferInfos
ASIOBufferInfo objects used for ASIOPrepare()


asioListeners

private java.util.ArrayList asioListeners
List of ASIOListeners


bufferIndex

int bufferIndex
The bufferIndex of the buffer half which should be filled right now and will be copied next to the asio buffers


buffersize

private int buffersize
buffersize


driverInfo

private ASIODriverInfo driverInfo
The ASIODriverInfo of the ASIO driver represented by this Mixer


INITIALIZED

static final int INITIALIZED
Status constants

See Also:
Constant Field Values

initSeq

private long initSeq
Sequence number from ASIOInit()-call


lastSample

private long lastSample
Variable for getMicrosecondPosition() and getSamplePosition()


lastTime

private long lastTime
Variable for getMicrosecondPosition() and getSamplePosition()


linesToSync

private java.util.ArrayList linesToSync
Lines that have to be opened simultaneously. Used with synchronize()


listeners

private java.util.ArrayList listeners
List of LineListeners


LOADED

static final int LOADED
Status constants

See Also:
Constant Field Values

mixerInfo

private ASIOMixerProvider.ASIOMixerInfo mixerInfo
The Mixer.Info corresponding to this Mixer


nanosSinceOpen

private long nanosSinceOpen
Variable for getMicrosecondPosition() and getSamplePosition()


POSSIBLE_RATES

static final double[] POSSIBLE_RATES
Because the ASIO driver can only say if he supports specific rates or not, we have to ask him before we can define the ASIOFormats it supports. These rates will be queried.


PREPARED

static final int PREPARED
Status constants

See Also:
Constant Field Values

RUNNING

static final int RUNNING
Status constants

See Also:
Constant Field Values

samplesSinceOpen

private long samplesSinceOpen
Variable for getMicrosecondPosition() and getSamplePosition()


sourceInfo

private javax.sound.sampled.Line.Info[] sourceInfo
The info objects for getSourceLineInfo()


status

private int status
The current status of this ASIO driver


stopFrame

private long stopFrame
Variable for getMicrosecondPosition() and getSamplePosition()


stopTime

private long stopTime
Variable for getMicrosecondPosition() and getSamplePosition()


targetInfo

private javax.sound.sampled.Line.Info[] targetInfo
The info objects for getTargetLineInfo()


tempBuffer

byte[] tempBuffer
Temporary byte buffer for compy operations


UNLOADED

static final int UNLOADED
Status constants

See Also:
Constant Field Values
Constructor Detail

ASIOMixer

ASIOMixer(ASIOMixerProvider.ASIOMixerInfo i)
Constructs a new ASIOMixer

Parameters:
i - The ASIOInfo describing the ASIO driver
Method Detail

addASIOListener

public void addASIOListener(ASIOListener listener)
Adds an ASIOListener that will be notified of callbacks from this ASIO driver

Parameters:
listener - The ASIOlistener to be added

addLineListener

public void addLineListener(javax.sound.sampled.LineListener listener)
Specified by:
addLineListener in interface javax.sound.sampled.Line
See Also:
Line.addLineListener(javax.sound.sampled.LineListener)

ASIOExit

void ASIOExit(long seq)
Calls ASIOExit(), ASIODisposeBuffers() and ASIOStop() for this Mixer if needed.

Parameters:
seq - A sequence number which should have been gotten from ASIOInit(). Only if this sequence number is the one of the call that initialized the driver, the driver will be unloaded.

ASIOInit

long ASIOInit()
        throws ASIOError
Try to initialize the ASIO driver. This is meeded for most inquiry methods. A sequence number is returned that must be passed to ASIOExit() after finishing the request. This sequence number is only valid if the driver was really initialized with this call. If it had been initialized before, the sequence number will be invalid. This mechanism gaurantees that ASIOExit only causes an unload of the driver if the caller is the one that initialized the driver.

Returns:
A sequence number that should be used as an argument to ASIOExit()
Throws:
ASIOError - If neither input nor output is present (ASE_NotPresent), other possible ASIOErrors are ASE_NoMemory and ASE_HWMalfunction

ASIOPrepare

private long ASIOPrepare(ASIOBufferInfo[] infos,
                         int buffersize)
                  throws ASIOError
Calls ASIOCreateBuffers() and ASIO Init() for this Mixer if needed and returns a sequence number for the use with ASIOExit()

Parameters:
infos - Array of ASIOBufferInfos which will be filled in the call
buffersize - The ASIO buffersize in sample frames
Returns:
A sequence number that should be used with ASIOExit()
Throws:
ASIOError - If not enough memory is available for the buffers (ASE_NoMemory), if no input/output is present (ASE_NotPresent), if buffersize is not supported or one or more of the ASIOBufferInfo elements contain invalid settings (ASE_InvalidMode). Other possible value is ASE_HWMalfunction

ASIOStart

private long ASIOStart(ASIOBufferInfo[] infos,
                       int buffersize)
                throws ASIOError
Calls ASIOStart(), ASIOCreateBuffers and ASIOInit() for this mixer if needed and returns a sequence number for the use with ASIOExit()

Parameters:
infos - Array of ASIOBufferInfos which will be filled in the call
buffersize - The ASIO buffersize in sample frames
Returns:
A sequence number that should be used with ASIOExit()
Throws:
ASIOError - If not enough memory is available for the buffers (ASE_NoMemory), if no input/output is present (ASE_NotPresent), if buffersize is not supported or one or more of the ASIOBufferInfo elements contain invalid settings (ASE_InvalidMode). Other possible value is ASE_HWMalfunction

ASIOStop

private boolean ASIOStop()
                  throws ASIOError
Calls ASIOStop() for this Mixer if needed

Returns:
true if the call to ASIOStop() succeeded
Throws:
ASIOError - If neither input nor output is present (ASE_NotPresent)

ASIOUnPrepare

boolean ASIOUnPrepare()
                throws ASIOError
Calls ASIODisposeBuffers() and ASIOStop() for this Mixer if needed

Returns:
true if the calls succeede, false otherwise
Throws:
ASIOError - If neither input nor output is present (ASE_NotPresent), if no buffers were ever created(ASE_InvalidMode)

bufferSizeChanged

public boolean bufferSizeChanged(ASIOMixer mixer,
                                 int newSize)
Description copied from interface: ASIOListener
Indicates that the preferred buffer size of the driver has changed.

Specified by:
bufferSizeChanged in interface ASIOListener
Parameters:
mixer - The ASIOMixer representing the ASIO driver
newSize - The new buffersize in sample frames. Please note that this value means a size in frames, not a number of bytes.
Returns:
true if this listener has accepted the message, false otherwise.
See Also:
ASIOListener.bufferSizeChanged(com.groovemanager.spi.asio.ASIOMixer, int)

bufferSwitchTimeInfo

void bufferSwitchTimeInfo(ASIOTime time,
                          int index,
                          boolean processNow,
                          boolean internal)
ASIOīs bufferSwitchTimeInfo() callback

Parameters:
time - ASIOTime object that represents the time and sample position at which this call was launched
index - The buffer half index that should be processed
processNow - Indicates whether this method should return immediately or should process the buffer contents immediately
internal - Indicates if this call has come from the ASIO driver (false) or as an internal call from this Mixer (true)

close

public void close()
Specified by:
close in interface javax.sound.sampled.Line
See Also:
Line.close()

close

void close(long seq)
Closes this Mixer only if the sequence number matches the one which was generated by ASIOInit()

Parameters:
seq - The sequence number

closeLine

void closeLine(ASIODataLine line,
               long seq)
Request from an ASIODataLine to be closed

Parameters:
line - The ASIODataLine which requests to be closed
seq - The sequence number with which this line was opened

createLines

private void createLines()
create the lines that correspond to this Mixer. Should be called only once for one Mixer


freeVM

private void freeVM()
Free all references in the native code


getAudioFormats

javax.sound.sampled.AudioFormat[] getAudioFormats(ASIOChannelInfo cInfo)
Get all AudioFormats supported by an ASIODataLine. All supported sample rates will be taken into account as well as all possible numbers of channels. The rest is specified by the ASIOChannelInfo. If a line is the last one on a device (e.g. the 8th channel on an 8 channel device) it will only support mono formats. All other channels will support mono, stereo and all possible numbers of channels from their channel number up to the highest channel.

Parameters:
cInfo - The ASIOChannelInfo describing the channel
Returns:
An Array of AudioFormats supported by this channel

getBufferSizeGranularity

private int getBufferSizeGranularity()
Get the granularity of the driverīs buffersize in sample frames

Returns:
The driverīs buffer size granularity in sample frames or 0 if the driver could not be initialized

getControl

public javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
No Controls are supported by ASIOMixer.

Specified by:
getControl in interface javax.sound.sampled.Line
See Also:
Line.getControl(javax.sound.sampled.Control.Type)

getControls

public javax.sound.sampled.Control[] getControls()
No Controls are supported by ASIOMixer.

Specified by:
getControls in interface javax.sound.sampled.Line
See Also:
Line.getControls()

getDriverVersion

int getDriverVersion()
Get the version of the ASIO driver

Returns:
The version of the ASIO driver

getInputLatency

public int getInputLatency()
Get the current input Latency in sample frames

Returns:
The current input latency in sample frames

getLine

public javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
                                 throws javax.sound.sampled.LineUnavailableException
Specified by:
getLine in interface javax.sound.sampled.Mixer
Throws:
javax.sound.sampled.LineUnavailableException
See Also:
Mixer.getLine(javax.sound.sampled.Line.Info)

getLineInfo

public javax.sound.sampled.Line.Info getLineInfo()
Specified by:
getLineInfo in interface javax.sound.sampled.Line
See Also:
Line.getLineInfo()

getMaxBufferSize

int getMaxBufferSize()
               throws ASIOError
Get the maximum buffersize supported by this driver

Returns:
The maximum buffer size in sample frames
Throws:
ASIOError - if the driver could not be initialized

getMaxFrameSize

static int getMaxFrameSize(javax.sound.sampled.AudioFormat[] formats)
Get the maximum frame size out of some given AudioFormats. Needed for the conversion between ASIOīs buffersizes (in sample frames) and Java Soundīs buffersizes (in bytes)

Parameters:
formats - The formats to query for their frame size
Returns:
The maximum occuring frame size or AudioSystem.NOT_SPECIFIED

getMaxInChannels

private int getMaxInChannels()
Get the number of input channels on this device

Returns:
The number of input channels or 0 if the ASIO driver can not be initialized

getMaxLines

public int getMaxLines(javax.sound.sampled.Line.Info info)
Specified by:
getMaxLines in interface javax.sound.sampled.Mixer
See Also:
Mixer.getMaxLines(javax.sound.sampled.Line.Info)

getMaxOutChannels

private int getMaxOutChannels()
Get the number of output channels on this device

Returns:
The number of input channels or 0 if the ASIO driver can not be initialized

getMicrosecondPosition

long getMicrosecondPosition()
Is used for DataLine.getMicrosencondposition()

Returns:
The number of microseconds that this line has been running since it was opened

getMinBufferSize

int getMinBufferSize()
               throws ASIOError
Get the minimum buffersize supported by this driver

Returns:
The minimum buffer size in sample frames
Throws:
ASIOError - if the driver could not be initialized

getMinFrameSize

static int getMinFrameSize(javax.sound.sampled.AudioFormat[] formats)
Get the minimum frame size out of some given AudioFormats. Needed for the conversion between ASIOīs buffersizes (in sample frames) and Java Soundīs buffersizes (in bytes)

Parameters:
formats - The formats to query for their frame size
Returns:
The minimum occuring frame size or AudioSystem.NOT_SPECIFIED

getMixerInfo

public javax.sound.sampled.Mixer.Info getMixerInfo()
Specified by:
getMixerInfo in interface javax.sound.sampled.Mixer
See Also:
Mixer.getMixerInfo()

getName

java.lang.String getName()
Get the name of the ASIO driver

Returns:
The name of the ASIO driver

getOutputLatency

public int getOutputLatency()
Get the current output Latency in sample frames

Returns:
The current output latency in sample frames

getPreferredBufferSize

int getPreferredBufferSize()
Get the preferreed buffersize of the ASIO driver

Returns:
The preferred buffer size in sample frames or 0 if the driver could not be initialized

getSamplePosition

long getSamplePosition()
Is used by ASIODataLine.getFramePosition()

Returns:
The number of sampleFrames played back or recorded since the Line was opened

getSampleRate

double getSampleRate()
Get the current sample rate of this ASIO driver

Returns:
The current sample rate of this ASIO driver

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo()
Returns one ASIOLineInfo object for each mono output channel of this device. You can query the returned objects with ASIOLineInfo.getName().

Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer
See Also:
Mixer.getSourceLineInfo()

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer
See Also:
Mixer.getSourceLineInfo(javax.sound.sampled.Line.Info)

getSourceLines

public javax.sound.sampled.Line[] getSourceLines()
Specified by:
getSourceLines in interface javax.sound.sampled.Mixer
See Also:
Mixer.getSourceLines()

getStatus

int getStatus()
Get the status of the ASIO driver

Returns:
One of the status constants

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo()
Returns one ASIOLineInfo object for each mono input channel of this device. You can query the returned objects with ASIOLineInfo.getName().

Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer
See Also:
Mixer.getTargetLineInfo()

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer
See Also:
Mixer.getTargetLineInfo(javax.sound.sampled.Line.Info)

getTargetLines

public javax.sound.sampled.Line[] getTargetLines()
Specified by:
getTargetLines in interface javax.sound.sampled.Mixer
See Also:
Mixer.getTargetLines()

initVM

private void initVM()
Initialize some variables in the native code for being able to accept callbacks from native code


isControlSupported

public boolean isControlSupported(javax.sound.sampled.Control.Type control)
No Controls are supported by ASIOMixer.

Specified by:
isControlSupported in interface javax.sound.sampled.Line
See Also:
Line.isControlSupported(javax.sound.sampled.Control.Type)

isLineSupported

public boolean isLineSupported(javax.sound.sampled.Line.Info info)
Specified by:
isLineSupported in interface javax.sound.sampled.Mixer
See Also:
Mixer.isLineSupported(javax.sound.sampled.Line.Info)

isLineSupported

private boolean isLineSupported(javax.sound.sampled.Line l)
Indicate whether a Line object is belonging to this ASIOMixer instance

Parameters:
l - The Line to test
Returns:
true if this Line belongs to this Mixer, false otherwise

isOpen

public boolean isOpen()
Specified by:
isOpen in interface javax.sound.sampled.Line
See Also:
Line.isOpen()

isSynchronizationSupported

public boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines,
                                          boolean maintainSync)
Synchronization is supported for all Lines of this Mixer.

Specified by:
isSynchronizationSupported in interface javax.sound.sampled.Mixer
See Also:
Mixer.isSynchronizationSupported(javax.sound.sampled.Line[], boolean)

jBufferSwitchTimeInfo

void jBufferSwitchTimeInfo(long asioTime,
                           int index,
                           boolean directProcess)
This method is called from the native bufferSwitchTimeInfo callback

Parameters:
asioTime - Pointer to an ASIOTime structure
index - The buffer half index that should be processed
directProcess - Indicates whether this method should return immediately or should process the buffer contents immediately

latenciesChanged

public boolean latenciesChanged(ASIOMixer mixer)
Description copied from interface: ASIOListener
Indicates that the input - and/or output-latencies have changed. The latency values can be queried by ASIOMixer.getInputLatency() and ASIOMixer.getOutputLatency()

Specified by:
latenciesChanged in interface ASIOListener
Parameters:
mixer - The ASIOMixer representing the ASIO driver
Returns:
true if this listener has accepted the message, false otherwise.
See Also:
ASIOListener.latenciesChanged(com.groovemanager.spi.asio.ASIOMixer)

notifyListeners

private void notifyListeners(javax.sound.sampled.LineEvent e)
Notify the LineListeners of a LineEvent

Parameters:
e - The LineEvent

open

public void open()
          throws javax.sound.sampled.LineUnavailableException
Specified by:
open in interface javax.sound.sampled.Line
Throws:
javax.sound.sampled.LineUnavailableException
See Also:
Line.open()

openLine

void openLine(ASIODataLine line)
        throws javax.sound.sampled.LineUnavailableException
A request from an ASIOdataLine to be opened with default buffersize

Parameters:
line - The ASIODataLine the askes to be opened
Throws:
javax.sound.sampled.LineUnavailableException

openLine

void openLine(ASIODataLine line,
              int buffersize)
        throws javax.sound.sampled.LineUnavailableException
A request from an ASIODataLine to be opened with the given buffersize

Parameters:
line - The ASIODataLine which requests to be opened
buffersize - The requested buffersize in sample frames
Throws:
javax.sound.sampled.LineUnavailableException - If other lines are already open on this Mixer or if the driver could not be initialized

prepare

private void prepare(ASIODataLine[] lines,
                     int buffersize)
Prepare all Lines, buffers etc. for being able to start.

Parameters:
lines - The ASIODataLines which should be synchronized
buffersize - The buffersize in sample frames

removeASIOListener

public void removeASIOListener(ASIOListener listener)
Removes a registeres ASIOListener

Parameters:
listener - The ASIOListener to be removed

removeLineListener

public void removeLineListener(javax.sound.sampled.LineListener listener)
Specified by:
removeLineListener in interface javax.sound.sampled.Line
See Also:
Line.removeLineListener(javax.sound.sampled.LineListener)

resetRequest

public void resetRequest(ASIOMixer mixer)
Description copied from interface: ASIOListener
Is called when the driver needs a reset. It will automatically be closed.

Specified by:
resetRequest in interface ASIOListener
Parameters:
mixer - The ASIOMixer representing the ASIO driver
See Also:
ASIOListener.resetRequest(com.groovemanager.spi.asio.ASIOMixer)

resyncRequest

public boolean resyncRequest(ASIOMixer mixer)
Description copied from interface: ASIOListener
Indicates that the driver has lost its sync because of some reason and needs resyncing (usually stop and restart)

Specified by:
resyncRequest in interface ASIOListener
Parameters:
mixer - The ASIOMixer representing the ASIO driver
Returns:
true if this listener has accepted the message, false otherwise.
See Also:
ASIOListener.resyncRequest(com.groovemanager.spi.asio.ASIOMixer)

sampleRateChanged

public void sampleRateChanged(ASIOMixer mixer,
                              double newRate)
Description copied from interface: ASIOListener
Indicates that the sample rate has changed. May be because of external sync or because of opening an ASIODataLine with a new AudioFormat

Specified by:
sampleRateChanged in interface ASIOListener
Parameters:
mixer - The ASIOMixer representing the ASIO driver
newRate - The new sample rate
See Also:
ASIOListener.sampleRateChanged(com.groovemanager.spi.asio.ASIOMixer, double)

setDriverInfo

void setDriverInfo(ASIODriverInfo driverInfo)
Set the driver info of this ASIOMixer instance. Is called from the ASIOMixerProvider

Parameters:
driverInfo -

setStatus

void setStatus(int i)
Set the status of this Mixer. Should only be called from ASIOMixerProvider

Parameters:
i - The new status

showControlPanel

public void showControlPanel()
Open the ASIO Control Panel for this driver


startLine

void startLine(ASIODataLine line)
A request from an ASIODataLine to be started

Parameters:
line - The ASIODataLine which requests to be started

stopLine

void stopLine(ASIODataLine line)
Request from an ASIODataLine to be stopped

Parameters:
line - The ASIODataLine which requested to be stopped

supportsBufferSizeChange

public boolean supportsBufferSizeChange()
Description copied from interface: ASIOListener
Ask if this ASIOListener will react to the bufferSizeChanged() call. If it ignores calls to bufferSizeChanged(), false should be returned.

Specified by:
supportsBufferSizeChange in interface ASIOListener
Returns:
true if this listener may react to calls to bufferSizeChanged(), false otherwise
See Also:
ASIOListener.supportsBufferSizeChange()

supportsLatenciesChanged

public boolean supportsLatenciesChanged()
Description copied from interface: ASIOListener
Ask if this ASIOListener will react to the latenciesChanged() call. If it ignores calls to latenciesChanged(), false should be returned.

Specified by:
supportsLatenciesChanged in interface ASIOListener
Returns:
true if this listener may react to calls to latenciesChanged(), false otherwise

supportsResyncRequest

public boolean supportsResyncRequest()
Description copied from interface: ASIOListener
Ask if this ASIOListener will react to the resyncRequest() call. If it ignores calls to resyncRequest(), false should be returned.

Specified by:
supportsResyncRequest in interface ASIOListener
Returns:
true if this listener may react to calls to resyncRequest(), false otherwise
See Also:
ASIOListener.supportsResyncRequest()

synchronize

public void synchronize(javax.sound.sampled.Line[] lines,
                        boolean maintainSync)
ASIO automatically synchronizes all DataLines on one Mixer. But if you want to use more than one line simultaneosly on an ASIOMixer, you will have to call this Method before opening a line. Otherwise trying to open a Line when another one is already open on this Mixer would result in a LineUnavailableException

Specified by:
synchronize in interface javax.sound.sampled.Mixer
See Also:
Mixer.synchronize(javax.sound.sampled.Line[], boolean)

unsynchronize

public void unsynchronize(javax.sound.sampled.Line[] lines)
Specified by:
unsynchronize in interface javax.sound.sampled.Mixer
See Also:
Mixer.unsynchronize(javax.sound.sampled.Line[])