0

So, I decided to use JAsioHost ( https://github.com/mhroth/jasiohost ) to output audio through ASIO in my program.

Interaction with ASIO is done via an instance of AsioDriverListener interface. ASIO host will call its void bufferSwitch(long sampleTime, long samplePosition, Set<AsioChannel> activeChannels) method each time it wants new samples to playback. If I want to output mono sound, I just write the same data in all channels in the activeChannels. But what if I want to make something more complex and therefore need to know exact channel configuration?

In the simple test stub program ( http://pastebin.com/sC870VJR ) the activeChannels set is printed like:

#{#<AsioChannel Output Channel 0: HD Audio output 1, ASIOSTInt32LSB, group 0, inactive>
  #<AsioChannel Output Channel 1: HD Audio output 2, ASIOSTInt32LSB, group 0, inactive>}

So I can know an index of each channel. The question is - how to determine which channel is really left, right, center, and so on?.. Or there is no way and I should leave it to user, who will manually tell their positions?

Display Name
  • 8,022
  • 3
  • 31
  • 66

2 Answers2

1

The purpose of ASIO is to provide high-performance abstraction for multi-channel audio interfaces.

In the domain that it was designed - that is to say professional audio applications - channels counts are often much higher than two, and whether any pair of channels is a stereo bus - and which channel is which - really depends on how the user has connected the inputs and outputs of their interface.

The ASIO API doesn't provide a means of retrieving routing information for channels - such as name-labels or where they are connected to. Even - as is often the case - the audio interface's control panel software does have this facility.
This has been a long-standing deficit in ASIO.

The use of a group of channels (e.g. a stereo or 5.1 bus) is purely convention. At least in stereo applications, the left channel is usually the lower numbered channel of the sequential pair.

If you're using MacOSX, CoreAudio does provide both names channels and meaning audio routing data. As ASIO works as a thin wrapper between the application and the CoreAudio APIs, you could obtain this.

marko
  • 9,029
  • 4
  • 30
  • 46
0

You could write some code which outputs audio to only one channel (say channel 1), and listen to which side is played (assuming your rig is set up right). Do the same for each of the channels (assuming more than just two ... if it is just two you can stop at testing one channel) The centre channel would be the same as the "mono" channel that you refer to in your question. CHEERS

happy coder
  • 1,517
  • 1
  • 14
  • 29
  • Of course, I can. But it can be different on different systems, right? – Display Name Jan 05 '13 at 18:57
  • Of course, if someone else thinks that the right channel is the left on their hardware then the channels will be "different". There is no way of guarenteeing what another person is going to do. So what I suggest is as good as "knowing" what the author of the software had in mind. BUT if you are set up correctly, and the user of your software is connected properly, they should have the same experience as you had intended. CHEERS! – happy coder Jan 06 '13 at 03:27