From: Tom Breton (Tehom) <tehom@pa...> - 2012-03-16 00:24:00
I found another bug in logical-instruments. I'm glad I waited and ran
thru (almost) a full development cycle of something I'm writing, or I
wouldn't have caught it.
The bug: When you save the document, all the controllers go back to their
defaults. It happens when RosegardenDocument::saveDocumentActual sets the
The diagnosis: It's a consequence of an earlier fix of mine, for the bug
where loading a document could set controllers badly (like expression
controller to zero). I fixed that by making MidiDevice reconsider static
controller settings when it is set to a new connection. Two things wrong:
* When connection hasn't really changed, resetting controllers is the
wrong thing to do. That's the direct cause of the bug.
* Device's m_connection field isn't kept in sync. Initially it
doesn't think it is connected. So the first time we save the
document, Device thinks it just changed connections.
The fix, two parts:
* I made setConnection does nothing if the new connection is the same
as the old (compare by name).
* I try to keep Device's connection always in sync
* We set it when we load a document. That's the major one.
Everything else would iron itself out after one save.
* CreateOrDeleteDevice now sets connection too.
* RosegardenMainWindow::setDocument syncs all connections
That seems to cover all the calls to AlsaDriver that change connections,
and it seems to fix all the symptoms.
It'd be nice to do it more cleanly. Unfortunately the options seem to be
* Can't just set it in Studio::addDevice and a few other calls to
Device ctors. addDevice seems to be called before connections
are found, and in any case their timing just doesn't correspond
to when AlsaDriver sets connections.
* Setting it in Device ctors has the same problem.
* All the relevant calls funnel thru RosegardenSequencer, but
that's on the mapped side and has no real access to Studio and
the device list.
Tom Breton (Tehom)