> On Sun, 20 Jan 2013, Tim Munro wrote:
>
>> Holger Marzen wrote:
>>
>>> By trying some tricks with grouping I noticed that I can't set the audio
>>> mixer to 8 submasters. Rosegarden crashes immediately.
>> Hi Holger.
>>
>> There is a special trick involved here. It isn't a fix, but it works for me,
>> as I've been too lazy to fix it right.
>>
>> When you open the audio mixer and try to set the number of submasters, the
>> control will initially indicate "No Submasters," regardless of how many
>> submasters are actually present.
>>
>> Click on "No Submasters" even though the control appears to indicate this
>> already. The existing submasters will disappear.
>>
>> Now when you reopen the Settings menu, you should be able to set eight
>> submasters.
> Indeed. Works for me. Thanks for the hint.
>
> But it would be cool if someone could fix this UI-type bug.
OK. I've taken another look at this issue, and here's what I've found.
Changing the number of submasters involves requesting copies of existing
plugins at src/gui/studio/AudioMixerWindow.cpp, line 1421:
dups.push_back(new Buss(*busses[i + 1]));
The resulting copies have, however, been defective, resulting in a crash
at src/document/RosegardenDocument.cpp, line 1038:
plugin->getIdentifier().c_str());
The program was puking when it sucked up garbage instead of the expected
string.
I've dealt with the issue by cobbling together an ugly, complicated copy
constructor for the PluginContainer class.
The resulting code appears to work, but I have no idea what sort of memory
leaks or other future train wrecks I might have introduced while beating
it into submission.
I've also added some minor tweaks to ensure the "Number of Stereo Inputs"
and "Number of Submasters" menu checkboxes correctly display the initial
state of a file.
Tim Munro
--- src/gui/studio/AudioMixerWindow.cpp 2013-01-07 13:43:39.000000000 -0800
+++ src/gui/studio/AudioMixerWindow.cpp 2013-02-09 19:49:14.938682499 -0800
@@ -130,26 +130,45 @@
createAction("show_unassigned_faders", SLOT(slotToggleUnassignedFaders()))
->setChecked(mixerOptions & MIXER_SHOW_UNASSIGNED_FADERS);
- QAction *action = 0;
+ QAction *ri_action[17];
+ for (int i = 0; i < 17; i++){
+ ri_action[i] = 0;
+ }
for (int i = 1; i <= 16; i *= 2) {
- action = createAction
+ ri_action[i] = createAction
(QString("inputs_%1").arg(i), SLOT(slotSetInputCountFromAction()));
- if (i == int(m_studio->getRecordIns().size()))
- action->setChecked(true);
+ }
+
+ QAction *sm_action[9];
+ for (int i = 0; i < 9; i++){
+ sm_action[i] = 0;
}
createAction("submasters_0", SLOT(slotSetSubmasterCountFromAction()));
for (int i = 2; i <= 8; i *= 2) {
- action = createAction
+ sm_action[i] = createAction
(QString("submasters_%1").arg(i),
SLOT(slotSetSubmasterCountFromAction()));
-
- if (i == int(m_studio->getBusses().size()) - 1)
- action->setChecked(true);
}
createGUI("mixer.rc");
+
+ // The action->setChecked() stuff must be done after createGUI("mixer.rc"),
+ // if the initial "Number of stereo Inputs" and "Number of Submasters"
+ // menus are to reflect reality.
+ for (int i = 1; i <= 16; i *= 2) {
+ if (i == int(m_studio->getRecordIns().size())) {
+ ri_action[i]->setChecked(true);
+ }
+ }
+ // "submasters_0" is checked by default in data/rc/mixer.rc
+ for (int i = 2; i <= 8; i *= 2) {
+ if (i == int(m_studio->getBusses().size()) - 1) {
+ sm_action[i]->setChecked(true);
+ }
+ }
+
setRewFFwdToAutoRepeat();
// We must populate AFTER the actions are created, or else all the
@@ -692,6 +711,8 @@
// rec.m_plugins[index]->setPaletteBackgroundColor(pluginBgColour);
}
}
+ // A rather crude way to force an immediate update of buttons' appearance.
+ populate();
}
void
--- src/base/Instrument.h 2013-01-07 13:43:44.000000000 -0800
+++ src/base/Instrument.h 2013-02-07 14:54:03.258905554 -0800
@@ -92,6 +92,7 @@
protected:
PluginContainer(bool havePlugins);
+ PluginContainer(PluginContainer &);
virtual ~PluginContainer();
std::vector<AudioPluginInstance*> m_audioPlugins;
--- src/base/Instrument.cpp 2013-01-07 13:43:44.000000000 -0800
+++ src/base/Instrument.cpp 2013-02-09 18:50:42.088570088 -0800
@@ -45,6 +45,35 @@
}
}
+// Copy constructor
+// This was added to avert a crash when changing the number of submasters in an
+// existing composition. It explicitly copies enough stuff to preserve
+// existing LADSPA plugins and their settings. Should it do more?
+//
+PluginContainer::PluginContainer(PluginContainer &pic)
+{
+ PluginInstanceIterator plugit = pic.m_audioPlugins.begin(); //
(std::vector<AudioPluginInstance*>::iterator)
+
+ for (; plugit != pic.m_audioPlugins.end(); plugit++) {
+ AudioPluginInstance *api = new
AudioPluginInstance((*plugit)->getPosition());
+ (api)->setIdentifier((*plugit)->getIdentifier());
+
+ if ((*plugit)->getMappedId() != -1) {
+ (api)->setAssigned((*plugit)->isAssigned());
+ (api)->setBypass((*plugit)->isBypassed());
+
+ if ((*plugit)->getPortCount() > 0) {
+ PortInstanceIterator portit = (*plugit)->begin();
+
+ for (; portit != (*plugit)->end(); portit++) {
+ api->addPort((*portit)->number, (*portit)->value);
+ }
+ }
+ }
+ addPlugin(api);
+ }
+}
+
PluginContainer::~PluginContainer()
{
clearPlugins();
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel