From b121a3b91f0e288934c4d78161ff1d20f96ff861 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sun, 28 Nov 2010 21:10:42 +0000 Subject: Deicsonze2 added (!!) Fresh re-import from evolution. Werner's AWL and DOM xml added. --- muse2/CMakeLists.txt | 2 +- muse2/ChangeLog | 4 + muse2/al/CMakeLists.txt | 4 +- muse2/al/xml.cpp | 362 ++++++++++++++++++++++++++++++++++++++++++++ muse2/al/xml.h | 69 +++++++++ muse2/all.h | 100 +++--------- muse2/muse/plugin.h | 14 ++ muse2/synti/libsynti/mess.h | 6 + 8 files changed, 480 insertions(+), 81 deletions(-) create mode 100644 muse2/al/xml.cpp create mode 100644 muse2/al/xml.h diff --git a/muse2/CMakeLists.txt b/muse2/CMakeLists.txt index 2624a2c3..047cdc3e 100644 --- a/muse2/CMakeLists.txt +++ b/muse2/CMakeLists.txt @@ -361,7 +361,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g -DQT_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}") # subdirs(al awl grepmidi plugins midiplugins muse share synti) # subdirs(al lib grepmidi plugins xpm muse share demos doc synti utils) #subdirs(al lib grepmidi plugins muse share demos synti ) -subdirs(al grepmidi plugins muse share synti packaging utils demos) +subdirs(al awl grepmidi plugins muse share synti packaging utils demos) # Uninstall support configure_file( diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 53366a1b..26ccf925 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -2,6 +2,10 @@ - Finished porting Marker View. (Orcan) - Ported ctrlpanel. Needs some testing. I also removed usage of the Oxygen's "pen" icon in place of the pencil. The pen looks bad in ctrlpanel. (Orcan) + - Deicsonze2 added (!!) Fresh re-import from evolution. Test OK. (Tim) + TODO: Plugin controllers disabled - we need the Ctrl class. + Restoring of state (that's a MusE problem I think). + Fix deicsonze.cpp:3612: warning: deprecated conversion from string constant to ‘char*’ 27.11.2010 - Completed porting pianoroll module including menus, shortcuts. Should be done. (Tim) - Ported the following .ui widgets to Qt4: organguibase, gatetime, midisync, diff --git a/muse2/al/CMakeLists.txt b/muse2/al/CMakeLists.txt index 6075a399..044f1a8f 100644 --- a/muse2/al/CMakeLists.txt +++ b/muse2/al/CMakeLists.txt @@ -6,7 +6,7 @@ include(${PROJECT_SOURCE_DIR}/pch.txt) set (al_src - al.cpp dsp.cpp + al.cpp dsp.cpp xml.cpp ) if (USE_SSE) @@ -19,7 +19,7 @@ add_library(al STATIC ) set_source_files_properties( - al.cpp dsp.cpp + al.cpp dsp.cpp xml.cpp dspXMM.cpp PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h" ) diff --git a/muse2/al/xml.cpp b/muse2/al/xml.cpp new file mode 100644 index 00000000..7ae40b3e --- /dev/null +++ b/muse2/al/xml.cpp @@ -0,0 +1,362 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#include "xml.h" +#include "al.h" + +namespace AL { + +//--------------------------------------------------------- +// Xml +//--------------------------------------------------------- + +Xml::Xml() + { + level = 0; + } + +Xml::Xml(QIODevice* device) + : QTextStream(device) + { + setCodec("utf8"); + level = 0; + } + +//--------------------------------------------------------- +// putLevel +//--------------------------------------------------------- + +void Xml::putLevel() + { + for (int i = 0; i < level*2; ++i) + *this << ' '; + } + +//--------------------------------------------------------- +// header +//--------------------------------------------------------- + +void Xml::header() + { + *this << "" << endl; + } + +//--------------------------------------------------------- +// put +//--------------------------------------------------------- + +void Xml::put(const QString& s) + { + putLevel(); + *this << xmlString(s) << endl; + } + +//--------------------------------------------------------- +// stag +// +//--------------------------------------------------------- + +void Xml::stag(const QString& s) + { + putLevel(); + *this << '<' << s << '>' << endl; + ++level; + } + +//--------------------------------------------------------- +// etag +//--------------------------------------------------------- + +void Xml::etag(const char* s) + { + putLevel(); + *this << "' << endl; + --level; + } + +//--------------------------------------------------------- +// tagE +// +//--------------------------------------------------------- + +void Xml::tagE(const QString& s) + { + putLevel(); + *this << '<' << s << "/>" << endl; + } + +void Xml::tag(const char* name, int val) + { + putLevel(); + *this << '<' << name << '>' << val << "' << endl; + } + +void Xml::tag(const char* name, unsigned val) + { + putLevel(); + *this << '<' << name << '>' << val << "' << endl; + } + +void Xml::tag(const char* name, float val) + { + putLevel(); + *this << '<' << name << '>' << val << "' << endl; + } + +void Xml::tag(const char* name, const double& val) + { + putLevel(); + *this << '<' << name << '>' << val << "' << endl; + } + +void Xml::tag(const char* name, const QString& val) + { + putLevel(); + *this << "<" << name << ">" << xmlString(val) << "' << endl; + } + +void Xml::tag(const char* name, const QColor& color) + { + putLevel(); + *this << QString("<%1 r=\"%2\" g=\"%3\" b=\"%4\"/>") + .arg(name).arg(color.red()).arg(color.green()).arg(color.blue()) << endl; + } + +void Xml::tag(const char* name, const QWidget* g) + { + tag(name, QRect(g->pos(), g->size())); + } + +void Xml::tag(const char* name, const QRect& r) + { + putLevel(); + *this << "<" << name; + *this << QString(" x=\"%1\" y=\"%2\" w=\"%3\" h=\"%4\"/>") + .arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height()) << endl; + } + +//--------------------------------------------------------- +// xmlString +//--------------------------------------------------------- + +QString Xml::xmlString(const QString& ss) + { + QString s(ss); + s.replace('&', "&"); + s.replace('<', "<"); + s.replace('>', ">"); + s.replace('\'', "'"); + s.replace('"', """); + return s; + } + +//--------------------------------------------------------- +// readGeometry +//--------------------------------------------------------- + +QRect readGeometry(QDomNode node) + { + QDomElement e = node.toElement(); + int x = e.attribute("x","0").toInt(); + int y = e.attribute("y","0").toInt(); + int w = e.attribute("w","50").toInt(); + int h = e.attribute("h","50").toInt(); + return QRect(x, y, w, h); + } + +//--------------------------------------------------------- +// writeProperties +//--------------------------------------------------------- + +void Xml::writeProperties(const QObject* o) + { + const QMetaObject* meta = o->metaObject(); + + // + // start from dummy "muse" property, assuming this is the + // first muse propertie in widget hierarchy + // + int from = meta->indexOfProperty("muse") + 1; + int n = meta->propertyCount(); + for (int i = from; i < n; ++i) { + QMetaProperty p = meta->property(i); + if (!p.isScriptable()) + continue; + const char* name = p.name(); + QVariant v = p.read(o); + switch(v.type()) { + case QVariant::Bool: + case QVariant::Int: + tag(name, v.toInt()); + break; + case QVariant::Double: + tag(name, v.toDouble()); + break; + case QVariant::String: + tag(name, v.toString()); + break; + case QVariant::Rect: + tag(name, v.toRect()); + break; + case QVariant::Point: + { + QPoint p = v.toPoint(); + putLevel(); + *this << "<" << name << QString(" x=\"%1\" y=\"%2\" />") + .arg(p.x()).arg(p.y()) << endl; + } + break; + + default: + printf("MusE:%s type %d not implemented\n", + meta->className(), v.type()); + break; + } + } + } + +//--------------------------------------------------------- +// readProperties +//--------------------------------------------------------- + +void readProperties(QObject* o, QDomNode node) + { + const QMetaObject* meta = o->metaObject(); + + QDomElement e = node.toElement(); + QString tag(e.tagName()); + int idx = meta->indexOfProperty(tag.toLatin1().data()); + if (idx == -1) { + printf("MusE:%s: unknown tag %s\n", + meta->className(), tag.toLatin1().data()); + return; + } + QMetaProperty p = meta->property(idx); + QVariant v; + switch(p.type()) { + case QVariant::Int: + case QVariant::Bool: + v.setValue(e.text().toInt()); + break; + case QVariant::Double: + v.setValue(e.text().toDouble()); + break; + case QVariant::String: + v.setValue(e.text()); + break; + case QVariant::Rect: + v.setValue(AL::readGeometry(node)); + break; + case QVariant::Point: + { + int x = e.attribute("x","0").toInt(); + int y = e.attribute("y","0").toInt(); + v.setValue(QPoint(x, y)); + } + break; + default: + printf("MusE:%s type %d not implemented\n", + meta->className(), p.type()); + return; + } + if (p.isWritable()) + p.write(o, v); + } + +//--------------------------------------------------------- +// dump +//--------------------------------------------------------- + +void Xml::dump(int len, const unsigned char* p) + { + putLevel(); + int col = 0; + setFieldWidth(5); + setNumberFlags(numberFlags() | QTextStream::ShowBase); + setIntegerBase(16); + for (int i = 0; i < len; ++i, ++col) { + if (col >= 16) { + setFieldWidth(0); + *this << endl; + col = 0; + putLevel(); + setFieldWidth(5); + } + *this << (p[i] & 0xff); + } + if (col) + *this << endl << dec; + setFieldWidth(0); + setIntegerBase(10); + } + +//--------------------------------------------------------- +// domError +//--------------------------------------------------------- + +void domError(QDomNode node) + { + QDomElement e = node.toElement(); + QString tag(e.tagName()); + QString s; + QDomNode dn(node); + while (!dn.parentNode().isNull()) { + dn = dn.parentNode(); + const QDomElement e = dn.toElement(); + const QString k(e.tagName()); + if (!s.isEmpty()) + s += ":"; + s += k; + } + fprintf(stderr, "%s: Unknown Node <%s>, type %d\n", + s.toLatin1().data(), tag.toLatin1().data(), node.nodeType()); + if (node.isText()) { + fprintf(stderr, " text node <%s>\n", node.toText().data().toLatin1().data()); + } + } + +//--------------------------------------------------------- +// domNotImplemented +//--------------------------------------------------------- + +void domNotImplemented(QDomNode node) + { + if (!AL::debugMsg) + return; + QDomElement e = node.toElement(); + QString tag(e.tagName()); + QString s; + QDomNode dn(node); + while (!dn.parentNode().isNull()) { + dn = dn.parentNode(); + const QDomElement e = dn.toElement(); + const QString k(e.tagName()); + if (!s.isEmpty()) + s += ":"; + s += k; + } + fprintf(stderr, "%s: Node not implemented: <%s>, type %d\n", + s.toLatin1().data(), tag.toLatin1().data(), node.nodeType()); + if (node.isText()) { + fprintf(stderr, " text node <%s>\n", node.toText().data().toLatin1().data()); + } + } +} + diff --git a/muse2/al/xml.h b/muse2/al/xml.h new file mode 100644 index 00000000..340d8190 --- /dev/null +++ b/muse2/al/xml.h @@ -0,0 +1,69 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#ifndef __XML_H__ +#define __XML_H__ + +namespace AL { + +//--------------------------------------------------------- +// Xml +//--------------------------------------------------------- + +class Xml : public QTextStream { + int level; + + public: + Xml(); + Xml(QIODevice*); + + void header(); + void putLevel(); + + void put(const QString&); + + void stag(const QString&); + void etag(const char*); + + void tagE(const QString&); + + void tag(const char* name, int); + void tag(const char* name, unsigned); + void tag(const char* name, const double& val); + void tag(const char* name, float val); + void tag(const char* name, const QString& s); + void tag(const char* name, const QColor& color); + void tag(const char* name, const QWidget* g); + void tag(const char* name, const QRect& r); + + void dump(int n, const unsigned char*); + void writeProperties(const QObject*); + + static QString xmlString(const QString&); + }; + +extern QRect readGeometry(QDomNode); +extern void readProperties(QObject* o, QDomNode node); +extern void domError(QDomNode node); +extern void domNotImplemented(QDomNode node); +} + +#endif + diff --git a/muse2/all.h b/muse2/all.h index 147aa6b4..3ec26518 100644 --- a/muse2/all.h +++ b/muse2/all.h @@ -1,78 +1,26 @@ -//#ifndef __ALLQT_H__ -//#define __ALLQT_H__ +//============================================================================= +// MusE +// Linux Music Editor +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= +#ifndef __ALLQT_H__ +#define __ALLQT_H__ -/* -#include -#include -#include -#include -#include -#include -*/ - -/* -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -*/ - - - -/* #include #ifndef __APPLE__ #include @@ -86,9 +34,7 @@ #include #include #include -*/ -/* #include #include #include @@ -173,7 +119,5 @@ #include #include #include -*/ - -//#endif +#endif diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index a6834cdc..8c69058e 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -165,6 +165,20 @@ class Plugin { unsigned long controlInPorts() const { return _controlInPorts; } unsigned long controlOutPorts() const { return _controlOutPorts; } bool inPlaceCapable() const { return _inPlaceCapable; } + + /* + bool isLog(int k) const { + LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]]; + return LADSPA_IS_HINT_LOGARITHMIC(r.HintDescriptor); + } + bool isBool(int k) const { + return LADSPA_IS_HINT_TOGGLED(plugin->PortRangeHints[pIdx[k]].HintDescriptor); + } + bool isInt(int k) const { + LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]]; + return LADSPA_IS_HINT_INTEGER(r.HintDescriptor); + } + */ }; typedef std::list::iterator iPlugin; diff --git a/muse2/synti/libsynti/mess.h b/muse2/synti/libsynti/mess.h index 921dbd6c..ea4f425f 100644 --- a/muse2/synti/libsynti/mess.h +++ b/muse2/synti/libsynti/mess.h @@ -21,6 +21,12 @@ class MessP; // MidiPatch //--------------------------------------------------------- +#define MP_TYPE_GM 1 +#define MP_TYPE_GS 2 +#define MP_TYPE_XG 4 +#define MP_TYPE_LBANK 8 +#define MP_TYPE_HBANK 16 + struct MidiPatch { signed char typ; // 1 - GM 2 - GS 4 - XG signed char hbank, lbank, prog; -- cgit v1.2.3