summaryrefslogtreecommitdiff
path: root/muse2/muse/instruments
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-09-10 17:06:00 +0000
committerFlorian Jung <flo@windfisch.org>2011-09-10 17:06:00 +0000
commit24f84a489364741eb3fc126a3f83d91a86b65e27 (patch)
tree63a4e20aaf4a2ebd2462c91b574eddceeac31170 /muse2/muse/instruments
parent38c5cccc7273247353264bb7dc97f42296d8e259 (diff)
parent2120ea4f083228dde0d7307203391a4ec8f57e2d (diff)
merged the first bunch of orcans changes
STILL WAIT WITH COMMITTING NEW STUFF! i have to merge the rest as well! this is a bit buggy (connect errors, not tested much), but doesn't segfault immediately
Diffstat (limited to 'muse2/muse/instruments')
-rw-r--r--muse2/muse/instruments/CMakeLists.txt11
-rw-r--r--muse2/muse/instruments/editinstrument.cpp73
-rw-r--r--muse2/muse/instruments/editinstrument.h15
-rw-r--r--muse2/muse/instruments/midictrledit.cpp15
-rw-r--r--muse2/muse/instruments/midictrledit.h15
-rw-r--r--muse2/muse/instruments/minstrument.cpp49
-rw-r--r--muse2/muse/instruments/minstrument.h26
7 files changed, 151 insertions, 53 deletions
diff --git a/muse2/muse/instruments/CMakeLists.txt b/muse2/muse/instruments/CMakeLists.txt
index bca57336..5a3bedad 100644
--- a/muse2/muse/instruments/CMakeLists.txt
+++ b/muse2/muse/instruments/CMakeLists.txt
@@ -3,10 +3,12 @@
# Linux Music Editor
# $Id:$
#
-# Copyright (C) 2002-2006 by Werner Schweer and others
+# Copyright (C) 1999-2011 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.
+# it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,8 +16,9 @@
# 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.
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#=============================================================================
##
diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp
index c45ac97a..49bdd6c2 100644
--- a/muse2/muse/instruments/editinstrument.cpp
+++ b/muse2/muse/instruments/editinstrument.cpp
@@ -4,6 +4,21 @@
// $Id: editinstrument.cpp,v 1.2.2.6 2009/05/31 05:12:12 terminator356 Exp $
//
// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#include <stdio.h>
@@ -262,7 +277,7 @@ void EditInstrument::fileSave()
// Do not allow a direct overwrite of a 'built-in' muse instrument.
QFileInfo qfi(workingInstrument.filePath());
- if(qfi.absolutePath() == museInstruments)
+ if(qfi.absolutePath() == MusEGlobal::museInstruments)
{
//fileSaveAs();
saveAs();
@@ -384,34 +399,34 @@ void EditInstrument::saveAs()
//MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
// MidiInstrument* instrument = (MidiInstrument*)item->data();
- //QString path = QDir::homePath() + "/" + config.instrumentPath;
- //QString path = QDir::homeDirPath() + "/" + museGlobalShare;
- //QString path = museInstruments;
- QString path = museUserInstruments;
+ //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath;
+ //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare;
+ //QString path = MusEGlobal::museInstruments;
+ QString path = MusEGlobal::museUserInstruments;
- if(!QDir(museUserInstruments).exists())
+ if(!QDir(MusEGlobal::museUserInstruments).exists())
{
if(QMessageBox::question(this,
tr("MusE:"),
- tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
+ tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"),
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::Cancel | QMessageBox::Escape,
Qt::NoButton) == QMessageBox::Ok)
{
- if(QDir().mkdir(museUserInstruments))
- printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData());
+ if(QDir().mkdir(MusEGlobal::museUserInstruments))
+ printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData());
else
{
- printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData());
- QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments);
+ printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData());
+ QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments);
//return;
- path = museUser;
+ path = MusEGlobal::museUser;
}
}
else
// return;
- path = museUser;
+ path = MusEGlobal::museUser;
}
//if (instrument->filePath().isEmpty())
@@ -431,7 +446,7 @@ void EditInstrument::saveAs()
{
// Prompt only if it's a user instrument, to avoid duplicates in the user instrument dir.
// This will still allow a user instrument to override a built-in instrument with the same name.
- if(fi.absolutePath() != museInstruments)
+ if(fi.absolutePath() != MusEGlobal::museInstruments)
{
//QMessageBox::critical(this,
// tr("MusE: Bad instrument name"),
@@ -555,7 +570,7 @@ void EditInstrument::fileSaveAs()
{
// Allow override of built-in instrument names.
QFileInfo fi((*imi)->filePath());
- if(fi.absolutePath() == museInstruments)
+ if(fi.absolutePath() == MusEGlobal::museInstruments)
break;
found = true;
break;
@@ -589,7 +604,7 @@ void EditInstrument::fileSaveAs()
QFileInfo fi((*imi)->filePath());
// Allow override of built-in and user instruments:
// If it's a user instrument, not a built-in instrument...
- if(fi.absolutePath() == museUserInstruments)
+ if(fi.absolutePath() == MusEGlobal::museUserInstruments)
{
// No choice really but to overwrite the destination instrument file!
// Can not have two user files containing the same instrument name.
@@ -676,34 +691,34 @@ void EditInstrument::fileSaveAs()
break;
}
- //QString path = QDir::homePath() + "/" + config.instrumentPath;
- //QString path = QDir::homeDirPath() + "/" + museGlobalShare;
- //QString path = museInstruments;
- QString path = museUserInstruments;
+ //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath;
+ //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare;
+ //QString path = MusEGlobal::museInstruments;
+ QString path = MusEGlobal::museUserInstruments;
- if(!QDir(museUserInstruments).exists())
+ if(!QDir(MusEGlobal::museUserInstruments).exists())
{
if(QMessageBox::question(this,
tr("MusE:"),
- tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
+ tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"),
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::Cancel | QMessageBox::Escape,
Qt::NoButton) == QMessageBox::Ok)
{
- if(QDir().mkdir(museUserInstruments))
- printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData());
+ if(QDir().mkdir(MusEGlobal::museUserInstruments))
+ printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData());
else
{
- printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData());
- QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments);
+ printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData());
+ QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments);
//return;
- path = museUser;
+ path = MusEGlobal::museUser;
}
}
else
// return;
- path = museUser;
+ path = MusEGlobal::museUser;
}
path += QString("/%1.idf").arg(so);
@@ -1448,7 +1463,7 @@ void EditInstrument::patchButtonClicked()
PatchGroup* pgp = *i;
QMenu* pm = patchpopup->addMenu(pgp->name);
//pm->setCheckable(false);//Qt4 doc says this is unnecessary
- pm->setFont(config.fonts[0]);
+ pm->setFont(MusEConfig::config.fonts[0]);
const PatchList& pl = pgp->patches;
for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
const Patch* mp = *ipl;
diff --git a/muse2/muse/instruments/editinstrument.h b/muse2/muse/instruments/editinstrument.h
index b3c6b5e0..645a5b98 100644
--- a/muse2/muse/instruments/editinstrument.h
+++ b/muse2/muse/instruments/editinstrument.h
@@ -4,6 +4,21 @@
// $Id: editinstrument.h,v 1.1.1.1.2.4 2009/05/31 05:12:12 terminator356 Exp $
//
// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#ifndef __EDITINSTRUMENT_H__
diff --git a/muse2/muse/instruments/midictrledit.cpp b/muse2/muse/instruments/midictrledit.cpp
index 9dcac628..56f4cabf 100644
--- a/muse2/muse/instruments/midictrledit.cpp
+++ b/muse2/muse/instruments/midictrledit.cpp
@@ -4,6 +4,21 @@
// $Id: midictrledit.cpp,v 1.1.1.1.2.2 2008/08/18 00:15:24 terminator356 Exp $
//
// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#include <stdio.h>
diff --git a/muse2/muse/instruments/midictrledit.h b/muse2/muse/instruments/midictrledit.h
index e1624f29..308302b1 100644
--- a/muse2/muse/instruments/midictrledit.h
+++ b/muse2/muse/instruments/midictrledit.h
@@ -4,6 +4,21 @@
// $Id: midictrledit.h,v 1.1.1.1.2.1 2008/08/18 00:15:25 terminator356 Exp $
//
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#ifndef __MIDICTRLEDIT_H__
diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp
index 613e5bdf..20bee129 100644
--- a/muse2/muse/instruments/minstrument.cpp
+++ b/muse2/muse/instruments/minstrument.cpp
@@ -4,6 +4,21 @@
// $Id: minstrument.cpp,v 1.10.2.5 2009/03/28 01:46:10 terminator356 Exp $
//
// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#include <stdio.h>
@@ -27,6 +42,7 @@
#include "gconfig.h"
#include "popupmenu.h"
+
MidiInstrumentList midiInstruments;
MidiInstrument* genericMidiInstrument;
@@ -140,7 +156,7 @@ static void loadIDF(QFileInfo* fi)
printf("cannot open file %s\n", fi->fileName().toLatin1());
return;
}
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf(" load instrument definition <%s>\n", fi->filePath().local8Bit().data());
QDomDocument doc;
int line, column;
@@ -172,7 +188,7 @@ static void loadIDF(QFileInfo* fi)
if (midiInstruments[idx]->iname() == i->iname()) {
midiInstruments.replace(idx, i);
replaced = true;
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("Midi Instrument Definition <%s> overwritten\n",
i->iname().toLocal8Bit().data());
break;
@@ -193,7 +209,7 @@ static void loadIDF(QFileInfo* fi)
FILE* f = fopen(fi->filePath().toAscii().constData(), "r");
if (f == 0)
return;
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("READ IDF %s\n", fi->filePath().toLatin1().constData());
Xml xml(f);
@@ -252,9 +268,9 @@ void initMidiInstruments()
{
genericMidiInstrument = new MidiInstrument(QWidget::tr("generic midi"));
midiInstruments.push_back(genericMidiInstrument);
- if (debugMsg)
- printf("load user instrument definitions from <%s>\n", museUserInstruments.toLatin1().constData());
- QDir usrInstrumentsDir(museUserInstruments, QString("*.idf"));
+ if (MusEGlobal::debugMsg)
+ printf("load user instrument definitions from <%s>\n", MusEGlobal::museUserInstruments.toLatin1().constData());
+ QDir usrInstrumentsDir(MusEGlobal::museUserInstruments, QString("*.idf"));
if (usrInstrumentsDir.exists()) {
QFileInfoList list = usrInstrumentsDir.entryInfoList();
QFileInfoList::iterator it=list.begin(); // ddskrjo
@@ -265,15 +281,15 @@ void initMidiInstruments()
}
//else
//{
- // if(usrInstrumentsDir.mkdir(museUserInstruments))
- // printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1());
+ // if(usrInstrumentsDir.mkdir(MusEGlobal::museUserInstruments))
+ // printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1());
// else
- // printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1());
+ // printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1());
//}
- if (debugMsg)
- printf("load instrument definitions from <%s>\n", museInstruments.toLatin1().constData());
- QDir instrumentsDir(museInstruments, QString("*.idf"));
+ if (MusEGlobal::debugMsg)
+ printf("load instrument definitions from <%s>\n", MusEGlobal::museInstruments.toLatin1().constData());
+ QDir instrumentsDir(MusEGlobal::museInstruments, QString("*.idf"));
if (instrumentsDir.exists()) {
QFileInfoList list = instrumentsDir.entryInfoList();
QFileInfoList::iterator it=list.begin(); // ddskrjo
@@ -283,7 +299,7 @@ void initMidiInstruments()
}
}
else
- printf("Instrument directory not found: %s\n", museInstruments.toLatin1().constData());
+ printf("Instrument directory not found: %s\n", MusEGlobal::museInstruments.toLatin1().constData());
}
@@ -543,6 +559,7 @@ void MidiInstrument::reset(int portNo, MType)
// These loops send 2048 events, which is more than our FIFO (or Jack buffer) can handle! p4.0.15 Tim.
// Nope, instead, increased FIFO sizes to accommodate.
//port->device()->playEvents()->add(ev);
+ //port->device()->addScheduledEvent(ev);
}
}
}
@@ -918,7 +935,7 @@ QString MidiInstrument::getPatchName(int channel, int prog, MType mode, bool dru
// populatePatchPopup
//---------------------------------------------------------
-void MidiInstrument::populatePatchPopup(PopupMenu* menu, int chan, MType songType, bool drum)
+void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, MType songType, bool drum)
{
menu->clear();
int mask = 0;
@@ -943,9 +960,9 @@ void MidiInstrument::populatePatchPopup(PopupMenu* menu, int chan, MType songTyp
for (ciPatchGroup i = pg.begin(); i != pg.end(); ++i) {
PatchGroup* pgp = *i;
//QMenu* pm = menu->addMenu(pgp->name);
- PopupMenu* pm = new PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here.
+ MusEWidget::PopupMenu* pm = new MusEWidget::PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here.
menu->addMenu(pm);
- pm->setFont(config.fonts[0]);
+ pm->setFont(MusEConfig::config.fonts[0]);
const PatchList& pl = pgp->patches;
for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
const Patch* mp = *ipl;
diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h
index dacd17fc..e7800eea 100644
--- a/muse2/muse/instruments/minstrument.h
+++ b/muse2/muse/instruments/minstrument.h
@@ -4,6 +4,21 @@
// $Id: minstrument.h,v 1.3.2.3 2009/03/09 02:05:18 terminator356 Exp $
//
// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
//=========================================================
#ifndef __MINSTRUMENT_H__
@@ -13,14 +28,17 @@
#include <list>
#include <vector>
+class QString;
+
class MidiPort;
-//class QMenu;
-class PopupMenu;
class MidiPlayEvent;
class Xml;
class EventList;
class MidiControllerList;
-class QString;
+
+namespace MusEWidget {
+class PopupMenu;
+}
//---------------------------------------------------------
// Patch
@@ -123,7 +141,7 @@ class MidiInstrument {
virtual void reset(int, MType);
virtual QString getPatchName(int,int,MType,bool);
//virtual void populatePatchPopup(QMenu*, int, MType, bool);
- virtual void populatePatchPopup(PopupMenu*, int, MType, bool);
+ virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool);
void read(Xml&);
void write(int level, Xml&);