On Mon, Feb 13, 2012 at 6:15 PM, Jonathan Woithe <jwoithe@just42.net> wrote:
Hi Patrick

> > > Would there be any conflict when using Ardour for the recording?
> >
> > I guess that would depend on what the controller did and how it interacted
> > with the streaming system.  If all you're doing is controlling the onboard
> > mixer I can't see that it would cause ardour any issues.
> >
> The main thing is I wouldn't want ardour to "grab" the controller data and
> prevent this other software from communicating with the controller.

Ardour (and any other audio software) does not attempt to control the
firewire interface in any way except for the sample rate (and at the end of

I'm sorry, but I meant the MIDI controller.  Ardour has MIDI support, so I don't want it trying to open the same MIDI device my app will need.  Or if there is a library or driver with some abstraction that allows multiple applications to speak to the same MIDI device (and play nice with each other), then I should be using that instead of the raw /dev/midi1 device.
 
> I was thinking something like the Behringer BCF 2000.  Mainly to get
> faders.  Control buttons to select the different mix buses would be nice,
> as well as mute and pan controls.  Some way to easily configure how the
> controller's controls map to hardware controls would be good, too.

That sounds fair.

To use the BCF-2000 for your task you'd have to first work out a way to get
access to its MIDI data.  As far as I can tell the BCF-2000 is a USB device
which shows up as an ALSA MIDI interface.  This means you'd read the
control data in the same way you'd read any other MIDI data from ALSA.
Finding example code to do this shouldn't be difficult.


I'll look into this.  It might be the abstraction layer I'm looking for.
 
> Yes, send the data to the PC (this MOTU can't speak MIDI).  Then the
> software on the PC turns the MIDI control data into control messages over
> the firewire bus (via ffado-dbus-server, as you suggest below).

Ok, that seems perfectly doable to me.

> > If it is then the only software which you require which is not yet in
> > existance is the bridging software from MIDI to the interface.  This
> > would not be hard to write and would have only a weak binding to ffado
> > itself. You may or may not be aware that ffado-mixer is really just a
> > PyQt skin around dbus controls provided by ffado-dbus-server.  So this
> > new software would just need to do is take incoming MIDI control
> > messages, translate them into the (straight-forward) form expected by
> > ffado-dbus-server's dbus nodes, and send them out to the applicable dbus
> > nodes.
> >
> Thanks.  I program in Qt a lot at work and at home.  I'll look into how to
> communicate with a MIDI device.

You'd have options here.  There are various libraries around which abstract
the MIDI side of things somewhat.  Alternatively, maybe directly opening the
MIDI device yourself is feasible in this case.

> Is there some documentation on the dbus interface for ffado-dbus-server?
> Otherwise I can probably figure it out through the ffado-mixer code.

Referring to the ffado-mixer code is probably your best bet.  The main issue
is that because every firewire interface is very different in its control
structure, there is no standard dbus interface presented by
ffado-dbus-server.  Documenting the dbus nodes supported by each interface
is certainly something which should be done, but to my knowledge none of us
have had time to do so yet.

In the case of the 896HD, the file which will of most use is

 libffado/support/mixer-qt4/ffado/mixer/motu.py

This is probably the place where it's easiest to see what dbus nodes are
provided without having to read a lot of code: in init() you'll find a list
of all the dbus controls as they are linked to GUI elements.  While you
could determine the same information by reading src/motu/motu_mixer.cpp
(MotuDevice::buildMixerAudioControls() in particular) things are less clear
there due to the extensive use of iterations.

For the mixer the MOTU exports a number of matrix mixer controls:
/Mixer/fader, /Mixer/pan, /Mixer/mute, /Mixer/solo.  The first index (the
row) is the zero-based mix number while the second (the column) is the the
zero-based channel index.  There are also a bunch of other switches and
stand-alone controls for other things (level switches, mix faders and so
on).  Feel free to email me if you have any questions about these.

Precisely how these are accessed via dbus outside the context of the python
ffado-mixer code I am not sure.  You may have to dig further into ffado's
python support functions to find this.  Then again, we use the python
bindings to dbus so I suspect it won't be hard to move to another binding if
that's where you're heading.

Thanks!  I have a MIDI (over USB) keyboard, so I'm using that to play around with.  I have a "hello, MIDI" app that plays a middle C.  Now I want to see if I can get some of the keyboard keys to map to the MOTU controls.

Patrick