diff options
Diffstat (limited to 'src/base/Track.h')
-rw-r--r-- | src/base/Track.h | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/src/base/Track.h b/src/base/Track.h new file mode 100644 index 0000000..bcded51 --- /dev/null +++ b/src/base/Track.h @@ -0,0 +1,162 @@ +// -*- c-basic-offset: 4 -*- + +/* + Rosegarden + A sequencer and musical notation editor. + + This program is Copyright 2000-2008 + Guillaume Laurent <[email protected]>, + Chris Cannam <[email protected]>, + Richard Bown <[email protected]> + + The moral right of the authors to claim authorship of this work + has been asserted. + + 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; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +// Representation of a Track +// +// + + +#ifndef _TRACK_H_ +#define _TRACK_H_ + +#include <string> + +#include "XmlExportable.h" +#include "Instrument.h" +#include "Device.h" + +namespace Rosegarden +{ +class Composition; + +typedef unsigned int TrackId; + +/** + * A Track represents a line on the SegmentCanvas on the + * Rosegarden GUI. A Track is owned by a Composition and + * has reference to an Instrument from which the playback + * characteristics of the Track can be derived. A Track + * has no type itself - the type comes only from the + * Instrument relationship. + * + */ +class Track : public XmlExportable +{ + friend class Composition; + +public: + Track(); + Track(TrackId id, + InstrumentId instrument = 0, + int position =0 , + const std::string &label = "", + bool muted = false); + + void setId(TrackId id) { m_id = id; } + +private: + Track(const Track &); + Track operator=(const Track &); + +public: + + ~Track(); + + TrackId getId() const { return m_id; } + + void setMuted(bool muted); + bool isMuted() const { return m_muted; } + + void setPosition(int position) { m_position = position; } + int getPosition() const { return m_position; } + + void setLabel(const std::string &label); + std::string getLabel() const { return m_label; } + + void setPresetLabel(const std::string &label); + std::string getPresetLabel() const { return m_presetLabel; } + + void setInstrument(InstrumentId instrument); + InstrumentId getInstrument() const { return m_instrument; } + + // Implementation of virtual + // + virtual std::string toXmlString(); + + Composition* getOwningComposition() { return m_owningComposition; } + + void setMidiInputDevice(DeviceId id); + DeviceId getMidiInputDevice() const { return m_input_device; } + + void setMidiInputChannel(char ic); + char getMidiInputChannel() const { return m_input_channel; } + + int getClef() { return m_clef; } + void setClef(int clef) { m_clef = clef; } + + int getTranspose() { return m_transpose; } + void setTranspose(int transpose) { m_transpose = transpose; } + + int getColor() { return m_color; } + void setColor(int color) { m_color = color; } + + int getHighestPlayable() { return m_highestPlayable; } + void setHighestPlayable(int pitch) { m_highestPlayable = pitch; } + + int getLowestPlayable() { return m_lowestPlayable; } + void setLowestPlayable(int pitch) { m_lowestPlayable = pitch; } + + // Controls size of exported staff in LilyPond + int getStaffSize() { return m_staffSize; } + void setStaffSize(int index) { m_staffSize = index; } + + // Staff bracketing in LilyPond + int getStaffBracket() { return m_staffBracket; } + void setStaffBracket(int index) { m_staffBracket = index; } + + bool isArmed() const { return m_armed; } + void setArmed(bool armed); + +protected: // For Composition use only + void setOwningComposition(Composition* comp) { m_owningComposition = comp; } + +private: + //--------------- Data members --------------------------------- + + TrackId m_id; + bool m_muted; + std::string m_label; + std::string m_presetLabel; + int m_position; + InstrumentId m_instrument; + + Composition* m_owningComposition; + + DeviceId m_input_device; + char m_input_channel; + bool m_armed; + + // default parameters for new segments created belonging to this track + int m_clef; + int m_transpose; + int m_color; + int m_highestPlayable; + int m_lowestPlayable; + + // staff parameters for LilyPond export + int m_staffSize; + int m_staffBracket; +}; + +} + +#endif // _TRACK_H_ + |