summaryrefslogtreecommitdiff
path: root/muse2/muse/instruments
diff options
context:
space:
mode:
authorterminator356 <termtech@rogers.com>2014-01-07 02:00:22 -0500
committerterminator356 <termtech@rogers.com>2014-01-07 02:00:22 -0500
commit7a6952bbdbcf8bd6573543d1c28e6fa75d50d4e4 (patch)
treecc4f8980591848591ba05389cf1791d8c611d4d1 /muse2/muse/instruments
parent42ecd9fd47fe44c999bfd7f4f051179806735b0a (diff)
Instrument can now be changed from trackinfo panel. Tweaks, cleanups.
Midi instrument can now be changed from midi track info panel. Some minor code tweaks, code cleanup in mtrackinfo.cpp, confmport.cpp.
Diffstat (limited to 'muse2/muse/instruments')
-rw-r--r--muse2/muse/instruments/minstrument.cpp26
-rw-r--r--muse2/muse/instruments/minstrument.h3
2 files changed, 24 insertions, 5 deletions
diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp
index c119f0bc..ecfc2da4 100644
--- a/muse2/muse/instruments/minstrument.cpp
+++ b/muse2/muse/instruments/minstrument.cpp
@@ -472,13 +472,13 @@ MType MidiInstrument::midiType() const
void MidiInstrument::reset(int portNo)
{
MusECore::MidiPort* port = &MusEGlobal::midiPorts[portNo];
- if(port->device() == 0) // p4.0.15
+ if(port->device() == 0)
return;
MusECore::MidiPlayEvent ev;
ev.setType(0x90);
ev.setPort(portNo);
- ev.setTime(0); // p4.0.15
+ ev.setTime(0);
for (int chan = 0; chan < MIDI_CHANNELS; ++chan)
{
@@ -692,7 +692,7 @@ void SysEx::write(int level, Xml& xml)
void MidiInstrument::readMidiState(Xml& xml)
{
- // p4.0.27 A kludge to support old midistates by wrapping them in the proper header.
+ // A kludge to support old midistates by wrapping them in the proper header.
_tmpMidiStateVersion = 1; // Assume old (unmarked) first version 1.
for (;;)
{
@@ -918,7 +918,6 @@ void MidiInstrument::read(Xml& xml)
else if (tag == "Controller") {
MidiController* mc = new MidiController();
mc->read(xml);
- // Added by Tim. Copied from muse 2.
//
// HACK: make predefined "Program" controller overloadable
//
@@ -1041,6 +1040,25 @@ void MidiInstrument::write(int level, Xml& xml)
//---------------------------------------------------------
+// populateInstrPopup (static)
+//---------------------------------------------------------
+
+void MidiInstrument::populateInstrPopup(MusEGui::PopupMenu* menu, MidiInstrument* /*current*/, bool show_synths)
+ {
+ menu->clear();
+ for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i
+ != MusECore::midiInstruments.end(); ++i)
+ {
+ // Do not list synths. Although it is possible to assign a synth
+ // as an instrument to a non-synth device, we should not allow this.
+ // (One reason is that the 'show gui' column is then enabled, which
+ // makes no sense for a non-synth device).
+ if(show_synths || !(*i)->isSynti())
+ menu->addAction((*i)->iname());
+ }
+ }
+
+//---------------------------------------------------------
// populatePatchPopup
//---------------------------------------------------------
diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h
index 5a520e67..4f532719 100644
--- a/muse2/muse/instruments/minstrument.h
+++ b/muse2/muse/instruments/minstrument.h
@@ -202,8 +202,8 @@ class MidiInstrument {
const QString& iname() const { return _name; }
void setIName(const QString& txt) { _name = txt; }
MType midiType() const;
+ virtual bool isSynti() const { return false; }
- //MidiInstrument& uniqueCopy(const MidiInstrument&);
// Assign will 'delete' all existing patches and groups from the instrument.
MidiInstrument& assign(const MidiInstrument&);
QString filePath() const { return _filePath; }
@@ -240,6 +240,7 @@ class MidiInstrument {
virtual void reset(int);
virtual QString getPatchName(int,int,bool) const;
virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool);
+ static void populateInstrPopup(MusEGui::PopupMenu*, MidiInstrument* current = 0, bool show_synths = false); // Static
void read(Xml&);
void write(int level, Xml&);