summaryrefslogtreecommitdiff
path: root/muse2/muse/part.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-08 13:47:24 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-08 13:47:24 +0000
commita347445db32f51562aee5c6a786c312d1f612d2f (patch)
treeba3dc9a6e03eec2edf2c213b7f4d7e5e49903edc /muse2/muse/part.cpp
parent375d6a53630f364c6560eb40255a8cc4c0496b8c (diff)
parent5367067f7a36dce8a362dcc000d41ac581bffdfe (diff)
merged namespace changes. HOPEFULLY the last one.
Diffstat (limited to 'muse2/muse/part.cpp')
-rw-r--r--muse2/muse/part.cpp85
1 files changed, 47 insertions, 38 deletions
diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp
index 2d9111f7..3601ff57 100644
--- a/muse2/muse/part.cpp
+++ b/muse2/muse/part.cpp
@@ -37,6 +37,8 @@
#include "drummap.h"
//#include "midiedit/drummap.h" // p4.0.2
+namespace MusECore {
+
int Part::snGen;
//---------------------------------------------------------
@@ -94,7 +96,7 @@ void chainCloneInternal(Part* p)
if(!t || (t && t->isMidiTrack()))
{
MidiTrack* mt = 0;
- MidiTrackList* mtl = song->midis();
+ MidiTrackList* mtl = MusEGlobal::song->midis();
for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
{
mt = *imt;
@@ -116,9 +118,9 @@ void chainCloneInternal(Part* p)
}
if((!p1 && !t) || (t && t->type() == Track::WAVE))
{
- WaveTrack* wt = 0;
- WaveTrackList* wtl = song->waves();
- for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
+ MusECore::WaveTrack* wt = 0;
+ MusECore::WaveTrackList* wtl = MusEGlobal::song->waves();
+ for(MusECore::ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
{
wt = *iwt;
const PartList* pl = wt->cparts();
@@ -292,7 +294,7 @@ void chainTrackParts(Track* t, bool incRefCount)
if(!t || (t && t->isMidiTrack()))
{
MidiTrack* mt = 0;
- MidiTrackList* mtl = song->midis();
+ MidiTrackList* mtl = MusEGlobal::song->midis();
for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
{
mt = *imt;
@@ -314,9 +316,9 @@ void chainTrackParts(Track* t, bool incRefCount)
}
if((!p1 && !t) || (t && t->type() == Track::WAVE))
{
- WaveTrack* wt = 0;
- WaveTrackList* wtl = song->waves();
- for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
+ MusECore::WaveTrack* wt = 0;
+ MusECore::WaveTrackList* wtl = MusEGlobal::song->waves();
+ for(MusECore::ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
{
wt = *iwt;
const PartList* pl = wt->cparts();
@@ -398,7 +400,7 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones)
int tck = event.tick() + p->tick();
int cntrl = event.dataA();
int val = event.dataB();
- MidiPort* mp = &midiPorts[port];
+ MidiPort* mp = &MusEGlobal::midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das?
@@ -408,9 +410,9 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
- ch = drumMap[note].channel;
- mp = &midiPorts[drumMap[note].port];
- cntrl |= drumMap[note].anote;
+ ch = MusEGlobal::drumMap[note].channel;
+ mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
+ cntrl |= MusEGlobal::drumMap[note].anote;
}
}
@@ -466,7 +468,7 @@ void addPortCtrlEvents(Part* part, bool doClones)
int tck = ev.tick() + p->tick();
int cntrl = ev.dataA();
int val = ev.dataB();
- MidiPort* mp = &midiPorts[port];
+ MidiPort* mp = &MusEGlobal::midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das?
@@ -476,9 +478,9 @@ void addPortCtrlEvents(Part* part, bool doClones)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
- ch = drumMap[note].channel;
- mp = &midiPorts[drumMap[note].port];
- cntrl |= drumMap[note].anote;
+ ch = MusEGlobal::drumMap[note].channel;
+ mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
+ cntrl |= MusEGlobal::drumMap[note].anote;
}
}
@@ -525,7 +527,7 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones)
int ch = mt->outChannel();
int tck = event.tick() + p->tick();
int cntrl = event.dataA();
- MidiPort* mp = &midiPorts[port];
+ MidiPort* mp = &MusEGlobal::midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das?
@@ -535,9 +537,9 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
- ch = drumMap[note].channel;
- mp = &midiPorts[drumMap[note].port];
- cntrl |= drumMap[note].anote;
+ ch = MusEGlobal::drumMap[note].channel;
+ mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
+ cntrl |= MusEGlobal::drumMap[note].anote;
}
}
@@ -594,7 +596,7 @@ void removePortCtrlEvents(Part* part, bool doClones)
int ch = mt->outChannel();
int tck = ev.tick() + p->tick();
int cntrl = ev.dataA();
- MidiPort* mp = &midiPorts[port];
+ MidiPort* mp = &MusEGlobal::midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das?
@@ -604,9 +606,9 @@ void removePortCtrlEvents(Part* part, bool doClones)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
- ch = drumMap[note].channel;
- mp = &midiPorts[drumMap[note].port];
- cntrl |= drumMap[note].anote;
+ ch = MusEGlobal::drumMap[note].channel;
+ mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
+ cntrl |= MusEGlobal::drumMap[note].anote;
}
}
@@ -714,6 +716,7 @@ MidiPart::MidiPart(const MidiPart& p) : Part(p)
_nextClone = this;
}
+
//---------------------------------------------------------
// WavePart
//---------------------------------------------------------
@@ -741,6 +744,7 @@ WavePart::WavePart(const WavePart& p) : Part(p)
_nextClone = this;
}
+
//---------------------------------------------------------
// Part
//---------------------------------------------------------
@@ -842,9 +846,9 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo
switch(track->type()) {
case Track::WAVE:
{
- WavePart* nPart = new WavePart(*(WavePart*)oPart);
+ MusECore::WavePart* nPart = new MusECore::WavePart(*(MusECore::WavePart*)oPart);
EventList* el = nPart->events();
- unsigned new_partlength = tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len);
+ unsigned new_partlength = MusEGlobal::tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len);
// If new nr of frames is less than previous what can happen is:
// - 0 or more events are beginning after the new final position. Those are removed from the part
@@ -874,7 +878,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo
// Do not do port controller values and clone parts.
operations.push_back(UndoOp(UndoOp::ModifyPart, oPart, nPart, false, false));
- song->applyOperationGroup(operations);
+ MusEGlobal::song->applyOperationGroup(operations);
}
// If the part is expanded there can be no additional events beginning after the previous final position
// since those are removed if the part has been shrunk at some time (see above)
@@ -888,7 +892,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo
i--;
Event last = i->second;
unsigned last_start = last.frame();
- SndFileR file = last.sndFile();
+ MusECore::SndFileR file = last.sndFile();
if (file.isNull())
return;
@@ -907,7 +911,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo
nPart->setLenFrame(new_partlength);
// Do not do port controller values and clone parts.
operations.push_back(UndoOp(UndoOp::ModifyPart, oPart, nPart, false, false));
- song->applyOperationGroup(operations);
+ MusEGlobal::song->applyOperationGroup(operations);
}
}
break;
@@ -932,7 +936,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo
part_it=(MidiPart*)part_it->nextClone();
} while (doClones && (part_it != (MidiPart*)oPart));
- song->applyOperationGroup(operations);
+ MusEGlobal::song->applyOperationGroup(operations);
break;
}
default:
@@ -951,7 +955,7 @@ void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2)
int l1 = 0; // len of first new part (ticks or samples)
int l2 = 0; // len of second new part
- int samplepos = tempomap.tick2frame(tickpos);
+ int samplepos = MusEGlobal::tempomap.tick2frame(tickpos);
switch (type()) {
case WAVE:
@@ -1048,14 +1052,14 @@ void Song::cmdSplitPart(Track* track, Part* part, int tick)
Part* p2;
track->splitPart(part, tick, p1, p2);
- //song->informAboutNewParts(part, p1); // is unneccessary because of ChangePart below
- song->informAboutNewParts(part, p2);
+ //MusEGlobal::song->informAboutNewParts(part, p1); // is unneccessary because of ChangePart below
+ MusEGlobal::song->informAboutNewParts(part, p2);
startUndo();
// Indicate no undo, and do port controller values but not clone parts.
- //audio->msgChangePart(part, p1, false);
- audio->msgChangePart(part, p1, false, true, false);
- audio->msgAddPart(p2, false);
+ //MusEGlobal::audio->msgChangePart(part, p1, false);
+ MusEGlobal::audio->msgChangePart(part, p1, false, true, false);
+ MusEGlobal::audio->msgAddPart(p2, false);
endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED);
}
@@ -1141,9 +1145,9 @@ void Song::cmdGluePart(Track* track, Part* oPart)
}
startUndo();
- audio->msgRemovePart(nextPart, false);
+ MusEGlobal::audio->msgRemovePart(nextPart, false);
// Indicate no undo, and do port controller values but not clone parts.
- audio->msgChangePart(oPart, nPart, false, true, false);
+ MusEGlobal::audio->msgChangePart(oPart, nPart, false, true, false);
endUndo(SC_PART_MODIFIED | SC_PART_REMOVED);
}
@@ -1161,6 +1165,7 @@ void Part::dump(int n) const
PosLen::dump();
}
+
void WavePart::dump(int n) const
{
Part::dump(n);
@@ -1169,6 +1174,7 @@ void WavePart::dump(int n) const
printf("WavePart\n");
}
+
void MidiPart::dump(int n) const
{
Part::dump(n);
@@ -1186,11 +1192,13 @@ MidiPart* MidiPart::clone() const
return new MidiPart(*this);
}
+
WavePart* WavePart::clone() const
{
return new WavePart(*this);
}
+
/*
bool Part::hasHiddenNotes()
{
@@ -1226,3 +1234,4 @@ int Part::hasHiddenEvents()
return _hiddenEvents;
}
+} // namespace MusECore