From 030457faadce72a099193617237d5b7dcc792c87 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sat, 17 Sep 2011 08:35:55 +0000 Subject: Fixed errors when ladspa plugins not found while loading. Fixed forgotten bool to pointer conversion in some calls to song::addTrack, createSynthI. --- muse2/ChangeLog | 3 ++ muse2/muse/arranger/pcanvas.cpp | 6 ++-- muse2/muse/confmport.cpp | 2 +- muse2/muse/plugin.cpp | 67 +++++++++++++++++++++++++++-------------- muse2/muse/remote/pyapi.cpp | 2 +- 5 files changed, 53 insertions(+), 27 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 960d558f..6674512d 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,6 @@ +16.09.2011: + - Fixed errors when ladspa plugins not found while loading. (Tim) + - Fixed forgotten bool to pointer conversion in some calls to song::addTrack, createSynthI. (Tim) 14.09.2011: - added sane configuration defaults to muse (flo93) - several minor fixes (flo93) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 9e27ca41..d6ae1300 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -332,7 +332,7 @@ UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragT ntrack = tracks->size(); if (MusEGlobal::debugMsg) printf("PartCanvas::moveItem - add new track\n"); - Track* newTrack = song->addTrack(type, false); // Add at end of list. + Track* newTrack = song->addTrack(type); // Add at end of list. if (type == Track::WAVE) { WaveTrack* st = (WaveTrack*) track; WaveTrack* dt = (WaveTrack*) newTrack; @@ -3138,9 +3138,9 @@ void PartCanvas::viewDropEvent(QDropEvent* event) if (!track) { // we need to create a track for this drop if (text.endsWith(".mpt", Qt::CaseInsensitive)) { - track = song->addTrack(Track::MIDI, false); // Add at end of list. + track = song->addTrack(Track::MIDI); // Add at end of list. } else { - track = song->addTrack(Track::WAVE, false); // Add at end of list. + track = song->addTrack(Track::WAVE); // Add at end of list. } } if (track->type() == Track::WAVE && diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index 6e371d0e..724b5a51 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -1341,7 +1341,7 @@ void MPConfig::addInstanceClicked() QTreeWidgetItem* item = synthList->currentItem(); if (item == 0) return; - SynthI *si = song->createSynthI(item->text(0), item->text(2), false); // Add at end of list. + SynthI *si = song->createSynthI(item->text(0), item->text(2)); // Add at end of list. if(!si) return; diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index e2170ebb..53e3d471 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -2252,22 +2252,25 @@ bool PluginI::loadControl(Xml& xml) // p4.0.23 Special for loader - bypass the ring buffer and store directly, // so that upon the 'gui = 1' tag (show the gui), the gui has immediate // access to the values. - bool found = false; - for(unsigned long i = 0; i < controlPorts; ++i) - { - if(_plugin->portName(controls[i].idx) == name) - { - controls[i].val = controls[i].tmpVal = val; - found = true; - } - } - if(!found) - { - printf("PluginI:loadControl(%s, %f) controller not found\n", - name.toLatin1().constData(), val); - return false; - } - initControlValues = true; + if(_plugin) + { + bool found = false; + for(unsigned long i = 0; i < controlPorts; ++i) + { + if(_plugin->portName(controls[i].idx) == name) + { + controls[i].val = controls[i].tmpVal = val; + found = true; + } + } + if(!found) + { + printf("PluginI:loadControl(%s, %f) controller not found\n", + name.toLatin1().constData(), val); + return false; + } + initControlValues = true; + } } return true; default: @@ -2304,11 +2307,22 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset) //if (_plugin && initPluginInstance(_plugin, instances)) { // p3.3.41 - if (_plugin && initPluginInstance(_plugin, channel)) { + if (_plugin) + { + if(initPluginInstance(_plugin, channel)) { _plugin = 0; xml.parse1(); - break; + printf("Error initializing plugin instance (%s, %s)\n", + file.toLatin1().constData(), label.toLatin1().constData()); + //break; // Don't break - let it read any control tags. } + } + else + { + //printf("Warning: Plugin not found (%s, %s)\n", + // file.toLatin1().constData(), label.toLatin1().constData()); + //break; // Don't break - let it read any control tags. + } } if (tag == "control") loadControl(xml); @@ -2319,7 +2333,8 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset) } else if (tag == "gui") { bool flag = xml.parseInt(); - showGui(flag); + if (_plugin) + showGui(flag); } else if (tag == "nativegui") { // We can't tell OSC to show the native plugin gui @@ -2368,12 +2383,20 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset) if (!readPreset && _plugin == 0) { _plugin = plugins.find(file, label); if (_plugin == 0) - return true; - + { + printf("Warning: Plugin not found (%s, %s)\n", + file.toLatin1().constData(), label.toLatin1().constData()); + return true; + } + //if (initPluginInstance(_plugin, instances)) // p3.3.41 if (initPluginInstance(_plugin, channel)) - return true; + { + printf("Error initializing plugin instance (%s, %s)\n", + file.toLatin1().constData(), label.toLatin1().constData()); + return true; + } } if (_gui) _gui->updateValues(); diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index c9f9470f..27a44e49 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -1127,7 +1127,7 @@ bool Song::event(QEvent* _e) break; } case QPybridgeEvent::SONG_ADD_TRACK: - song->addTrack((Track::TrackType)e->getP1(), false); // Add at end of list. + song->addTrack((Track::TrackType)e->getP1()); // Add at end of list. break; case QPybridgeEvent::SONG_CHANGE_TRACKNAME: { Track* t = this->findTrack(e->getS1()); -- cgit v1.2.3