File indexing completed on 2024-05-12 03:52:13

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022 
0023 #include "csengine.h"
0024 #include <QCoreApplication>
0025 #include <QDebug>
0026 #include <QDir>
0027 #include <QFile>
0028 #include <QStandardPaths>
0029 #include <QStringList>
0030 
0031 CsEngine::CsEngine()
0032 {
0033     m_fileName = (char *)"./template.csd";
0034 }
0035 
0036 void CsEngine::run()
0037 {
0038     cs.setOpenSlCallbacks();  // for android audio to work
0039     QFile file(m_fileName);
0040     file.open(QIODevice::ReadOnly);
0041     qDebug() << "Template: ";
0042     while (!file.atEnd()) {
0043         qDebug() << file.readLine();
0044     }
0045     file.close();
0046     qWarning() << "Dir " << QDir::currentPath() << " contains sf_GMbank.sf2? "
0047                << QDir::current().entryList(QDir::Files).contains("sf_GMbank.sf2");
0048     qWarning() << "Dir " << QCoreApplication::applicationDirPath()
0049                << " contains libfluidOpcodes.so? "
0050                << QDir(QCoreApplication::applicationDirPath())
0051                       .entryList(QDir::Files)
0052                       .contains("libfluidOpcodes.so");
0053     qDebug() << "READING " << QDir::currentPath() + "/template.csd";
0054     qDebug() << "SOUNDFONT EXISTS? "
0055              << QFile("/data/data/org.kde.minuet/files/sf_GMbank.sf2").exists() << " "
0056              << QFileInfo("/data/data/org.kde.minuet/files/sf_GMbank.sf2").size() << "b";
0057     if (cs.Compile(m_fileName)) {
0058         cs.Start();
0059         cs.Perform();
0060         cs.Cleanup();
0061         cs.Reset();
0062         cs.Stop();
0063     }
0064 }
0065 
0066 void CsEngine::stop()
0067 {
0068     //    cs.Stop();
0069 }
0070 
0071 #include "moc_csengine.cpp"