I'm almost done with a unittest for lilypond export.

The heart of it is:

   RosegardenDocument doc(0, 0, true /*skip autoload*/, true, false /*no 
sequencer*/);
    doc.openDocument(input, false /*not permanent, i.e. don't create midi 
devices*/, true /*no progress dlg*/);
    LilyPondExporter exporter(&doc, SegmentSelection(), qstrtostr(fileName));
    QVERIFY(exporter.write());
    // and then compare the contents of "fileName" with a "baseline" file 
(expected contents, saved in SVN).

Despite the arguments "useSequencer=false" for the constructor
and "permanent=false" for openDocument()  (which sets m_createDevices in the 
XML parser),
I still see one case which ends up creating the sequencer (and audio drivers 
etc.):

0       Rosegarden::AlsaDriver::AlsaDriver      AlsaDriver.cpp  123     
0x7ffff6eff1bb  
1       Rosegarden::SoundDriverFactory::createDriver    SoundDriverFactory.cpp  
34      0x7ffff6f45ab3  
2       Rosegarden::RosegardenSequencer::RosegardenSequencer    
RosegardenSequencer.cpp 86      0x7ffff6fe34db  
3       Rosegarden::RosegardenSequencer::getInstance    RosegardenSequencer.cpp 
118     0x7ffff6fe39d2  
4       Rosegarden::StudioControl::sendMappedEventList  StudioControl.cpp       
192     0x7ffff6da3cc9  
5       Rosegarden::StudioControl::sendController       StudioControl.cpp       
258     0x7ffff6da4004  
6       Rosegarden::Instrument::setControllerValue      Instrument.cpp  700     
0x7ffff6e2404f  
7       Rosegarden::RoseXmlHandler::startElement        RoseXmlHandler.cpp      
1688    0x7ffff693cb08  
8       QXmlSimpleReaderPrivate::processElementEmptyTag qxml.cpp        4022    
0x7ffff4ebb780  
9       QXmlSimpleReaderPrivate::parseElement   qxml.cpp        3990    
0x7ffff4ebb518  
10      QXmlSimpleReaderPrivate::parseContent   qxml.cpp        4443    
0x7ffff4ebd966  
11      QXmlSimpleReaderPrivate::parseElement   qxml.cpp        3969    
0x7ffff4ebb3ad  
12      QXmlSimpleReaderPrivate::parseContent   qxml.cpp        4443    
0x7ffff4ebd966  
13      QXmlSimpleReaderPrivate::parseElement   qxml.cpp        3969    
0x7ffff4ebb3ad  
14      QXmlSimpleReaderPrivate::parseContent   qxml.cpp        4443    
0x7ffff4ebd966  
15      QXmlSimpleReaderPrivate::parseElement   qxml.cpp        3969    
0x7ffff4ebb3ad  
16      QXmlSimpleReaderPrivate::parseContent   qxml.cpp        4443    
0x7ffff4ebd966  
17      QXmlSimpleReaderPrivate::parseElement   qxml.cpp        3969    
0x7ffff4ebb3ad  
18      QXmlSimpleReaderPrivate::parseBeginOrContinue   qxml.cpp        3514    
0x7ffff4eb9a4e  
19      QXmlSimpleReader::parse qxml.cpp        3456    0x7ffff4eb9891  
20      QXmlSimpleReader::parse qxml.cpp        3393    0x7ffff4eb96b2  
21      Rosegarden::RosegardenDocument::xmlParse        RosegardenDocument.cpp  
1669    0x7ffff69d32fc  
22      Rosegarden::RosegardenDocument::openDocument    RosegardenDocument.cpp  
561     0x7ffff69cc8f9  
23      TestLilypondExport::testExamples        lilypond_export_test.cpp        
136     0x409ed5        

Is it really wanted that merely loading a file in memory would send MIDI events 
out?
   The code at frame 7 in the above backtrace is:
                m_instrument->setControllerValue(MIDI_CONTROLLER_PAN, value);
                m_instrument->setSendPan(true);

Should I put an if(m_createDevices) around that maybe? (but then maybe the name 
of that
variable isn't correct; this is really set to the "permanent" argument of 
Document, so possibly
the meaning of that bool in the parser could be generalized to "don't touch 
midi"?).



==

There was another case of unwanted audio initialization but this patch fixes 
it. Looks ok?
commit 732d3fb065256deacd4bba3a8a8a144cb10d0890
Author: David Faure <fa...@kde.org>
Date:   Sat Nov 14 20:29:29 2015 +0100

    Another fix for not initializing the sequencer when we don't want to.
    
    From the Document::openDocument docu: "when permanent is false,
    the sequencer's device list will be left alone". Now this is true ;)

diff --git a/src/document/RoseXmlHandler.cpp b/src/document/RoseXmlHandler.cpp
index d4a7e44..defbd5d 100644
--- a/src/document/RoseXmlHandler.cpp
+++ b/src/document/RoseXmlHandler.cpp
@@ -1338,7 +1338,8 @@ RoseXmlHandler::startElement(const QString& namespaceURI,
                 setMIDIDeviceConnection(connection);
             }
 
-            setMIDIDeviceName(nameStr);
+            if (m_createDevices)
+                setMIDIDeviceName(nameStr);
 
             QString vstr = atts.value("variation").toLower();
             MidiDevice::VariationType variation =

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5


------------------------------------------------------------------------------
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to