-
Notifications
You must be signed in to change notification settings - Fork 25
Home
Welcome to the JAsioHost wiki!
JAsioHost is released under the Lesser Gnu Public License (LGPL).
First you will need to put JAsioHost.jar
in your classpath and jasiohost.dll
into C:\WINDOWS\system32
. The basic design pattern for using JAsioHost
is written below. static
methods in JAsioHost
are used to collect information about the available drivers. getAsioDriver
is called in order to load and instantiate a given driver. The AsioDriver
can then be queried for channel state information. Audio buffers are created using createBuffers
, before start
is called. Callbacks are made from the driver in order to submit input and retrieve output. Always remember to call JAsioHost.shutdownAndUnloadDriver()
before exiting the program. Your system may crash if you do not.
List<String> driverNameList = JAsioHost.getDriverNames();
AsioDriver asioDriver = JAsioHost.getAsioDriver(driverNameList.get(0));
asioDriver.openControlPanel(); // may not work for all drivers on all platforms
Set<AsioChannelInfo> activeChannels = new HashSet<AsioChannelInfo>();
activeChannels.add(asioDriver.getChannelInfoOutput(0));
activeChannels.add(asioDriver.getChannelInfoOutput(1));
asioDriver.createBuffers(activeChannels, asioDriver.getBufferPreferredSize());
asioDriver.start();
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
ie.printStackTrace(System.err);
}
JAsioHost.shutdownAndUnloadDriver();
Note that you can only load on ASIO driver at time. This is a limitation of the original API (AFAIK).
The JAsioHost
API does not strictly reflect the original C++ API written by Steinberg. There are two reasons for this. The first is that some elements of the original API do not translate well due to language semantics. The second is that I felt that some things could be improved or simplified.
An example of the former is that the native API refers to an audio buffer by using a void
pointer. Java does not allow arrays to be referenced by a generic type. JAsioHost
therefore encapsulates an audio buffer by using a ByteBuffer
, which exposes the raw bytes of the native buffer, but also allows other types to be read and written with relative ease.
An example of the latter is the absence of the BufferInfo
structure in Java. I simply added a reference to the audio buffer to the active AsioChannelInfo
objects. As the audio buffer conceptually belongs to a channel, this seemed to make sense, and also remove a superfluous class.
My name is Martin Roth. I am the author of JAsioHost. Please feel free to contact me with any questions or comments at [email protected].