diff options
author | Florian Jung <flo@windfisch.org> | 2013-09-18 22:40:48 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2013-09-18 22:40:48 +0200 |
commit | 32589cdd760755d685a76d31469798fde74ad827 (patch) | |
tree | d50afd9a2a176846dd6c5b19d734ed9108e44aad /muse2/muse | |
parent | af09b4f881888b97903cda57907cda571be83b18 (diff) | |
parent | 48a93993cfce160fb7d4cf0b67b4b77e22db19e5 (diff) |
Merge branch 'master' into audiomsg_overhaul
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/main.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/miditransform.cpp | 28 | ||||
-rw-r--r-- | muse2/muse/miditransform.h | 17 | ||||
-rw-r--r-- | muse2/muse/mplugins/midiitransform.cpp | 59 | ||||
-rw-r--r-- | muse2/muse/mplugins/midiitransform.h | 1 | ||||
-rw-r--r-- | muse2/muse/widgets/aboutbox.ui | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/aboutbox_impl.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/itransformbase.ui | 15 |
8 files changed, 118 insertions, 13 deletions
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index feb14324..2d2165d1 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -127,7 +127,10 @@ static void getCapabilities() static void printVersion(const char* prog) { - fprintf(stderr, "%s: Linux Music Editor; Version %s, (svn revision %s)\n", prog, VERSION, SVNVERSION); + if (strcmp("", GITSTRING)) + fprintf(stderr, "%s: Linux Music Editor; Version %s, (%s)\n", prog, VERSION, GITSTRING); + else + fprintf(stderr, "%s: Linux Music Editor; Version %s\n", prog, VERSION); } //--------------------------------------------------------- diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 3f0f9235..723e067b 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -48,7 +48,7 @@ namespace MusECore { // // Order of events: -// Note, Poly Pressure, Control, AfterTouch, Pitch Bend, NRPN, RPN +// Note, Poly Pressure, Control, AfterTouch, Pitch Bend, NRPN, RPN, Program // #define MIDITRANSFORM_NOTE 0 #define MIDITRANSFORM_POLY 1 @@ -57,11 +57,12 @@ namespace MusECore { #define MIDITRANSFORM_PITCHBEND 4 #define MIDITRANSFORM_NRPN 5 #define MIDITRANSFORM_RPN 6 +#define MIDITRANSFORM_PROGRAM 7 static int eventTypeTable[] = { MIDITRANSFORM_NOTE, MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH, - MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN + MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN, MIDITRANSFORM_PROGRAM }; static int procVal2Map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11 }; @@ -545,6 +546,8 @@ void MidiTransformerDialog::transformEvent(MusECore::Event& event, MusECore::Mid val = cmt->procVal1a; } break; + default: + break; } if (val < 0) val = 0; @@ -598,6 +601,7 @@ void MidiTransformerDialog::transformEvent(MusECore::Event& event, MusECore::Mid case MusECore::ScaleMap: case MusECore::Keep: case MusECore::Flip: + case MusECore::Toggle: break; } if (val < 0) @@ -634,6 +638,7 @@ void MidiTransformerDialog::transformEvent(MusECore::Event& event, MusECore::Mid case MusECore::Keep: case MusECore::Flip: case MusECore::Value: + case MusECore::Toggle: break; } if (len < 0) @@ -666,6 +671,7 @@ void MidiTransformerDialog::transformEvent(MusECore::Event& event, MusECore::Mid case MusECore::Keep: case MusECore::Flip: case MusECore::Value: + case MusECore::Toggle: break; } if (pos < 0) @@ -1139,6 +1145,8 @@ void MidiTransformerDialog::procVal1OpSel(int val) procVal1a->setEnabled(true); procVal1b->setEnabled(true); break; + default: + break; } procVal1aChanged(data->cmt->procVal1a); procVal1bChanged(data->cmt->procVal1b); @@ -1152,7 +1160,15 @@ void MidiTransformerDialog::procVal2OpSel(int val) { MusECore::TransformOperator op = MusECore::TransformOperator(MusECore::procVal2Map[val]); data->cmt->procVal2 = op; + procVal2OpUpdate(op); + } + +//--------------------------------------------------------- +// procVal2OpUpdate +//--------------------------------------------------------- +void MidiTransformerDialog::procVal2OpUpdate(MusECore::TransformOperator op) + { switch (op) { case MusECore::Keep: case MusECore::Invert: @@ -1699,6 +1715,14 @@ bool MidiTransformerDialog::typesMatch(const MusECore::Event& e, unsigned selTyp matched = (c == MusECore::MidiController::RPN); } } + case MIDITRANSFORM_PROGRAM: + { + if (e.type() == MusECore::Controller) { + MusECore::MidiController::ControllerType c = MusECore::midiControllerType(e.dataA()); + matched = (c == MusECore::MidiController::Program); + } + break; + } default: fprintf(stderr, "Error matching type in MidiTransformerDialog: unknown eventtype!\n"); break; diff --git a/muse2/muse/miditransform.h b/muse2/muse/miditransform.h index 626c83c5..5ff78357 100644 --- a/muse2/muse/miditransform.h +++ b/muse2/muse/miditransform.h @@ -50,7 +50,21 @@ enum TransformFunction { enum TransformOperator { Keep, Plus, Minus, Multiply, Divide, Fix, Value, Invert, - ScaleMap, Flip, Dynamic, Random + ScaleMap, Flip, Dynamic, Random, Toggle + }; + +class TransformToggleState { + private: + bool _ctrlStates[128]; + + public: + TransformToggleState() + { + for(int i = 0; i < 128; ++i) + _ctrlStates[i] = false; + } + bool ctrlState(int ctl_num) { return _ctrlStates[ctl_num & 0x7f]; } + void setCtrlState(int ctl_num, bool state) { _ctrlStates[ctl_num & 0x7f] = state; } }; extern void writeMidiTransforms(int level, Xml& xml); @@ -93,6 +107,7 @@ class MidiTransformerDialog : public QDialog, public Ui::MidiTransformDialogBase void procEventTypeSel(int); void procVal1OpSel(int); void procVal2OpSel(int); + void procVal2OpUpdate(MusECore::TransformOperator op); void procLenOpSel(int); void procPosOpSel(int); void funcOpSel(int); diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index 4be99f9d..dea7ce8b 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -51,20 +51,21 @@ #define MIDITRANSFORM_PITCHBEND 4 #define MIDITRANSFORM_NRPN 5 #define MIDITRANSFORM_RPN 6 +#define MIDITRANSFORM_PROGRAM 7 namespace MusECore { static int selTypeTable[] = { MIDITRANSFORM_NOTE, MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH, - MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN + MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN, MIDITRANSFORM_PROGRAM }; static int procTypeTable[] = { MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH, - MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN + MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN, MIDITRANSFORM_PROGRAM }; -static int procVal2Map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11 }; +static int procVal2Map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12 }; struct TDict { TransformFunction id; @@ -86,6 +87,8 @@ class MidiInputTransformation { QString name; QString comment; + MusECore::TransformToggleState toggleState; + ValOp selEventOp; int selType; @@ -145,7 +148,7 @@ class MidiInputTransformation { procChannelb = 0; } void write(int level, Xml& xml) const; - int apply(MidiRecordEvent& ev) const; + int apply(MidiRecordEvent& ev); bool typesMatch(MidiRecordEvent& e, int selType) const; }; @@ -234,7 +237,7 @@ static bool filterValOp(ValOp op, int val, int val1, int val2) // 2 - event changed //--------------------------------------------------------- -int MidiInputTransformation::apply(MidiRecordEvent& event) const +int MidiInputTransformation::apply(MidiRecordEvent& event) { int t = event.type(); @@ -312,6 +315,9 @@ int MidiInputTransformation::apply(MidiRecordEvent& event) const event.setType(ME_CONTROLLER); } break; + case MIDITRANSFORM_PROGRAM: + event.setType(ME_PROGRAM); + break; default: break; } @@ -366,6 +372,8 @@ int MidiInputTransformation::apply(MidiRecordEvent& event) const val = procVal1a; } break; + default: + break; } if (val < 0) val = 0; @@ -414,6 +422,28 @@ int MidiInputTransformation::apply(MidiRecordEvent& event) const val = procVal2a; } break; + case Toggle: + { + if(event.type() == ME_CONTROLLER) + { + int num = event.dataA(); + bool state = toggleState.ctrlState(num); + if(state) + { + state = false; + val = procVal2a; + } + else + { + state = true; + val = procVal2b; + } + toggleState.setCtrlState(num, state); + } + else + printf("toggle implemented only for controllers\n"); + } + break; case ScaleMap: case Keep: case Flip: @@ -469,6 +499,7 @@ int MidiInputTransformation::apply(MidiRecordEvent& event) const case ScaleMap: case Keep: case Flip: + case Toggle: break; } if (val < 0) @@ -521,6 +552,7 @@ int MidiInputTransformation::apply(MidiRecordEvent& event) const case ScaleMap: case Keep: case Flip: + case Toggle: break; } if (val < 0) @@ -578,6 +610,9 @@ bool MidiInputTransformation::typesMatch(MidiRecordEvent& e, int selType) const } } break; + case MIDITRANSFORM_PROGRAM: + matched = (t == ME_PROGRAM); + break; default: fprintf(stderr, "Error matching type in MidiTransformerDialog: unknown eventtype!\n"); break; @@ -1116,6 +1151,7 @@ void MidiInputTransformDialog::procVal1OpSel(int val) case MusECore::Random: case MusECore::ScaleMap: case MusECore::Dynamic: + case MusECore::Toggle: procVal1a->setDecimals(0); procVal1a->setEnabled(true); procVal1b->setEnabled(true); @@ -1133,7 +1169,15 @@ void MidiInputTransformDialog::procVal2OpSel(int val) { MusECore::TransformOperator op = MusECore::TransformOperator(MusECore::procVal2Map[val]); cmt->procVal2 = op; + procVal2OpUpdate(op); + } +//--------------------------------------------------------- +// procVal2OpUpdate +//--------------------------------------------------------- + +void MidiInputTransformDialog::procVal2OpUpdate(MusECore::TransformOperator op) + { switch (op) { case MusECore::Keep: case MusECore::Invert: @@ -1156,6 +1200,7 @@ void MidiInputTransformDialog::procVal2OpSel(int val) break; case MusECore::Random: case MusECore::Dynamic: + case MusECore::Toggle: procVal2a->setDecimals(0); procVal2a->setEnabled(true); procVal2b->setEnabled(true); @@ -1192,7 +1237,7 @@ void MidiInputTransformDialog::funcOpSel(int val) if (isFuncOp) { procEventOpSel(cmt->procEvent); procVal1OpSel(cmt->procVal1); - procVal2OpSel(cmt->procVal2); + procVal2OpUpdate(cmt->procVal2); procPortOpSel(cmt->procPort); procChannelOpSel(cmt->procChannel); } @@ -1507,6 +1552,7 @@ void MidiInputTransformDialog::procPortOpSel(int val) case MusECore::Random: case MusECore::ScaleMap: case MusECore::Dynamic: + case MusECore::Toggle: procPortVala->setDecimals(0); procPortVala->setEnabled(true); procPortValb->setEnabled(true); @@ -1563,6 +1609,7 @@ void MidiInputTransformDialog::procChannelOpSel(int val) case MusECore::Random: case MusECore::ScaleMap: case MusECore::Dynamic: + case MusECore::Toggle: procChannelVala->setDecimals(0); procChannelVala->setEnabled(true); procChannelValb->setEnabled(true); diff --git a/muse2/muse/mplugins/midiitransform.h b/muse2/muse/mplugins/midiitransform.h index 30dabd13..b183bc53 100644 --- a/muse2/muse/mplugins/midiitransform.h +++ b/muse2/muse/mplugins/midiitransform.h @@ -84,6 +84,7 @@ class MidiInputTransformDialog : public QDialog, public Ui::MidiInputTransformDi void procEventTypeSel(int); void procVal1OpSel(int); void procVal2OpSel(int); + void procVal2OpUpdate(MusECore::TransformOperator op); void funcOpSel(int); void presetChanged(QListWidgetItem*); void nameChanged(const QString&); diff --git a/muse2/muse/widgets/aboutbox.ui b/muse2/muse/widgets/aboutbox.ui index bf14e099..29497422 100644 --- a/muse2/muse/widgets/aboutbox.ui +++ b/muse2/muse/widgets/aboutbox.ui @@ -58,7 +58,7 @@ <item> <widget class="QLabel" name="textLabel1"> <property name="text"> - <string>(C) Copyright 1999-2012 Werner Schweer and others. + <string>(C) Copyright 1999-2013 Werner Schweer and others. See http://www.muse-sequencer.org for new versions and more information. diff --git a/muse2/muse/widgets/aboutbox_impl.cpp b/muse2/muse/widgets/aboutbox_impl.cpp index b53e246f..fcb96a1d 100644 --- a/muse2/muse/widgets/aboutbox_impl.cpp +++ b/muse2/muse/widgets/aboutbox_impl.cpp @@ -31,8 +31,8 @@ AboutBoxImpl::AboutBoxImpl() setupUi(this); imageLabel->setPixmap(*aboutMuseImage); QString version(VERSION); - QString svnrevision(SVNVERSION); - versionLabel->setText("Version: " + version + " (svn revision: "+ svnrevision +")"); + QString gitstring(GITSTRING); + versionLabel->setText("Version: " + version + (gitstring == QString() ? "" : "\n("+ gitstring + ")")); } } diff --git a/muse2/muse/widgets/itransformbase.ui b/muse2/muse/widgets/itransformbase.ui index 52c29a7e..882f383f 100644 --- a/muse2/muse/widgets/itransformbase.ui +++ b/muse2/muse/widgets/itransformbase.ui @@ -94,6 +94,11 @@ <string>RPN</string> </property> </item> + <item> + <property name="text"> + <string>Program</string> + </property> + </item> </widget> </item> <item row="0" column="2"> @@ -432,6 +437,11 @@ <string>RPN</string> </property> </item> + <item> + <property name="text"> + <string>Program</string> + </property> + </item> </widget> </item> <item row="1" column="1"> @@ -615,6 +625,11 @@ <string>Random</string> </property> </item> + <item> + <property name="text"> + <string>Toggle</string> + </property> + </item> </widget> </item> <item row="1" column="4"> |