summaryrefslogtreecommitdiff
path: root/muse2/muse/song.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/song.cpp')
-rw-r--r--muse2/muse/song.cpp244
1 files changed, 151 insertions, 93 deletions
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index e4749d19..bec5aabc 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -4,6 +4,21 @@
// $Id: song.cpp,v 1.59.2.52 2009/12/15 03:39:58 terminator356 Exp $
//
// (C) Copyright 2000-2004 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 <unistd.h>
@@ -49,7 +64,7 @@
extern void clearMidiTransforms();
extern void clearMidiInputTransforms();
-Song* song;
+Song* song = 0;
/*
//---------------------------------------------------------
@@ -177,7 +192,7 @@ Track* Song::addNewTrack(QAction* action)
if (dev==0)
{
midiSeq->msgSetMidiDevice(port, si);
- muse->changeConfig(true); // save configuration file
+ MusEGlobal::muse->changeConfig(true); // save configuration file
deselectTracks();
si->setSelected(true);
update();
@@ -451,7 +466,7 @@ bool Song::addEvent(Event& event, Part* part)
if(part->events()->find(event) != part->events()->end())
{
// This can be normal for some (redundant) operations.
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song::addEvent event already found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size());
return false;
}
@@ -470,7 +485,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part)
if (i == part->events()->end()) {
// This can be normal for some (redundant) operations.
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song::changeEvent event not found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size());
// abort();
// Removed by T356. Allow it to add the new event.
@@ -572,7 +587,7 @@ void Song::deleteEvent(Event& event, Part* part)
iEvent ev = part->events()->find(event);
if (ev == part->events()->end()) {
// This can be normal for some (redundant) operations.
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song::deleteEvent event not found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size());
return;
}
@@ -739,7 +754,7 @@ void Song::controllerChange(Track* t)
void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned startTick)
{
if (events->empty()) {
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("no events recorded\n");
return;
}
@@ -789,7 +804,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
e = events->end();
if (startTick > endTick) {
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("no events in record area\n");
return;
}
@@ -812,7 +827,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
break;
}
if (ip == pl->end()) {
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("create new part for recorded events\n");
// create new part
part = new MidiPart(mt);
@@ -1079,7 +1094,7 @@ void Song::setLoop(bool f)
{
if (loopFlag != f) {
loopFlag = f;
- loopAction->setChecked(loopFlag);
+ MusEGlobal::loopAction->setChecked(loopFlag);
emit loopChanged(loopFlag);
}
}
@@ -1098,12 +1113,12 @@ void Song::clearTrackRec()
//---------------------------------------------------------
void Song::setRecord(bool f, bool autoRecEnable)
{
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("setRecord recordflag =%d f(record state)=%d autoRecEnable=%d\n", recordFlag, f, autoRecEnable);
- if (f && config.useProjectSaveDialog && museProject == museProjectInitPath ) { // check that there is a project stored before commencing
+ if (f && MusEConfig::config.useProjectSaveDialog && MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // check that there is a project stored before commencing
// no project, we need to create one.
- if (!muse->saveAs())
+ if (!MusEGlobal::muse->saveAs())
return; // could not store project, won't enable record
}
if (recordFlag != f) {
@@ -1177,7 +1192,7 @@ void Song::setRecord(bool f, bool autoRecEnable)
if (audio->isPlaying() && f)
f = false;
recordFlag = f;
- recordAction->setChecked(recordFlag);
+ MusEGlobal::recordAction->setChecked(recordFlag);
emit recordChanged(recordFlag);
}
}
@@ -1191,7 +1206,7 @@ void Song::setPunchin(bool f)
{
if (punchinFlag != f) {
punchinFlag = f;
- punchinAction->setChecked(punchinFlag);
+ MusEGlobal::punchinAction->setChecked(punchinFlag);
emit punchinChanged(punchinFlag);
}
}
@@ -1205,7 +1220,7 @@ void Song::setPunchout(bool f)
{
if (punchoutFlag != f) {
punchoutFlag = f;
- punchoutAction->setChecked(punchoutFlag);
+ MusEGlobal::punchoutAction->setChecked(punchoutFlag);
emit punchoutChanged(punchoutFlag);
}
}
@@ -1258,13 +1273,13 @@ void Song::setMasterFlag(bool val)
void Song::setPlay(bool f)
{
if (extSyncFlag.value()) {
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("not allowed while using external sync");
return;
}
// only allow the user to set the button "on"
if (!f)
- playAction->setChecked(true);
+ MusEGlobal::playAction->setChecked(true);
else
audio->msgPlay(true);
}
@@ -1272,29 +1287,29 @@ void Song::setPlay(bool f)
void Song::setStop(bool f)
{
if (extSyncFlag.value()) {
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("not allowed while using external sync");
return;
}
// only allow the user to set the button "on"
if (!f)
- stopAction->setChecked(true);
+ MusEGlobal::stopAction->setChecked(true);
else
audio->msgPlay(false);
}
void Song::setStopPlay(bool f)
{
- playAction->blockSignals(true);
- stopAction->blockSignals(true);
+ MusEGlobal::playAction->blockSignals(true);
+ MusEGlobal::stopAction->blockSignals(true);
emit playChanged(f); // signal transport window
- playAction->setChecked(f);
- stopAction->setChecked(!f);
+ MusEGlobal::playAction->setChecked(f);
+ MusEGlobal::stopAction->setChecked(!f);
- stopAction->blockSignals(false);
- playAction->blockSignals(false);
+ MusEGlobal::stopAction->blockSignals(false);
+ MusEGlobal::playAction->blockSignals(false);
}
//---------------------------------------------------------
@@ -1332,20 +1347,29 @@ void Song::setPos(int idx, const Pos& val, bool sig,
// idx, sig, isSeek, adjustScrollbar);
// val.dump(0);
// printf("\n");
-
- // p3.3.23
- //printf("Song::setPos before audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
- if (pos[idx] == val)
- return;
+ //printf("Song::setPos before audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
+
+ // If seeking audio, ensure frame resolution CAN be kept throughout. This compares apples and oranges. Moved below. p4.0.33
+ //if (pos[idx] == val)
+ // return;
if (idx == CPOS) {
_vcpos = val;
- if (isSeek && !extSyncFlag.value()) {
+ if (isSeek && !extSyncFlag.value()) {
+ if (val == audio->pos())
+ {
+ //printf("Song::setPos seek audio->pos already == val tick:%d frame:%d\n", val.tick(), val.frame());
+ return;
+ }
audio->msgSeek(val);
- // p3.3.23
- //printf("Song::setPos after audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
+ //printf("Song::setPos after audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
return;
}
}
+ if (val == pos[idx])
+ {
+ //printf("Song::setPos song->pos already == val tick:%d frame:%d\n", val.tick(), val.frame());
+ return;
+ }
pos[idx] = val;
bool swap = pos[LPOS] > pos[RPOS];
if (swap) { // swap lpos/rpos if lpos > rpos
@@ -1404,7 +1428,7 @@ void Song::setPos(int idx, const Pos& val, bool sig,
void Song::forward()
{
- unsigned newPos = pos[0].tick() + config.division;
+ unsigned newPos = pos[0].tick() + MusEConfig::config.division;
audio->msgSeek(Pos(newPos, true));
}
@@ -1415,10 +1439,10 @@ void Song::forward()
void Song::rewind()
{
unsigned newPos;
- if (unsigned(config.division) > pos[0].tick())
+ if (unsigned(MusEConfig::config.division) > pos[0].tick())
newPos = 0;
else
- newPos = pos[0].tick() - config.division;
+ newPos = pos[0].tick() - MusEConfig::config.division;
audio->msgSeek(Pos(newPos, true));
}
@@ -1683,10 +1707,13 @@ void Song::beat()
}
- int tick = audio->tickPos();
+ //int tick = audio->tickPos();
if (audio->isPlaying())
- setPos(0, tick, true, false, true);
-
+ {
+ //Pos tick(audio->tickPos());
+ //setPos(0, tick, true, false, true);
+ setPos(0, audio->tickPos(), true, false, true);
+ }
// p3.3.40 Update synth native guis at the heartbeat rate.
for(ciSynthI is = _synthIs.begin(); is != _synthIs.end(); ++is)
(*is)->guiHeartBeat();
@@ -1701,14 +1728,14 @@ void Song::beat()
// filter midi remote control events
//---------------------------------------------------
- if (rcEnable && velo != 0) {
- if (pitch == rcStopNote)
+ if (MusEGlobal::rcEnable && velo != 0) {
+ if (pitch == MusEGlobal::rcStopNote)
setStop(true);
- else if (pitch == rcRecordNote)
+ else if (pitch == MusEGlobal::rcRecordNote)
setRecord(true);
- else if (pitch == rcGotoLeftMarkNote)
+ else if (pitch == MusEGlobal::rcGotoLeftMarkNote)
setPos(0, pos[LPOS].tick(), true, true, true);
- else if (pitch == rcPlayNote)
+ else if (pitch == MusEGlobal::rcPlayNote)
setPlay(true);
}
emit song->midiNote(pitch, velo);
@@ -1843,8 +1870,8 @@ void Song::endMsgCmd()
{
if (updateFlags) {
redoList->clear(); // TODO: delete elements in list
- undoAction->setEnabled(true);
- redoAction->setEnabled(false);
+ MusEGlobal::undoAction->setEnabled(true);
+ MusEGlobal::redoAction->setEnabled(false);
emit songChanged(updateFlags);
}
}
@@ -1860,8 +1887,8 @@ void Song::undo()
return;
audio->msgUndo();
doUndo3();
- redoAction->setEnabled(true);
- undoAction->setEnabled(!undoList->empty());
+ MusEGlobal::redoAction->setEnabled(true);
+ MusEGlobal::undoAction->setEnabled(!undoList->empty());
if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
audio->msgUpdateSoloStates();
@@ -1880,8 +1907,8 @@ void Song::redo()
return;
audio->msgRedo();
doRedo3();
- undoAction->setEnabled(true);
- redoAction->setEnabled(!redoList->empty());
+ MusEGlobal::undoAction->setEnabled(true);
+ MusEGlobal::redoAction->setEnabled(!redoList->empty());
if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
audio->msgUpdateSoloStates();
@@ -1955,6 +1982,28 @@ void Song::processMsg(AudioMsg* msg)
updateFlags = SC_EVENT_MODIFIED;
break;
+ // Moved here from MidiSeq::processMsg p4.0.34
+ case SEQM_ADD_TRACK:
+ insertTrack2(msg->track, msg->ival);
+ break;
+ case SEQM_REMOVE_TRACK:
+ //removeTrack2(msg->track);
+ cmdRemoveTrack(msg->track);
+ break;
+ case SEQM_CHANGE_TRACK:
+ changeTrack((Track*)(msg->p1), (Track*)(msg->p2));
+ break;
+ case SEQM_ADD_PART:
+ cmdAddPart((Part*)msg->p1);
+ break;
+ case SEQM_REMOVE_PART:
+ cmdRemovePart((Part*)msg->p1);
+ break;
+ case SEQM_CHANGE_PART:
+ //cmdChangePart((Part*)msg->p1, (Part*)msg->p2);
+ cmdChangePart((Part*)msg->p1, (Part*)msg->p2, msg->a, msg->b);
+ break;
+
case SEQM_ADD_TEMPO:
//printf("processMsg (SEQM_ADD_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
addUndo(UndoOp(UndoOp::AddTempo, msg->a, msg->b));
@@ -2090,7 +2139,7 @@ void Song::panic()
void Song::clear(bool signal, bool /*clear_all*/)
{
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song::clear\n");
bounceTrack = 0;
@@ -2212,36 +2261,36 @@ void Song::cleanupForQuit()
{
bounceTrack = 0;
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("MusE: Song::cleanupForQuit...\n");
_tracks.clear();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _midis\n");
_midis.clearDelete();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _waves\n");
_waves.clearDelete();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _inputs\n");
_inputs.clearDelete(); // audio input ports
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _outputs\n");
_outputs.clearDelete(); // audio output ports
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _groups\n");
_groups.clearDelete(); // mixer groups
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _auxs\n");
_auxs.clearDelete(); // aux sends
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting _synthIs\n");
_synthIs.clearDelete(); // each ~SynthI() -> deactivate3() -> ~SynthIF()
@@ -2249,19 +2298,19 @@ void Song::cleanupForQuit()
AL::sigmap.clear();
keymap.clear();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting undoList, clearing redoList\n");
undoList->clearDelete();
redoList->clear(); // Check this - Should we do a clearDelete? IIRC it was OK this way - no clearDelete in case of same items in both lists.
_markerList->clear();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting transforms\n");
clearMidiTransforms(); // Deletes stuff.
clearMidiInputTransforms(); // Deletes stuff.
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting midiport controllers\n");
// Clear all midi port controllers and values.
for(int i = 0; i < MIDI_PORTS; ++i)
@@ -2270,7 +2319,7 @@ void Song::cleanupForQuit()
// Can't do this here. Jack isn't running. Fixed. Test OK so far.
#if 1
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting midi devices except synths\n");
for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
{
@@ -2282,7 +2331,7 @@ void Song::cleanupForQuit()
midiDevices.clear(); // midi devices
#endif
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting global available synths\n");
// Delete all synths.
std::vector<Synth*>::iterator is;
@@ -2295,7 +2344,7 @@ void Song::cleanupForQuit()
}
synthis.clear();
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("deleting midi instruments\n");
for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi)
{
@@ -2311,7 +2360,7 @@ void Song::cleanupForQuit()
// Nothing required for ladspa plugin list, and rack instances of them
// are handled by ~AudioTrack.
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("...finished cleaning up.\n");
}
@@ -2354,11 +2403,11 @@ void Song::seqSignal(int fd)
setPos(0, audio->tickPos(), true, false, true);
break;
case 'S': // shutdown audio
- muse->seqStop();
+ MusEGlobal::muse->seqStop();
{
// give the user a sensible explanation
- int btn = QMessageBox::critical( muse, tr("Jack shutdown!"),
+ int btn = QMessageBox::critical( MusEGlobal::muse, tr("Jack shutdown!"),
tr("Jack has detected a performance problem which has lead to\n"
"MusE being disconnected.\n"
"This could happen due to a number of reasons:\n"
@@ -2376,27 +2425,27 @@ void Song::seqSignal(int fd)
"click on the Restart button."), "restart", "cancel");
if (btn == 0) {
printf("restarting!\n");
- muse->seqRestart();
+ MusEGlobal::muse->seqRestart();
}
}
break;
case 'f': // start freewheel
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song: seqSignal: case f: setFreewheel start\n");
// Enabled by Tim. p3.3.6
- if(config.freewheelMode)
+ if(MusEConfig::config.freewheelMode)
audioDevice->setFreewheel(true);
break;
case 'F': // stop freewheel
- if(debugMsg)
+ if(MusEGlobal::debugMsg)
printf("Song: seqSignal: case F: setFreewheel stop\n");
// Enabled by Tim. p3.3.6
- if(config.freewheelMode)
+ if(MusEConfig::config.freewheelMode)
audioDevice->setFreewheel(false);
audio->msgPlay(false);
@@ -2518,9 +2567,18 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a
{
CtrlList *cl = icl->second;
canAdd = true;
- int frame = pos[0].frame();
- ctlval = cl->curVal();
- //ctlval = cl->value(frame); // p4.0.32
+
+ //int frame = pos[0].frame();
+ int frame = audio->pos().frame(); // Try this. p4.0.33
+
+ //printf("pos[0]:%d f:%d tickPos:%d f:%d\n", pos[0].tick(), pos[0].frame(), audio->tickPos(), Pos(audio->tickPos(), true).frame());
+
+ //ctlval = cl->curVal();
+ //AutomationType at = track->MusEGlobal::automationType();
+ //if(!MusEGlobal::automation || track->MusEGlobal::automationType() == AUTO_OFF)
+ ctlval = cl->curVal();
+ //else
+ // ctlval = cl->value(frame);
count = cl->size();
if(count)
{
@@ -2544,7 +2602,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a
//menu->setItemEnabled(HEADER, false);
//MenuTitleItem* title = new MenuTitleItem(tr("Automation:")); ddskrjo
//menu->insertItem(title, HEADER, HEADER); ddskrjo
- menu->addAction(new MenuTitleItem(tr("Automation:"), menu));
+ menu->addAction(new MusEWidget::MenuTitleItem(tr("Automation:"), menu));
//menu->insertSeparator(SEP1);
@@ -2576,7 +2634,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a
eraseRangeAction->setData(CLEAR_RANGE);
eraseRangeAction->setEnabled(canEraseRange);
- QAction* clearAction = menu->addAction(tr("clear automation"));
+ QAction* clearAction = menu->addAction(tr("clear MusEGlobal::automation"));
clearAction->setData(CLEAR_ALL_EVENTS);
clearAction->setEnabled((bool)count);
@@ -2608,7 +2666,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a
break;
case CLEAR_ALL_EVENTS:
- if(QMessageBox::question(muse, QString("Muse"),
+ if(QMessageBox::question(MusEGlobal::muse, QString("Muse"),
tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"),
QString::null, 0, 1 ) == 0)
audio->msgClearControllerEvents(track, acid);
@@ -2759,7 +2817,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo
// menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE);
// menu->setItemEnabled(CLEAR_RANGE, canEraseRange);
-// menu->insertItem(tr("clear automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS);
+// menu->insertItem(tr("clear MusEGlobal::automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS);
// menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count);
@@ -2836,7 +2894,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo
//break;
//case CLEAR_ALL_EVENTS:
- //if(QMessageBox::question(muse, QString("Muse"),
+ //if(QMessageBox::question(MusEGlobal::muse, QString("Muse"),
// tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"),
// QString::null, 0, 1 ) == 0)
//audio->msgClearControllerEvents(track, acid);
@@ -2892,7 +2950,7 @@ void Song::processAutomationEvents()
{
// Just clear all pressed and touched flags, not rec event lists.
clearRecAutomation(false);
- if (!automation)
+ if (!MusEGlobal::automation)
return;
for(iTrack i = _tracks.begin(); i != _tracks.end(); ++i)
{
@@ -2938,7 +2996,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect)
if(!disconnect)
ao->setName(ao->name());
// Now reconnect the output routes.
- if(checkAudioDevice() && audio->isRunning())
+ if(MusEGlobal::checkAudioDevice() && audio->isRunning())
{
for(int ch = 0; ch < ao->channels(); ++ch)
{
@@ -2971,7 +3029,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect)
if(!disconnect)
ai->setName(ai->name());
// Now reconnect the input routes.
- if(checkAudioDevice() && audio->isRunning())
+ if(MusEGlobal::checkAudioDevice() && audio->isRunning())
{
for(int ch = 0; ch < ai->channels(); ++ch)
{
@@ -3104,7 +3162,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst)
// MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
// pup->insertItem(titel);
-// if (!checkAudioDevice()) return;
+// if (!MusEGlobal::checkAudioDevice()) return;
// std::list<QString> ol = audioDevice->outputPorts();
// for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
// int id = pup->insertItem(*ip, (gid * 16) + i);
@@ -3135,7 +3193,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst)
int mdidx = n / MIDI_CHANNELS;
int ch = n % MIDI_CHANNELS;
- //if(debugMsg)
+ //if(MusEGlobal::debugMsg)
//printf("Song::chooseMidiRoutes mdidx:%d ch:%d\n", mdidx, ch);
MidiPort* mp = &midiPorts[mdidx];
@@ -3702,7 +3760,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo
//const char* tmp = tmpnam(NULL);
char tmp[16] = "muse-tmp-XXXXXX";
int fd = mkstemp(tmp);
- if (debugMsg)
+ if (MusEGlobal::debugMsg)
printf("executeScript: script input filename=%s\n",tmp);
FILE *fp = fdopen(fd , "w");
MidiPart *part = (MidiPart*)(i->second);
@@ -3737,13 +3795,13 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo
QStringList arguments;
arguments << tmp;
- QProcess *myProcess = new QProcess(muse);
+ QProcess *myProcess = new QProcess(MusEGlobal::muse);
myProcess->start(scriptfile, arguments);
myProcess->waitForFinished();
QByteArray errStr = myProcess->readAllStandardError();
if (myProcess->exitCode()) {
- QMessageBox::warning(muse, tr("MusE - external script failed"),
+ QMessageBox::warning(MusEGlobal::muse, tr("MusE - external script failed"),
tr("MusE was unable to launch the script, error message:\n ")+ QString(errStr)
);
endUndo(SC_EVENT_REMOVED);
@@ -3806,9 +3864,9 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver)
//
// List scripts
//
- QString distScripts = museGlobalShare + "/scripts";
+ QString distScripts = MusEGlobal::museGlobalShare + "/scripts";
- QString userScripts = configPath + "/scripts";
+ QString userScripts = MusEGlobal::configPath + "/scripts";
QFileInfo distScriptsFi(distScripts);
if (distScriptsFi.isDir()) {
@@ -3861,11 +3919,11 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver)
QString Song::getScriptPath(int id, bool isdelivered)
{
if (isdelivered) {
- QString path = museGlobalShare + "/scripts/" + deliveredScriptNames[id];
+ QString path = MusEGlobal::museGlobalShare + "/scripts/" + deliveredScriptNames[id];
return path;
}
- QString path = configPath + "/scripts/" + userScriptNames[id - deliveredScriptNames.size()];
+ QString path = MusEGlobal::configPath + "/scripts/" + userScriptNames[id - deliveredScriptNames.size()];
return path;
}