From 28b49b703f20cba6ca43cac9bbfa795972cd71ee Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Tue, 12 Dec 2006 12:57:25 +0000 Subject: define new midi controller --- muse/ChangeLog | 20 ++++++------ muse/muse/ctrl/configmidictrl.cpp | 5 ++- muse/muse/ctrl/definemidictrl.cpp | 66 ++++++++++++++++++++++++++++++++++++++ muse/muse/ctrl/definemidictrl.h | 4 +++ muse/muse/ctrl/definemidictrl.ui | 67 +++++++++++++++++---------------------- muse/muse/liste/ctrllistedit.ui | 19 +++++++++-- 6 files changed, 131 insertions(+), 50 deletions(-) diff --git a/muse/ChangeLog b/muse/ChangeLog index 4892c302..2673b782 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,5 @@ +12.12 (ws) + - added possibility to define a new midicontroller 10.12 (ng) - items in pianoroll play the right pitch (event.pitch + transpose) - items in pianoroll are displayed correctly according to Y zoom @@ -27,7 +29,7 @@ - application spanning drag&drop of parts - cut/copy/paste for parts 24.11 (ws) - - added new make target: "doxy" to generate doxygen source + - added new make target: "doxy" to generate doxygen source documentation 21.11 (ws) - fixed DSSI support @@ -59,12 +61,12 @@ are no longer const; - Added getBankName() to interface to allow for simple structuring of patches. - - queue midi events which cannot be send to busy(locked) software + - queue midi events which cannot be send to busy(locked) software synthesizer - zynaddsubfx: implement locking, showGui(), and getControllerInfo(); cache patch names 29.10 (ws) - - fixed crash after some time of midi recording: made midi + - fixed crash after some time of midi recording: made midi input queue thread safe. 27.10 (ws) - added a MESS port of the Zynaddsubfx software synthesizer @@ -78,7 +80,7 @@ 18.10 (ws) - added routing for jack midi ports. Fixes for "mus". 17.10 (ws) - - added new program "mus". Mus is a wrapper to operate MusE MESS + - added new program "mus". Mus is a wrapper to operate MusE MESS synthesizer standalone with JACK audio/midi interface. The plan is to use them to test the upcoming jack midi implementation. 15.10 (ng) @@ -123,7 +125,7 @@ - change german documentation encoding to utf8 - dont assume system encoding is isoLatin1, first patches (ubuntu and others use utf8) -4.9 +4.9 (ws) - remove html documentation and replace with *pdf version (ng) @@ -151,7 +153,7 @@ 22.8 (rj) * playing with midi plugins, one new example plugin: trigg 29.7 (ws) - * fixed drawing of waveform in wave track. Concurrent wave file + * fixed drawing of waveform in wave track. Concurrent wave file accesses from gui and rt task produced distortions ("crackling"). 25.7 (ng) DeicsOnze * add panic button @@ -190,9 +192,9 @@ * drag/drop of projects in project dialog * added Roland JV-1010 instrument definitions from f.fabre 29.5 (ws) - * the list of available software synthesizer in + * the list of available software synthesizer in edit->AddTrack->AddSoftSynth was always empty - * properly ignore close event in MusE::closeEvent() if the + * properly ignore close event in MusE::closeEvent() if the user aborts operation 25.5 (ws) * remove automation buttons from midi track in arranger @@ -381,7 +383,7 @@ 3.1 (rj) * fixed search box in plugin dialog 2.1 (ws) - * fix recording of note off events when part does not start at zero + * fix recording of note off events when part does not start at zero 31.12 (ws) * fixes for audio prefetch thread 30.12 (ws) diff --git a/muse/muse/ctrl/configmidictrl.cpp b/muse/muse/ctrl/configmidictrl.cpp index 6f9187c9..395518a8 100644 --- a/muse/muse/ctrl/configmidictrl.cpp +++ b/muse/muse/ctrl/configmidictrl.cpp @@ -193,7 +193,10 @@ void ConfigMidiCtrl::done(int code) void ConfigMidiCtrl::defineClicked() { DefineMidiCtrl dc(track, this); - if (dc.exec()) + if (dc.exec()) { + Ctrl* ctrl = new Ctrl(dc.midiController()); + track->addController(ctrl); QDialog::done(0); + } } diff --git a/muse/muse/ctrl/definemidictrl.cpp b/muse/muse/ctrl/definemidictrl.cpp index 3b46f2d5..197d7572 100644 --- a/muse/muse/ctrl/definemidictrl.cpp +++ b/muse/muse/ctrl/definemidictrl.cpp @@ -20,9 +20,14 @@ #include "definemidictrl.h" #include "miditrack.h" +#include "instruments/minstrument.h" //--------------------------------------------------------- // DefineMidiCtrlDialog +// controllerName QLineEdit +// controllerType QComboBox +// msbId lsbId minVal maxVal initVal QSpinBox +// moveWithPart QCheckBox //--------------------------------------------------------- DefineMidiCtrl::DefineMidiCtrl(MidiTrack* t, QWidget* parent) @@ -30,6 +35,7 @@ DefineMidiCtrl::DefineMidiCtrl(MidiTrack* t, QWidget* parent) { setupUi(this); track = t; + connect(controllerType, SIGNAL(currentIndexChanged(int)), SLOT(typeChanged(int))); } //--------------------------------------------------------- @@ -39,6 +45,66 @@ DefineMidiCtrl::DefineMidiCtrl(MidiTrack* t, QWidget* parent) void DefineMidiCtrl::done(int val) { + if (val) { + ctrl.setName(controllerName->text()); + ctrl.setComment(controllerComment->toPlainText()); + int num = MidiController::genNum( + MidiController::ControllerType(controllerType->currentIndex()), + msbId->value(), lsbId->value()); + ctrl.setNum(num); + ctrl.setMinVal(minVal->value()); + ctrl.setMaxVal(maxVal->value()); + ctrl.setInitVal(initVal->value()); + ctrl.setMoveWithPart(moveWithPart->isChecked()); + + // + // add controller to instrument + // + MidiInstrument* instrument = track->instrument(); + MidiControllerList* mcl = instrument->controller(); + MidiController* c = new MidiController(ctrl); + mcl->append(c); + } + QDialog::done(val); } +//--------------------------------------------------------- +// typeChanged +//--------------------------------------------------------- + +void DefineMidiCtrl::typeChanged(int val) + { + MidiController::ControllerType t = (MidiController::ControllerType)val; + switch (t) { + case MidiController::RPN: + case MidiController::NRPN: + case MidiController::Controller7: + msbId->setEnabled(false); + lsbId->setEnabled(true); + maxVal->setRange(0, 127); + maxVal->setValue(127); + initVal->setRange(0, 127); + break; + case MidiController::Controller14: + case MidiController::RPN14: + case MidiController::NRPN14: + msbId->setEnabled(true); + lsbId->setEnabled(true); + maxVal->setRange(0, 128*128-1); + maxVal->setValue(128*128-1); + initVal->setRange(0, 128*128-1); + break; + case MidiController::Pitch: + case MidiController::Program: + msbId->setEnabled(false); + lsbId->setEnabled(false); + maxVal->setRange(0, 128*128-1); + initVal->setRange(0, 128*128-1); + maxVal->setValue(128*128-1); + break; + default: + break; + } + } + diff --git a/muse/muse/ctrl/definemidictrl.h b/muse/muse/ctrl/definemidictrl.h index c498c81c..bc0df6a9 100644 --- a/muse/muse/ctrl/definemidictrl.h +++ b/muse/muse/ctrl/definemidictrl.h @@ -22,6 +22,7 @@ #define __DEFINEMIDICTRL_H__ #include "ui_definemidictrl.h" +#include "midictrl.h" class MidiTrack; @@ -33,12 +34,15 @@ class DefineMidiCtrl : public QDialog, public Ui::DefineMidiCtrlBase { Q_OBJECT MidiTrack* track; + MidiController ctrl; private slots: virtual void done(int); + void typeChanged(int); public: DefineMidiCtrl(MidiTrack* t, QWidget* parent = 0); + const MidiController* midiController() const { return &ctrl; } }; #endif diff --git a/muse/muse/ctrl/definemidictrl.ui b/muse/muse/ctrl/definemidictrl.ui index 20269956..409ebfd6 100644 --- a/muse/muse/ctrl/definemidictrl.ui +++ b/muse/muse/ctrl/definemidictrl.ui @@ -5,8 +5,8 @@ 0 0 - 463 - 301 + 558 + 344 @@ -28,10 +28,10 @@ 6 - + - + 7-Bit @@ -103,19 +103,6 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical - - - - 20 - 16 - - - - @@ -140,7 +127,7 @@ p, li { white-space: pre-wrap; } - + @@ -157,7 +144,7 @@ p, li { white-space: pre-wrap; } - + @@ -166,6 +153,13 @@ p, li { white-space: pre-wrap; } + + + + Move with Part + + + @@ -177,7 +171,7 @@ p, li { white-space: pre-wrap; } 6 - + @@ -201,7 +195,7 @@ p, li { white-space: pre-wrap; } - + @@ -211,7 +205,7 @@ p, li { white-space: pre-wrap; } - + @@ -232,20 +226,7 @@ p, li { white-space: pre-wrap; } - - - Qt::Vertical - - - - 20 - 16 - - - - - - + Qt::Horizontal @@ -254,12 +235,22 @@ p, li { white-space: pre-wrap; } + + + + + + + Comment: + + + - buttonBox + okButton accepted() DefineMidiCtrlBase accept() @@ -275,7 +266,7 @@ p, li { white-space: pre-wrap; } - buttonBox + okButton rejected() DefineMidiCtrlBase reject() diff --git a/muse/muse/liste/ctrllistedit.ui b/muse/muse/liste/ctrllistedit.ui index 88f850d9..27389b7c 100644 --- a/muse/muse/liste/ctrllistedit.ui +++ b/muse/muse/liste/ctrllistedit.ui @@ -14,10 +14,10 @@ - 0 + 9 - 3 + 6 @@ -63,6 +63,14 @@ + + + 0 + 0 + 0 + 0 + + Id: @@ -75,6 +83,13 @@ + + + + move with part + + + -- cgit v1.2.3