Skip to content
mhroth edited this page Sep 13, 2010 · 19 revisions

Welcome to the JAsioHost wiki!

License

JAsioHost is released under the Lesser Gnu Public License (LGPL).


Javadoc

Javadocs are located at http://mhroth.github.com/jasiohost/.


Getting Started

Place JAsioHost.jar into your classpath and jasiohost.dll into C:\WINDOWS\system32. The basic design pattern for using JAsioHost is written below. static methods in AsioDriver are used to collect information about the available drivers. getDriver 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 to registered AsioDriverListener objects in order to submit input and retrieve output.


List<String> driverNameList = AsioDriver.getDriverNames();
AsioDriver asioDriver = AsioDriver.getDriver(driverNameList.get(0));
Set<AsioChannel> activeChannels = new HashSet<AsioChannel>();
activeChannels.add(asioDriver.getChannelOutput(0));
activeChannels.add(asioDriver.getChannelOutput(1));
asioDriver.createBuffers();
asioDriver.start();
try {
  Thread.sleep(1000);
} catch (InterruptedException ie) {
  ie.printStackTrace(System.err);
}
AsioDriver.shutdownAndUnloadDriver();

Note that you can only load on ASIO driver at time. This is a limitation of the original API (AFAIK).


Note on Compilation

If you are brave enough to try to compile the native component, please note the following helpful tips.

  • ./common/asiodrvr.cpp is not necessary. Rename or remove it.
  • ./common/dllentry.cpp is not necessary. Rename or remove it.
  • Line 219 of ./commong/combase.h, #if WINVER < 0x0501, should be replaced with #if 0. See here.

A Note about API Translation

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 opaquely. 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 ASIOBufferInfo structure in Java. I simply added a reference to the audio buffer to the active AsioChannel objects. As the audio buffer conceptually belongs to a channel, this seemed to make sense, and also remove a superfluous class.


Contact

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].

Clone this wiki locally