1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: part.h,v 1.1.1.1 2003/10/29 10:05:11 wschweer Exp $
//
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//=========================================================
#ifndef __PART_H__
#define __PART_H__
#include <map>
#include <qstring.h>
#include "pos.h"
class Track;
class MidiTrack;
class WaveTrack;
class EventList;
class Clip;
class Xml;
class Event;
typedef std::multimap<int, Event*, std::less<int> >::iterator iEvent;
//---------------------------------------------------------
// Part
//---------------------------------------------------------
class Part : public PosLen {
static int snGen;
int _sn;
QString _name;
bool _selected;
bool _mute;
int _colorIndex;
protected:
Track* _track;
EventList* _events;
public:
Part(Track*);
Part(Track*, EventList*);
virtual ~Part();
int sn() { return _sn; }
void setSn(int n) { _sn = n; }
int newSn() { return snGen++; }
virtual Part* clone() const = 0;
const QString& name() const { return _name; }
void setName(const QString& s) { _name = s; }
bool selected() const { return _selected; }
void setSelected(bool f) { _selected = f; }
bool mute() const { return _mute; }
void setMute(bool b) { _mute = b; }
Track* track() const { return _track; }
void setTrack(Track*t) { _track = t; }
EventList* events() const { return _events; }
const EventList* cevents() const { return _events; }
int colorIndex() const { return _colorIndex; }
void setColorIndex(int idx) { _colorIndex = idx; }
iEvent addEvent(Event* p);
virtual void read(Xml&);
virtual void write(int, Xml&) const;
virtual Event* newEvent() const = 0;
virtual void dump() const;
};
//---------------------------------------------------------
// MidiPart
//---------------------------------------------------------
class MidiPart : public Part {
public:
MidiPart(MidiTrack* t) : Part((Track*)t) {}
MidiPart(MidiTrack* t, EventList* ev) : Part((Track*)t, ev) {}
virtual ~MidiPart() {}
virtual MidiPart* clone() const;
MidiTrack* track() const { return (MidiTrack*)Part::track(); }
virtual Event* newEvent() const;
virtual void dump() const;
};
//---------------------------------------------------------
// WavePart
//---------------------------------------------------------
class WavePart : public Part {
public:
WavePart(WaveTrack* t);
WavePart(WaveTrack* t, EventList* ev);
virtual ~WavePart() {}
virtual WavePart* clone() const;
WaveTrack* track() const { return (WaveTrack*)Part::track(); }
virtual Event* newEvent() const;
virtual void dump() const;
};
//---------------------------------------------------------
// PartList
//---------------------------------------------------------
typedef std::multimap<int, Part*, std::less<int> >::iterator iPart;
typedef std::multimap<int, Part*, std::less<int> >::const_iterator ciPart;
class PartList : public std::multimap<int, Part*, std::less<int> > {
public:
iPart findPart(int tick);
iPart add(Part*);
void remove(Part* part);
int index(Part*);
Part* find(int idx);
};
#endif
|