|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.synthbot.jasiohost.AsioDriver
public class AsioDriver
The AsioDriver
class represents an ASIO driver. Only one may be loaded at any
time. A new driver is instantiated with getDriver()
, supplied with the name of the
driver to load, as derived from getDriverNames()
.
All methods may throw an AsioException
, which is a RuntimeException
(i.e., it is not required to be caught). The error message will have some information about
what has gone wrong. Generally, it is not possible to recover from such errors, except for
shutting down the driver.
Note that most methods also throw an IllegalStateException
if the driver is not
in the appropriate state for that method to be called. For instance, if start()
is called before createBuffers()
, an IllegalStateException
will be
thrown.
After the driver has been instantiated with getDriver()
, the sequence of setup calls
are: createBuffers()
and then start()
. Once the driver has been started,
bufferSwitch()
will be called on any AsioDriverListener
s and audio can be
sent or received from the driver. In order to shut down the driver from the RUNNING
state, call: stop()
, disposeBuffers()
, exit()
, and
finally unloadDriver()
(if the driver should be fully unloaded from memory). Alternatively
returnToState()
can also be used in order to return the AsioDriver
to
a particular AsioDriverState
.
Method Summary | |
---|---|
void |
addAsioDriverListener(AsioDriverListener listener)
Add a new AsioDriverListener . |
boolean |
canSampleRate(double sampleRate)
Inquires of the hardware if a specific available sample rate is available. |
void |
createBuffers(java.util.Set<AsioChannel> channelsToInit)
Creates audio buffers for the set of designated channels. |
void |
disposeBuffers()
Remove the previously created audio buffers (with createBuffers() ). |
void |
exit()
Closes all data structures relating to the operation of the ASIO driver, though the driver remains loaded in memory. |
protected void |
finalize()
|
int |
getAsioVersion()
Returns the version of ASIO which this driver uses (currently 1 or 2). |
int |
getBufferGranularity()
|
int |
getBufferMaxSize()
Returns the maximum supported buffer size. |
int |
getBufferMinSize()
Returns the minimum supported buffer size. |
int |
getBufferPreferredSize()
Returns the preferred buffer size. |
AsioChannel |
getChannelInput(int index)
Get information about an input channel. |
AsioChannel |
getChannelOutput(int index)
Get information about an output channel. |
static AsioDriver |
getCurrentDriver()
Returns the currently loaded AsioDriver . |
AsioDriverState |
getCurrentState()
Returns the current state of the ASIO driver. |
static AsioDriver |
getDriver(java.lang.String driverName)
The designated ASIO driver is loaded and returned in the INITIALIZED state. |
static java.util.List<java.lang.String> |
getDriverNames()
A list of all (maximum 32) ASIO drivers registered with the system is returned. |
int |
getLatencyInput()
Note: As getLatencyInput() will also have to include the audio buffer size of the
createBuffers() call, the application should call this function after the buffer creation. |
int |
getLatencyOutput()
Note: As getLatencyOutput() will also have to include the audio buffer size of the
createBuffers() call, the application should call this function after the buffer creation. |
java.lang.String |
getName()
Returns the name of the driver. |
int |
getNumChannelsInput()
Returns the number of available input channels. |
int |
getNumChannelsOutput()
Returns the number of available output channels. |
double |
getSampleRate()
Returns the current sample rate to which the host is set. |
int |
getVersion()
Returns the version of the driver. |
static boolean |
isDriverLoaded()
Returns true if a driver is currently loaded, false otherwise. |
void |
openControlPanel()
Open the native control panel, allowing the user to adjust the ASIO settings. |
void |
removeAsioDriverListener(AsioDriverListener listener)
Unregister an AsioDriverListener . |
void |
returnToState(AsioDriverState targetState)
Return the driver to a given state. |
void |
shutdownAndUnloadDriver()
Shutdown the ASIO driver, regardless of what state it is in. |
void |
start()
Start the driver. |
void |
stop()
Stop the driver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static AsioDriver getDriver(java.lang.String driverName)
INITIALIZED
state. If a driver is
already loaded and it is the named driver, then that driver object is returned. If the named
driver is different from the one currently loaded, then the currently loaded driver is shut
down and a new one is instantiated. There is only ever one loaded driver.
driverName
- The name of the driver to load, as returned by getDriverNames()
.
AsioException
- Thrown if the driver could not be loaded into memory.
java.lang.NullPointerException
- Thrown if the input is null
.public static AsioDriver getCurrentDriver()
AsioDriver
. If no driver is loaded, null
is returned. Check to see if a driver is currently loaded with isDriverLoaded()
.
public static boolean isDriverLoaded()
true
if a driver is currently loaded, false
otherwise.
public static java.util.List<java.lang.String> getDriverNames()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String getName()
public int getVersion()
public int getAsioVersion()
public AsioDriverState getCurrentState()
public void exit()
INITIALIZED
state to the
LOADED
state.
public void openControlPanel()
public int getNumChannelsInput()
public int getNumChannelsOutput()
public double getSampleRate()
public boolean canSampleRate(double sampleRate)
sampleRate
- The sample rate in question.
public int getBufferMinSize()
public int getBufferMaxSize()
public int getBufferPreferredSize()
public int getBufferGranularity()
public int getLatencyInput()
getLatencyInput()
will also have to include the audio buffer size of the
createBuffers()
call, the application should call this function after the buffer creation.
In the case that the call occurs beforehand the driver should assume preferred buffer size.
public int getLatencyOutput()
getLatencyOutput()
will also have to include the audio buffer size of the
createBuffers()
call, the application should call this function after the buffer creation.
In the case that the call occurs beforehand the driver should assume preferred buffer size.
public AsioChannel getChannelInput(int index)
AsioChannel
object
is persistent for as long as the driver is INITIALIZED
, and can be retrieved
in any context.
index
- The input channel index to get information about.
AsioChannel
object representing the requested input channel.
java.lang.IndexOutOfBoundsException
- Thrown if the requested channel index is out of bounds. The
channel does not exist.public AsioChannel getChannelOutput(int index)
AsioChannel
object
is persistent for as long as the driver is INITIALIZED
, and can be retrieved
in any context.
index
- The output channel index to get information about.
AsioChannel
object representing the requested output channel.
java.lang.IndexOutOfBoundsException
- Thrown if the requested channel index is out of bounds. The
channel does not exist.public void createBuffers(java.util.Set<AsioChannel> channelsToInit)
getBufferPreferredSize()
.
channelsToInit
- A Set
of AsioChannelInfo
objects designating the
input and output channels to initialise and create audio buffers for.public void disposeBuffers()
createBuffers()
). The active
channels are reset; all channels become inactive.
public void start()
bufferSwitch()
. Puts the AsioDriver
into the RUNNING
state.
public void stop()
bufferSwitch()
will cease. The AsioDriver
returns to the PREPARED
state.
public void shutdownAndUnloadDriver()
returnToState(AsioDriverState.UNLOADED)
.
public void returnToState(AsioDriverState targetState)
targetState
- The state to which the driver should return.public void addAsioDriverListener(AsioDriverListener listener)
AsioDriverListener
. Listeners can only be updated while the driver
is in the LOADED or INITIALIZED state.
listener
- A new AsioDriverListener
which should be sent callbacks.public void removeAsioDriverListener(AsioDriverListener listener)
AsioDriverListener
. Listeners can only be updated while the driver
is in the LOADED or INITIALIZED state.
listener
- A previously registered AsioDriverListener
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |