|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.spi.asio.ASIOMixer
An ASIOMixer represents an ASIO driver
| 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 |
|---|
private ASIODataLine[] activeLines
private java.util.HashMap allLines
private ASIOBufferInfo[] asioBufferInfos
private java.util.ArrayList asioListeners
int bufferIndex
private int buffersize
private ASIODriverInfo driverInfo
static final int INITIALIZED
private long initSeq
private long lastSample
private long lastTime
private java.util.ArrayList linesToSync
private java.util.ArrayList listeners
static final int LOADED
private ASIOMixerProvider.ASIOMixerInfo mixerInfo
private long nanosSinceOpen
static final double[] POSSIBLE_RATES
static final int PREPARED
static final int RUNNING
private long samplesSinceOpen
private javax.sound.sampled.Line.Info[] sourceInfo
private int status
private long stopFrame
private long stopTime
private javax.sound.sampled.Line.Info[] targetInfo
byte[] tempBuffer
static final int UNLOADED
| Constructor Detail |
|---|
ASIOMixer(ASIOMixerProvider.ASIOMixerInfo i)
i - The ASIOInfo describing the ASIO driver| Method Detail |
|---|
public void addASIOListener(ASIOListener listener)
listener - The ASIOlistener to be addedpublic void addLineListener(javax.sound.sampled.LineListener listener)
addLineListener in interface javax.sound.sampled.LineLine.addLineListener(javax.sound.sampled.LineListener)void ASIOExit(long seq)
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.
long ASIOInit()
throws ASIOError
ASIOError - If neither input nor output is present (ASE_NotPresent),
other possible ASIOErrors are ASE_NoMemory and ASE_HWMalfunction
private long ASIOPrepare(ASIOBufferInfo[] infos,
int buffersize)
throws ASIOError
infos - Array of ASIOBufferInfos which will be filled in the callbuffersize - The ASIO buffersize in sample frames
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
private long ASIOStart(ASIOBufferInfo[] infos,
int buffersize)
throws ASIOError
infos - Array of ASIOBufferInfos which will be filled in the callbuffersize - The ASIO buffersize in sample frames
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
private boolean ASIOStop()
throws ASIOError
ASIOError - If neither input nor output is present (ASE_NotPresent)
boolean ASIOUnPrepare()
throws ASIOError
ASIOError - If neither input nor output is present (ASE_NotPresent),
if no buffers were ever created(ASE_InvalidMode)
public boolean bufferSizeChanged(ASIOMixer mixer,
int newSize)
ASIOListener
bufferSizeChanged in interface ASIOListenermixer - The ASIOMixer representing the ASIO drivernewSize - The new buffersize in sample frames. Please note that this
value means a size in frames, not a number of bytes.
ASIOListener.bufferSizeChanged(com.groovemanager.spi.asio.ASIOMixer, int)
void bufferSwitchTimeInfo(ASIOTime time,
int index,
boolean processNow,
boolean internal)
time - ASIOTime object that represents the time and sample position
at which this call was launchedindex - The buffer half index that should be processedprocessNow - Indicates whether this method should return
immediately or should process the buffer contents immediatelyinternal - Indicates if this call has come from the ASIO driver
(false) or as an internal call from this Mixer (true)public void close()
close in interface javax.sound.sampled.LineLine.close()void close(long seq)
seq - The sequence number
void closeLine(ASIODataLine line,
long seq)
line - The ASIODataLine which requests to be closedseq - The sequence number with which this line was openedprivate void createLines()
private void freeVM()
javax.sound.sampled.AudioFormat[] getAudioFormats(ASIOChannelInfo cInfo)
cInfo - The ASIOChannelInfo describing the channel
private int getBufferSizeGranularity()
public javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
getControl in interface javax.sound.sampled.LineLine.getControl(javax.sound.sampled.Control.Type)public javax.sound.sampled.Control[] getControls()
getControls in interface javax.sound.sampled.LineLine.getControls()int getDriverVersion()
public int getInputLatency()
public javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
throws javax.sound.sampled.LineUnavailableException
getLine in interface javax.sound.sampled.Mixerjavax.sound.sampled.LineUnavailableExceptionMixer.getLine(javax.sound.sampled.Line.Info)public javax.sound.sampled.Line.Info getLineInfo()
getLineInfo in interface javax.sound.sampled.LineLine.getLineInfo()
int getMaxBufferSize()
throws ASIOError
ASIOError - if the driver could not be initializedstatic int getMaxFrameSize(javax.sound.sampled.AudioFormat[] formats)
formats - The formats to query for their frame size
private int getMaxInChannels()
public int getMaxLines(javax.sound.sampled.Line.Info info)
getMaxLines in interface javax.sound.sampled.MixerMixer.getMaxLines(javax.sound.sampled.Line.Info)private int getMaxOutChannels()
long getMicrosecondPosition()
int getMinBufferSize()
throws ASIOError
ASIOError - if the driver could not be initializedstatic int getMinFrameSize(javax.sound.sampled.AudioFormat[] formats)
formats - The formats to query for their frame size
public javax.sound.sampled.Mixer.Info getMixerInfo()
getMixerInfo in interface javax.sound.sampled.MixerMixer.getMixerInfo()java.lang.String getName()
public int getOutputLatency()
int getPreferredBufferSize()
long getSamplePosition()
double getSampleRate()
public javax.sound.sampled.Line.Info[] getSourceLineInfo()
getSourceLineInfo in interface javax.sound.sampled.MixerMixer.getSourceLineInfo()public javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
getSourceLineInfo in interface javax.sound.sampled.MixerMixer.getSourceLineInfo(javax.sound.sampled.Line.Info)public javax.sound.sampled.Line[] getSourceLines()
getSourceLines in interface javax.sound.sampled.MixerMixer.getSourceLines()int getStatus()
public javax.sound.sampled.Line.Info[] getTargetLineInfo()
getTargetLineInfo in interface javax.sound.sampled.MixerMixer.getTargetLineInfo()public javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
getTargetLineInfo in interface javax.sound.sampled.MixerMixer.getTargetLineInfo(javax.sound.sampled.Line.Info)public javax.sound.sampled.Line[] getTargetLines()
getTargetLines in interface javax.sound.sampled.MixerMixer.getTargetLines()private void initVM()
public boolean isControlSupported(javax.sound.sampled.Control.Type control)
isControlSupported in interface javax.sound.sampled.LineLine.isControlSupported(javax.sound.sampled.Control.Type)public boolean isLineSupported(javax.sound.sampled.Line.Info info)
isLineSupported in interface javax.sound.sampled.MixerMixer.isLineSupported(javax.sound.sampled.Line.Info)private boolean isLineSupported(javax.sound.sampled.Line l)
l - The Line to test
public boolean isOpen()
isOpen in interface javax.sound.sampled.LineLine.isOpen()
public boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines,
boolean maintainSync)
isSynchronizationSupported in interface javax.sound.sampled.MixerMixer.isSynchronizationSupported(javax.sound.sampled.Line[], boolean)
void jBufferSwitchTimeInfo(long asioTime,
int index,
boolean directProcess)
asioTime - Pointer to an ASIOTime structureindex - The buffer half index that should be processeddirectProcess - Indicates whether this method should return
immediately or should process the buffer contents immediatelypublic boolean latenciesChanged(ASIOMixer mixer)
ASIOListener
latenciesChanged in interface ASIOListenermixer - The ASIOMixer representing the ASIO driver
ASIOListener.latenciesChanged(com.groovemanager.spi.asio.ASIOMixer)private void notifyListeners(javax.sound.sampled.LineEvent e)
e - The LineEvent
public void open()
throws javax.sound.sampled.LineUnavailableException
open in interface javax.sound.sampled.Linejavax.sound.sampled.LineUnavailableExceptionLine.open()
void openLine(ASIODataLine line)
throws javax.sound.sampled.LineUnavailableException
line - The ASIODataLine the askes to be opened
javax.sound.sampled.LineUnavailableException
void openLine(ASIODataLine line,
int buffersize)
throws javax.sound.sampled.LineUnavailableException
line - The ASIODataLine which requests to be openedbuffersize - The requested buffersize in sample frames
javax.sound.sampled.LineUnavailableException - If other lines are already open on
this Mixer or if the driver could not be initialized
private void prepare(ASIODataLine[] lines,
int buffersize)
lines - The ASIODataLines which should be synchronizedbuffersize - The buffersize in sample framespublic void removeASIOListener(ASIOListener listener)
listener - The ASIOListener to be removedpublic void removeLineListener(javax.sound.sampled.LineListener listener)
removeLineListener in interface javax.sound.sampled.LineLine.removeLineListener(javax.sound.sampled.LineListener)public void resetRequest(ASIOMixer mixer)
ASIOListener
resetRequest in interface ASIOListenermixer - The ASIOMixer representing the ASIO driverASIOListener.resetRequest(com.groovemanager.spi.asio.ASIOMixer)public boolean resyncRequest(ASIOMixer mixer)
ASIOListener
resyncRequest in interface ASIOListenermixer - The ASIOMixer representing the ASIO driver
ASIOListener.resyncRequest(com.groovemanager.spi.asio.ASIOMixer)
public void sampleRateChanged(ASIOMixer mixer,
double newRate)
ASIOListener
sampleRateChanged in interface ASIOListenermixer - The ASIOMixer representing the ASIO drivernewRate - The new sample rateASIOListener.sampleRateChanged(com.groovemanager.spi.asio.ASIOMixer, double)void setDriverInfo(ASIODriverInfo driverInfo)
driverInfo - void setStatus(int i)
i - The new statuspublic void showControlPanel()
void startLine(ASIODataLine line)
line - The ASIODataLine which requests to be startedvoid stopLine(ASIODataLine line)
line - The ASIODataLine which requested to be stoppedpublic boolean supportsBufferSizeChange()
ASIOListener
supportsBufferSizeChange in interface ASIOListenerASIOListener.supportsBufferSizeChange()public boolean supportsLatenciesChanged()
ASIOListener
supportsLatenciesChanged in interface ASIOListenerpublic boolean supportsResyncRequest()
ASIOListener
supportsResyncRequest in interface ASIOListenerASIOListener.supportsResyncRequest()
public void synchronize(javax.sound.sampled.Line[] lines,
boolean maintainSync)
synchronize in interface javax.sound.sampled.MixerMixer.synchronize(javax.sound.sampled.Line[], boolean)public void unsynchronize(javax.sound.sampled.Line[] lines)
unsynchronize in interface javax.sound.sampled.MixerMixer.unsynchronize(javax.sound.sampled.Line[])
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||