|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.spi.asio.ASIOMixer
public class ASIOMixer
An ASIOMixer represents an ASIO driver
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface javax.sound.sampled.Mixer |
|---|
Mixer.Info |
| Field Summary | |
|---|---|
private ASIODataLine[] |
activeLines
Lines that have been opened simultanously and must be started and stopped simultaneously. |
private HashMap<String,ASIODataLine> |
allLines
The lines associated to this mixer |
private ASIOBufferInfo[] |
asioBufferInfos
ASIOBufferInfo objects used for ASIOPrepare() |
private ArrayList<ASIOListener> |
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 ArrayList<ASIODataLine> |
linesToSync
Lines that have to be opened simultaneously. |
private ArrayList<LineListener> |
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 ASIOLineInfo[] |
sourceInfo
The info objects for getSourceLineInfo() |
private int |
status
The current status of this ASIO driver |
private ASIOLineInfo[] |
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(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(boolean isInput)
create the lines that correspond to this Mixer. |
private void |
freeVM()
Free all references in the native code |
(package private) 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 |
Control |
getControl(Control.Type control)
No Controls are supported by ASIOMixer. |
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 |
ASIODataLine |
getLine(Line.Info info)
|
Line.Info |
getLineInfo()
|
(package private) int |
getMaxBufferSize()
Get the maximum buffersize supported by this driver |
(package private) static int |
getMaxFrameSize(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(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(AudioFormat[] formats)
Get the minimum frame size out of some given AudioFormats. |
ASIOMixerProvider.ASIOMixerInfo |
getMixerInfo()
|
(package private) 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 |
ASIOLineInfo[] |
getSourceLineInfo()
Returns one ASIOLineInfo object for each mono output channel of this device. |
Line.Info[] |
getSourceLineInfo(Line.Info info)
|
ASIODataLine[] |
getSourceLines()
|
(package private) int |
getStatus()
Get the status of the ASIO driver |
ASIOLineInfo[] |
getTargetLineInfo()
Returns one ASIOLineInfo object for each mono input channel of this device. |
Line.Info[] |
getTargetLineInfo(Line.Info info)
|
ASIODataLine[] |
getTargetLines()
|
private void |
initVM()
Initialize some variables in the native code for being able to accept callbacks from native code |
boolean |
isControlSupported(Control.Type control)
No Controls are supported by ASIOMixer. |
boolean |
isLineSupported(Line.Info info)
|
private boolean |
isLineSupported(Line l)
Indicate whether a Line object is belonging to this ASIOMixer instance |
boolean |
isOpen()
|
boolean |
isSynchronizationSupported(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(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(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(Line[] lines,
boolean maintainSync)
ASIO automatically synchronizes all DataLines on one Mixer. |
void |
unsynchronize(Line[] lines)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final double[] POSSIBLE_RATES
private ASIOLineInfo[] sourceInfo
private ASIOLineInfo[] targetInfo
private ASIOMixerProvider.ASIOMixerInfo mixerInfo
private ASIODriverInfo driverInfo
private ArrayList<LineListener> listeners
static final int UNLOADED
static final int LOADED
static final int INITIALIZED
static final int PREPARED
static final int RUNNING
private int status
private HashMap<String,ASIODataLine> allLines
private ArrayList<ASIODataLine> linesToSync
private ASIODataLine[] activeLines
private ASIOBufferInfo[] asioBufferInfos
private long initSeq
private long lastTime
private long lastSample
private long nanosSinceOpen
private long samplesSinceOpen
private int buffersize
private ArrayList<ASIOListener> asioListeners
int bufferIndex
byte[] tempBuffer
| Constructor Detail |
|---|
ASIOMixer(ASIOMixerProvider.ASIOMixerInfo i)
i - The ASIOInfo describing the ASIO driver| Method Detail |
|---|
private void initVM()
private void freeVM()
void setDriverInfo(ASIODriverInfo driverInfo)
driverInfo - String getName()
int getDriverVersion()
int getStatus()
private void createLines(boolean isInput)
public void showControlPanel()
public ASIOMixerProvider.ASIOMixerInfo getMixerInfo()
getMixerInfo in interface MixerMixer.getMixerInfo()void setStatus(int i)
i - The new status
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)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.public ASIOLineInfo[] getSourceLineInfo()
getSourceLineInfo in interface MixerMixer.getSourceLineInfo()static int getMinFrameSize(AudioFormat[] formats)
formats - The formats to query for their frame size
static int getMaxFrameSize(AudioFormat[] formats)
formats - The formats to query for their frame size
AudioFormat[] getAudioFormats(ASIOChannelInfo cInfo)
cInfo - The ASIOChannelInfo describing the channel
public ASIOLineInfo[] getTargetLineInfo()
getTargetLineInfo in interface MixerMixer.getTargetLineInfo()public Line.Info[] getSourceLineInfo(Line.Info info)
getSourceLineInfo in interface MixerMixer.getSourceLineInfo(javax.sound.sampled.Line.Info)public Line.Info[] getTargetLineInfo(Line.Info info)
getTargetLineInfo in interface MixerMixer.getTargetLineInfo(javax.sound.sampled.Line.Info)
int getMinBufferSize()
throws ASIOError
ASIOError - if the driver could not be initialized
int getMaxBufferSize()
throws ASIOError
ASIOError - if the driver could not be initializedprivate boolean isLineSupported(Line l)
l - The Line to test
public boolean isLineSupported(Line.Info info)
isLineSupported in interface MixerMixer.isLineSupported(javax.sound.sampled.Line.Info)
public ASIODataLine getLine(Line.Info info)
throws LineUnavailableException
getLine in interface MixerLineUnavailableExceptionMixer.getLine(javax.sound.sampled.Line.Info)public int getMaxLines(Line.Info info)
getMaxLines in interface MixerMixer.getMaxLines(javax.sound.sampled.Line.Info)public ASIODataLine[] getSourceLines()
getSourceLines in interface MixerMixer.getSourceLines()public ASIODataLine[] getTargetLines()
getTargetLines in interface MixerMixer.getTargetLines()
public void synchronize(Line[] lines,
boolean maintainSync)
synchronize in interface MixerMixer.synchronize(javax.sound.sampled.Line[],
boolean)public void unsynchronize(Line[] lines)
unsynchronize in interface MixerMixer.unsynchronize(javax.sound.sampled.Line[])private int getMaxInChannels()
private int getMaxOutChannels()
public boolean isSynchronizationSupported(Line[] lines,
boolean maintainSync)
isSynchronizationSupported in interface MixerMixer.isSynchronizationSupported(javax.sound.sampled.Line[],
boolean)public Line.Info getLineInfo()
getLineInfo in interface LineLine.getLineInfo()
public void open()
throws LineUnavailableException
open in interface LineLineUnavailableExceptionLine.open()public void close()
close in interface LineLine.close()void close(long seq)
seq - The sequence numberpublic boolean isOpen()
isOpen in interface LineLine.isOpen()public Control[] getControls()
getControls in interface LineLine.getControls()public boolean isControlSupported(Control.Type control)
isControlSupported in interface LineLine.isControlSupported(javax.sound.sampled.Control.Type)public Control getControl(Control.Type control)
getControl in interface LineLine.getControl(javax.sound.sampled.Control.Type)public void addLineListener(LineListener listener)
addLineListener in interface LineLine.addLineListener(javax.sound.sampled.LineListener)public void removeLineListener(LineListener listener)
removeLineListener in interface LineLine.removeLineListener(javax.sound.sampled.LineListener)private void notifyListeners(LineEvent e)
e - The LineEvent
void openLine(ASIODataLine line)
throws LineUnavailableException
line - The ASIODataLine the askes to be opened
LineUnavailableExceptionint getPreferredBufferSize()
void openLine(ASIODataLine line,
int buffersize)
throws LineUnavailableException
line - The ASIODataLine which requests to be openedbuffersize - The requested buffersize in sample frames
LineUnavailableException - If other lines are already open on this Mixer or if the
driver could not be initializedvoid startLine(ASIODataLine line)
line - The ASIODataLine which requests to be started
private void prepare(ASIODataLine[] lines,
int buffersize)
lines - The ASIODataLines which should be synchronizedbuffersize - The buffersize in sample framesprivate int getBufferSizeGranularity()
void stopLine(ASIODataLine line)
line - The ASIODataLine which requested to be stoppedlong getMicrosecondPosition()
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 immediately
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)
void closeLine(ASIODataLine line,
long seq)
line - The ASIODataLine which requests to be closedseq - The sequence number with which this line was openeddouble getSampleRate()
long getSamplePosition()
public void addASIOListener(ASIOListener listener)
listener - The ASIOlistener to be addedpublic void removeASIOListener(ASIOListener listener)
listener - The ASIOListener to be removed
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)public void resetRequest(ASIOMixer mixer)
ASIOListener
resetRequest in interface ASIOListenermixer - The ASIOMixer representing the ASIO driverASIOListener.resetRequest(com.groovemanager.spi.asio.ASIOMixer)public boolean supportsBufferSizeChange()
ASIOListener
supportsBufferSizeChange in interface ASIOListenerASIOListener.supportsBufferSizeChange()
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)public boolean supportsResyncRequest()
ASIOListener
supportsResyncRequest in interface ASIOListenerASIOListener.supportsResyncRequest()public boolean resyncRequest(ASIOMixer mixer)
ASIOListener
resyncRequest in interface ASIOListenermixer - The ASIOMixer representing the ASIO driver
ASIOListener.resyncRequest(com.groovemanager.spi.asio.ASIOMixer)public boolean supportsLatenciesChanged()
ASIOListener
supportsLatenciesChanged in interface ASIOListenerpublic boolean latenciesChanged(ASIOMixer mixer)
ASIOListener
latenciesChanged in interface ASIOListenermixer - The ASIOMixer representing the ASIO driver
ASIOListener.latenciesChanged(com.groovemanager.spi.asio.ASIOMixer)public int getInputLatency()
public int getOutputLatency()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||