diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 3 | ||||
-rw-r--r-- | muse2/muse/arranger/CMakeLists.txt | 1 | ||||
-rw-r--r-- | muse2/muse/arranger/arranger.cpp | 224 | ||||
-rw-r--r-- | muse2/muse/arranger/arranger.h | 52 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/CMakeLists.txt | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/mtrackinfo.cpp (renamed from muse2/muse/arranger/trackinfo.cpp) | 1084 | ||||
-rw-r--r-- | muse2/muse/widgets/mtrackinfo.h | 71 |
8 files changed, 677 insertions, 762 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index ebabf1bf..d8f1fb53 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,4 +1,7 @@ 23.12.2010: + - MidiTrackInfo is now self-contained. (Tim) + Moved all of its members from Arranger into MidiTrackInfo. Removed trackinfo.cpp +23.12.2010: - MusE 2.0alpha released! (rj) 22.12.2010: - Capitalizations in the menus thanks to Geoff King (gsking1->gmail. com) diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt index bb425339..21a06698 100644 --- a/muse2/muse/arranger/CMakeLists.txt +++ b/muse2/muse/arranger/CMakeLists.txt @@ -36,7 +36,6 @@ file (GLOB arranger_source_files arranger.cpp pcanvas.cpp tlist.cpp - trackinfo.cpp ) # diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 2173e6c7..d2bd4412 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -21,9 +21,11 @@ #include <QToolButton> #include <QVBoxLayout> #include <QWheelEvent> +#include <QPainter> #include "arranger.h" #include "song.h" +#include "app.h" #include "mtscale.h" #include "scrollscale.h" #include "pcanvas.h" @@ -31,6 +33,7 @@ #include "xml.h" #include "splitter.h" #include "lcombo.h" +#include "mtrackinfo.h" #include "midiport.h" #include "mididev.h" #include "utils.h" @@ -97,9 +100,9 @@ Arranger::Arranger(QMainWindow* parent, const char* name) selected = 0; // Since program covers 3 controls at once, it is in 'midi controller' units rather than 'gui control' units. //program = -1; - program = CTRL_VAL_UNKNOWN; - pan = -65; - volume = -1; + ///program = CTRL_VAL_UNKNOWN; + ///pan = -65; + ///volume = -1; setMinimumSize(600, 50); showTrackinfoFlag = true; @@ -251,7 +254,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) infoScroll = new QScrollBar(Qt::Vertical, tracklist); infoScroll->setObjectName("infoScrollBar"); - genTrackInfo(tracklist); + //genTrackInfo(tracklist); // Moved below // Track-Info Button ib = new QToolButton(tracklist); @@ -291,6 +294,9 @@ Arranger::Arranger(QMainWindow* parent, const char* name) header->setMovable (true ); list = new TList(header, tracklist, "tracklist"); + // Do this now that the list is available. + genTrackInfo(tracklist); + connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged())); connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw())); connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw())); @@ -788,116 +794,6 @@ void Arranger::verticalScrollSetYpos(unsigned ypos) } //--------------------------------------------------------- -// progRecClicked -//--------------------------------------------------------- - -void Arranger::progRecClicked() - { - MidiTrack* track = (MidiTrack*)selected; - int portno = track->outPort(); - int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int program = port->hwCtrlState(channel, CTRL_PROGRAM); - if(program == CTRL_VAL_UNKNOWN || program == 0xffffff) - return; - - unsigned tick = song->cpos(); - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_PROGRAM); - a.setB(program); - - song->recordEvent(track, a); - } - -//--------------------------------------------------------- -// volRecClicked -//--------------------------------------------------------- - -void Arranger::volRecClicked() - { - MidiTrack* track = (MidiTrack*)selected; - int portno = track->outPort(); - int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int volume = port->hwCtrlState(channel, CTRL_VOLUME); - if(volume == CTRL_VAL_UNKNOWN) - return; - - unsigned tick = song->cpos(); - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_VOLUME); - a.setB(volume); - - song->recordEvent(track, a); - } - -//--------------------------------------------------------- -// panRecClicked -//--------------------------------------------------------- - -void Arranger::panRecClicked() - { - MidiTrack* track = (MidiTrack*)selected; - int portno = track->outPort(); - int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int pan = port->hwCtrlState(channel, CTRL_PANPOT); - if(pan == CTRL_VAL_UNKNOWN) - return; - - unsigned tick = song->cpos(); - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_PANPOT); - a.setB(pan); - - song->recordEvent(track, a); - } - -//--------------------------------------------------------- -// recordClicked -//--------------------------------------------------------- - -void Arranger::recordClicked() - { - MidiTrack* track = (MidiTrack*)selected; - int portno = track->outPort(); - int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - unsigned tick = song->cpos(); - - int program = port->hwCtrlState(channel, CTRL_PROGRAM); - if(program != CTRL_VAL_UNKNOWN && program != 0xffffff) - { - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_PROGRAM); - a.setB(program); - song->recordEvent(track, a); - } - int volume = port->hwCtrlState(channel, CTRL_VOLUME); - if(volume != CTRL_VAL_UNKNOWN) - { - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_VOLUME); - a.setB(volume); - song->recordEvent(track, a); - } - int pan = port->hwCtrlState(channel, CTRL_PANPOT); - if(pan != CTRL_VAL_UNKNOWN) - { - Event a(Controller); - a.setTick(tick); - a.setA(CTRL_PANPOT); - a.setB(pan); - song->recordEvent(track, a); - } - } - -//--------------------------------------------------------- // trackInfoScroll //--------------------------------------------------------- @@ -1012,3 +908,103 @@ void Arranger::controllerChanged(Track *t) { canvas->controllerChanged(t); } + +//--------------------------------------------------------- +// showTrackInfo +//--------------------------------------------------------- + +void Arranger::showTrackInfo(bool flag) + { + showTrackinfoFlag = flag; + trackInfo->setShown(flag); + infoScroll->setShown(flag); + updateTrackInfo(-1); + } + +//--------------------------------------------------------- +// genTrackInfo +//--------------------------------------------------------- + +void Arranger::genTrackInfo(QWidget* parent) + { + trackInfo = new WidgetStack(parent, "trackInfoStack"); + + noTrackInfo = new QWidget(trackInfo); + QPixmap *noInfoPix = new QPixmap(160, 1000); //muse_leftside_logo_xpm); + const QPixmap *logo = new QPixmap(*museLeftSideLogo); + noInfoPix->fill(noTrackInfo->palette().color(QPalette::Window) ); + // Orcan - check + //copyBlt(noInfoPix, 10, 0, logo, 0,0, logo->width(), logo->height()); + QPainter p; + p.begin(noInfoPix); + p.drawImage(10, 0, logo->toImage(), 0,0, logo->width(), logo->height()); + + //noTrackInfo->setPaletteBackgroundPixmap(*noInfoPix); + QPalette palette; + palette.setBrush(noTrackInfo->backgroundRole(), QBrush(*noInfoPix)); + noTrackInfo->setPalette(palette); + noTrackInfo->setGeometry(0, 0, 65, 200); + noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); + + midiTrackInfo = new MidiTrackInfo(trackInfo); + trackInfo->addWidget(noTrackInfo, 0); + trackInfo->addWidget(midiTrackInfo, 1); + trackInfo->addWidget(0, 2); + +/// genMidiTrackInfo(); + connect(midiTrackInfo, SIGNAL(outputPortChanged(int)), list, SLOT(redraw())); + } + +//--------------------------------------------------------- +// updateTrackInfo +//--------------------------------------------------------- + +void Arranger::updateTrackInfo(int flags) + { + if (!showTrackinfoFlag) { + switchInfo(-1); + return; + } + if (selected == 0) { + switchInfo(0); + return; + } + if (selected->isMidiTrack()) { + switchInfo(1); + ///updateMidiTrackInfo(flags); + midiTrackInfo->setTrack(selected); + midiTrackInfo->updateTrackInfo(flags); + } + else { + switchInfo(2); + } + } + +//--------------------------------------------------------- +// switchInfo +//--------------------------------------------------------- + +void Arranger::switchInfo(int n) + { + if (n == 2) { + AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); + if (w == 0 || selected != w->getTrack()) { + if (w) + delete w; + w = new AudioStrip(trackInfo, (AudioTrack*)selected); + connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); + connect(muse, SIGNAL(configChanged()), w, SLOT(configChanged())); + w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + trackInfo->addWidget(w, 2); + w->show(); + tgrid->activate(); + tgrid->update(); // muse-2 Qt4 + } + } + if (trackInfo->curIdx() == n) + return; + trackInfo->raiseWidget(n); + tgrid->activate(); + tgrid->update(); // muse-2 Qt4 + } + diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index fa4bb06b..e86444bf 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -12,7 +12,6 @@ #include "midieditor.h" #include "pcanvas.h" -#include "ui_mtrackinfobase.h" #include "trackautomationview.h" class QAction; @@ -32,7 +31,7 @@ class Xml; class Splitter; class LabelCombo; class PosLabel; -class MidiTrackInfoBase; +class MidiTrackInfo; class TLLayout; class WidgetStack; class AudioStrip; @@ -57,17 +56,6 @@ class WidgetStack : public QWidget { QSize minimumSizeHint() const; }; - -//--------------------------------------------------------- -// MidiTrackInfo -//--------------------------------------------------------- - -class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase { - public: - bool _midiDetect; - MidiTrackInfo(QWidget* parent) : QWidget(parent) { setupUi(this); _midiDetect = false; } - }; - //--------------------------------------------------------- // Arranger //--------------------------------------------------------- @@ -103,13 +91,11 @@ class Arranger : public QWidget { PosLabel* cursorPos; SpinBox* globalTempoSpinBox; SpinBox* globalPitchSpinBox; - int program, pan, volume; unsigned cursVal; void genTrackInfo(QWidget* parent); void genMidiTrackInfo(); void genWaveTrackInfo(); - void updateMidiTrackInfo(int flags); void switchInfo(int); void setHeaderToolTips(); void setHeaderWhatsThis(); @@ -120,28 +106,8 @@ class Arranger : public QWidget { void showTrackInfo(bool); void trackSelectionChanged(); void trackInfoScroll(int); - - //void iNameChanged(); - ///void iInputChannelChanged(const QString&); - void iOutputChannelChanged(int); - ///void iInputPortChanged(const QString&); - void iOutputPortChanged(int); - void iProgHBankChanged(); - void iProgLBankChanged(); - void iProgramChanged(); - void iProgramDoubleClicked(); - void iLautstChanged(int); - void iLautstDoubleClicked(); - void iTranspChanged(int); - void iAnschlChanged(int); - void iVerzChanged(int); - void iLenChanged(int); - void iKomprChanged(int); - void iPanChanged(int); - void iPanDoubleClicked(); void songChanged(int); void modeChange(int); - void instrPopup(); void setTime(unsigned); void headerMoved(); void globalPitchChanged(int); @@ -150,16 +116,7 @@ class Arranger : public QWidget { void setTempo100(); void setTempo200(); //void seek(); - void recordClicked(); - void progRecClicked(); - void volRecClicked(); - void panRecClicked(); - void recEchoToggled(bool); void verticalScrollSetYpos(unsigned); - void inRoutesPressed(); - void outRoutesPressed(); - void routingPopupMenuActivated(QAction*); - //void routingPopupViewActivated(const QModelIndex&); signals: void redirectWheelEvent(QWheelEvent*); @@ -174,12 +131,8 @@ class Arranger : public QWidget { protected: - virtual void wheelEvent(QWheelEvent* e); - protected slots: - virtual void midiTrackInfoHeartBeat(); - public slots: void dclickPart(Track*); void setTool(int); @@ -194,9 +147,6 @@ class Arranger : public QWidget { Arranger(QMainWindow* parent, const char* name = 0); void setMode(int); void reset(); - - void setTrackInfoLabelText(); - void setTrackInfoLabelFont(); void writeStatus(int level, Xml&); void readStatus(Xml&); diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index e6c30f0e..714e9a16 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1682,6 +1682,8 @@ void PartCanvas::drawWavePart(QPainter& p, // // combine multi channels into one waveform // + //printf("PartCanvas::drawWavePart i:%d ex:%d\n", i, ex); // REMOVE Tim. + for (; i < ex; i++) { SampleV sa[channels]; xScale = tempomap.deltaTick2frame(postick, postick + tickstep); diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index e27650ef..24785709 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -47,6 +47,7 @@ QT4_WRAP_CPP (widget_mocs mixdowndialog.h mlabel.h mtscale.h + mtrackinfo.h nentry.h noteinfo.h pitchedit.h @@ -138,6 +139,7 @@ file (GLOB widgets_source_files mixdowndialog.cpp mlabel.cpp mmath.cpp + mtrackinfo.cpp mtscale.cpp nentry.cpp noteinfo.cpp diff --git a/muse2/muse/arranger/trackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index c1253358..f88f60ce 100644 --- a/muse2/muse/arranger/trackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -1,46 +1,146 @@ //========================================================= // MusE // Linux Music Editor -// $Id: trackinfo.cpp,v 1.10.2.15 2009/11/14 03:37:48 terminator356 Exp $ -// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) +// (C) Copyright 2010 Werner Schweer and others (ws@seh.de) //========================================================= -#include <QMenu> -#include <QPainter> -#include <QScrollBar> #include <QTimer> #include <QMessageBox> #include <math.h> #include <string.h> +#include "mtrackinfo.h" #include "song.h" #include "globals.h" #include "config.h" #include "gconfig.h" -#include "arranger.h" #include "midiport.h" +#include "minstrument.h" #include "mididev.h" #include "utils.h" -#include "tlist.h" -#include "alayout.h" #include "audio.h" -#include "mixer/amixer.h" #include "midi.h" #include "midictrl.h" -#include "mixer/astrip.h" #include "icons.h" #include "app.h" #include "route.h" #include "popupmenu.h" //--------------------------------------------------------- -// midiTrackInfoHeartBeat +// setTrack //--------------------------------------------------------- -void Arranger::midiTrackInfoHeartBeat() +void MidiTrackInfo::setTrack(Track* t) { - if(!showTrackinfoFlag || !selected) + selected = t; + //updateTrackInfo(-1); +} + +//--------------------------------------------------------- +// midiTrackInfo +//--------------------------------------------------------- + +MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent) +{ + setupUi(this); + _midiDetect = false; + + selected = sel_track; + + // Since program covers 3 controls at once, it is in 'midi controller' units rather than 'gui control' units. + //program = -1; + program = CTRL_VAL_UNKNOWN; + pan = -65; + volume = -1; + + //iChanDetectLabel->setPixmap(*darkgreendotIcon); + iChanDetectLabel->setPixmap(*darkRedLedIcon); + + QIcon recEchoIconSet; + //recEchoIconSet.addPixmap(*recEchoIconOn, QIcon::Normal, QIcon::On); + //recEchoIconSet.addPixmap(*recEchoIconOff, QIcon::Normal, QIcon::Off); + recEchoIconSet.addPixmap(*midiConnectorRedBorderIcon, QIcon::Normal, QIcon::On); + recEchoIconSet.addPixmap(*edit_midiIcon, QIcon::Normal, QIcon::Off); + recEchoButton->setIcon(recEchoIconSet); + //recEchoButton->setIcon(QIcon(*edit_midiIcon)); + //recEchoButton->setIconSize(edit_midiIcon->size()); + + + // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. + trackNameLabel->setAlignment(Qt::AlignCenter); + //Qt::TextWordWrap is not available for alignment in Qt4 - Orcan + // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence + // over word wrap, so I found it is not really desirable. Maybe with a user setting... + //trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); + //trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); + + if(selected) + trackNameLabel->setObjectName(selected->cname()); + QPalette pal; + pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue + trackNameLabel->setPalette(pal); + trackNameLabel->setWordWrap(true); + trackNameLabel->setAutoFillBackground(true); + trackNameLabel->setTextFormat(Qt::PlainText); + trackNameLabel->setLineWidth(2); + trackNameLabel->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); + trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); + + // Added by Tim. p3.3.9 + setLabelText(); + setLabelFont(); + + connect(iPatch, SIGNAL(released()), SLOT(instrPopup())); + + ///pop = new QMenu(iPatch); + //pop->setCheckable(false); // not needed in Qt4 + + // Removed by Tim. p3.3.9 + //connect(iName, SIGNAL(returnPressed()), SLOT(iNameChanged())); + + connect(iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int))); + ///connect(iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&))); + connect(iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged())); + connect(iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged())); + connect(iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged())); + connect(iHBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); + connect(iLBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); + connect(iProgram, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); + connect(iLautst, SIGNAL(valueChanged(int)), SLOT(iLautstChanged(int))); + connect(iLautst, SIGNAL(doubleClicked()), SLOT(iLautstDoubleClicked())); + connect(iTransp, SIGNAL(valueChanged(int)), SLOT(iTranspChanged(int))); + connect(iAnschl, SIGNAL(valueChanged(int)), SLOT(iAnschlChanged(int))); + connect(iVerz, SIGNAL(valueChanged(int)), SLOT(iVerzChanged(int))); + connect(iLen, SIGNAL(valueChanged(int)), SLOT(iLenChanged(int))); + connect(iKompr, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int))); + connect(iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int))); + connect(iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked())); + connect(iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int))); + ///connect(iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&))); + connect(recordButton, SIGNAL(clicked()), SLOT(recordClicked())); + connect(progRecButton, SIGNAL(clicked()), SLOT(progRecClicked())); + connect(volRecButton, SIGNAL(clicked()), SLOT(volRecClicked())); + connect(panRecButton, SIGNAL(clicked()), SLOT(panRecClicked())); + connect(recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool))); + connect(iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed())); + + // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values... + oRButton->setEnabled(false); + oRButton->setVisible(false); + connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); + + connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); +} + +//--------------------------------------------------------- +// heartBeat +//--------------------------------------------------------- + +void MidiTrackInfo::heartBeat() +{ + ///if(!showTrackinfoFlag || !selected) + if(!isVisible() || !isEnabled() || !selected) return; switch(selected->type()) { @@ -58,11 +158,11 @@ void Arranger::midiTrackInfoHeartBeat() MidiPort* mp = &midiPorts[outPort]; // Set record echo. - if(midiTrackInfo->recEchoButton->isChecked() != track->recEcho()) + if(recEchoButton->isChecked() != track->recEcho()) { - midiTrackInfo->recEchoButton->blockSignals(true); - midiTrackInfo->recEchoButton->setChecked(track->recEcho()); - midiTrackInfo->recEchoButton->blockSignals(false); + recEchoButton->blockSignals(true); + recEchoButton->setChecked(track->recEcho()); + recEchoButton->blockSignals(false); } // Check for detection of midi general activity on chosen channels... @@ -97,16 +197,16 @@ void Arranger::midiTrackInfoHeartBeat() //if(midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel]) if(midiPorts[mpt].syncInfo().actDetectBits() & r->channel) // p3.3.50 Use new channel mask. { - //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != green) - // midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(green); - //if(midiTrackInfo->iChanDetectLabel->pixmap() != greendotIcon) - if(!midiTrackInfo->_midiDetect) + //if(iChanTextLabel->paletteBackgroundColor() != green) + // iChanTextLabel->setPaletteBackgroundColor(green); + //if(iChanDetectLabel->pixmap() != greendotIcon) + if(!_midiDetect) { //printf("Arranger::midiTrackInfoHeartBeat setting green icon\n"); - midiTrackInfo->_midiDetect = true; - //midiTrackInfo->iChanDetectLabel->setPixmap(*greendotIcon); - midiTrackInfo->iChanDetectLabel->setPixmap(*redLedIcon); + _midiDetect = true; + //iChanDetectLabel->setPixmap(*greendotIcon); + iChanDetectLabel->setPixmap(*redLedIcon); } break; } @@ -117,16 +217,16 @@ void Arranger::midiTrackInfoHeartBeat() //if(mpt == MIDI_PORTS) if(r == rl->end()) { - //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != darkGreen) - // midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(darkGreen); - //if(midiTrackInfo->iChanDetectLabel->pixmap() != darkgreendotIcon) - if(midiTrackInfo->_midiDetect) + //if(iChanTextLabel->paletteBackgroundColor() != darkGreen) + // iChanTextLabel->setPaletteBackgroundColor(darkGreen); + //if(iChanDetectLabel->pixmap() != darkgreendotIcon) + if(_midiDetect) { //printf("Arranger::midiTrackInfoHeartBeat setting darkgreen icon\n"); - midiTrackInfo->_midiDetect = false; - //midiTrackInfo->iChanDetectLabel->setPixmap(*darkgreendotIcon); - midiTrackInfo->iChanDetectLabel->setPixmap(*darkRedLedIcon); + _midiDetect = false; + //iChanDetectLabel->setPixmap(*darkgreendotIcon); + iChanDetectLabel->setPixmap(*darkRedLedIcon); } } @@ -138,23 +238,23 @@ void Arranger::midiTrackInfoHeartBeat() //printf("Arranger::midiTrackInfoHeartBeat setting program to unknown\n"); program = CTRL_VAL_UNKNOWN; - if(midiTrackInfo->iHBank->value() != 0) + if(iHBank->value() != 0) { - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iHBank->setValue(0); - midiTrackInfo->iHBank->blockSignals(false); + iHBank->blockSignals(true); + iHBank->setValue(0); + iHBank->blockSignals(false); } - if(midiTrackInfo->iLBank->value() != 0) + if(iLBank->value() != 0) { - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iLBank->setValue(0); - midiTrackInfo->iLBank->blockSignals(false); + iLBank->blockSignals(true); + iLBank->setValue(0); + iLBank->blockSignals(false); } - if(midiTrackInfo->iProgram->value() != 0) + if(iProgram->value() != 0) { - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iProgram->setValue(0); - midiTrackInfo->iProgram->blockSignals(false); + iProgram->blockSignals(true); + iProgram->setValue(0); + iProgram->blockSignals(false); } } @@ -163,12 +263,12 @@ void Arranger::midiTrackInfoHeartBeat() { //const char* n = "<unknown>"; const QString n(tr("<unknown>")); - //if(strcmp(midiTrackInfo->iPatch->text().toLatin1().constData(), n) != 0) - if(midiTrackInfo->iPatch->text() != n) + //if(strcmp(iPatch->text().toLatin1().constData(), n) != 0) + if(iPatch->text() != n) { //printf("Arranger::midiTrackInfoHeartBeat setting patch <unknown>\n"); - midiTrackInfo->iPatch->setText(n); + iPatch->setText(n); } } else @@ -178,15 +278,15 @@ void Arranger::midiTrackInfoHeartBeat() if(name.isEmpty()) { const QString n("???"); - if(midiTrackInfo->iPatch->text() != n) - midiTrackInfo->iPatch->setText(n); + if(iPatch->text() != n) + iPatch->setText(n); } else - if(midiTrackInfo->iPatch->text() != name) + if(iPatch->text() != name) { //printf("Arranger::midiTrackInfoHeartBeat setting patch name\n"); - midiTrackInfo->iPatch->setText(name); + iPatch->setText(name); } } } @@ -204,8 +304,8 @@ void Arranger::midiTrackInfoHeartBeat() //{ MidiInstrument* instr = mp->instrument(); QString name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM); - if(midiTrackInfo->iPatch->text() != name) - midiTrackInfo->iPatch->setText(name); + if(iPatch->text() != name) + iPatch->setText(name); int hb = ((program >> 16) & 0xff) + 1; if (hb == 0x100) @@ -220,23 +320,23 @@ void Arranger::midiTrackInfoHeartBeat() //printf("Arranger::midiTrackInfoHeartBeat setting program\n"); - if(midiTrackInfo->iHBank->value() != hb) + if(iHBank->value() != hb) { - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iHBank->setValue(hb); - midiTrackInfo->iHBank->blockSignals(false); + iHBank->blockSignals(true); + iHBank->setValue(hb); + iHBank->blockSignals(false); } - if(midiTrackInfo->iLBank->value() != lb) + if(iLBank->value() != lb) { - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iLBank->setValue(lb); - midiTrackInfo->iLBank->blockSignals(false); + iLBank->blockSignals(true); + iLBank->setValue(lb); + iLBank->blockSignals(false); } - if(midiTrackInfo->iProgram->value() != pr) + if(iProgram->value() != pr) { - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iProgram->setValue(pr); - midiTrackInfo->iProgram->blockSignals(false); + iProgram->blockSignals(true); + iProgram->setValue(pr); + iProgram->blockSignals(false); } } @@ -257,14 +357,14 @@ void Arranger::midiTrackInfoHeartBeat() if(volume != v) { volume = v; - if(midiTrackInfo->iLautst->value() != v) + if(iLautst->value() != v) { //printf("Arranger::midiTrackInfoHeartBeat setting volume\n"); - midiTrackInfo->iLautst->blockSignals(true); - //midiTrackInfo->iLautst->setRange(mn - 1, mc->maxVal()); - midiTrackInfo->iLautst->setValue(v); - midiTrackInfo->iLautst->blockSignals(false); + iLautst->blockSignals(true); + //iLautst->setRange(mn - 1, mc->maxVal()); + iLautst->setValue(v); + iLautst->blockSignals(false); } } @@ -284,14 +384,14 @@ void Arranger::midiTrackInfoHeartBeat() if(pan != v) { pan = v; - if(midiTrackInfo->iPan->value() != v) + if(iPan->value() != v) { //printf("Arranger::midiTrackInfoHeartBeat setting pan\n"); - midiTrackInfo->iPan->blockSignals(true); - //midiTrackInfo->iPan->setRange(mn - 1, mc->maxVal()); - midiTrackInfo->iPan->setValue(v); - midiTrackInfo->iPan->blockSignals(false); + iPan->blockSignals(true); + //iPan->setRange(mn - 1, mc->maxVal()); + iPan->setValue(v); + iPan->blockSignals(false); } } @@ -300,16 +400,16 @@ void Arranger::midiTrackInfoHeartBeat() // seek(); /* - if(midiTrackInfo->iTransp->value() != track->transposition) - midiTrackInfo->iTransp->setValue(track->transposition); - if(midiTrackInfo->iAnschl->value() != track->velocity) - midiTrackInfo->iAnschl->setValue(track->velocity); - if(midiTrackInfo->iVerz->value() != track->delay) - midiTrackInfo->iVerz->setValue(track->delay); - if(midiTrackInfo->iLen->value() != track->len) - midiTrackInfo->iLen->setValue(track->len); - if(midiTrackInfo->iKompr->value() != track->compression) - midiTrackInfo->iKompr->setValue(track->compression); + if(iTransp->value() != track->transposition) + iTransp->setValue(track->transposition); + if(iAnschl->value() != track->velocity) + iAnschl->setValue(track->velocity); + if(iVerz->value() != track->delay) + iVerz->setValue(track->delay); + if(iLen->value() != track->len) + iLen->setValue(track->len); + if(iKompr->value() != track->compression) + iKompr->setValue(track->compression); */ } break; @@ -325,119 +425,82 @@ void Arranger::midiTrackInfoHeartBeat() } //--------------------------------------------------------- -// showTrackInfo +// songChanged //--------------------------------------------------------- -void Arranger::showTrackInfo(bool flag) +void MidiTrackInfo::songChanged(int type) { - showTrackinfoFlag = flag; - trackInfo->setShown(flag); - infoScroll->setShown(flag); - updateTrackInfo(-1); - } - -//--------------------------------------------------------- -// genTrackInfo -//--------------------------------------------------------- - -void Arranger::genTrackInfo(QWidget* parent) - { - trackInfo = new WidgetStack(parent, "trackInfoStack"); - - noTrackInfo = new QWidget(trackInfo); - QPixmap *noInfoPix = new QPixmap(160, 1000); //muse_leftside_logo_xpm); - const QPixmap *logo = new QPixmap(*museLeftSideLogo); - noInfoPix->fill(noTrackInfo->palette().color(QPalette::Window) ); - // Orcan - check - //copyBlt(noInfoPix, 10, 0, logo, 0,0, logo->width(), logo->height()); - QPainter p; - p.begin(noInfoPix); - p.drawImage(10, 0, logo->toImage(), 0,0, logo->width(), logo->height()); - - //noTrackInfo->setPaletteBackgroundPixmap(*noInfoPix); - QPalette palette; - palette.setBrush(noTrackInfo->backgroundRole(), QBrush(*noInfoPix)); - noTrackInfo->setPalette(palette); - noTrackInfo->setGeometry(0, 0, 65, 200); - noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); - - midiTrackInfo = new MidiTrackInfo(trackInfo); - trackInfo->addWidget(noTrackInfo, 0); - trackInfo->addWidget(midiTrackInfo, 1); - trackInfo->addWidget(0, 2); - - genMidiTrackInfo(); - } - -//--------------------------------------------------------- -// updateTrackInfo -//--------------------------------------------------------- - -void Arranger::updateTrackInfo(int flags) - { - if (!showTrackinfoFlag) { - switchInfo(-1); - return; - } - if (selected == 0) { - switchInfo(0); - return; - } - if (selected->isMidiTrack()) { - switchInfo(1); - updateMidiTrackInfo(flags); - } - else { - switchInfo(2); - } - } - -//--------------------------------------------------------- -// switchInfo -//--------------------------------------------------------- - -void Arranger::switchInfo(int n) + // Is it simply a midi controller value adjustment? Forget it. + if(type != SC_MIDI_CONTROLLER) { - if (n == 2) { - AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); - if (w == 0 || selected != w->getTrack()) { - if (w) - delete w; - w = new AudioStrip(trackInfo, (AudioTrack*)selected); - connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), w, SLOT(configChanged())); - w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - trackInfo->addWidget(w, 2); - w->show(); - tgrid->activate(); - tgrid->update(); // muse-2 Qt4 - } - } - if (trackInfo->curIdx() == n) - return; - trackInfo->raiseWidget(n); - tgrid->activate(); - tgrid->update(); // muse-2 Qt4 +/* + unsigned endTick = song->len(); + int offset = AL::sigmap.ticksMeasure(endTick); + hscroll->setRange(-offset, endTick + offset); //DEBUG + canvas->setOrigin(-offset, 0); + time->setOrigin(-offset, 0); + + int bar, beat; + unsigned tick; + AL::sigmap.tickValues(endTick, &bar, &beat, &tick); + if (tick || beat) + ++bar; + lenEntry->blockSignals(true); + lenEntry->setValue(bar); + lenEntry->blockSignals(false); + + trackSelectionChanged(); + canvas->partsChanged(); + typeBox->setCurrentIndex(int(song->mtype())); + if (type & SC_SIG) + time->redraw(); + if (type & SC_TEMPO) + setGlobalTempo(tempomap.globalTempo()); + + if(type & SC_TRACK_REMOVED) + { + AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); + if(w) + { + Track* t = w->getTrack(); + if(t) + { + TrackList* tl = song->tracks(); + iTrack it = tl->find(t); + if(it == tl->end()) + { + delete w; + trackInfo->addWidget(0, 2); + selected = 0; + } + } + } + } +*/ + } + + updateTrackInfo(type); + } //--------------------------------------------------------- -// setTrackInfoLabelText +// setLabelText //--------------------------------------------------------- -void Arranger::setTrackInfoLabelText() +void MidiTrackInfo::setLabelText() { MidiTrack* track = (MidiTrack*)selected; if(track) - midiTrackInfo->trackNameLabel->setText(track->name()); + trackNameLabel->setText(track->name()); else - midiTrackInfo->trackNameLabel->setText(QString()); + trackNameLabel->setText(QString()); } //--------------------------------------------------------- -// setTrackInfoLabelFont +// setLabelFont //--------------------------------------------------------- -void Arranger::setTrackInfoLabelFont() +void MidiTrackInfo::setLabelFont() { MidiTrack* track = (MidiTrack*)selected; if(!track) @@ -445,58 +508,16 @@ void Arranger::setTrackInfoLabelFont() // Use the new font #6 I created just for these labels (so far). // Set the label's font. - midiTrackInfo->trackNameLabel->setFont(config.fonts[6]); + trackNameLabel->setFont(config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - autoAdjustFontSize(midiTrackInfo->trackNameLabel, midiTrackInfo->trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); + autoAdjustFontSize(trackNameLabel, trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); } -// Removed by Tim. p3.3.9 - -/* -//--------------------------------------------------------- -// iNameChanged -//--------------------------------------------------------- - -void Arranger::iNameChanged() - { - QString txt = midiTrackInfo->iName->text(); - if (txt == selected->name()) - return; - - TrackList* tl = song->tracks(); - for(iTrack i = tl->begin(); i != tl->end(); ++i) - { - if((*i)->name() == txt) - { - // Restore the text. - midiTrackInfo->iName->blockSignals(true); - midiTrackInfo->iName->setText(selected->name()); - midiTrackInfo->iName->blockSignals(false); - - QMessageBox::critical(this, - tr("MusE: bad trackname"), - tr("please choose a unique track name"), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton); - - midiTrackInfo->iName->setFocus(); - return; - } - } - - //Track* track = selected->clone(); - Track* track = selected->clone(false); - selected->setName(txt); - audio->msgChangeTrack(track, selected); - } -*/ - //--------------------------------------------------------- // iOutputChannelChanged //--------------------------------------------------------- -void Arranger::iOutputChannelChanged(int channel) +void MidiTrackInfo::iOutputChannelChanged(int channel) { --channel; MidiTrack* track = (MidiTrack*)selected; @@ -514,27 +535,11 @@ void Arranger::iOutputChannelChanged(int channel) } } -/* -//--------------------------------------------------------- -// iKanalChanged -//--------------------------------------------------------- - -void Arranger::iInputChannelChanged(const QString& s) - { - MidiTrack* track = (MidiTrack*)selected; - int val = string2bitmap(s); - if (val != track->inChannelMask()) { - track->setInChannelMask(val); - list->redraw(); - } - } -*/ - //--------------------------------------------------------- // iOutputPortChanged //--------------------------------------------------------- -void Arranger::iOutputPortChanged(int index) +void MidiTrackInfo::iOutputPortChanged(int index) { MidiTrack* track = (MidiTrack*)selected; if (index == track->outPort()) @@ -546,36 +551,19 @@ void Arranger::iOutputPortChanged(int index) track->setOutPortAndUpdate(index); audio->msgIdle(false); - list->redraw(); + ///list->redraw(); + emit outputPortChanged(index); } -/* -//--------------------------------------------------------- -// iInputPortChanged -//--------------------------------------------------------- - -void Arranger::iInputPortChanged(const QString& s) - { - // Changed by Tim. p3.3.8 - //int val = string2bitmap(s); - unsigned int val = string2u32bitmap(s); - - MidiTrack* track = (MidiTrack*)selected; - if (val == track->inPortMask()) - return; - track->setInPortMask(val); - list->redraw(); - } -*/ - //--------------------------------------------------------- // routingPopupMenuActivated //--------------------------------------------------------- -//void Arranger::routingPopupMenuActivated(int n) -void Arranger::routingPopupMenuActivated(QAction* act) +//void MidiTrackInfo::routingPopupMenuActivated(int n) +void MidiTrackInfo::routingPopupMenuActivated(QAction* act) { - if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack()) + ///if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack()) + if((gRoutingPopupMenuMaster != this) || !selected || !selected->isMidiTrack()) return; muse->routingPopupMenuActivated(selected, act->data().toInt()); } @@ -585,9 +573,10 @@ void Arranger::routingPopupMenuActivated(QAction* act) // routingPopupViewActivated //--------------------------------------------------------- -void Arranger::routingPopupViewActivated(const QModelIndex& mdi) +void MidiTrackInfo::routingPopupViewActivated(const QModelIndex& mdi) { - if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack()) + ///if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack()) + if(gRoutingPopupMenuMaster != this || !selected || !selected->isMidiTrack()) return; muse->routingPopupMenuActivated(selected, mdi.data().toInt()); } @@ -597,7 +586,7 @@ void Arranger::routingPopupViewActivated(const QModelIndex& mdi) // inRoutesPressed //--------------------------------------------------------- -void Arranger::inRoutesPressed() +void MidiTrackInfo::inRoutesPressed() { if(!selected) return; @@ -620,14 +609,15 @@ void Arranger::inRoutesPressed() return; } - gRoutingPopupMenuMaster = midiTrackInfo; + ///gRoutingPopupMenuMaster = midiTrackInfo; + gRoutingPopupMenuMaster = this; connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*))); //connect(pup, SIGNAL(activated(const QModelIndex&)), SLOT(routingPopupViewActivated(const QModelIndex&))); connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); //connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupViewAboutToHide())); pup->popup(QCursor::pos()); //pup->setVisible(true); - midiTrackInfo->iRButton->setDown(false); + iRButton->setDown(false); return; } @@ -635,7 +625,7 @@ void Arranger::inRoutesPressed() // outRoutesPressed //--------------------------------------------------------- -void Arranger::outRoutesPressed() +void MidiTrackInfo::outRoutesPressed() { if(!selected) return; @@ -646,11 +636,12 @@ void Arranger::outRoutesPressed() if(!pup) return; - gRoutingPopupMenuMaster = midiTrackInfo; + ///gRoutingPopupMenuMaster = midiTrackInfo; + gRoutingPopupMenuMaster = this; connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*))); connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); pup->popup(QCursor::pos()); - midiTrackInfo->oRButton->setDown(false); + oRButton->setDown(false); return; } @@ -658,14 +649,14 @@ void Arranger::outRoutesPressed() // iProgHBankChanged //--------------------------------------------------------- -void Arranger::iProgHBankChanged() +void MidiTrackInfo::iProgHBankChanged() { MidiTrack* track = (MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); - int hbank = midiTrackInfo->iHBank->value(); - int lbank = midiTrackInfo->iLBank->value(); - int prog = midiTrackInfo->iProgram->value(); + int hbank = iHBank->value(); + int lbank = iLBank->value(); + int prog = iProgram->value(); if (hbank > 0 && hbank < 129) hbank -= 1; @@ -705,28 +696,28 @@ void Arranger::iProgHBankChanged() ilbnk = -1; ++ilbnk; ++iprog; - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iLBank->setValue(ilbnk); - midiTrackInfo->iProgram->setValue(iprog); - midiTrackInfo->iLBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); + iLBank->blockSignals(true); + iProgram->blockSignals(true); + iLBank->setValue(ilbnk); + iProgram->setValue(iprog); + iLBank->blockSignals(false); + iProgram->blockSignals(false); } } if(prog == 0xff && (hbank != 0xff || lbank != 0xff)) { prog = 0; - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iProgram->setValue(1); - midiTrackInfo->iProgram->blockSignals(false); + iProgram->blockSignals(true); + iProgram->setValue(1); + iProgram->blockSignals(false); } program = (hbank << 16) + (lbank << 8) + prog; MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program); audio->msgPlayMidiEvent(&ev); MidiInstrument* instr = mp->instrument(); - midiTrackInfo->iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); + iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); // updateTrackInfo(); } @@ -734,14 +725,14 @@ void Arranger::iProgHBankChanged() // iProgLBankChanged //--------------------------------------------------------- -void Arranger::iProgLBankChanged() +void MidiTrackInfo::iProgLBankChanged() { MidiTrack* track = (MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); - int hbank = midiTrackInfo->iHBank->value(); - int lbank = midiTrackInfo->iLBank->value(); - int prog = midiTrackInfo->iProgram->value(); + int hbank = iHBank->value(); + int lbank = iLBank->value(); + int prog = iProgram->value(); if (hbank > 0 && hbank < 129) hbank -= 1; @@ -781,28 +772,28 @@ void Arranger::iProgLBankChanged() ihbnk = -1; ++ihbnk; ++iprog; - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iHBank->setValue(ihbnk); - midiTrackInfo->iProgram->setValue(iprog); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); + iHBank->blockSignals(true); + iProgram->blockSignals(true); + iHBank->setValue(ihbnk); + iProgram->setValue(iprog); + iHBank->blockSignals(false); + iProgram->blockSignals(false); } } if(prog == 0xff && (hbank != 0xff || lbank != 0xff)) { prog = 0; - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iProgram->setValue(1); - midiTrackInfo->iProgram->blockSignals(false); + iProgram->blockSignals(true); + iProgram->setValue(1); + iProgram->blockSignals(false); } program = (hbank << 16) + (lbank << 8) + prog; MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program); audio->msgPlayMidiEvent(&ev); MidiInstrument* instr = mp->instrument(); - midiTrackInfo->iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); + iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); // updateTrackInfo(); } @@ -810,14 +801,14 @@ void Arranger::iProgLBankChanged() // iProgramChanged //--------------------------------------------------------- -void Arranger::iProgramChanged() +void MidiTrackInfo::iProgramChanged() { MidiTrack* track = (MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); - int hbank = midiTrackInfo->iHBank->value(); - int lbank = midiTrackInfo->iLBank->value(); - int prog = midiTrackInfo->iProgram->value(); + int hbank = iHBank->value(); + int lbank = iLBank->value(); + int prog = iProgram->value(); if (hbank > 0 && hbank < 129) hbank -= 1; @@ -836,12 +827,12 @@ void Arranger::iProgramChanged() if(prog == 0xff) { program = CTRL_VAL_UNKNOWN; - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iHBank->setValue(0); - midiTrackInfo->iLBank->setValue(0); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); + iHBank->blockSignals(true); + iLBank->blockSignals(true); + iHBank->setValue(0); + iLBank->setValue(0); + iHBank->blockSignals(false); + iLBank->blockSignals(false); if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN) audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN); @@ -865,12 +856,12 @@ void Arranger::iProgramChanged() ilbnk = -1; ++ihbnk; ++ilbnk; - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iHBank->setValue(ihbnk); - midiTrackInfo->iLBank->setValue(ilbnk); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); + iHBank->blockSignals(true); + iLBank->blockSignals(true); + iHBank->setValue(ihbnk); + iLBank->setValue(ilbnk); + iHBank->blockSignals(false); + iLBank->blockSignals(false); } } program = (hbank << 16) + (lbank << 8) + prog; @@ -878,7 +869,7 @@ void Arranger::iProgramChanged() audio->msgPlayMidiEvent(&ev); MidiInstrument* instr = mp->instrument(); - midiTrackInfo->iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); + iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); } // updateTrackInfo(); @@ -888,7 +879,7 @@ void Arranger::iProgramChanged() // iLautstChanged //--------------------------------------------------------- -void Arranger::iLautstChanged(int val) +void MidiTrackInfo::iLautstChanged(int val) { MidiTrack* track = (MidiTrack*)selected; int outPort = track->outPort(); @@ -915,7 +906,7 @@ void Arranger::iLautstChanged(int val) // iTranspChanged //--------------------------------------------------------- -void Arranger::iTranspChanged(int val) +void MidiTrackInfo::iTranspChanged(int val) { MidiTrack* track = (MidiTrack*)selected; track->transposition = val; @@ -925,7 +916,7 @@ void Arranger::iTranspChanged(int val) // iAnschlChanged //--------------------------------------------------------- -void Arranger::iAnschlChanged(int val) +void MidiTrackInfo::iAnschlChanged(int val) { MidiTrack* track = (MidiTrack*)selected; track->velocity = val; @@ -935,7 +926,7 @@ void Arranger::iAnschlChanged(int val) // iVerzChanged //--------------------------------------------------------- -void Arranger::iVerzChanged(int val) +void MidiTrackInfo::iVerzChanged(int val) { MidiTrack* track = (MidiTrack*)selected; track->delay = val; @@ -945,7 +936,7 @@ void Arranger::iVerzChanged(int val) // iLenChanged //--------------------------------------------------------- -void Arranger::iLenChanged(int val) +void MidiTrackInfo::iLenChanged(int val) { MidiTrack* track = (MidiTrack*)selected; track->len = val; @@ -955,7 +946,7 @@ void Arranger::iLenChanged(int val) // iKomprChanged //--------------------------------------------------------- -void Arranger::iKomprChanged(int val) +void MidiTrackInfo::iKomprChanged(int val) { MidiTrack* track = (MidiTrack*)selected; track->compression = val; @@ -965,7 +956,7 @@ void Arranger::iKomprChanged(int val) // iPanChanged //--------------------------------------------------------- -void Arranger::iPanChanged(int val) +void MidiTrackInfo::iPanChanged(int val) { MidiTrack* track = (MidiTrack*)selected; int port = track->outPort(); @@ -993,7 +984,7 @@ void Arranger::iPanChanged(int val) // instrPopup //--------------------------------------------------------- -void Arranger::instrPopup() +void MidiTrackInfo::instrPopup() { MidiTrack* track = (MidiTrack*)selected; int channel = track->outChannel(); @@ -1011,8 +1002,8 @@ void Arranger::instrPopup() return; } - ///QAction *act = pop->exec(midiTrackInfo->iPatch->mapToGlobal(QPoint(10,5))); - QAction *act = pup->exec(midiTrackInfo->iPatch->mapToGlobal(QPoint(10,5))); + ///QAction *act = pop->exec(iPatch->mapToGlobal(QPoint(10,5))); + QAction *act = pup->exec(iPatch->mapToGlobal(QPoint(10,5))); if (act) { int rv = act->data().toInt(); MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv); @@ -1027,7 +1018,7 @@ void Arranger::instrPopup() // recEchoToggled //--------------------------------------------------------- -void Arranger::recEchoToggled(bool v) +void MidiTrackInfo::recEchoToggled(bool v) { MidiTrack* track = (MidiTrack*)selected; track->setRecEcho(v); @@ -1039,7 +1030,7 @@ void Arranger::recEchoToggled(bool v) // iProgramDoubleClicked //--------------------------------------------------------- -void Arranger::iProgramDoubleClicked() +void MidiTrackInfo::iProgramDoubleClicked() { MidiTrack* track = (MidiTrack*)selected; int port = track->outPort(); @@ -1095,7 +1086,7 @@ void Arranger::iProgramDoubleClicked() // iLautstDoubleClicked //--------------------------------------------------------- -void Arranger::iLautstDoubleClicked() +void MidiTrackInfo::iLautstDoubleClicked() { MidiTrack* track = (MidiTrack*)selected; int port = track->outPort(); @@ -1151,7 +1142,7 @@ void Arranger::iLautstDoubleClicked() // iPanDoubleClicked //--------------------------------------------------------- -void Arranger::iPanDoubleClicked() +void MidiTrackInfo::iPanDoubleClicked() { MidiTrack* track = (MidiTrack*)selected; int port = track->outPort(); @@ -1203,97 +1194,16 @@ void Arranger::iPanDoubleClicked() song->update(SC_MIDI_CONTROLLER); } -//--------------------------------------------------------- -// genMidiTrackInfo -//--------------------------------------------------------- - -void Arranger::genMidiTrackInfo() - { - //midiTrackInfo->iChanDetectLabel->setPixmap(*darkgreendotIcon); - midiTrackInfo->iChanDetectLabel->setPixmap(*darkRedLedIcon); - - QIcon recEchoIconSet; - //recEchoIconSet.addPixmap(*recEchoIconOn, QIcon::Normal, QIcon::On); - //recEchoIconSet.addPixmap(*recEchoIconOff, QIcon::Normal, QIcon::Off); - recEchoIconSet.addPixmap(*midiConnectorRedBorderIcon, QIcon::Normal, QIcon::On); - recEchoIconSet.addPixmap(*edit_midiIcon, QIcon::Normal, QIcon::Off); - midiTrackInfo->recEchoButton->setIcon(recEchoIconSet); - //midiTrackInfo->recEchoButton->setIcon(QIcon(*edit_midiIcon)); - //midiTrackInfo->recEchoButton->setIconSize(edit_midiIcon->size()); - - - // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. - midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter); - //Qt::TextWordWrap is not available for alignment in Qt4 - Orcan - // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence - // over word wrap, so I found it is not really desirable. Maybe with a user setting... - //midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); - //midiTrackInfo->trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); - - if(selected) - midiTrackInfo->trackNameLabel->setObjectName(selected->cname()); - QPalette pal; - pal.setColor(midiTrackInfo->trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue - midiTrackInfo->trackNameLabel->setPalette(pal); - midiTrackInfo->trackNameLabel->setWordWrap(true); - midiTrackInfo->trackNameLabel->setAutoFillBackground(true); - midiTrackInfo->trackNameLabel->setTextFormat(Qt::PlainText); - midiTrackInfo->trackNameLabel->setLineWidth(2); - midiTrackInfo->trackNameLabel->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); - midiTrackInfo->trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); - - // Added by Tim. p3.3.9 - setTrackInfoLabelText(); - setTrackInfoLabelFont(); - - connect(midiTrackInfo->iPatch, SIGNAL(released()), SLOT(instrPopup())); - - ///pop = new QMenu(midiTrackInfo->iPatch); - //pop->setCheckable(false); // not needed in Qt4 - - // Removed by Tim. p3.3.9 - //connect(midiTrackInfo->iName, SIGNAL(returnPressed()), SLOT(iNameChanged())); - - connect(midiTrackInfo->iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int))); - ///connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&))); - connect(midiTrackInfo->iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged())); - connect(midiTrackInfo->iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged())); - connect(midiTrackInfo->iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged())); - connect(midiTrackInfo->iHBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); - connect(midiTrackInfo->iLBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); - connect(midiTrackInfo->iProgram, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked())); - connect(midiTrackInfo->iLautst, SIGNAL(valueChanged(int)), SLOT(iLautstChanged(int))); - connect(midiTrackInfo->iLautst, SIGNAL(doubleClicked()), SLOT(iLautstDoubleClicked())); - connect(midiTrackInfo->iTransp, SIGNAL(valueChanged(int)), SLOT(iTranspChanged(int))); - connect(midiTrackInfo->iAnschl, SIGNAL(valueChanged(int)), SLOT(iAnschlChanged(int))); - connect(midiTrackInfo->iVerz, SIGNAL(valueChanged(int)), SLOT(iVerzChanged(int))); - connect(midiTrackInfo->iLen, SIGNAL(valueChanged(int)), SLOT(iLenChanged(int))); - connect(midiTrackInfo->iKompr, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int))); - connect(midiTrackInfo->iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int))); - connect(midiTrackInfo->iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked())); - connect(midiTrackInfo->iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int))); - ///connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&))); - connect(midiTrackInfo->recordButton, SIGNAL(clicked()), SLOT(recordClicked())); - connect(midiTrackInfo->progRecButton, SIGNAL(clicked()), SLOT(progRecClicked())); - connect(midiTrackInfo->volRecButton, SIGNAL(clicked()), SLOT(volRecClicked())); - connect(midiTrackInfo->panRecButton, SIGNAL(clicked()), SLOT(panRecClicked())); - connect(midiTrackInfo->recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool))); - connect(midiTrackInfo->iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed())); - - // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values... - midiTrackInfo->oRButton->setEnabled(false); - midiTrackInfo->oRButton->setVisible(false); - connect(midiTrackInfo->oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); - - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(midiTrackInfoHeartBeat())); - } //--------------------------------------------------------- -// updateMidiTrackInfo +// updateTrackInfo //--------------------------------------------------------- -void Arranger::updateMidiTrackInfo(int flags) +void MidiTrackInfo::updateTrackInfo(int flags) { + if(!selected) + return; + MidiTrack* track = (MidiTrack*)selected; // Is it simply a midi controller value adjustment? Forget it. @@ -1305,11 +1215,12 @@ void Arranger::updateMidiTrackInfo(int flags) if(flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)) // p3.3.50 // Use this handy shared routine. //muse->updateRouteMenus(selected); - muse->updateRouteMenus(selected, midiTrackInfo); // p3.3.50 + ///muse->updateRouteMenus(selected, midiTrackInfo); // p3.3.50 + muse->updateRouteMenus(selected, this); // Added by Tim. p3.3.9 - setTrackInfoLabelText(); - setTrackInfoLabelFont(); + setLabelText(); + setLabelFont(); //{ int outChannel = track->outChannel(); @@ -1318,61 +1229,61 @@ void Arranger::updateMidiTrackInfo(int flags) //int inPort = track->inPortMask(); ///unsigned int inPort = track->inPortMask(); - //midiTrackInfo->iInput->clear(); - midiTrackInfo->iOutput->clear(); + //iInput->clear(); + iOutput->clear(); for (int i = 0; i < MIDI_PORTS; ++i) { QString name; name.sprintf("%d:%s", i+1, midiPorts[i].portname().toLatin1().constData()); - midiTrackInfo->iOutput->insertItem(i, name); + iOutput->insertItem(i, name); if (i == outPort) - midiTrackInfo->iOutput->setCurrentIndex(i); + iOutput->setCurrentIndex(i); } - //midiTrackInfo->iInput->setText(bitmap2String(inPort)); - ///midiTrackInfo->iInput->setText(u32bitmap2String(inPort)); + //iInput->setText(bitmap2String(inPort)); + ///iInput->setText(u32bitmap2String(inPort)); - //midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel)); + //iInputChannel->setText(bitmap2String(inChannel)); // Removed by Tim. p3.3.9 - //if (midiTrackInfo->iName->text() != selected->name()) { - // midiTrackInfo->iName->setText(selected->name()); - // midiTrackInfo->iName->home(false); + //if (iName->text() != selected->name()) { + // iName->setText(selected->name()); + // iName->home(false); // } - midiTrackInfo->iOutputChannel->setValue(outChannel+1); - ///midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel)); + iOutputChannel->setValue(outChannel+1); + ///iInputChannel->setText(bitmap2String(inChannel)); // Set record echo. - if(midiTrackInfo->recEchoButton->isChecked() != track->recEcho()) + if(recEchoButton->isChecked() != track->recEcho()) { - midiTrackInfo->recEchoButton->blockSignals(true); - midiTrackInfo->recEchoButton->setChecked(track->recEcho()); - midiTrackInfo->recEchoButton->blockSignals(false); + recEchoButton->blockSignals(true); + recEchoButton->setChecked(track->recEcho()); + recEchoButton->blockSignals(false); } MidiPort* mp = &midiPorts[outPort]; int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM); if(nprogram == CTRL_VAL_UNKNOWN) { - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iHBank->setValue(0); - midiTrackInfo->iLBank->setValue(0); - midiTrackInfo->iProgram->setValue(0); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); + iHBank->blockSignals(true); + iLBank->blockSignals(true); + iProgram->blockSignals(true); + iHBank->setValue(0); + iLBank->setValue(0); + iProgram->setValue(0); + iHBank->blockSignals(false); + iLBank->blockSignals(false); + iProgram->blockSignals(false); program = CTRL_VAL_UNKNOWN; nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM); if(nprogram == CTRL_VAL_UNKNOWN) - //midiTrackInfo->iPatch->setText(QString("<unknown>")); - midiTrackInfo->iPatch->setText(tr("<unknown>")); + //iPatch->setText(QString("<unknown>")); + iPatch->setText(tr("<unknown>")); else { MidiInstrument* instr = mp->instrument(); - midiTrackInfo->iPatch->setText(instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM)); + iPatch->setText(instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM)); } } else @@ -1383,12 +1294,12 @@ void Arranger::updateMidiTrackInfo(int flags) //int hb, lb, pr; //if (program == CTRL_VAL_UNKNOWN) { // hb = lb = pr = 0; - // midiTrackInfo->iPatch->setText("---"); + // iPatch->setText("---"); // } //else //{ MidiInstrument* instr = mp->instrument(); - midiTrackInfo->iPatch->setText(instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM)); + iPatch->setText(instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM)); int hb = ((program >> 16) & 0xff) + 1; if (hb == 0x100) @@ -1400,17 +1311,17 @@ void Arranger::updateMidiTrackInfo(int flags) if (pr == 0x100) pr = 0; //} - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); + iHBank->blockSignals(true); + iLBank->blockSignals(true); + iProgram->blockSignals(true); - midiTrackInfo->iHBank->setValue(hb); - midiTrackInfo->iLBank->setValue(lb); - midiTrackInfo->iProgram->setValue(pr); + iHBank->setValue(hb); + iLBank->setValue(lb); + iProgram->setValue(pr); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); + iHBank->blockSignals(false); + iLBank->blockSignals(false); + iProgram->blockSignals(false); } MidiController* mc = mp->midiController(CTRL_VOLUME); @@ -1427,10 +1338,10 @@ void Arranger::updateMidiTrackInfo(int flags) else // Auto bias... v -= mc->bias(); - midiTrackInfo->iLautst->blockSignals(true); - midiTrackInfo->iLautst->setRange(mn - 1, mc->maxVal()); - midiTrackInfo->iLautst->setValue(v); - midiTrackInfo->iLautst->blockSignals(false); + iLautst->blockSignals(true); + iLautst->setRange(mn - 1, mc->maxVal()); + iLautst->setValue(v); + iLautst->blockSignals(false); mc = mp->midiController(CTRL_PANPOT); mn = mc->minVal(); @@ -1446,10 +1357,10 @@ void Arranger::updateMidiTrackInfo(int flags) else // Auto bias... v -= mc->bias(); - midiTrackInfo->iPan->blockSignals(true); - midiTrackInfo->iPan->setRange(mn - 1, mc->maxVal()); - midiTrackInfo->iPan->setValue(v); - midiTrackInfo->iPan->blockSignals(false); + iPan->blockSignals(true); + iPan->setRange(mn - 1, mc->maxVal()); + iPan->setValue(v); + iPan->blockSignals(false); //} @@ -1460,140 +1371,121 @@ void Arranger::updateMidiTrackInfo(int flags) // Is it simply a midi controller value adjustment? Forget it. //if(flags != SC_MIDI_CONTROLLER) //{ - midiTrackInfo->iTransp->setValue(track->transposition); - midiTrackInfo->iAnschl->setValue(track->velocity); - midiTrackInfo->iVerz->setValue(track->delay); - midiTrackInfo->iLen->setValue(track->len); - midiTrackInfo->iKompr->setValue(track->compression); + iTransp->setValue(track->transposition); + iAnschl->setValue(track->velocity); + iVerz->setValue(track->delay); + iLen->setValue(track->len); + iKompr->setValue(track->compression); //} } -/* //--------------------------------------------------------- -// seek -// change values akkording to seek position +// progRecClicked //--------------------------------------------------------- -void Arranger::seek() +void MidiTrackInfo::progRecClicked() { - if (!showTrackinfoFlag || !selected) - return; - switch(selected->type()) { - case Track::MIDI: - case Track::DRUM: - { - MidiTrack* track = (MidiTrack*)selected; - int outPort = track->outPort(); - int outChannel = track->outChannel(); - MidiPort* mp = &midiPorts[outPort]; - - // int nprogram = mp->getCtrl(outChannel, tick, CTRL_PROGRAM); - int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) - { - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); - midiTrackInfo->iHBank->setValue(0); - midiTrackInfo->iLBank->setValue(0); - midiTrackInfo->iProgram->setValue(0); - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); - - program = CTRL_VAL_UNKNOWN; - nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) - midiTrackInfo->iPatch->setText(QString("<unknown>")); - else - { - MidiInstrument* instr = mp->instrument(); - const char* name = instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM); - midiTrackInfo->iPatch->setText(QString(name)); - } - } - else - if (program != nprogram) { - program = nprogram; - - //int hb, lb, pr; - //if (program == CTRL_VAL_UNKNOWN) { - // hb = lb = pr = 0; - // midiTrackInfo->iPatch->setText("---"); - // } - //else - //{ - MidiInstrument* instr = mp->instrument(); - const char* name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM); - midiTrackInfo->iPatch->setText(QString(name)); - - int hb = ((program >> 16) & 0xff) + 1; - if (hb == 0x100) - hb = 0; - int lb = ((program >> 8) & 0xff) + 1; - if (lb == 0x100) - lb = 0; - int pr = (program & 0xff) + 1; - if (pr == 0x100) - pr = 0; - //} - midiTrackInfo->iHBank->blockSignals(true); - midiTrackInfo->iLBank->blockSignals(true); - midiTrackInfo->iProgram->blockSignals(true); - - midiTrackInfo->iHBank->setValue(hb); - midiTrackInfo->iLBank->setValue(lb); - midiTrackInfo->iProgram->setValue(pr); - - midiTrackInfo->iHBank->blockSignals(false); - midiTrackInfo->iLBank->blockSignals(false); - midiTrackInfo->iProgram->blockSignals(false); - } - - //int nvolume = midiPorts[outPort].getCtrl(outChannel, tick, CTRL_VOLUME); - // int npan = midiPorts[outPort].getCtrl(outChannel, tick, CTRL_PANPOT); - MidiController* mc = mp->midiController(CTRL_VOLUME); - int v = mp->hwCtrlState(outChannel, CTRL_VOLUME); - if(v != volume) - { - volume = v; - if(v == CTRL_VAL_UNKNOWN) - v = mc->minVal() - 1; - else - v -= mc->bias(); - midiTrackInfo->iLautst->blockSignals(true); - midiTrackInfo->iLautst->setValue(v); - midiTrackInfo->iLautst->blockSignals(false); - } - mc = mp->midiController(CTRL_PANPOT); - v = mp->hwCtrlState(outChannel, CTRL_PANPOT); - if(v != pan) - { - pan = v; - if(v == CTRL_VAL_UNKNOWN) - //{ - //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) - // v = 0; - v = mc->minVal() - 1; - //} - else - // Auto bias... - v -= mc->bias(); - midiTrackInfo->iPan->blockSignals(true); - midiTrackInfo->iPan->setValue(v); - midiTrackInfo->iPan->blockSignals(false); - } - - } - break; - case Track::WAVE: - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: - break; - } + MidiTrack* track = (MidiTrack*)selected; + int portno = track->outPort(); + int channel = track->outChannel(); + MidiPort* port = &midiPorts[portno]; + int program = port->hwCtrlState(channel, CTRL_PROGRAM); + if(program == CTRL_VAL_UNKNOWN || program == 0xffffff) + return; + + unsigned tick = song->cpos(); + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_PROGRAM); + a.setB(program); + + song->recordEvent(track, a); } -*/ + +//--------------------------------------------------------- +// volRecClicked +//--------------------------------------------------------- + +void MidiTrackInfo::volRecClicked() + { + MidiTrack* track = (MidiTrack*)selected; + int portno = track->outPort(); + int channel = track->outChannel(); + MidiPort* port = &midiPorts[portno]; + int volume = port->hwCtrlState(channel, CTRL_VOLUME); + if(volume == CTRL_VAL_UNKNOWN) + return; + + unsigned tick = song->cpos(); + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_VOLUME); + a.setB(volume); + + song->recordEvent(track, a); + } + +//--------------------------------------------------------- +// panRecClicked +//--------------------------------------------------------- + +void MidiTrackInfo::panRecClicked() + { + MidiTrack* track = (MidiTrack*)selected; + int portno = track->outPort(); + int channel = track->outChannel(); + MidiPort* port = &midiPorts[portno]; + int pan = port->hwCtrlState(channel, CTRL_PANPOT); + if(pan == CTRL_VAL_UNKNOWN) + return; + + unsigned tick = song->cpos(); + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_PANPOT); + a.setB(pan); + + song->recordEvent(track, a); + } + +//--------------------------------------------------------- +// recordClicked +//--------------------------------------------------------- + +void MidiTrackInfo::recordClicked() + { + MidiTrack* track = (MidiTrack*)selected; + int portno = track->outPort(); + int channel = track->outChannel(); + MidiPort* port = &midiPorts[portno]; + unsigned tick = song->cpos(); + + int program = port->hwCtrlState(channel, CTRL_PROGRAM); + if(program != CTRL_VAL_UNKNOWN && program != 0xffffff) + { + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_PROGRAM); + a.setB(program); + song->recordEvent(track, a); + } + int volume = port->hwCtrlState(channel, CTRL_VOLUME); + if(volume != CTRL_VAL_UNKNOWN) + { + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_VOLUME); + a.setB(volume); + song->recordEvent(track, a); + } + int pan = port->hwCtrlState(channel, CTRL_PANPOT); + if(pan != CTRL_VAL_UNKNOWN) + { + Event a(Controller); + a.setTick(tick); + a.setA(CTRL_PANPOT); + a.setB(pan); + song->recordEvent(track, a); + } + } + diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h new file mode 100644 index 00000000..c643cc08 --- /dev/null +++ b/muse2/muse/widgets/mtrackinfo.h @@ -0,0 +1,71 @@ +//========================================================= +// MusE +// Linux Music Editor +// (C) Copyright 2010 Werner Schweer and others (ws@seh.de) +//========================================================= + +#ifndef __MTRACKINFO_H__ +#define __MTRACKINFO_H__ + +#include "ui_mtrackinfobase.h" + +class Track; + +//--------------------------------------------------------- +// MidiTrackInfo +//--------------------------------------------------------- + +class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase +{ + Q_OBJECT + Track* selected; + bool _midiDetect; + int program, pan, volume; + + private slots: + void iOutputChannelChanged(int); + void iOutputPortChanged(int); + void iProgHBankChanged(); + void iProgLBankChanged(); + void iProgramChanged(); + void iProgramDoubleClicked(); + void iLautstChanged(int); + void iLautstDoubleClicked(); + void iTranspChanged(int); + void iAnschlChanged(int); + void iVerzChanged(int); + void iLenChanged(int); + void iKomprChanged(int); + void iPanChanged(int); + void iPanDoubleClicked(); + void songChanged(int); + void instrPopup(); + void recordClicked(); + void progRecClicked(); + void volRecClicked(); + void panRecClicked(); + void recEchoToggled(bool); + void inRoutesPressed(); + void outRoutesPressed(); + void routingPopupMenuActivated(QAction*); + //void routingPopupViewActivated(const QModelIndex&); + + protected slots: + virtual void heartBeat(); + + signals: + void outputPortChanged(int); + + public: + MidiTrackInfo(QWidget*, Track* = 0); + Track* track() const { return selected; } + void setTrack(Track*); + void setLabelText(); + void setLabelFont(); + void updateTrackInfo(int); +}; + + + +#endif + |