1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 3 /* 4 Rosegarden 5 A sequencer and musical notation editor. 6 Copyright 2000-2021 the Rosegarden development team. 7 8 This program is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License as 10 published by the Free Software Foundation; either version 2 of the 11 License, or (at your option) any later version. See the file 12 COPYING included with this distribution for more information. 13 */ 14 15 #ifndef RG_MAPPEDINSTRUMENT_H 16 #define RG_MAPPEDINSTRUMENT_H 17 18 #include "base/Instrument.h" 19 #include "MappedDevice.h" 20 #include "MappedCommon.h" 21 22 // A scaled-down version of an Instrument that we keep Sequencer 23 // side. IDs match with those on the GUI. 24 // 25 // 26 27 namespace Rosegarden 28 { 29 30 class MappedInstrument 31 { 32 public: 33 34 MappedInstrument(); 35 36 // GUI uses this constructor because it already knows 37 // the name of the Instrument 38 // 39 MappedInstrument(Instrument::InstrumentType type, 40 MidiByte channel, 41 InstrumentId id); 42 43 // Driver uses this constructor (because the gui will want 44 // to know the name) 45 // 46 MappedInstrument(Instrument::InstrumentType type, 47 MidiByte channel, 48 InstrumentId id, 49 const std::string &name, 50 DeviceId device); 51 52 // from instrument 53 MappedInstrument(const Instrument &instrument); 54 MappedInstrument(Instrument *instrument); 55 ~MappedInstrument()56 ~MappedInstrument() { ;} 57 setId(InstrumentId id)58 void setId(InstrumentId id) { m_id = id; } getId()59 InstrumentId getId() const { return m_id; } 60 setType(Instrument::InstrumentType type)61 void setType(Instrument::InstrumentType type) { m_type = type; } getType()62 Instrument::InstrumentType getType() const { return m_type; } 63 setName(const std::string & name)64 void setName(const std::string &name) { m_name = name; } getName()65 const std::string& getName() const { return m_name; } 66 setDevice(DeviceId device)67 void setDevice(DeviceId device) { m_device = device; } getDevice()68 DeviceId getDevice() const { return m_device; } 69 70 // How many audio channels we've got on this audio MappedInstrument 71 // getAudioChannels()72 unsigned int getAudioChannels() const { return m_audioChannels; } setAudioChannels(unsigned int channels)73 void setAudioChannels(unsigned int channels) { m_audioChannels = channels; } 74 75 friend QDataStream& operator>>(QDataStream &dS, MappedInstrument *mI); 76 friend QDataStream& operator<<(QDataStream &dS, MappedInstrument *mI); 77 friend QDataStream& operator>>(QDataStream &dS, MappedInstrument &mI); 78 friend QDataStream& operator<<(QDataStream &dS, const MappedInstrument &mI); 79 80 private: 81 82 Instrument::InstrumentType m_type; 83 InstrumentId m_id; 84 std::string m_name; 85 DeviceId m_device; 86 87 // If this is an audio MappedInstrument then how many channels 88 // are associated with it? 89 // 90 unsigned int m_audioChannels; 91 }; 92 93 } 94 95 #endif // RG_MAPPEDINSTRUMENT_H 96