diff options
-rw-r--r-- | muse/CMakeLists.txt | 7 | ||||
-rw-r--r-- | muse/ChangeLog | 5 | ||||
-rw-r--r-- | muse/awl/mslider.cpp | 45 | ||||
-rw-r--r-- | muse/muse/midiedit/CMakeLists.txt | 1 | ||||
-rw-r--r-- | muse/muse/midiedit/miditracker.cpp | 129 | ||||
-rw-r--r-- | muse/muse/midiedit/miditracker.h | 20 | ||||
-rw-r--r-- | muse/muse/midiedit/trackpattern.cpp | 431 | ||||
-rw-r--r-- | muse/muse/midiedit/trackpattern.h | 132 | ||||
-rw-r--r-- | muse/plugins/freeverb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | muse/synti/deicsonze/TODO | 2 | ||||
-rw-r--r-- | muse/synti/deicsonze/deicsonze.cpp | 248 | ||||
-rw-r--r-- | muse/synti/deicsonze/deicsonze.h | 80 | ||||
-rw-r--r-- | muse/synti/deicsonze/deicsonzegui.cpp | 6 | ||||
-rw-r--r-- | muse/synti/deicsonze/deicsonzegui.ui | 5 | ||||
-rw-r--r-- | muse/synti/deicsonze/deicsonzeplugin.cpp | 70 |
15 files changed, 918 insertions, 265 deletions
diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt index 71310187..19beacb1 100644 --- a/muse/CMakeLists.txt +++ b/muse/CMakeLists.txt @@ -137,6 +137,13 @@ if (ENABLE_ZYNADDSUBFX) # else (NOT FLTK_FOUND) # message("fltk toolkit found") # endif (NOT FLTK_FOUND) + PKGCONFIG (mxml 2.0 MXML_INCDIR MXML_LIBDIR MXML_LIB MXML_CPP ) + if (NOT MXML_INCDIR) + message("mxml >= 2.0 not found, zynaddsubfx not build") + set(ENABLE_ZYNADDSUBFX OFF) + else (NOT MXML_INCDIR) + message("mxml detected.") + endif (NOT MXML_INCDIR) endif (ENABLE_ZYNADDSUBFX) diff --git a/muse/ChangeLog b/muse/ChangeLog index a4688528..7fa43c42 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,8 @@ +21.11 (ng) + - add color gradient to meterslider + - update miditracker (not working yet) + - check mxml >= 2.0 for zynaddsubfx + - fix deicsonze FX plugin bug 16.11 (ws) - implemented controller editor part of new list editor 12.11 (ws) diff --git a/muse/awl/mslider.cpp b/muse/awl/mslider.cpp index 0bfac826..2639dde8 100644 --- a/muse/awl/mslider.cpp +++ b/muse/awl/mslider.cpp @@ -32,7 +32,7 @@ MeterSlider::MeterSlider(QWidget* parent) : VolSlider(parent) { _channel = 0; - yellowScale = -10; + yellowScale = -16; //-10; redScale = 0; _meterWidth = _scaleWidth * 3; setChannel(1); @@ -138,7 +138,41 @@ void MeterSlider::paint(const QRect& r) h = 0; else if (h > mh) h = mh; - if (h > h1) { + + QColor yellowRed; + yellowRed.setHsv(QColor(Qt::yellow).hue()-8, + QColor(Qt::yellow).saturation(), + QColor(Qt::yellow).value()); + QColor yellRedRed; + yellRedRed.setHsv(QColor(Qt::yellow).hue()-16, + QColor(Qt::yellow).saturation(), + QColor(Qt::yellow).value()); + QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, mh)); + linearGrad.setColorAt(0, Qt::red); + linearGrad.setColorAt(1-(double)(h1-5)/(double)mh, yellRedRed); + linearGrad.setColorAt(1-(double)(h1-6)/(double)mh, yellowRed); + linearGrad.setColorAt(1-(double)h2/(double)mh, Qt::yellow); + linearGrad.setColorAt(1, Qt::green); + + QColor darkYellowRed; + darkYellowRed.setHsv(QColor(Qt::darkYellow).hue()-8, + QColor(Qt::darkYellow).saturation(), + QColor(Qt::darkYellow).value()); + QColor darkYellRedRed; + darkYellRedRed.setHsv(QColor(Qt::darkYellow).hue()-16, + QColor(Qt::darkYellow).saturation(), + QColor(Qt::darkYellow).value()); + QLinearGradient linearDarkGrad(QPointF(0, 0), QPointF(0, mh)); + linearDarkGrad.setColorAt(0, Qt::darkRed); + linearDarkGrad.setColorAt(1-(double)(h1-5)/(double)mh, darkYellRedRed); + linearDarkGrad.setColorAt(1-(double)(h1-6)/(double)mh, darkYellowRed); + linearDarkGrad.setColorAt(1-(double)h2/(double)mh, Qt::darkYellow); + linearDarkGrad.setColorAt(1, Qt::darkGreen); + + p.fillRect(x, y1, mw, mh, linearGrad); + p.fillRect(x, y1, mw, mh-h, linearDarkGrad); + + /*if (h > h1) { p.fillRect(x, y3-h2, mw, h2, QBrush(0x00ff00)); // green p.fillRect(x, y3-h1, mw, h1 - h2, QBrush(0xffff00)); // yellow p.fillRect(x, y3-h, mw, h - h1, QBrush(0xff0000)); // red @@ -155,14 +189,17 @@ void MeterSlider::paint(const QRect& r) p.fillRect(x, y3-h2, mw, h2-h, QBrush(0x007000)); // dark green p.fillRect(x, y3-h1, mw, h1-h2, QBrush(0x8e8e00)); // dark yellow p.fillRect(x, y1, mw, mh - h1, QBrush(0x8e0000)); // dark red - } + }*/ //--------------------------------------------------- // draw peak line //--------------------------------------------------- h = mh - (lrint(fast_log10(meterPeak[i]) * -20.0f * mh / range)); - p.drawLine(x, y3-h, x+mw, y3-h); + if (h > mh) + h = mh; + if (h > 0) + p.drawLine(x, y3-h, x+mw, y3-h); x += mw; } diff --git a/muse/muse/midiedit/CMakeLists.txt b/muse/muse/midiedit/CMakeLists.txt index 384eed3f..dcce663b 100644 --- a/muse/muse/midiedit/CMakeLists.txt +++ b/muse/muse/midiedit/CMakeLists.txt @@ -63,6 +63,7 @@ add_library ( midiedit STATIC pianoroll.cpp prcanvas.cpp miditracker.cpp + trackpattern.cpp ) set_target_properties( midiedit diff --git a/muse/muse/midiedit/miditracker.cpp b/muse/muse/midiedit/miditracker.cpp index 92e72e0c..0b3e2652 100644 --- a/muse/muse/midiedit/miditracker.cpp +++ b/muse/muse/midiedit/miditracker.cpp @@ -11,17 +11,24 @@ #include "muse.h" #include "part.h" +#define MAX(x,y) (x>y?x:y) + +class TrackPattern; + //--------------------------------------------------------- // MidiTrackerEditor //--------------------------------------------------------- MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/) : MidiEditor(pl) { - - //---------menuView--------------------------------- + //-------- + //menuView + //-------- menuView = menuBar()->addMenu(tr("&View")); - - //---------ToolBar---------------------------------- + + //------- + //ToolBar + //------- tools = addToolBar(tr("MidiTracker Tools")); tools->addAction(undoAction); tools->addAction(redoAction); @@ -53,20 +60,27 @@ MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/) //second bar addToolBarBreak(); - //row per measure bar + //row per bar QToolBar* rowfeatures = addToolBar(tr("row features")); - QLabel* rpmLabel = new QLabel(tr("Row per measure"), rowfeatures); - rpmLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - rpmLabel->setIndent(3); - rowfeatures->addWidget(rpmLabel); - _rpmSpinBox = new QSpinBox(rowfeatures); - _rpmSpinBox->setRange(1, 256); - _rpmSpinBox->setFixedHeight(24); - rowfeatures->addWidget(_rpmSpinBox); - //init row per measure - setRowPerMeasure(16); - updateRowPerMeasure(); + QLabel* quantLabel = new QLabel(tr("Quantize")); + quantLabel->setIndent(5); + rowfeatures->addWidget(quantLabel); + _quantCombo = new QuantCombo(rowfeatures); + rowfeatures->addWidget(_quantCombo); + + //QLabel* rpmLabel = new QLabel(tr("Row per bar"), rowfeatures); + //rpmLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + //rpmLabel->setIndent(3); + //rowfeatures->addWidget(rpmLabel); + //_rpmSpinBox = new QSpinBox(rowfeatures); + //_rpmSpinBox->setRange(1, 256); + //_rpmSpinBox->setFixedHeight(24); + //rowfeatures->addWidget(_rpmSpinBox); + + //init row per bar + setQuant(96); //corresponds to 16 quant + updateQuant(); //number of visible rows //rowfeatures->addSeparator(); @@ -82,43 +96,36 @@ MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/) setNumVisibleRows(20); updateNumVisibleRows(); + //evaluate fisrtTick and lastTick + unsigned firstTick = _pl->begin()->second->tick(); + unsigned lastTick = 0; + for(ciPart p = _pl->begin(); p != _pl->end(); ++p) { + Part* part = p->second; + lastTick = MAX(lastTick, part->endTick()); + } + //------------- //timing matrix - QDockWidget* timingDock = new QDockWidget("Timing"); - addDockWidget(Qt::AllDockWidgetAreas, timingDock); - timingDock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); - timingDock->setFeatures(QDockWidget::DockWidgetClosable | - QDockWidget::DockWidgetMovable); - - QTreeWidget* timingTree = new QTreeWidget(timingDock); - timingTree->setColumnCount(3); - timingTree->setHeaderLabels(QStringList("hr:min:sec:fr")+ - QStringList("bar:beat:tick")+ - QStringList("row")); - timingDock->setWidget(timingTree); - //addWidget(trackTest); + //------------- + TimingPattern* timingPattern = + new TimingPattern(this, "Timing", firstTick, lastTick, _quant); + //--------------- //tracks matrices - QDockWidget* tracksDock[MAXTRACKS]; - QTreeWidget* tracksTree[MAXTRACKS]; - int i=0; - for (ciPart p = _pl->begin(); p != _pl->end(); ++p) { - //Part* part = p->second; - tracksDock[i] = new QDockWidget(/*part->track()->name()*/"trackName"); - //tracksDock[i]->setAllowedAreas(Qt::LeftDockWidgetArea | - // Qt::RightDockWidgetArea); - tracksDock[i]->setFeatures(QDockWidget::DockWidgetClosable | - QDockWidget::DockWidgetMovable); - addDockWidget(Qt::AllDockWidgetAreas, tracksDock[i]); - //tracksTree - tracksTree[i] = new QTreeWidget(tracksDock[i]); - tracksTree[i]->setColumnCount(3); - tracksTree[i]->setHeaderLabels(QStringList("Voice 1")+ - QStringList("Voice 2")+ - QStringList("FX 1")); - tracksDock[i]->setWidget(tracksTree[i]); - i++; + //--------------- + for(ciPart p = _pl->begin(); p != _pl->end(); ++p) { + Part* part = p->second; + Track* track = part->track(); + if(track->isMidiTrack()) { + bool trackNotFound = true; + for(unsigned int i = 0; i < _trackPatterns.size(); i++) + if(_trackPatterns[i]->getTrack()==track) trackNotFound = false; + if(trackNotFound) { + TrackPattern* tp; + tp = new TrackPattern(this, firstTick, _quant, pl, (MidiTrack*) track); + _trackPatterns.push_back(tp); + } + } } /* @@ -154,30 +161,30 @@ MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/) canvas()->range(&s1, &e); e += AL::sigmap.ticksMeasure(e); // show one more measure canvas()->setTimeRange(s1, e);*/ - + } //--------------------------------------------------------- -// setRowPerMeasure +// setRowPerBar //--------------------------------------------------------- -void MidiTrackerEditor::setRowPerMeasure(int rpm) { - _rowPerMeasure = rpm; +void MidiTrackerEditor::setQuant(int q) { + _quant = q; } //--------------------------------------------------------- -// getRowPerMeasure +// getRowPerBar //--------------------------------------------------------- -int MidiTrackerEditor::getRowPerMeasure() { - return _rowPerMeasure; +int MidiTrackerEditor::getQuant() { + return _quant; } //--------------------------------------------------------- -// updateRowPerMeasure +// updateRowPerBar //--------------------------------------------------------- -void MidiTrackerEditor::updateRowPerMeasure() { - _rpmSpinBox->blockSignals(true); - _rpmSpinBox->setValue(_rowPerMeasure); - _rpmSpinBox->blockSignals(false); +void MidiTrackerEditor::updateQuant() { + _quantCombo->blockSignals(true); + _quantCombo->setQuant(_quant); + _quantCombo->blockSignals(false); } //--------------------------------------------------------- diff --git a/muse/muse/midiedit/miditracker.h b/muse/muse/midiedit/miditracker.h index 164d6841..1ee3e831 100644 --- a/muse/muse/midiedit/miditracker.h +++ b/muse/muse/midiedit/miditracker.h @@ -10,8 +10,11 @@ #include "midieditor.h" #include "trackpattern.h" +#include "quantcombo.h" +#include <vector> -#define MAXTRACKS 256 + +class QuantCombo; namespace AL { class Xml; @@ -19,29 +22,32 @@ namespace AL { using AL::Xml; //--------------------------------------------------------- -// SoundTrackerEditor +// MidiTrackerEditor //--------------------------------------------------------- class MidiTrackerEditor : public MidiEditor { Q_OBJECT private: - int _rowPerMeasure; + int _quant; + QuantCombo* _quantCombo; int _numVisibleRows; QSpinBox* _nvrSpinBox; - QSpinBox* _rpmSpinBox; QMenu* menuView; bool _follow; void setFollow(bool); + + std::vector<TrackPattern*> _trackPatterns; + private slots: virtual void cmd(QAction*); public: MidiTrackerEditor(PartList*, bool); ~MidiTrackerEditor() {} - void setRowPerMeasure(int rpm); - int getRowPerMeasure(); - void updateRowPerMeasure(); //update the gui + void setQuant(int rpm); + int getQuant(); + void updateQuant(); //update the gui void setNumVisibleRows(int nvr); int getNumVisibleRows(); diff --git a/muse/muse/midiedit/trackpattern.cpp b/muse/muse/midiedit/trackpattern.cpp index 6099d212..ee560e16 100644 --- a/muse/muse/midiedit/trackpattern.cpp +++ b/muse/muse/midiedit/trackpattern.cpp @@ -1,68 +1,431 @@ #include "trackpattern.h" +#include "event.h" +#include "al/sig.h" + +class EventList; + +#define EMPTYCHAR "-" +#define NONREADCHAR "*" +#define SPACECHAR "-" +#define PLUSCHAR "+" +#define STOPCHAR "=" +#define SEPCHAR " " +//#define FONT "Console" +//#define FONT "Monospace" +#define FONT "MiscFixed" //---------------------------------------------------------- // EventPat // has to be derived, can be note or control //---------------------------------------------------------- -EventPat::EventPat(bool r) {_isReadable = r;} -EventPat::EventPat() {EventPat(true);} +EventPat::EventPat(bool e, bool r) {_isEmpty = e; _isReadable = r;} +EventPat::EventPat() {EventPat(true, true);} EventPat::~EventPat() {} +void EventPat::setEmpty(bool e) {_isEmpty = e;} +bool EventPat::getEmpty() {return _isEmpty;} void EventPat::setReadable(bool r) {_isReadable = r;} bool EventPat::getReadable() {return _isReadable;} //---------------------------------------------------------- -// VoicePat +// VoiceEventPat //---------------------------------------------------------- -VoicePat::VoicePat(int n, int v):EventPat(true) { +VoiceEventPat::VoiceEventPat(int n, int v):EventPat(false, true) { _noteNum = n; _velocity = v; } -VoicePat::VoicePat():EventPat(false) {} -VoicePat::~VoicePat() {} +VoiceEventPat::VoiceEventPat(bool e, bool r):EventPat(e, r) {} +VoiceEventPat::VoiceEventPat():EventPat(true, true) {} +VoiceEventPat::~VoiceEventPat() {} -void VoicePat::setNoteNum(int n) { _noteNum = n; } -int VoicePat::getNoteNum() { return _noteNum; } -void VoicePat::setVelocity(int n) { _velocity = n; } -int VoicePat::getVelocity() { return _velocity; } -QString VoicePat::str() { - //TODO - QString sNote; - sNote.setNum(_noteNum); - QString s = " "; - QString sVel; - sVel.setNum(_velocity); - return sNote + s + sVel; +void VoiceEventPat::setNoteNum(int n) { _noteNum = n; } +int VoiceEventPat::getNoteNum() { return _noteNum; } +void VoiceEventPat::setVelocity(int n) { _velocity = n; } +int VoiceEventPat::getVelocity() { return _velocity; } +QString VoiceEventPat::str() { + if(_isEmpty) { + return QString(EMPTYCHAR EMPTYCHAR EMPTYCHAR EMPTYCHAR) + + QString(SEPCHAR) + QString(EMPTYCHAR EMPTYCHAR EMPTYCHAR); + } + else if(_isReadable) { + if(_velocity==0) { + return QString(STOPCHAR STOPCHAR STOPCHAR STOPCHAR) + + QString(SEPCHAR) + QString(EMPTYCHAR EMPTYCHAR EMPTYCHAR); + } + else { + int octave = _noteNum/12 - 2; + int note = _noteNum%12; + QString sNote; + switch(note) { + case 0: sNote = QString("C") + QString(SPACECHAR); + break; + case 1: sNote = QString("C#"); + break; + case 2: sNote = QString("D") + QString(SPACECHAR); + break; + case 3: sNote = QString("D#"); + break; + case 4: sNote = QString("E") + QString(SPACECHAR); + break; + case 5: sNote = QString("F") + QString(SPACECHAR); + break; + case 6: sNote = QString("F#"); + break; + case 7: sNote = QString("G") + QString(SPACECHAR); + break; + case 8: sNote = QString("G#"); + break; + case 9: sNote = QString("A") + QString(SPACECHAR); + break; + case 10: sNote = QString("A#"); + break; + case 11: sNote = QString("F") + QString(SPACECHAR); + break; + default: + printf("VoiceEventPat::str() Error : case note not treated\n"); + break; + } + QString sOctave; + sOctave.setNum(octave); + if(octave>=0) { + sOctave = QString(PLUSCHAR) + sOctave; + } + QString sVel; + sVel.setNum(_velocity); + if(_velocity<10) { + sVel = QString("00") + sVel; + } + else if(_velocity<100) { + sVel = QString("0") + sVel; + } + return sNote + sOctave + QString(SEPCHAR) + sVel; + } + } + else { + return QString(NONREADCHAR NONREADCHAR NONREADCHAR NONREADCHAR) + + QString(SEPCHAR) + QString(NONREADCHAR NONREADCHAR NONREADCHAR); + } } //---------------------------------------------------------- -// CtrlPat +// CtrlEventPat //---------------------------------------------------------- -CtrlPat::CtrlPat(int c, int v):EventPat(true) { +CtrlEventPat::CtrlEventPat(int c, int v):EventPat(false, true) { _ctrlNum = c; _value = v; } -CtrlPat::CtrlPat():EventPat(false) {} -CtrlPat::~CtrlPat() {} +CtrlEventPat::CtrlEventPat():EventPat(true, true) {} +CtrlEventPat::~CtrlEventPat() {} -void CtrlPat::setCtrlNum(int n) { _ctrlNum = n; } -int CtrlPat::getCtrlNum() { return _ctrlNum; } -void CtrlPat::setValue(int n) { _value = n; } -int CtrlPat::getValue() { return _value; } -QString CtrlPat::str() { +void CtrlEventPat::setCtrlNum(int n) { _ctrlNum = n; } +int CtrlEventPat::getCtrlNum() { return _ctrlNum; } +void CtrlEventPat::setValue(int n) { _value = n; } +int CtrlEventPat::getValue() { return _value; } +QString CtrlEventPat::str() { //TODO - QString sCtrl; - sCtrl.setNum(_ctrlNum); - QString s = " "; - QString sVal; - sVal.setNum(_value); - return sCtrl + s + sVal; + if(_isReadable) { + QString sCtrl; + sCtrl.setNum(_ctrlNum); + QString s = " "; + QString sVal; + sVal.setNum(_value); + return sCtrl + s + sVal; + } + else { + QString s = "***"; + return s; + } +} + +//---------------------------------------------------------- +// BasePat +//---------------------------------------------------------- +BasePat::BasePat(QString name, unsigned firstTick, + unsigned lastTick, int quant) { + _name = name; + _firstTick = firstTick; + _lastTick = lastTick; + _quant = quant; +} + +BasePat::~BasePat() {} + +QString BasePat::getName() { + return _name; +} + +bool BasePat::isRow(unsigned tick) { + Pos p = AL::sigmap.raster(_firstTick + tick, _quant); + return p.tick() == _firstTick + tick; } +unsigned BasePat::tick2row(unsigned tick) { + return (_firstTick + tick) / _quant - (_firstTick / _quant); +} + +//---------------------------------------------------------- +// VoicePat +//---------------------------------------------------------- +VoicePat::VoicePat(QString name, unsigned firstTick, unsigned lastTick, + int quant):BasePat(name, firstTick, lastTick, quant) { + _events = new EventList(); +} +VoicePat::~VoicePat() { + delete(_events); +} + +std::vector<VoiceEventPat*> VoicePat::getEventsCol() { + return _eventsCol; +} + +bool VoicePat::add(const Event* ev, unsigned tick) { + Event* e = new Event(*ev); + if(isFreeSpace(e, tick)) { + //add into the list of events + _events->add(*e, tick); + //add the begin tick into the column + unsigned beginRow = tick2row(tick); + if(beginRow >= _eventsCol.size()) { + for(unsigned i = _eventsCol.size(); i <= beginRow; i++) { + //empty voice event + _eventsCol.push_back(new VoiceEventPat()); + } + } + VoiceEventPat* vbep; + if(isRow(tick)) vbep = new VoiceEventPat(e->pitch(), e->velo()); + else vbep = new VoiceEventPat(false, false); //non-readable + if(_eventsCol[beginRow]) delete(_eventsCol[beginRow]); + _eventsCol[beginRow] = vbep; + + //add the end tick into the column + unsigned endTick = e->lenTick() + tick; + unsigned endRow = tick2row(endTick); + if(endRow >= _eventsCol.size()) { + for(unsigned i = _eventsCol.size(); i <= endRow; i++) { + //empty voice event + _eventsCol.push_back(new VoiceEventPat()); + } + } + VoiceEventPat* veep; + if(isRow(endTick)) veep = new VoiceEventPat(e->pitch(), 0); + else veep = new VoiceEventPat(false, false); //non-readable + if(_eventsCol[endRow] + && + (_eventsCol[endRow]->getEmpty() || tick2row(endTick)==tick2row(tick))) { + delete(_eventsCol[endRow]); + _eventsCol[endRow] = veep; + } + return true; + } + else { + return false; + } +} + +bool VoicePat::isFreeSpace(const Event* e, unsigned tick) { + bool isFree = true; + for(ciEvent ce = _events->begin(); ce != _events->end(); ce++) { + const Event* cevent = &ce->second; + unsigned beginTick = ce->first; + unsigned endTick = ce->first + cevent->lenTick(); + isFree = (endTick <= tick) || (beginTick >= tick + e->lenTick()); + if(!isFree) break; + } + return isFree; +} + +//---------------------------------------------------------- +// CtrlPat +//---------------------------------------------------------- +CtrlPat::CtrlPat(QString name) { +} +CtrlPat::~CtrlPat() {} //------------------------------------------------------ // TrackPattern //------------------------------------------------------ -TrackPattern::TrackPattern(){} +TrackPattern::TrackPattern(QMainWindow* parent, unsigned firstTick, + int quant, PartList* pl, MidiTrack* t) { + //set attributs + _track = t; + _quant = quant; + _firstTick = firstTick; + + //build the list of parts belonging to track t + _partList = new PartList; + for(ciPart p = pl->begin(); p != pl->end(); p++) { + Part* part = p->second; + if(t==part->track()) + _partList->add(part); + } + + //build the matrix of events + for(ciPart p = _partList->begin(); p != _partList->end(); p++) { + Part* part = p->second; + EventList* events = part->events(); + for(ciEvent e = events->begin(); e != events->end(); e++) { + const Event* event = &e->second; + unsigned rescaledTick = part->tick() + event->tick() - _firstTick; + add(event, rescaledTick); + } + } + + //build the dockWidget + _dock = new QDockWidget(_track->name()); + _dock->setFeatures(QDockWidget::DockWidgetClosable | + QDockWidget::DockWidgetMovable); + parent->addDockWidget(Qt::LeftDockWidgetArea, _dock, Qt::Horizontal); + + //build the treeWidget + _tree = new QTreeWidget(_dock); + _tree->setColumnCount(_voiceColumns.size() + _ctrlColumns.size()); + QStringList headerLabels; + for(unsigned i = 0; i < _voiceColumns.size(); i++) { + headerLabels += QStringList(_voiceColumns[i]->getName()); + } + for(unsigned i = 0; i < _ctrlColumns.size(); i++) { + //TODO + //headerLabels += QStringList(_ctrlColumns[i]->getName()); + } + _tree->setHeaderLabels(headerLabels); + //set some display properties + _tree->setRootIsDecorated(false); + _tree->setUniformRowHeights(true); + QFont font =_tree->font(); + font.setFamily(FONT); + _tree->setFont(font); + _dock->setWidget(_tree); + + //fill the treeWidget + for(unsigned i = 0; i < _voiceColumns.size(); i++) { + for(unsigned j = 0; j < _voiceColumns[i]->getEventsCol().size(); j++) { + QTreeWidgetItem* item = _tree->topLevelItem(j); + if(!item) item = new QTreeWidgetItem(_tree); + VoiceEventPat* vep = (_voiceColumns[i]->getEventsCol())[j]; + if(vep) item->setText(i, vep->str()); + } + } + for(unsigned i = 0; i < _ctrlColumns.size(); i++) { + //TODO CTRL + } + + + for(unsigned i = 0; i < _voiceColumns.size(); i++) + _tree->resizeColumnToContents(i); + +} + TrackPattern::~TrackPattern(){} +void TrackPattern::add(const Event* e, unsigned tick) { + if(e->isNote()) { + bool success = false; + for(unsigned i = 0; i < _voiceColumns.size(); i++) { + success = _voiceColumns[i]->add(e, tick); + if(success) break; + } + if(!success) { + QString voiceName; + voiceName.setNum(_voiceColumns.size()); + voiceName = QString("Voice " + voiceName); + VoicePat* vp = new VoicePat(voiceName, _firstTick, 0, _quant); + _voiceColumns.push_back(vp); + bool success = vp->add(e, tick); + if(!success) printf("Error TrackPattern::add\n"); + } + } + else { + //TODO Ctrl + } +} + +void TrackPattern::setQuant(int quant) { + //TODO +} + +//--------------------------------------------------------------- +// TimingEvent +//--------------------------------------------------------------- +TimingEvent::TimingEvent(unsigned row) { + _row = row; +} + +void TimingEvent::setBarBeatTick(unsigned tick) { + AL::sigmap.tickValues(tick, &_bar, &_beat, &_tick); +} + +QString TimingEvent::barBeatTickStr() { + QString barS; + barS.setNum(_bar); + if(_bar<10) barS = QString("000") + barS; + else if(_bar<100) barS = QString("00") + barS; + else if(_bar<1000) barS = QString("0") + barS; + QString beatS; + beatS.setNum(_beat); + if(_beat<10) beatS = QString("0") + beatS; + QString tickS; + tickS.setNum(_tick); + if(_tick<10) tickS = QString("00") + tickS; + else if(_tick<100) tickS = QString("0") + tickS; + return barS + QString(":") + beatS + QString(":") + tickS; +} + +QString TimingEvent::rowStr() { + QString r; + r.setNum(_row); + if(_row<10) r = QString("00") + r; + else if(_row<100) r = QString("0") + r; + return r; +} + +//--------------------------------------------------------------- +// TimingPattern +//--------------------------------------------------------------- +TimingPattern::TimingPattern(QMainWindow* parent, QString name, + unsigned firstTick, unsigned lastTick, int quant) + : BasePat(name, firstTick, lastTick, quant) { + + //build the timing matrix + buildTimingMatrix(); + + //build the dockWidget + _dock = new QDockWidget(_name); + _dock->setFeatures(QDockWidget::DockWidgetClosable | + QDockWidget::DockWidgetMovable); + parent->addDockWidget(Qt::LeftDockWidgetArea, _dock, Qt::Horizontal); + + //build the treeWidget + _tree = new QTreeWidget(_dock); + _tree->setColumnCount(2); + QStringList headerLabels; + _tree->setHeaderLabels(QStringList("bar:bt:tick") + QStringList("row")); + _tree->setHeaderLabels(headerLabels); + //set some display properties + _tree->setRootIsDecorated(false); + _tree->setUniformRowHeights(true); + QFont font =_tree->font(); + font.setFamily(FONT); + _tree->setFont(font); + _dock->setWidget(_tree); + + //fill the treeWidget + for(unsigned i = 0; i < _timingEvents.size(); i++) { + QTreeWidgetItem* item = new QTreeWidgetItem(_tree); + TimingEvent* te = _timingEvents[i]; + item->setText(0, te->barBeatTickStr()); + item->setText(1, te->rowStr()); + } + + for(int i = 0; i < _tree->columnCount(); i++) + _tree->resizeColumnToContents(i); +} + +void TimingPattern::buildTimingMatrix() { + for(unsigned tick = _firstTick; tick <= _lastTick; tick++) { + if(isRow(tick)) { + TimingEvent* te = new TimingEvent(tick2row(tick)); + te->setBarBeatTick(tick); + _timingEvents.push_back(te); + } + } +} diff --git a/muse/muse/midiedit/trackpattern.h b/muse/muse/midiedit/trackpattern.h index f6fcaa3c..be780d44 100644 --- a/muse/muse/midiedit/trackpattern.h +++ b/muse/muse/midiedit/trackpattern.h @@ -10,6 +10,9 @@ #include <vector> #include "miditrack.h" +#include "part.h" + +class PartList; //---------------------------------------------------------- // EventPat @@ -17,27 +20,32 @@ //---------------------------------------------------------- class EventPat { private: + protected: bool _isReadable; //true iff the time of the event is the exact row time + bool _isEmpty; public: - EventPat(bool); - EventPat(); //_isReadable is true at the initialization + EventPat(bool isEmpty, bool isReadable); + EventPat(); //_isEmpty=true and_isReadable=true at the initialization ~EventPat(); + void setEmpty(bool); + bool getEmpty(); void setReadable(bool); bool getReadable(); }; //---------------------------------------------------------- -// VoicePat +// VoiceEventPat //---------------------------------------------------------- -class VoicePat : public EventPat { +class VoiceEventPat : public EventPat { private: int _noteNum; //absolute note number including octave int _velocity; //if velocity is 0 note is off public: - VoicePat(int noteNum, int velocity); // _isReadable is initialized true - VoicePat(); // _isReadable is initialized false - ~VoicePat(); + VoiceEventPat(int noteNum, int velocity); // _isReadable is initialized true + VoiceEventPat(bool isEmpty, bool isReadable); + VoiceEventPat(); //_isEmpty = true, _isReadable = true + ~VoiceEventPat(); void setNoteNum(int n); int getNoteNum(); @@ -47,16 +55,16 @@ class VoicePat : public EventPat { }; //---------------------------------------------------------- -// CtrlPat +// CtrlEventPat //---------------------------------------------------------- -class CtrlPat : public EventPat { +class CtrlEventPat : public EventPat { private: int _ctrlNum; int _value; //if velocity is 0 note is off public: - CtrlPat(int ctrlNum, int value); // _isReadable is initialized true - CtrlPat(); // _isReadable is initialized false - ~CtrlPat(); + CtrlEventPat(int ctrlNum, int value); // _isReadable is initialized true + CtrlEventPat(); // _isReadable is initialized false + ~CtrlEventPat(); void setCtrlNum(int n); int getCtrlNum(); @@ -66,18 +74,58 @@ class CtrlPat : public EventPat { }; //---------------------------------------------------------- -// TrackRowPat +// BasePat //---------------------------------------------------------- -class TrackRowPat { +class BasePat { + protected: + QString _name; + unsigned _firstTick; + unsigned _lastTick; + int _quant; + public: + BasePat(QString name, unsigned firstTick, unsigned lastTick, int quant); + ~BasePat(); + + QString getName(); + + bool isRow(unsigned tick); //return true iff tick coincides with one row + unsigned tick2row(unsigned tick); +}; + +//---------------------------------------------------------- +// VoicePat +//---------------------------------------------------------- +class VoicePat : public BasePat { private: - std::vector<EventPat> _events; //one event for each voice/ctrl of a track + std::vector<VoiceEventPat*> _eventsCol; //column of VoiceEventPat to display + EventList* _events; //actual list of events, only one at a time public: - TrackRowPat(); - ~TrackRowPat(); + VoicePat(QString name, unsigned firstTick, unsigned lastTick, int quant); + ~VoicePat(); + + std::vector<VoiceEventPat*> getEventsCol(); - //TODO methods + bool add(const Event* e, unsigned tick); //add the Event e into the EventList + //and update properly _eventsPat + //return true if success, that is + //there is an empty space of the + //event + bool isFreeSpace(const Event* e, unsigned tick); //return true iff there + //is space to add the + //event e without + //overlapping other events }; +//---------------------------------------------------------- +// CtrlPat +//---------------------------------------------------------- +class CtrlPat { + private: + std::vector<CtrlEventPat> _events; //column of CtrlEventPat + public: + CtrlPat(QString name); + ~CtrlPat(); +}; //------------------------------------------------------ // TrackPattern @@ -88,12 +136,54 @@ class TrackPattern { QTreeWidget* _tree; PartList* _partList; //partList concerned by a track MidiTrack* _track; - TrackRowPat* _trackRow; + int _quant; + unsigned _firstTick; + std::vector<VoicePat*> _voiceColumns; //matrix of voice events + std::vector<CtrlPat*> _ctrlColumns; //matrix of ctrl events public: - TrackPattern(); + TrackPattern(QMainWindow* parent, unsigned firstTick, + int quant, PartList* pl, MidiTrack* t); ~TrackPattern(); - //TODO methods + void add(const Event* e, unsigned tick); //add the Event e and + //build consequently + //the matrix, + //creating new voices when necessary + MidiTrack* getTrack() {return _track;} + void setQuant(int quant); +}; + +//------------------------------------------------------ +// TimingEvent +//------------------------------------------------------ +class TimingEvent { + private: + int _bar; + int _beat; + unsigned _tick; + unsigned _row; + + public: + TimingEvent(unsigned row); + ~TimingEvent(); + + void setBarBeatTick(unsigned tick); + + QString barBeatTickStr(); + QString rowStr(); +}; + +class TimingPattern : public BasePat { + private: + QDockWidget* _dock; + QTreeWidget* _tree; + std::vector<TimingEvent*> _timingEvents; + public: + TimingPattern(QMainWindow* parent, QString name, unsigned firstTick, + unsigned lastTick, int quant); + ~TimingPattern(); + + void buildTimingMatrix(); }; #endif diff --git a/muse/plugins/freeverb/CMakeLists.txt b/muse/plugins/freeverb/CMakeLists.txt index 5e4aa13c..0a86454f 100644 --- a/muse/plugins/freeverb/CMakeLists.txt +++ b/muse/plugins/freeverb/CMakeLists.txt @@ -27,7 +27,7 @@ add_library ( freeverb SHARED # set_target_properties (freeverb PROPERTIES PREFIX "" - #COMPILE_FLAGS "-O3" + COMPILE_FLAGS "-O2" ) install_targets ( /lib/${MusE_INSTALL_NAME}/plugins freeverb) diff --git a/muse/synti/deicsonze/TODO b/muse/synti/deicsonze/TODO index 34a75f67..8583778f 100644 --- a/muse/synti/deicsonze/TODO +++ b/muse/synti/deicsonze/TODO @@ -12,3 +12,5 @@ - Pan per voices - Load BUMP preset - calibrate portamento and pitch envelope to fit real DX11 +- record plugin parameters with song +- fix bug plugin control change not working diff --git a/muse/synti/deicsonze/deicsonze.cpp b/muse/synti/deicsonze/deicsonze.cpp index 900bb32b..2360f4c8 100644 --- a/muse/synti/deicsonze/deicsonze.cpp +++ b/muse/synti/deicsonze/deicsonze.cpp @@ -122,6 +122,8 @@ DeicsOnze::DeicsOnze() : Mess(2) { _gui->setWindowTitle(QString("DeicsOnze")); //FX + _pluginIReverb = NULL; + _pluginIChorus = NULL; initPluginReverb(plugins.find("freeverb", "freeverb1")); initPluginChorus(plugins.find("doublechorus", "doublechorus1")); @@ -146,7 +148,15 @@ DeicsOnze::DeicsOnze() : Mess(2) { _preset[c]=_initialPreset; setPreset(c); } - + //update display gui + //update mastervol + unsigned char dataMasterVol[2]; + dataMasterVol[0]=SYSEX_MASTERVOL; + dataMasterVol[1]=getMasterVol(); + MidiEvent evSysexMasterVol(0, ME_SYSEX, + (const unsigned char*)dataMasterVol, + 2); + _gui->writeEvent(evSysexMasterVol); //display load preset unsigned char dataUpdateGuiSet[1]; dataUpdateGuiSet[0]=SYSEX_UPDATESETGUI; @@ -203,12 +213,12 @@ void DeicsOnze::showGui(bool val) //--------------------------------------------------------- void DeicsOnze::getGeometry(int* x, int* y, int* w, int* h) const { - QPoint pos(_gui->pos()); - QSize size(_gui->size()); - *x = pos.x(); - *y = pos.y(); - *w = size.width(); - *h = size.height(); + QPoint pos(_gui->pos()); + QSize size(_gui->size()); + *x = pos.x(); + *y = pos.y(); + *w = size.width(); + *h = size.height(); } void DeicsOnze::setSampleRate(int sr) { @@ -2087,62 +2097,100 @@ void DeicsOnze::getInitData(int* length, const unsigned char** data) { //save the set FILE* comptmpf=fopen(comptmp, "r"); fseek(comptmpf, 0, SEEK_END); - *length=ftell(comptmpf) + NUMCONFIGLENGTH; + *length = NUM_CONFIGLENGTH + + sizeof(float)*_pluginIReverb->plugin()->parameter() + + sizeof(float)*_pluginIChorus->plugin()->parameter() + + ftell(comptmpf); fseek(comptmpf, 0, SEEK_SET); unsigned char* buffer = new unsigned char[*length]; //save init data buffer[0]=SYSEX_INIT_DATA; buffer[1]=SYSEX_INIT_DATA_VERSION; //save global data - buffer[NUMMASTERVOL] = (unsigned char) getMasterVol(); + buffer[NUM_MASTERVOL] = (unsigned char) getMasterVol(); for(int c = 0; c < NBRCHANNELS; c++) { - buffer[NUMCHANNELENABLE + c] = (unsigned char) getChannelEnable(c); - buffer[NUMCHANNELVOL + c] = (unsigned char) getChannelVol(c); - buffer[NUMCHANNELPAN + c] = (unsigned char) getChannelPan(c); + buffer[NUM_CHANNEL_ENABLE + c] = (unsigned char) getChannelEnable(c); + buffer[NUM_CHANNEL_VOL + c] = (unsigned char) getChannelVol(c); + buffer[NUM_CHANNEL_PAN + c] = (unsigned char) getChannelPan(c); int b = getChannelBrightness(c); - buffer[NUMCHANNELBRIGHTNESS + 2*c] = (unsigned char) (b%256); - buffer[NUMCHANNELBRIGHTNESS + 2*c + 1] = (unsigned char) (b/256); - buffer[NUMCHANNELMODULATION + c] = (unsigned char) getChannelModulation(c); - buffer[NUMCHANNELDETUNE + c] = + buffer[NUM_CHANNEL_BRIGHTNESS + 2*c] = (unsigned char) (b%256); + buffer[NUM_CHANNEL_BRIGHTNESS + 2*c + 1] = (unsigned char) (b/256); + buffer[NUM_CHANNEL_MODULATION + c] = + (unsigned char) getChannelModulation(c); + buffer[NUM_CHANNEL_DETUNE + c] = (unsigned char) getChannelDetune(c) + MAXCHANNELDETUNE; - buffer[NUMCHANNELATTACK + c] = (unsigned char) getChannelAttack(c); - buffer[NUMCHANNELRELEASE + c] = (unsigned char) getChannelRelease(c); - buffer[NUMCURRENTPROG + c] = (unsigned char) _preset[c]->prog; - buffer[NUMCURRENTLBANK + c] = + buffer[NUM_CHANNEL_ATTACK + c] = (unsigned char) getChannelAttack(c); + buffer[NUM_CHANNEL_RELEASE + c] = (unsigned char) getChannelRelease(c); + buffer[NUM_CURRENTPROG + c] = (unsigned char) _preset[c]->prog; + buffer[NUM_CURRENTLBANK + c] = (unsigned char) _preset[c]->_subcategory->_lbank; - buffer[NUMCURRENTHBANK + c] = + buffer[NUM_CURRENTHBANK + c] = (unsigned char) _preset[c]->_subcategory->_category->_hbank; - buffer[NUMNBRVOICES + c] = (unsigned char) getNbrVoices(c); + buffer[NUM_NBRVOICES + c] = (unsigned char) getNbrVoices(c); } - buffer[NUMSAVEONLYUSED]=(unsigned char) _saveOnlyUsed; - buffer[NUMSAVECONFIG]=(unsigned char) _saveConfig; + buffer[NUM_SAVEONLYUSED]=(unsigned char) _saveOnlyUsed; + buffer[NUM_SAVECONFIG]=(unsigned char) _saveConfig; //save config data if(_saveConfig) { - buffer[NUMQUALITY]=(unsigned char)_global.quality; - buffer[NUMFONTSIZE]=(unsigned char)_global.fontSize; - buffer[NUMREDTEXT]=(unsigned char)_gui->tColor->red(); - buffer[NUMGREENTEXT]=(unsigned char)_gui->tColor->green(); - buffer[NUMBLUETEXT]=(unsigned char)_gui->tColor->blue(); - buffer[NUMREDBACKGROUND]=(unsigned char)_gui->bColor->red(); - buffer[NUMGREENBACKGROUND]=(unsigned char)_gui->bColor->green(); - buffer[NUMBLUEBACKGROUND]=(unsigned char)_gui->bColor->blue(); - buffer[NUMREDEDITTEXT]=(unsigned char)_gui->etColor->red(); - buffer[NUMGREENEDITTEXT]=(unsigned char)_gui->etColor->green(); - buffer[NUMBLUEEDITTEXT]=(unsigned char)_gui->etColor->blue(); - buffer[NUMREDEDITBACKGROUND]=(unsigned char)_gui->ebColor->red(); - buffer[NUMGREENEDITBACKGROUND]=(unsigned char)_gui->ebColor->green(); - buffer[NUMBLUEEDITBACKGROUND]=(unsigned char)_gui->ebColor->blue(); - buffer[NUMISINITSET]=(unsigned char)_isInitSet; - strncpy((char*)&buffer[NUMINITSETPATH], + buffer[NUM_QUALITY]=(unsigned char)_global.quality; + buffer[NUM_FONTSIZE]=(unsigned char)_global.fontSize; + buffer[NUM_RED_TEXT]=(unsigned char)_gui->tColor->red(); + buffer[NUM_GREEN_TEXT]=(unsigned char)_gui->tColor->green(); + buffer[NUM_BLUE_TEXT]=(unsigned char)_gui->tColor->blue(); + buffer[NUM_RED_BACKGROUND]=(unsigned char)_gui->bColor->red(); + buffer[NUM_GREEN_BACKGROUND]=(unsigned char)_gui->bColor->green(); + buffer[NUM_BLUE_BACKGROUND]=(unsigned char)_gui->bColor->blue(); + buffer[NUM_RED_EDITTEXT]=(unsigned char)_gui->etColor->red(); + buffer[NUM_GREEN_EDITTEXT]=(unsigned char)_gui->etColor->green(); + buffer[NUM_BLUE_EDITTEXT]=(unsigned char)_gui->etColor->blue(); + buffer[NUM_RED_EDITBACKGROUND]=(unsigned char)_gui->ebColor->red(); + buffer[NUM_GREEN_EDITBACKGROUND]=(unsigned char)_gui->ebColor->green(); + buffer[NUM_BLUE_EDITBACKGROUND]=(unsigned char)_gui->ebColor->blue(); + buffer[NUM_ISINITSET]=(unsigned char)_isInitSet; + strncpy((char*)&buffer[NUM_INITSETPATH], _initSetPath.toLatin1().data(), MAXSTRLENGTHINITSETPATH); - buffer[NUMISBACKGROUNDPIX]=(unsigned char)_isBackgroundPix; - strncpy((char*)&buffer[NUMBACKGROUNDPIXPATH], + buffer[NUM_ISBACKGROUNDPIX]=(unsigned char)_isBackgroundPix; + strncpy((char*)&buffer[NUM_BACKGROUNDPIXPATH], _backgroundPixPath.toLatin1().data(), MAXSTRLENGTHBACKGROUNDPIXPATH); } + //FX + buffer[NUM_IS_REVERB_ON]=(unsigned char)_global.isReverbActivated; + buffer[NUM_REVERB_RETURN]=(unsigned char)getReverbReturn(); + buffer[NUM_REVERB_PARAM_NBR]= + (unsigned char)_pluginIReverb->plugin()->parameter(); + strncpy((char*)&buffer[NUM_REVERB_LIB], + _pluginIReverb->plugin()->lib().toLatin1().data(), + MAXSTRLENGTHFXLIB); + strncpy((char*)&buffer[NUM_REVERB_LABEL], + _pluginIReverb->plugin()->label().toLatin1().data(), + MAXSTRLENGTHFXLABEL); + buffer[NUM_IS_CHORUS_ON]=(unsigned char)_global.isReverbActivated; + buffer[NUM_CHORUS_RETURN]=(unsigned char)getChorusReturn(); + buffer[NUM_CHORUS_PARAM_NBR]= + (unsigned char)_pluginIChorus->plugin()->parameter(); + strncpy((char*)&buffer[NUM_CHORUS_LIB], + _pluginIChorus->plugin()->lib().toLatin1().data(), + MAXSTRLENGTHFXLIB); + strncpy((char*)&buffer[NUM_CHORUS_LABEL], + _pluginIChorus->plugin()->label().toLatin1().data(), + MAXSTRLENGTHFXLABEL); + //save FX parameters + //reverb + for(int i = 0; i < _pluginIReverb->plugin()->parameter(); i++) { + float val = (float)_pluginIReverb->param(i); + memcpy(&buffer[NUM_CONFIGLENGTH + i], &val, sizeof(float)); + } + for(int i = 0; i < _pluginIChorus->plugin()->parameter(); i++) { + float val = (float)_pluginIChorus->param(i); + memcpy(&buffer[NUM_CONFIGLENGTH + _pluginIReverb->plugin()->parameter() + + i], &val, sizeof(float)); + } //save set data - for(int i=NUMCONFIGLENGTH; - i<*length; i++) buffer[i]=(unsigned char)getc(comptmpf); + for(int i = NUM_CONFIGLENGTH + + sizeof(float)*_pluginIReverb->plugin()->parameter() + + sizeof(float)*_pluginIChorus->plugin()->parameter(); + i < *length; i++) buffer[i]=(unsigned char)getc(comptmpf); fclose(comptmpf); QString rmcmd="rm "; rmcmd+=comptmp; @@ -2159,7 +2207,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { if(data[1]==SYSEX_INIT_DATA_VERSION) { //load global parameters //master volume - setMasterVol(data[NUMMASTERVOL]); + setMasterVol(data[NUM_MASTERVOL]); unsigned char *dataMasterVol = new unsigned char[2]; dataMasterVol[0]=SYSEX_MASTERVOL; dataMasterVol[1]=(unsigned char) getMasterVol(); @@ -2169,63 +2217,64 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { //channel configuration for(int c = 0; c < NBRCHANNELS; c++) { //isEnable - setChannelEnable(c, data[NUMCHANNELENABLE + c]); + setChannelEnable(c, data[NUM_CHANNEL_ENABLE + c]); MidiEvent evChEnable(0, c, ME_CONTROLLER, - CTRL_CHANNELENABLE, data[NUMCHANNELENABLE + c]); + CTRL_CHANNELENABLE, data[NUM_CHANNEL_ENABLE + c]); _gui->writeEvent(evChEnable); //nbrVoices - setNbrVoices(c, data[NUMNBRVOICES + c]); + setNbrVoices(c, data[NUM_NBRVOICES + c]); MidiEvent - evNbrVoices(0,c,ME_CONTROLLER,CTRL_NBRVOICES, data[NUMNBRVOICES + c]); + evNbrVoices(0,c,ME_CONTROLLER,CTRL_NBRVOICES, data[NUM_NBRVOICES + c]); _gui->writeEvent(evNbrVoices); //channel volume - setChannelVol(c, data[NUMCHANNELVOL + c]); + setChannelVol(c, data[NUM_CHANNEL_VOL + c]); MidiEvent evChVol(0, c, ME_CONTROLLER, - CTRL_CHANNELVOLUME, data[NUMCHANNELVOL + c]); + CTRL_CHANNELVOLUME, data[NUM_CHANNEL_VOL + c]); _gui->writeEvent(evChVol); //channel pan - setChannelPan(c, data[NUMCHANNELPAN + c]); + setChannelPan(c, data[NUM_CHANNEL_PAN + c]); MidiEvent - evChPan(0, c, ME_CONTROLLER, CTRL_CHANNELPAN, data[NUMCHANNELPAN + c]); + evChPan(0, c, ME_CONTROLLER, CTRL_CHANNELPAN, + data[NUM_CHANNEL_PAN + c]); _gui->writeEvent(evChPan); if(getChannelEnable(c)) applyChannelAmp(c); //channel detune - setChannelDetune(c, data[NUMCHANNELDETUNE + c]-MAXCHANNELDETUNE); + setChannelDetune(c, data[NUM_CHANNEL_DETUNE + c]-MAXCHANNELDETUNE); MidiEvent evChDetune(0, c, ME_CONTROLLER, CTRL_CHANNELDETUNE, - data[NUMCHANNELDETUNE + c]-MAXCHANNELDETUNE); + data[NUM_CHANNEL_DETUNE + c]-MAXCHANNELDETUNE); _gui->writeEvent(evChDetune); //channel brightness setChannelBrightness(c, - data[NUMCHANNELBRIGHTNESS + 2*c] - + data[NUMCHANNELBRIGHTNESS + 2*c + 1] * 256); + data[NUM_CHANNEL_BRIGHTNESS + 2*c] + + data[NUM_CHANNEL_BRIGHTNESS + 2*c + 1] * 256); MidiEvent evChBrightness(0, c, ME_CONTROLLER, CTRL_FINEBRIGHTNESS, getChannelBrightness(c)); _gui->writeEvent(evChBrightness); //channel modulation - setChannelModulation(c, data[NUMCHANNELMODULATION + c]); + setChannelModulation(c, data[NUM_CHANNEL_MODULATION + c]); MidiEvent evChMod(0, c, ME_CONTROLLER, - CTRL_MODULATION, data[NUMCHANNELMODULATION + c]); + CTRL_MODULATION, data[NUM_CHANNEL_MODULATION + c]); _gui->writeEvent(evChMod); //channel attack - setChannelAttack(c, data[NUMCHANNELATTACK + c]); + setChannelAttack(c, data[NUM_CHANNEL_ATTACK + c]); MidiEvent evChAttack(0, c, ME_CONTROLLER, - CTRL_ATTACK_TIME, data[NUMCHANNELATTACK + c]); + CTRL_ATTACK_TIME, data[NUM_CHANNEL_ATTACK + c]); _gui->writeEvent(evChAttack); //channel release - setChannelRelease(c, data[NUMCHANNELRELEASE + c]); + setChannelRelease(c, data[NUM_CHANNEL_RELEASE + c]); MidiEvent evChRelease(0, c, ME_CONTROLLER, - CTRL_RELEASE_TIME, data[NUMCHANNELRELEASE + c]); + CTRL_RELEASE_TIME, data[NUM_CHANNEL_RELEASE + c]); _gui->writeEvent(evChRelease); } //load configuration - _saveConfig = (bool)data[NUMSAVECONFIG]; + _saveConfig = (bool)data[NUM_SAVECONFIG]; unsigned char *dataSaveConfig = new unsigned char[2]; dataSaveConfig[0]=SYSEX_SAVECONFIG; dataSaveConfig[1]=(unsigned char)_saveConfig; @@ -2234,7 +2283,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { _gui->writeEvent(evSaveConfig); if(_saveConfig) { //saveOnlyUsed - _saveOnlyUsed = (bool)data[NUMSAVEONLYUSED]; + _saveOnlyUsed = (bool)data[NUM_SAVEONLYUSED]; unsigned char *dataSaveOnlyUsed = new unsigned char[2]; dataSaveOnlyUsed[0]=SYSEX_SAVEONLYUSED; dataSaveOnlyUsed[1]=(unsigned char)_saveOnlyUsed; @@ -2245,54 +2294,86 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char dataColorGui[COLORSYSEXLENGTH+1]; dataColorGui[0]=SYSEX_COLORGUI; for (int i=0; i<COLORSYSEXLENGTH; i++) - dataColorGui[i+1]=data[NUMREDTEXT+i]; + dataColorGui[i+1]=data[NUM_RED_TEXT+i]; MidiEvent evSysexColor(0, ME_SYSEX, (const unsigned char*)dataColorGui, COLORSYSEXLENGTH+1); _gui->writeEvent(evSysexColor); //quality unsigned char dataQuality[2]; dataQuality[0]=SYSEX_QUALITY; - dataQuality[1]=data[NUMQUALITY]; - setQuality((Quality)data[NUMQUALITY]); + dataQuality[1]=data[NUM_QUALITY]; + setQuality((Quality)data[NUM_QUALITY]); MidiEvent evQuality(0, ME_SYSEX, (const unsigned char*)dataQuality, 2); _gui->writeEvent(evQuality); //font size unsigned char dataFontSize[2]; dataFontSize[0]=SYSEX_FONTSIZE; - dataFontSize[1]=data[NUMFONTSIZE]; + dataFontSize[1]=data[NUM_FONTSIZE]; MidiEvent evFontSize(0, ME_SYSEX, (const unsigned char*)dataFontSize, 2); _gui->writeEvent(evFontSize); //load init set unsigned char dataIsInitSet[2]; dataIsInitSet[0]=SYSEX_ISINITSET; - dataIsInitSet[1]=data[NUMISINITSET]; + dataIsInitSet[1]=data[NUM_ISINITSET]; MidiEvent evIsInitSet(0, ME_SYSEX, (const unsigned char*)dataIsInitSet, 2); _gui->writeEvent(evIsInitSet); unsigned char dataInitSetPath[1+MAXSTRLENGTHINITSETPATH]; dataInitSetPath[0]=SYSEX_INITSETPATH; - dataInitSetPath[1]=data[NUMINITSETPATH]; + dataInitSetPath[1]=data[NUM_INITSETPATH]; MidiEvent evInitSetPath(0,ME_SYSEX,(const unsigned char*)dataInitSetPath, 1+MAXSTRLENGTHINITSETPATH); _gui->writeEvent(evInitSetPath); //load background pix unsigned char dataIsBackgroundPix[2]; dataIsBackgroundPix[0]=SYSEX_ISBACKGROUNDPIX; - dataIsBackgroundPix[1]=data[NUMISBACKGROUNDPIX]; + dataIsBackgroundPix[1]=data[NUM_ISBACKGROUNDPIX]; MidiEvent evIsBackgroundPix(0, ME_SYSEX, (const unsigned char*)dataIsBackgroundPix, 2); _gui->writeEvent(evIsBackgroundPix); unsigned char dataBackgroundPixPath[1+MAXSTRLENGTHBACKGROUNDPIXPATH]; dataBackgroundPixPath[0]=SYSEX_BACKGROUNDPIXPATH; for(int a = 0; a < MAXSTRLENGTHBACKGROUNDPIXPATH; a++) - dataBackgroundPixPath[a+1] = data[a+NUMBACKGROUNDPIXPATH]; + dataBackgroundPixPath[a+1] = data[a+NUM_BACKGROUNDPIXPATH]; MidiEvent evBackgroundPixPath(0,ME_SYSEX, (const unsigned char*)dataBackgroundPixPath, 1+MAXSTRLENGTHBACKGROUNDPIXPATH); _gui->writeEvent(evBackgroundPixPath); } else _gui->saveConfigCheckBox->setChecked(false); - + //load FX + //reverb + _global.isReverbActivated = (bool)data[NUM_IS_REVERB_ON]; + setReverbReturn((int)data[NUM_REVERB_RETURN]); + initPluginReverb(plugins.find((const char*)&data[NUM_REVERB_LIB], + (const char*)&data[NUM_REVERB_LABEL])); + for(int i = 0; i < _pluginIReverb->plugin()->parameter(); i++) { + float val; + memcpy(&val, &data[NUM_CONFIGLENGTH + i], sizeof(float)); + _pluginIReverb->setParam(i, (double)val); + } + char dataBuildRev; + dataBuildRev = SYSEX_BUILDGUIREVERB; + MidiEvent evSysexBuildRev(0,ME_SYSEX, + (const unsigned char*)&dataBuildRev, 1); + _gui->writeEvent(evSysexBuildRev); + //chorus + _global.isChorusActivated = (bool)data[NUM_IS_CHORUS_ON]; + setChorusReturn((int)data[NUM_CHORUS_RETURN]); + initPluginChorus(plugins.find((const char*)&data[NUM_CHORUS_LIB], + (const char*)&data[NUM_CHORUS_LABEL])); + for(int i = 0; i < _pluginIChorus->plugin()->parameter(); i++) { + float val; + memcpy(&val, &data[NUM_CONFIGLENGTH + + _pluginIReverb->plugin()->parameter() + i], + sizeof(float)); + _pluginIChorus->setParam(i, (double)val); + } + char dataBuildCho; + dataBuildCho = SYSEX_BUILDGUICHORUS; + MidiEvent evSysexBuildCho(0,ME_SYSEX, + (const unsigned char*)&dataBuildCho, 1); + _gui->writeEvent(evSysexBuildCho); //load set FILE* tmp; char* tmpname; @@ -2302,9 +2383,13 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { //get the bz2 part tmpname=tempnam("/tmp", "DEIBZ2"); tmp=fopen(tmpname, "w"); - for(int i = NUMCONFIGLENGTH;i<length; i++) putc(data[i], tmp); + for(int i = + NUM_CONFIGLENGTH + + sizeof(float)*_pluginIReverb->plugin()->parameter() + + sizeof(float)*_pluginIChorus->plugin()->parameter(); + i<length; i++) putc(data[i], tmp); fclose(tmp); - + //uncompress the set uncompname=tempnam("/tmp", "DEISET"); cmd+=tmpname; @@ -2312,6 +2397,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { cmd+=uncompname; system(cmd.toAscii().data()); + //load the set // read the XML file and create DOM tree //QString filename = (const char*) (data+2); @@ -2332,7 +2418,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { if (version == "1.0") { for(int c = 0; c < NBRCHANNELS; c++) _preset[c]=_initialPreset; //read the set - if((bool)data[NUMSAVEONLYUSED]) { + if((bool)data[NUM_SAVEONLYUSED]) { //printf("Mini\n"); //updateSaveOnlyUsed(true); } @@ -2356,16 +2442,16 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { int dL=2+strlen(uncompname); char dataSend[dL]; dataSend[0]=SYSEX_LOADSET; - dataSend[1]=data[NUMSAVEONLYUSED]; + dataSend[1]=data[NUM_SAVEONLYUSED]; for(int i=2; i<dL; i++) dataSend[i]=uncompname[i-2]; MidiEvent evSysex(0,ME_SYSEX,(const unsigned char*)dataSend, dL); _gui->writeEvent(evSysex); //select programs per channel for(int c = 0; c < NBRCHANNELS; c++) { - int hbank=(int)data[NUMCURRENTHBANK+c]; - int lbank=(int)data[NUMCURRENTLBANK+c]; - int prog=(int)data[NUMCURRENTPROG+c]; + int hbank=(int)data[NUM_CURRENTHBANK+c]; + int lbank=(int)data[NUM_CURRENTLBANK+c]; + int prog=(int)data[NUM_CURRENTPROG+c]; programSelect(c, hbank, lbank, prog); int val=prog+(lbank<<8)+(hbank<<16); MidiEvent evProgSel(0, c, ME_CONTROLLER, CTRL_PROGRAM, val); diff --git a/muse/synti/deicsonze/deicsonze.h b/muse/synti/deicsonze/deicsonze.h index f33d7e7a..1075a05b 100644 --- a/muse/synti/deicsonze/deicsonze.h +++ b/muse/synti/deicsonze/deicsonze.h @@ -65,6 +65,8 @@ #define MAXVOLUME 100.0 #define MAXSTRLENGTHINITSETPATH 256 #define MAXSTRLENGTHBACKGROUNDPIXPATH 256 +#define MAXSTRLENGTHFXLIB 256 +#define MAXSTRLENGTHFXLABEL 256 //coef determined by ear to sound like the YAMAHA DX11 #define COEFFEEDBACK 0.3 @@ -146,40 +148,50 @@ //REVERB PARAMETERS enum { - NUMMASTERVOL = SAVEINITLENGTH, - NUMCHANNELENABLE, - NUMCHANNELVOL = NUMCHANNELENABLE + NBRCHANNELS + 1, - NUMCHANNELPAN = NUMCHANNELVOL + NBRCHANNELS + 1, - NUMCHANNELBRIGHTNESS = NUMCHANNELPAN + NBRCHANNELS + 1, - NUMCHANNELMODULATION = NUMCHANNELBRIGHTNESS + 2*NBRCHANNELS +1, - NUMCHANNELDETUNE = NUMCHANNELMODULATION + NBRCHANNELS + 1, - NUMCHANNELATTACK = NUMCHANNELDETUNE + NBRCHANNELS + 1, - NUMCHANNELRELEASE = NUMCHANNELATTACK + NBRCHANNELS + 1, - NUMCURRENTPROG = NUMCHANNELRELEASE + NBRCHANNELS + 1, - NUMCURRENTLBANK = NUMCURRENTPROG + NBRCHANNELS + 1, - NUMCURRENTHBANK = NUMCURRENTLBANK + NBRCHANNELS + 1, - NUMNBRVOICES = NUMCURRENTHBANK + NBRCHANNELS + 1, - NUMSAVEONLYUSED = NUMNBRVOICES + NBRCHANNELS + 1, - NUMSAVECONFIG, - NUMREDTEXT, - NUMGREENTEXT, - NUMBLUETEXT, - NUMREDBACKGROUND, - NUMGREENBACKGROUND, - NUMBLUEBACKGROUND, - NUMREDEDITTEXT, - NUMGREENEDITTEXT, - NUMBLUEEDITTEXT, - NUMREDEDITBACKGROUND, - NUMGREENEDITBACKGROUND, - NUMBLUEEDITBACKGROUND, - NUMQUALITY, - NUMFONTSIZE, - NUMISINITSET, - NUMINITSETPATH, - NUMISBACKGROUNDPIX = NUMINITSETPATH + MAXSTRLENGTHINITSETPATH +1, - NUMBACKGROUNDPIXPATH, - NUMCONFIGLENGTH = NUMBACKGROUNDPIXPATH + MAXSTRLENGTHBACKGROUNDPIXPATH + 1 + NUM_MASTERVOL = SAVEINITLENGTH, + NUM_CHANNEL_ENABLE, + NUM_CHANNEL_VOL = NUM_CHANNEL_ENABLE + NBRCHANNELS + 1, + NUM_CHANNEL_PAN = NUM_CHANNEL_VOL + NBRCHANNELS + 1, + NUM_CHANNEL_BRIGHTNESS = NUM_CHANNEL_PAN + NBRCHANNELS + 1, + NUM_CHANNEL_MODULATION = NUM_CHANNEL_BRIGHTNESS + 2*NBRCHANNELS +1, + NUM_CHANNEL_DETUNE = NUM_CHANNEL_MODULATION + NBRCHANNELS + 1, + NUM_CHANNEL_ATTACK = NUM_CHANNEL_DETUNE + NBRCHANNELS + 1, + NUM_CHANNEL_RELEASE = NUM_CHANNEL_ATTACK + NBRCHANNELS + 1, + NUM_CURRENTPROG = NUM_CHANNEL_RELEASE + NBRCHANNELS + 1, + NUM_CURRENTLBANK = NUM_CURRENTPROG + NBRCHANNELS + 1, + NUM_CURRENTHBANK = NUM_CURRENTLBANK + NBRCHANNELS + 1, + NUM_NBRVOICES = NUM_CURRENTHBANK + NBRCHANNELS + 1, + NUM_SAVEONLYUSED = NUM_NBRVOICES + NBRCHANNELS + 1, + NUM_SAVECONFIG, + NUM_RED_TEXT, + NUM_GREEN_TEXT, + NUM_BLUE_TEXT, + NUM_RED_BACKGROUND, + NUM_GREEN_BACKGROUND, + NUM_BLUE_BACKGROUND, + NUM_RED_EDITTEXT, + NUM_GREEN_EDITTEXT, + NUM_BLUE_EDITTEXT, + NUM_RED_EDITBACKGROUND, + NUM_GREEN_EDITBACKGROUND, + NUM_BLUE_EDITBACKGROUND, + NUM_QUALITY, + NUM_FONTSIZE, + NUM_ISINITSET, + NUM_INITSETPATH, + NUM_ISBACKGROUNDPIX = NUM_INITSETPATH + MAXSTRLENGTHINITSETPATH + 1, + NUM_BACKGROUNDPIXPATH, + NUM_IS_REVERB_ON = NUM_BACKGROUNDPIXPATH + MAXSTRLENGTHBACKGROUNDPIXPATH + 1, + NUM_REVERB_RETURN, + NUM_REVERB_PARAM_NBR, + NUM_REVERB_LIB, + NUM_REVERB_LABEL = NUM_REVERB_LIB + MAXSTRLENGTHFXLIB + 1, + NUM_IS_CHORUS_ON = NUM_REVERB_LABEL + MAXSTRLENGTHFXLABEL + 1, + NUM_CHORUS_RETURN, + NUM_CHORUS_PARAM_NBR, + NUM_CHORUS_LIB, + NUM_CHORUS_LABEL = NUM_CHORUS_LIB + MAXSTRLENGTHFXLIB + 1, + NUM_CONFIGLENGTH = NUM_CHORUS_LABEL + MAXSTRLENGTHFXLABEL + 1 }; class DeicsOnzeGui; diff --git a/muse/synti/deicsonze/deicsonzegui.cpp b/muse/synti/deicsonze/deicsonzegui.cpp index 9d614008..ad2508d5 100644 --- a/muse/synti/deicsonze/deicsonzegui.cpp +++ b/muse/synti/deicsonze/deicsonzegui.cpp @@ -385,7 +385,7 @@ DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze) colorFrame->setPalette(p); //update maaster volume - updateMasterVolume(INITMASTERVOL); + //updateMasterVolume(INITMASTERVOL); //update Quick edit updateQuickEdit(); @@ -3022,8 +3022,10 @@ void DeicsOnzeGui::updateNbrVoices(int val) { nbrVoicesSpinBox->blockSignals(false); } void DeicsOnzeGui::updateMasterVolume(int val) { + double d = (double)val/(double)MAXMASTERVOLUME; + //printf("D = %d, %f\n", val, d); masterVolKnob->blockSignals(true); - masterVolKnob->setValue(((double)val)/((double)MAXMASTERVOLUME)); + masterVolKnob->setValue(d); masterVolKnob->blockSignals(false); } //void DeicsOnzeGui::updateMidiInCh(int val) { diff --git a/muse/synti/deicsonze/deicsonzegui.ui b/muse/synti/deicsonze/deicsonzegui.ui index 60d634f2..fd3784b8 100644 --- a/muse/synti/deicsonze/deicsonzegui.ui +++ b/muse/synti/deicsonze/deicsonzegui.ui @@ -5687,6 +5687,9 @@ Wave form 8 = <i>if <b>t</b>&#060 pi then sin(2*<b>t</b>)*sin <height>40</height> </size> </property> + <property name="value" > + <double>0.000000000000000</double> + </property> <property name="minValue" > <double>0.000000000000000</double> </property> @@ -5700,7 +5703,7 @@ Wave form 8 = <i>if <b>t</b>&#060 pi then sin(2*<b>t</b>)*sin <double>0.200000000000000</double> </property> <property name="log" > - <bool>true</bool> + <bool>false</bool> </property> </widget> </item> diff --git a/muse/synti/deicsonze/deicsonzeplugin.cpp b/muse/synti/deicsonze/deicsonzeplugin.cpp index e08c6e7d..196777fa 100644 --- a/muse/synti/deicsonze/deicsonzeplugin.cpp +++ b/muse/synti/deicsonze/deicsonzeplugin.cpp @@ -31,6 +31,7 @@ #include "plugin.h" #include "plugingui.h" #include "ctrl.h" +#include "fastlog.h" #include "muse/midi.h" #include "awl/floatentry.h" #include "awl/slider.h" @@ -45,7 +46,7 @@ class PluginDialog; void DeicsOnze::initPluginReverb(Plugin* pluginReverb) { //init plugin - if(_pluginIReverb) delete(_pluginIChorus); + if(_pluginIReverb) delete(_pluginIReverb); _pluginIReverb = new PluginI(NULL); _pluginIReverb->initPluginInstance(pluginReverb, 2); @@ -64,7 +65,6 @@ void DeicsOnze::initPluginReverb(Plugin* pluginReverb) { } void DeicsOnze::initPluginChorus(Plugin* pluginChorus) { - if(_pluginIChorus) delete(_pluginIChorus); _pluginIChorus = new PluginI(NULL); @@ -195,19 +195,25 @@ void DeicsOnzeGui::buildGuiReverb() { if(!_reverbCheckBoxVector.empty()) _reverbCheckBoxVector.clear(); //build sliders for(int i = 0; i < plugI->plugin()->parameter(); i++) { + double min, max, val; + plugI->range(i, &min, &max); + val = plugI->param(i); if(plugI->isBool(i)) - addPluginCheckBox(i, plugI->getParameterName(i), plugI->param(i) > 0.0, + addPluginCheckBox(i, plugI->getParameterName(i), val > 0.0, _reverbSuperWidget, grid, true); else if(plugI->isInt(i)) { - double min, max; - plugI->range(i, &min, &max); addPluginIntSlider(i, plugI->getParameterName(i), rint(min), rint(max), - rint(plugI->param(i)), _reverbSuperWidget, grid, + rint(val), _reverbSuperWidget, grid, true); } else { - double min, max; - plugI->range(i, &min, &max); + if(plugI->isLog(i)) { + if (min == 0.0) min = 0.001; + min = fast_log10(min)*20.0; + max = fast_log10(max)*20.0; + if (val == 0.0f) val = min; + else val = fast_log10(val) * 20.0; + } addPluginSlider(i, plugI->getParameterName(i), plugI->isLog(i), min, max, plugI->param(i), _reverbSuperWidget, grid, true); @@ -242,22 +248,28 @@ void DeicsOnzeGui::buildGuiChorus() { if(!_chorusCheckBoxVector.empty()) _chorusCheckBoxVector.clear(); //build sliders for(int i = 0; i < plugI->plugin()->parameter(); i++) { + double min, max, val; + plugI->range(i, &min, &max); + val = plugI->param(i); if(plugI->isBool(i)) - addPluginCheckBox(i, plugI->getParameterName(i), plugI->param(i) > 0.0, + addPluginCheckBox(i, plugI->getParameterName(i), val > 0.0, _chorusSuperWidget, grid, false); else if(plugI->isInt(i)) { - double min, max; - plugI->range(i, &min, &max); - addPluginIntSlider(i, plugI->getParameterName(i), - rint(min), rint(max), rint(plugI->param(i)), - _chorusSuperWidget, grid, false); + addPluginIntSlider(i, plugI->getParameterName(i), rint(min), rint(max), + rint(val), _chorusSuperWidget, grid, + false); } else { - double min, max; - plugI->range(i, &min, &max); + if(plugI->isLog(i)) { + if (min == 0.0) min = 0.001; + min = fast_log10(min)*20.0; + max = fast_log10(max)*20.0; + if (val == 0.0f) val = min; + else val = fast_log10(val) * 20.0; + } addPluginSlider(i, plugI->getParameterName(i), plugI->isLog(i), - min, max, plugI->param(i), - _chorusSuperWidget, grid, false); + min, max, plugI->param(i), _chorusSuperWidget, grid, + false); } } //update colors of the new sliders (and the whole gui actually) @@ -265,7 +277,11 @@ void DeicsOnzeGui::buildGuiChorus() { setEditBackgroundColor(reinterpret_cast<const QColor &>(*ebColor)); } +//setReverbCheckBox is used, by the way, to send the value +//of the parameter because it sends a double and does not +//change any thing void DeicsOnzeGui::setReverbCheckBox(double v, int i) { + printf("setReverbCheckBox(%f, %d)\n", v, i); float f = (float)v; unsigned char* message = new unsigned char[2+sizeof(float)]; message[0]=SYSEX_REVERBPARAM; @@ -274,9 +290,14 @@ void DeicsOnzeGui::setReverbCheckBox(double v, int i) { memcpy(&message[2], &f, sizeof(float)); sendSysex(message, 2+sizeof(float)); } + else printf("setReverbCheckBox Error : cannot send controller upper than 225\n"); } +//setChorusCheckBox is used, by the way, to send the value +//of the parameter because it sends a double and does not +//change any thing void DeicsOnzeGui::setChorusCheckBox(double v, int i) { + printf("setChorusCheckBox(%f, %d)\n", v, i); float f = (float)v; unsigned char* message = new unsigned char[2+sizeof(float)]; message[0]=SYSEX_CHORUSPARAM; @@ -285,22 +306,31 @@ void DeicsOnzeGui::setChorusCheckBox(double v, int i) { memcpy(&message[2], &f, sizeof(float)); sendSysex(message, 2+sizeof(float)); } + else printf("setChorusCheckBox Error : cannot send controller upper than 225\n"); } - void DeicsOnzeGui::setReverbFloatEntry(double v, int i) { + if(_deicsOnze->_pluginIReverb->isInt(i)) v = rint(v); + updateReverbFloatEntry(v, i); updateReverbSlider(v, i); setReverbCheckBox(v, i); //because this send the SYSEX } void DeicsOnzeGui::setReverbSlider(double v, int i) { + if(_deicsOnze->_pluginIReverb->isInt(i)) v = rint(v); updateReverbFloatEntry(v, i); + updateReverbSlider(v, i); setReverbCheckBox(v, i); //because this send the SYSEX } void DeicsOnzeGui::setChorusFloatEntry(double v, int i) { + if(_deicsOnze->_pluginIChorus->isInt(i)) v = rint(v); + updateChorusFloatEntry(v, i); updateChorusSlider(v, i); setChorusCheckBox(v, i); //because this send the SYSEX } void DeicsOnzeGui::setChorusSlider(double v, int i) { + printf("setChorusSlider(%f, %i)\n", v, i); + if(_deicsOnze->_pluginIChorus->isInt(i)) v = rint(v); + updateChorusSlider(v, i); updateChorusFloatEntry(v, i); setChorusCheckBox(v, i); //because this send the SYSEX } @@ -321,6 +351,7 @@ void DeicsOnzeGui::updateReverbFloatEntry(double v, int i) { } } void DeicsOnzeGui::updateChorusSlider(double v, int i) { + printf("updateChorusSlider(%f, %i)\n", v, i); if(i < (int)_reverbSliderVector.size() && _reverbSliderVector[i]) { _reverbSliderVector[i]->blockSignals(true); _reverbSliderVector[i]->setValue(v); @@ -328,6 +359,7 @@ void DeicsOnzeGui::updateChorusSlider(double v, int i) { } } void DeicsOnzeGui::updateChorusFloatEntry(double v, int i) { + printf("updateChorusFloatEntry(%f, %i)\n", v, i); if(i < (int)_chorusFloatEntryVector.size() && _chorusFloatEntryVector[i]) { _chorusFloatEntryVector[i]->blockSignals(true); _chorusFloatEntryVector[i]->setValue(v); |