diff options
Diffstat (limited to 'muse2/muse/widgets')
-rw-r--r-- | muse2/muse/widgets/CMakeLists.txt | 3 | ||||
-rw-r--r-- | muse2/muse/widgets/aboutbox.ui | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/bigtime.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/widgets/filedialog.cpp | 30 | ||||
-rw-r--r-- | muse2/muse/widgets/filedialog.h | 3 | ||||
-rw-r--r-- | muse2/muse/widgets/midi_audio_control.cpp | 340 | ||||
-rw-r--r-- | muse2/muse/widgets/midi_audio_control.h | 60 | ||||
-rw-r--r-- | muse2/muse/widgets/midi_audio_control_base.ui | 310 | ||||
-rw-r--r-- | muse2/muse/widgets/midisync.ui | 110 | ||||
-rw-r--r-- | muse2/muse/widgets/midisyncimpl.cpp | 283 | ||||
-rw-r--r-- | muse2/muse/widgets/musewidgetsplug.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/scldraw.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/widgets/sliderbase.cpp | 12 | ||||
-rw-r--r-- | muse2/muse/widgets/sliderbase.h | 1 |
14 files changed, 907 insertions, 261 deletions
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index fae0d614..88706339 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -57,6 +57,7 @@ QT4_WRAP_CPP (widget_mocs menutitleitem.h meter.h metronome.h + midi_audio_control.h midisyncimpl.h mixdowndialog.h mlabel.h @@ -122,6 +123,7 @@ file (GLOB widgets_ui_files itransformbase.ui metronomebase.ui midisync.ui + midi_audio_control_base.ui mittransposebase.ui mixdowndialogbase.ui mtrackinfobase.ui @@ -169,6 +171,7 @@ file (GLOB widgets_source_files menutitleitem.cpp meter.cpp metronome.cpp + midi_audio_control.cpp midisyncimpl.cpp mixdowndialog.cpp mlabel.cpp diff --git a/muse2/muse/widgets/aboutbox.ui b/muse2/muse/widgets/aboutbox.ui index 250f656f..8b4d5b37 100644 --- a/muse2/muse/widgets/aboutbox.ui +++ b/muse2/muse/widgets/aboutbox.ui @@ -48,7 +48,7 @@ <item> <widget class="QLabel" name="versionLabel"> <property name="text"> - <string>Version 2 pre-alpha</string> + <string>Version 2</string> </property> <property name="wordWrap"> <bool>false</bool> @@ -58,7 +58,7 @@ <item> <widget class="QLabel" name="textLabel1"> <property name="text"> - <string>(C) Copyright 1999-2010 Werner Schweer and others. + <string>(C) Copyright 1999-2012 Werner Schweer and others. See http://www.muse-sequencer.org for new versions and more information. diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp index 0b213f28..5adf4966 100644 --- a/muse2/muse/widgets/bigtime.cpp +++ b/muse2/muse/widgets/bigtime.cpp @@ -32,6 +32,7 @@ #include "song.h" #include "app.h" #include "gconfig.h" +#include "audio.h" namespace MusEGlobal { extern int mtcType; @@ -229,7 +230,9 @@ bool BigTime::setString(unsigned v) return true; } - unsigned absFrame = MusEGlobal::tempomap.tick2frame(v); + // Quick fix: Not much to do but ignore the supplied tick: We need the exact frame here. + unsigned absFrame = MusEGlobal::audio->pos().frame(); + int bar, beat; unsigned tick; AL::sigmap.tickValues(v, &bar, &beat, &tick); diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 6e7d6882..aa8c5df1 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -102,6 +102,7 @@ void MFileDialog::globalToggled(bool flag) { if (flag) { buttons.readMidiPortsButton->setChecked(false); + readMidiPortsSaved = false; if (lastGlobalDir.isEmpty()) lastGlobalDir = MusEGlobal::museGlobalShare + QString("/") + baseDir; // Initialize if first time setDirectory(lastGlobalDir); @@ -117,6 +118,7 @@ void MFileDialog::userToggled(bool flag) { if (flag) { buttons.readMidiPortsButton->setChecked(true); + readMidiPortsSaved = true; if (lastUserDir.isEmpty()) { //lastUserDir = MusEGlobal::museUser + QString("/") + baseDir; // Initialize if first time lastUserDir = MusEGlobal::configPath + QString("/") + baseDir; // Initialize if first time // p4.0.39 @@ -140,6 +142,7 @@ void MFileDialog::projectToggled(bool flag) { if (flag) { buttons.readMidiPortsButton->setChecked(true); + readMidiPortsSaved = true; QString s; if (MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // if project path is uninitialized, meaning it is still set to museProjectInitPath. @@ -158,6 +161,29 @@ void MFileDialog::projectToggled(bool flag) } } +void MFileDialog::fileChanged(const QString& path) +{ + bool is_mid = path.endsWith(".mid", Qt::CaseInsensitive) || + path.endsWith(".midi", Qt::CaseInsensitive) || + path.endsWith(".kar", Qt::CaseInsensitive); + + if (is_mid) + { + readMidiPortsSaved=buttons.readMidiPortsButton->isChecked(); + buttons.readMidiPortsButton->setEnabled(false); + buttons.readMidiPortsButton->setChecked(false); + } + else + { + if (!buttons.readMidiPortsButton->isEnabled()) + { + buttons.readMidiPortsButton->setEnabled(true); + buttons.readMidiPortsButton->setChecked(readMidiPortsSaved); + } + } + +} + //--------------------------------------------------------- // MFileDialog @@ -167,6 +193,7 @@ MFileDialog::MFileDialog(const QString& dir, const QString& filter, QWidget* parent, bool writeFlag) : QFileDialog(parent, QString(), QString("."), filter) { + readMidiPortsSaved = true; showButtons = false; lastUserDir = ""; lastGlobalDir = ""; @@ -201,10 +228,11 @@ MFileDialog::MFileDialog(const QString& dir, buttons.userButton->setAutoExclusive(true); buttons.projectButton->setAutoExclusive(true); - connect(buttons.globalButton, SIGNAL(toggled(bool)), this, SLOT(globalToggled(bool))); + connect(buttons.globalButton, SIGNAL(toggled(bool)), this, SLOT(globalToggled(bool))); connect(buttons.userButton, SIGNAL(toggled(bool)), this, SLOT(userToggled(bool))); connect(buttons.projectButton, SIGNAL(toggled(bool)), this, SLOT(projectToggled(bool))); connect(this, SIGNAL(directoryEntered(const QString&)), SLOT(directoryChanged(const QString&))); + connect(this, SIGNAL(currentChanged(const QString&)), SLOT(fileChanged(const QString&))); if (writeFlag) { setAcceptMode(QFileDialog::AcceptSave); diff --git a/muse2/muse/widgets/filedialog.h b/muse2/muse/widgets/filedialog.h index 1e2616da..582e943d 100644 --- a/muse2/muse/widgets/filedialog.h +++ b/muse2/muse/widgets/filedialog.h @@ -52,9 +52,12 @@ class MFileDialog : public QFileDialog { QString lastUserDir, lastGlobalDir; bool showButtons; QString baseDir; + + bool readMidiPortsSaved; private slots: void directoryChanged(const QString& directory); + void fileChanged(const QString&); public slots: void globalToggled(bool); void userToggled(bool); diff --git a/muse2/muse/widgets/midi_audio_control.cpp b/muse2/muse/widgets/midi_audio_control.cpp new file mode 100644 index 00000000..78c8de3c --- /dev/null +++ b/muse2/muse/widgets/midi_audio_control.cpp @@ -0,0 +1,340 @@ +//========================================================= +// MusE +// Linux Music Editor +// +// midi_audio_control.cpp +// Copyright (C) 2012 by Tim E. Real (terminator356 at users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= +#include "midi_audio_control.h" + +#include "globals.h" +#include "globaldefs.h" +#include "mididev.h" +#include "midiport.h" +#include "midictrl.h" +#include "audio.h" +#include "app.h" + +#include <QTimer> + +namespace MusEGui { + +// ----------------------------------- +// MidiAudioControl +// Set port to -1 to automatically set it to the port of +// the first combo box item (the first readable port). +// ----------------------------------- + +MidiAudioControl::MidiAudioControl(int port, int chan, int ctrl, QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + + _port = port; + _chan = chan; + _ctrl = ctrl; + _is_learning = false; + + update(); + + connect(learnPushButton, SIGNAL(clicked(bool)), SLOT(learnChanged(bool))); + connect(portComboBox, SIGNAL(currentIndexChanged(int)), SLOT(portChanged(int))); + connect(channelSpinBox, SIGNAL(valueChanged(int)), SLOT(chanChanged())); + connect(controlTypeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(ctrlTypeChanged(int))); + connect(ctrlHiSpinBox, SIGNAL(valueChanged(int)), SLOT(ctrlHChanged())); + connect(ctrlLoSpinBox, SIGNAL(valueChanged(int)), SLOT(ctrlLChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartbeat())); +} + +void MidiAudioControl::heartbeat() +{ + if(_is_learning) + { + if(MusEGlobal::midiLearnPort != -1) + { + int port_item = portComboBox->findData(MusEGlobal::midiLearnPort); + if(port_item != -1 && port_item != portComboBox->currentIndex()) + { + _port = MusEGlobal::midiLearnPort; + portComboBox->blockSignals(true); + portComboBox->setCurrentIndex(port_item); + portComboBox->blockSignals(false); + } + } + + if(MusEGlobal::midiLearnChan != -1 && (MusEGlobal::midiLearnChan + 1) != channelSpinBox->value()) + { + _chan = MusEGlobal::midiLearnChan; + channelSpinBox->blockSignals(true); + channelSpinBox->setValue(_chan + 1); + channelSpinBox->blockSignals(false); + } + + if(MusEGlobal::midiLearnCtrl != -1) + { + int type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl); + if(type < controlTypeComboBox->count() && type != controlTypeComboBox->currentIndex()) + { + controlTypeComboBox->blockSignals(true); + controlTypeComboBox->setCurrentIndex(type); + controlTypeComboBox->blockSignals(false); + } + + int hv = (MusEGlobal::midiLearnCtrl >> 8) & 0xff; + int lv = MusEGlobal::midiLearnCtrl & 0xff; + if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(false); + ctrlHiSpinBox->blockSignals(true); + ctrlLoSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlLoSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + ctrlLoSpinBox->blockSignals(false); + } + else if(type == MusECore::MidiController::Controller7) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(true); + + ctrlHiSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + + if(lv != ctrlLoSpinBox->value()) + { + ctrlLoSpinBox->blockSignals(true); + ctrlLoSpinBox->setValue(lv); + ctrlLoSpinBox->blockSignals(false); + } + } + else + { + ctrlHiSpinBox->setEnabled(true); + ctrlLoSpinBox->setEnabled(true); + if(hv != ctrlHiSpinBox->value()) + { + ctrlHiSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(hv); + ctrlHiSpinBox->blockSignals(false); + } + if(lv != ctrlLoSpinBox->value()) + { + ctrlLoSpinBox->blockSignals(true); + ctrlLoSpinBox->setValue(lv); + ctrlLoSpinBox->blockSignals(false); + } + } + + _ctrl = MusECore::midiCtrlTerms2Number(type, (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value()); + } + } +} + +void MidiAudioControl::learnChanged(bool v) +{ + _is_learning = v; + if(_is_learning) + MusEGlobal::audio->msgStartMidiLearn(); // Resets the learn values to -1. +} + +void MidiAudioControl::resetLearn() +{ + _is_learning = false; + learnPushButton->blockSignals(true); + learnPushButton->setChecked(false); + learnPushButton->blockSignals(false); + MusEGlobal::audio->msgStartMidiLearn(); // Resets the learn values to -1. +} + +void MidiAudioControl::portChanged(int idx) +{ + if(idx == -1) + return; + int port_num = portComboBox->itemData(idx).toInt(); + if(port_num < 0 || port_num >= MIDI_PORTS) + return; + + _port = port_num; + resetLearn(); +} + +void MidiAudioControl::chanChanged() +{ + _chan = channelSpinBox->value() - 1; + resetLearn(); +} + +void MidiAudioControl::updateCtrlBoxes() +{ + int idx = controlTypeComboBox->currentIndex(); + if(idx == -1) + return; + + if(idx == MusECore::MidiController::Program || idx == MusECore::MidiController::Pitch) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(false); + ctrlHiSpinBox->blockSignals(true); + ctrlLoSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlLoSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + ctrlLoSpinBox->blockSignals(false); + } + else if(idx == MusECore::MidiController::Controller7) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(true); + + ctrlHiSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + } + else + { + ctrlHiSpinBox->setEnabled(true); + ctrlLoSpinBox->setEnabled(true); + } +} + +void MidiAudioControl::ctrlTypeChanged(int idx) +{ + if(idx == -1) + return; + + updateCtrlBoxes(); + + _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); + _ctrl = MusECore::midiCtrlTerms2Number(idx, _ctrl); + + resetLearn(); +} + +void MidiAudioControl::ctrlHChanged() +{ + if(controlTypeComboBox->currentIndex() == -1) + return; + _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); + _ctrl = MusECore::midiCtrlTerms2Number(controlTypeComboBox->currentIndex(), _ctrl); + + resetLearn(); +} + +void MidiAudioControl::ctrlLChanged() +{ + if(controlTypeComboBox->currentIndex() == -1) + return; + _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); + _ctrl = MusECore::midiCtrlTerms2Number(controlTypeComboBox->currentIndex(), _ctrl); + + resetLearn(); +} + +void MidiAudioControl::configChanged() +{ + update(); +} + +void MidiAudioControl::update() +{ + portComboBox->blockSignals(true); + portComboBox->clear(); + + int item_idx = 0; + for (int i = 0; i < MIDI_PORTS; ++i) { + MusECore::MidiDevice* md = MusEGlobal::midiPorts[i].device(); + if(!md) // In the case of this combo box, don't bother listing empty ports. + continue; + //if(!(md->rwFlags() & 1 || md->isSynti()) && (i != outPort)) + if(!(md->rwFlags() & 2) && (i != _port)) // Only readable ports, or current one. + continue; + QString name; + name.sprintf("%d:%s", i+1, MusEGlobal::midiPorts[i].portname().toLatin1().constData()); + portComboBox->insertItem(item_idx, name, i); + if(_port == -1) + _port = i; // Initialize + if(i == _port) + portComboBox->setCurrentIndex(item_idx); + item_idx++; + } + portComboBox->blockSignals(false); + + channelSpinBox->blockSignals(true); + channelSpinBox->setValue(_chan + 1); + channelSpinBox->blockSignals(false); + + int type = MusECore::midiControllerType(_ctrl); + if(type < controlTypeComboBox->count()) + { + controlTypeComboBox->blockSignals(true); + controlTypeComboBox->setCurrentIndex(type); + controlTypeComboBox->blockSignals(false); + } + + int hv = (_ctrl >> 8) & 0xff; + int lv = _ctrl & 0xff; + if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(false); + ctrlHiSpinBox->blockSignals(true); + ctrlLoSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlLoSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + ctrlLoSpinBox->blockSignals(false); + } + else if(type == MusECore::MidiController::Controller7) + { + ctrlHiSpinBox->setEnabled(false); + ctrlLoSpinBox->setEnabled(true); + + ctrlHiSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(0); + ctrlHiSpinBox->blockSignals(false); + + if(lv != ctrlLoSpinBox->value()) + { + ctrlLoSpinBox->blockSignals(true); + ctrlLoSpinBox->setValue(lv); + ctrlLoSpinBox->blockSignals(false); + } + } + else + { + ctrlHiSpinBox->setEnabled(true); + ctrlLoSpinBox->setEnabled(true); + if(hv != ctrlHiSpinBox->value()) + { + ctrlHiSpinBox->blockSignals(true); + ctrlHiSpinBox->setValue(hv); + ctrlHiSpinBox->blockSignals(false); + } + if(lv != ctrlLoSpinBox->value()) + { + ctrlLoSpinBox->blockSignals(true); + ctrlLoSpinBox->setValue(lv); + ctrlLoSpinBox->blockSignals(false); + } + } +} + +} diff --git a/muse2/muse/widgets/midi_audio_control.h b/muse2/muse/widgets/midi_audio_control.h new file mode 100644 index 00000000..887de942 --- /dev/null +++ b/muse2/muse/widgets/midi_audio_control.h @@ -0,0 +1,60 @@ +//========================================================= +// MusE +// Linux Music Editor +// +// midi_audio_control.h +// Copyright (C) 2012 by Tim E. Real (terminator356 at users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= +#ifndef MIDI_AUDIO_CONTROL_H +#define MIDI_AUDIO_CONTROL_H + +#include "ui_midi_audio_control_base.h" + +namespace MusEGui { + +class MidiAudioControl : public QDialog, public Ui::MidiAudioControlBase +{ + Q_OBJECT + +private: + int _port, _chan, _ctrl; + bool _is_learning; + void update(); + void resetLearn(); + void updateCtrlBoxes(); + +private slots: + void heartbeat(); + void learnChanged(bool); + void portChanged(int); + void chanChanged(); + void ctrlTypeChanged(int); + void ctrlHChanged(); + void ctrlLChanged(); + void configChanged(); + +public: + MidiAudioControl(int port = -1, int chan = 0, int ctrl = 0, QWidget* parent = 0); + int port() const { return _port; } + int chan() const { return _chan; } + int ctrl() const { return _ctrl; } +}; + +} + +#endif // MIDI_AUDIO_CONTROL_H diff --git a/muse2/muse/widgets/midi_audio_control_base.ui b/muse2/muse/widgets/midi_audio_control_base.ui new file mode 100644 index 00000000..2e341121 --- /dev/null +++ b/muse2/muse/widgets/midi_audio_control_base.ui @@ -0,0 +1,310 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MidiAudioControlBase</class> + <widget class="QDialog" name="MidiAudioControlBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>341</width> + <height>148</height> + </rect> + </property> + <property name="windowTitle"> + <string>Midi control</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Port:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="portComboBox"/> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Channel:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="channelSpinBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>16</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Control type:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="controlTypeComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <item> + <property name="text"> + <string>Control7</string> + </property> + </item> + <item> + <property name="text"> + <string>Control14</string> + </property> + </item> + <item> + <property name="text"> + <string>RPN</string> + </property> + </item> + <item> + <property name="text"> + <string>NRPN</string> + </property> + </item> + <item> + <property name="text"> + <string>RPN14</string> + </property> + </item> + <item> + <property name="text"> + <string>NRPN14</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Program</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Hi:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="ctrlHiSpinBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Lo:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="ctrlLoSpinBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QPushButton" name="learnPushButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Learn</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>18</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>MidiAudioControlBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>MidiAudioControlBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/midisync.ui b/muse2/muse/widgets/midisync.ui index a7464aaf..942a4e59 100644 --- a/muse2/muse/widgets/midisync.ui +++ b/muse2/muse/widgets/midisync.ui @@ -10,7 +10,7 @@ configuration dialog</comment> <x>0</x> <y>0</y> <width>655</width> - <height>419</height> + <height>445</height> </rect> </property> <property name="windowTitle"> @@ -337,6 +337,100 @@ Enabled inputs in the list will <item row="3" column="0"> <layout class="QHBoxLayout"> <item> + <widget class="QComboBox" name="syncRecFilterPreset"> + <property name="toolTip"> + <string>Averaging applied to recorded external tempo changes.</string> + </property> + <property name="whatsThis"> + <string>External midi clock can be very jittery. +Tempo is derived from it and recorded. +It is usually desirable to average it and + limit the number of recorded changes. + +Tiny: 2 section 4/4 = 8 stages. +1/8T note averaging, may produce jitter. + +Small: 3 section 12/8/4 = 24 stages. +1/4 note averaging, may still produce jitter. + +Medium: 3 section 28/12/8 = 48 stages. +1/2 note averaging. Less jitter. + +Large: 4 section 48/48/48/48 = 192 stages. +Use this if the song has only one tempo. +Very low quantization values can be used. + +Large pre-detect: 4 section 8/48/48/48 = 152 + stages + first stage large step pre-detector. +Use this if you expect sudden large tempo steps. + +None: Use only if high accuracy is needed for + audio alignment on playback. Caution: Records + thousands of tempo changes per minute. MusE + may slow and the song file will be large.</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="syncRecFilterLabel"> + <property name="text"> + <string>Tempo record averaging</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0"> + <layout class="QHBoxLayout"> + <item> + <widget class="QDoubleSpinBox" name="syncRecTempoValQuant"> + <property name="toolTip"> + <string/> + </property> + <property name="whatsThis"> + <string/> + </property> + <property name="suffix"> + <string>bpm</string> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="syncRecTempoValQuantLabel"> + <property name="text"> + <string>Tempo record quantization</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="5" column="0"> + <layout class="QHBoxLayout"> + <item> <widget class="QSpinBox" name="syncDelaySpinBox"> <property name="toolTip"> <string>Send start to first clock delay</string> @@ -379,7 +473,7 @@ Enabled inputs in the list will </item> </layout> </item> - <item row="4" column="0"> + <item row="6" column="0"> <widget class="QTreeWidget" name="devicesListView"> <column> <property name="text"> @@ -388,18 +482,18 @@ Enabled inputs in the list will </column> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="toBeDoneLabel"> + <item row="7" column="0"> + <widget class="QLabel" name="toBeDoneLabel"> <property name="text"> - <string>Note: Sync delay and MTC sync currently not fully implemented</string> + <string>Note: Sync delay and MTC sync currently not fully implemented</string> </property> <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <property name="wordWrap"> - <bool>false</bool> + <bool>false</bool> </property> - </widget> + </widget> </item> </layout> </widget> diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp index 904e8759..e286ca74 100644 --- a/muse2/muse/widgets/midisyncimpl.cpp +++ b/muse2/muse/widgets/midisyncimpl.cpp @@ -28,6 +28,7 @@ #include <QTimer> #include <QTreeWidgetItem> #include <QHeaderView> +#include <QComboBox> #include "app.h" #include "song.h" @@ -137,32 +138,12 @@ void MidiSyncConfig::addDevice(QTreeWidgetItem *item, QTreeWidget *tree) tree->addTopLevelItem(item); } -/* -//--------------------------------------------------------- -// MidiSyncLViewItem -// setDevice -//--------------------------------------------------------- - -void MidiSyncLViewItem::setDevice(MusECore::MidiDevice* d) -{ - _device = d; - if(_device) - _syncInfo.copyParams(_device->syncInfo()); -} -*/ - -//--------------------------------------------------------- -// MidiSyncLViewItem -// setPort -//--------------------------------------------------------- - void MidiSyncLViewItem::setPort(int port) { _port = port; if(_port < 0 || port > MIDI_PORTS) return; - //_syncInfo.copyParams(MusEGlobal::midiPorts[port].syncInfo()); copyFromSyncInfo(MusEGlobal::midiPorts[port].syncInfo()); } @@ -221,41 +202,6 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) _dirty = false; applyButton->setEnabled(false); - //inHeartBeat = true; - - //for(int i = 0; i < MIDI_PORTS; ++i) - // tmpMidiSyncPorts[i] = midiSyncPorts[i]; - - //bool ext = MusEGlobal::extSyncFlag.value(); - //syncMode->setButton(int(ext)); - //syncChanged(ext); -// extSyncCheckbox->setChecked(MusEGlobal::extSyncFlag.value()); - -// dstDevId->setValue(txDeviceId); -// srcDevId->setValue(rxDeviceId); -// srcSyncPort->setValue(rxSyncPort + 1); -// dstSyncPort->setValue(txSyncPort + 1); - -// mtcSync->setChecked(genMTCSync); -// mcSync->setChecked(genMCSync); -// midiMachineControl->setChecked(genMMC); - -// acceptMTCCheckbox->setChecked(acceptMTC); - //acceptMTCCheckbox->setChecked(false); -// acceptMCCheckbox->setChecked(acceptMC); -// acceptMMCCheckbox->setChecked(acceptMMC); - -// mtcSyncType->setCurrentItem(MusEGlobal::mtcType); - -// mtcOffH->setValue(MusEGlobal::mtcOffset.h()); -// mtcOffM->setValue(MusEGlobal::mtcOffset.m()); -// mtcOffS->setValue(MusEGlobal::mtcOffset.s()); -// mtcOffF->setValue(MusEGlobal::mtcOffset.f()); -// mtcOffSf->setValue(MusEGlobal::mtcOffset.sf()); - - - - devicesListView->setAllColumnsShowFocus(true); QStringList columnnames; columnnames << tr("Port") @@ -284,9 +230,11 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) setToolTips(devicesListView->headerItem()); devicesListView->setFocusPolicy(Qt::NoFocus); - //MSyncHeaderTip::add(devicesListView->header(), QString("Midi sync ports")); - -// updateSyncInfoLV(); + syncRecFilterPreset->addItem(tr("None"), MusECore::MidiSyncInfo::NONE); + syncRecFilterPreset->addItem(tr("Tiny"), MusECore::MidiSyncInfo::TINY); + syncRecFilterPreset->addItem(tr("Small"), MusECore::MidiSyncInfo::SMALL); + syncRecFilterPreset->addItem(tr("Large"), MusECore::MidiSyncInfo::LARGE); + syncRecFilterPreset->addItem(tr("Large with pre-detect"), MusECore::MidiSyncInfo::LARGE_WITH_PRE_DETECT); songChanged(-1); @@ -308,14 +256,14 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) connect(mtcSyncType, SIGNAL(activated(int)), SLOT(syncChanged())); connect(useJackTransportCheckbox, SIGNAL(clicked()), SLOT(syncChanged())); connect(jackTransportMasterCheckbox, SIGNAL(clicked()), SLOT(syncChanged())); + connect(syncRecFilterPreset, SIGNAL(currentIndexChanged(int)), SLOT(syncChanged())); + connect(syncRecTempoValQuant, SIGNAL(valueChanged(double)), SLOT(syncChanged())); connect(&MusEGlobal::extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(extSyncChanged(bool))); connect(syncDelaySpinBox, SIGNAL(valueChanged(int)), SLOT(syncChanged())); // Done in show(). //connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); //connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); - - //inHeartBeat = false; } MidiSyncConfig::~MidiSyncConfig() @@ -356,6 +304,17 @@ void MidiSyncConfig::songChanged(int flags) jackTransportMasterCheckbox->blockSignals(false); useJackTransportCheckbox->blockSignals(false); extSyncCheckbox->blockSignals(false); + + int fp_idx = syncRecFilterPreset->findData(MusEGlobal::syncRecFilterPreset); + if(fp_idx != -1) + { + syncRecFilterPreset->blockSignals(true); + syncRecFilterPreset->setCurrentIndex(fp_idx); + syncRecFilterPreset->blockSignals(false); + } + syncRecTempoValQuant->blockSignals(true); + syncRecTempoValQuant->setValue(MusEGlobal::syncRecTempoValQuant); + syncRecTempoValQuant->blockSignals(false); mtcSyncType->setCurrentIndex(MusEGlobal::mtcType); @@ -400,9 +359,6 @@ void MidiSyncConfig::heartBeat() { if(!lvi->_curDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting current red icon\n"); - lvi->_curDet = true; lvi->_inDet = false; lvi->setIcon(DEVCOL_IN, QIcon( *record1_Icon)); @@ -411,9 +367,6 @@ void MidiSyncConfig::heartBeat() else if(!lvi->_inDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting non-current green icon\n"); - lvi->_inDet = true; lvi->_curDet = false; lvi->setIcon(DEVCOL_IN, QIcon( *dotIcon)); @@ -423,9 +376,6 @@ void MidiSyncConfig::heartBeat() { if(lvi->_curDet || lvi->_inDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting off icon\n"); - lvi->_curDet = false; lvi->_inDet = false; lvi->setIcon(DEVCOL_IN, QIcon( *dothIcon)); @@ -437,9 +387,6 @@ void MidiSyncConfig::heartBeat() { if(!lvi->_tickDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting tick on icon\n"); - lvi->_tickDet = true; lvi->setIcon(DEVCOL_TICKIN, QIcon( *dotIcon)); } @@ -448,9 +395,6 @@ void MidiSyncConfig::heartBeat() { if(lvi->_tickDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting tick off icon\n"); - lvi->_tickDet = false; lvi->setIcon(DEVCOL_TICKIN, QIcon( *dothIcon)); } @@ -461,9 +405,6 @@ void MidiSyncConfig::heartBeat() { if(!lvi->_MRTDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MRT on icon\n"); - lvi->_MRTDet = true; lvi->setIcon(DEVCOL_MRTIN, QIcon( *dotIcon)); } @@ -472,9 +413,6 @@ void MidiSyncConfig::heartBeat() { if(lvi->_MRTDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MRT off icon\n"); - lvi->_MRTDet = false; lvi->setIcon(DEVCOL_MRTIN, QIcon( *dothIcon)); } @@ -487,9 +425,6 @@ void MidiSyncConfig::heartBeat() { if(!lvi->_MMCDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MMC on icon\n"); - lvi->_MMCDet = true; lvi->setIcon(DEVCOL_MMCIN, QIcon( *dotIcon)); } @@ -521,9 +456,6 @@ void MidiSyncConfig::heartBeat() { if(lvi->_MMCDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MMC off icon\n"); - lvi->_MMCDet = false; lvi->setIcon(DEVCOL_MMCIN, QIcon( *dothIcon)); } @@ -535,9 +467,6 @@ void MidiSyncConfig::heartBeat() { if(!lvi->_curMTCDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting current red icon\n"); - lvi->_curMTCDet = true; lvi->_MTCDet = false; lvi->setIcon(DEVCOL_MTCIN, QIcon( *record1_Icon)); @@ -546,9 +475,6 @@ void MidiSyncConfig::heartBeat() else if(!lvi->_MTCDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MTC on icon\n"); - lvi->_MTCDet = true; lvi->_curMTCDet = false; lvi->setIcon(DEVCOL_MTCIN, QIcon( *dotIcon)); @@ -581,9 +507,6 @@ void MidiSyncConfig::heartBeat() { if(lvi->_curMTCDet || lvi->_MTCDet) { - // Added by Tim. p3.3.6 - //printf("MidiSyncConfig::heartBeat setting MTC off icon\n"); - lvi->_MTCDet = false; lvi->_curMTCDet = false; lvi->setIcon(DEVCOL_MTCIN, QIcon( *dothIcon)); @@ -610,13 +533,6 @@ void MidiSyncConfig::heartBeat() void MidiSyncConfig::syncChanged() { setDirty(); - - //MusEGlobal::jackTransportMasterCheckbox->setEnabled(MusEGlobal::useJackTransport); - - //acceptMTCCheckbox->setEnabled(val); -// acceptMTCCheckbox->setEnabled(false); -// acceptMCCheckbox->setEnabled(val); -// acceptMMCCheckbox->setEnabled(val); } //--------------------------------------------------------- @@ -702,24 +618,14 @@ void MidiSyncConfig::closeEvent(QCloseEvent* e) void MidiSyncConfig::apply() { -// txDeviceId = dstDevId->value(); -// rxDeviceId = srcDevId->value(); -// rxSyncPort = srcSyncPort->value() - 1; -// txSyncPort = dstSyncPort->value() - 1; - -// genMTCSync = mtcSync->isChecked(); -// genMCSync = mcSync->isChecked(); -// genMMC = midiMachineControl->isChecked(); + // Protect all structures. + if(MusEGlobal::audio && MusEGlobal::audio->isRunning()) + MusEGlobal::audio->msgIdle(true); MusEGlobal::syncSendFirstClockDelay = syncDelaySpinBox->value(); MusEGlobal::mtcType = mtcSyncType->currentIndex(); - //MusEGlobal::extSyncFlag.setValue(syncMode->id(syncMode->selected())); - //MusEGlobal::extSyncFlag.blockSignals(true); MusEGlobal::extSyncFlag.setValue(extSyncCheckbox->isChecked()); -// if(MusEGlobal::extSyncFlag.value()) -// MusEGlobal::song->setMasterFlag(false); - //MusEGlobal::extSyncFlag.blockSignals(false); MusEGlobal::useJackTransport.setValue(useJackTransportCheckbox->isChecked()); // if(MusEGlobal::useJackTransport) MusEGlobal::jackTransportMaster = jackTransportMasterCheckbox->isChecked(); @@ -729,33 +635,38 @@ void MidiSyncConfig::apply() if(MusEGlobal::audioDevice) MusEGlobal::audioDevice->setMaster(MusEGlobal::jackTransportMaster); + if(syncRecFilterPreset->currentIndex() != -1) + { + int fp_idx = syncRecFilterPreset->itemData(syncRecFilterPreset->currentIndex()).toInt(); + if(fp_idx >= 0 && fp_idx < MusECore::MidiSyncInfo::TYPE_END) + { + MusEGlobal::syncRecFilterPreset = MusECore::MidiSyncInfo::SyncRecFilterPresetType(fp_idx); + if(MusEGlobal::midiSeq) + MusEGlobal::midiSeq->setSyncRecFilterPreset(MusEGlobal::syncRecFilterPreset); + } + } + MusEGlobal::syncRecTempoValQuant = syncRecTempoValQuant->value(); + if(MusEGlobal::midiSeq) + MusEGlobal::midiSeq->setRecTempoValQuant(MusEGlobal::syncRecTempoValQuant); + MusEGlobal::mtcOffset.setH(mtcOffH->value()); MusEGlobal::mtcOffset.setM(mtcOffM->value()); MusEGlobal::mtcOffset.setS(mtcOffS->value()); MusEGlobal::mtcOffset.setF(mtcOffF->value()); MusEGlobal::mtcOffset.setSf(mtcOffSf->value()); -// acceptMC = acceptMCCheckbox->isChecked(); -// acceptMMC = acceptMMCCheckbox->isChecked(); -// acceptMTC = acceptMTCCheckbox->isChecked(); - - - //MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)devicesListView->firstChild(); - //while(lvi) for (int i = MIDI_PORTS-1; i >= 0; --i) { MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)devicesListView->topLevelItem(i); - //MusECore::MidiDevice* dev = lvi->device(); - // Does the device really exist? - //if(midiDevices.find(dev) != midiDevices.end()) - // dev->syncInfo().copyParams(lvi->syncInfo()); int port = lvi->port(); if(port >= 0 && port < MIDI_PORTS) - //MusEGlobal::midiPorts[port].syncInfo().copyParams(lvi->syncInfo()); lvi->copyToSyncInfo(MusEGlobal::midiPorts[port].syncInfo()); } + if(MusEGlobal::audio && MusEGlobal::audio->isRunning()) + MusEGlobal::audio->msgIdle(false); + //muse->changeConfig(true); // save settings _dirty = false; @@ -777,7 +688,6 @@ void MidiSyncConfig::updateSyncInfoLV() { MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; MusECore::MidiDevice* dev = port->device(); - // p3.3.31 // Don't show if it is a synthesizer device. // Hmm, some synths might support transport commands or even sync? // If anything, the DSSI or VST synths just might... @@ -791,9 +701,6 @@ void MidiSyncConfig::updateSyncInfoLV() s.setNum(i+1); MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView); lvi->setPort(i); // setPort will copy parameters. - //MusECore::MidiSyncInfo& si = lvi->syncInfo(); - //si.copyParams(port->syncInfo()); - //lvi.copyFromSyncInfo(port->syncInfo()); MusECore::MidiSyncInfo& portsi = port->syncInfo(); lvi->setText(DEVCOL_NO, s); @@ -925,11 +832,6 @@ void MidiSyncConfig::updateSyncInfoLV() //lvi->setText(DEVCOL_MTCTYPE, "--"); } - //lvi->setText(DEVCOL_RID, QString().setNum(si.idIn()) ); - //lvi->setRenameEnabled(DEVCOL_RID, true); - //lvi->setIcon(DEVCOL_RCLK, QIcon( si.MCIn() ? *dotIcon : *dothIcon)); - //lvi->setIcon(DEVCOL_RMMC, QIcon( si.MMCIn() ? *dotIcon : *dothIcon)); - //lvi->setIcon(DEVCOL_RMTC, QIcon( si.MTCIn() ? *dotIcon : *dothIcon)); lvi->setText(DEVCOL_RID, QString().setNum(lvi->_idIn) ); lvi->setIcon(DEVCOL_RCLK, QIcon( lvi->_recMC ? *dotIcon : *dothIcon)); lvi->setIcon(DEVCOL_RMRT, QIcon( lvi->_recMRT ? *dotIcon : *dothIcon)); @@ -937,11 +839,6 @@ void MidiSyncConfig::updateSyncInfoLV() lvi->setIcon(DEVCOL_RMTC, QIcon( lvi->_recMTC ? *dotIcon : *dothIcon)); lvi->setIcon(DEVCOL_RREWSTART, QIcon( lvi->_recRewOnStart ? *dotIcon : *dothIcon)); - //lvi->setText(DEVCOL_TID, QString().setNum(si.idOut()) ); - //lvi->setRenameEnabled(DEVCOL_TID, true); - //lvi->setIcon(DEVCOL_TCLK, QIcon( si.MCOut() ? *dotIcon : *dothIcon)); - //lvi->setIcon(DEVCOL_TMMC, QIcon( si.MMCOut() ? *dotIcon : *dothIcon)); - //lvi->setIcon(DEVCOL_TMTC, QIcon( si.MTCOut() ? *dotIcon : *dothIcon)); lvi->setText(DEVCOL_TID, QString().setNum(lvi->_idOut) ); lvi->setIcon(DEVCOL_TCLK, QIcon(lvi->_sendMC ? *dotIcon : *dothIcon)); lvi->setIcon(DEVCOL_TMRT, QIcon(lvi->_sendMRT ? *dotIcon : *dothIcon)); @@ -988,38 +885,6 @@ void MidiSyncConfig::updateSyncInfoLV() devicesListView->header()->setResizeMode(DEVCOL_TMRT, QHeaderView::Fixed); devicesListView->header()->setResizeMode(DEVCOL_TMMC, QHeaderView::Fixed); - - /* - for(MusECore::iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) - { - MusECore::MidiDevice* dev = *id; - - //MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; - //MusECore::MidiDevice* dev = port->device(); - MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView); - //lvi->setPort(i); - // setDevice will copy parameters. - lvi->setDevice(dev); - MusECore::MidiSyncInfo& si = lvi->syncInfo(); - //si.copyParams(dev->syncInfo()); - - lvi->setText(DEVCOL_NAME, dev->name()); - - lvi->setIcon(DEVCOL_IN, QIcon( si.MCSyncDetect() ? *dotIcon : *dothIcon)); - - lvi->setText(DEVCOL_RID, QString().setNum(si.idIn()) ); - lvi->setIcon(DEVCOL_RCLK, QIcon( si.MCIn() ? *dotIcon : *dothIcon)); - lvi->setIcon(DEVCOL_RMMC, QIcon( si.MMCIn() ? *dotIcon : *dothIcon)); - lvi->setIcon(DEVCOL_RMTC, QIcon( si.MTCIn() ? *dotIcon : *dothIcon)); - - lvi->setText(DEVCOL_TID, QString().setNum(si.idOut()) ); - lvi->setIcon(DEVCOL_TCLK, QIcon( si.MCOut() ? *dotIcon : *dothIcon)); - lvi->setIcon(DEVCOL_TMMC, QIcon( si.MMCOut() ? *dotIcon : *dothIcon)); - lvi->setIcon(DEVCOL_TMTC, QIcon( si.MTCOut() ? *dotIcon : *dothIcon)); - - devicesListView->insertItem(lvi); - } - */ } @@ -1027,7 +892,6 @@ void MidiSyncConfig::updateSyncInfoLV() // dlvClicked //--------------------------------------------------------- -//void MidiSyncConfig::dlvClicked(QListViewItem* item, const QPoint&, int col) void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) { if (item == 0) @@ -1042,14 +906,6 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) //if(midiDevices.find(dev) == midiDevices.end()) // return; - //int n; - //MusECore::MidiPort* port = &MusEGlobal::midiPorts[no]; - //MusECore::MidiDevice* dev = port->device(); - //int rwFlags = dev ? dev->rwFlags() : 0; - //int openFlags = dev ? dev->openFlags() : 0; - //MusECore::MidiSyncInfo& si = lvi->syncInfo(); - //MusECore::MidiSyncInfo& portsi = MusEGlobal::midiPorts[no].syncInfo(); - switch (col) { case DEVCOL_NO: @@ -1060,8 +916,6 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) // If this is not the current midi sync in port, and sync in from this port is enabled, // and sync is in fact detected on this port, allow the user to force this port to now be the // current sync in port. - //if(no != MusEGlobal::curMidiSyncInPort && si.MCIn() && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) - //if(no != MusEGlobal::curMidiSyncInPort && lvi->_recMC && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) if(no != MusEGlobal::curMidiSyncInPort) { if(lvi->_recMC && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) @@ -1084,8 +938,6 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) // If this is not the current midi sync in port, and sync in from this port is enabled, // and sync is in fact detected on this port, allow the user to force this port to now be the // current sync in port. - //if(no != MusEGlobal::curMidiSyncInPort && si.MTCIn() && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) - //if(no != MusEGlobal::curMidiSyncInPort && lvi->_recMTC && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) if(no != MusEGlobal::curMidiSyncInPort) { if(lvi->_recMTC && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) @@ -1105,8 +957,6 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) case DEVCOL_RID: break; case DEVCOL_RCLK: - //si.setMCIn(si.MCIn() ? false : true); - //lvi->setIcon(DEVCOL_RCLK, QIcon( si.MCIn() ? *dotIcon : *dothIcon)); lvi->_recMC = (lvi->_recMC ? false : true); lvi->setIcon(DEVCOL_RCLK, QIcon( lvi->_recMC ? *dotIcon : *dothIcon)); setDirty(); @@ -1117,15 +967,11 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) setDirty(); break; case DEVCOL_RMMC: - //si.setMMCIn(si.MMCIn() ? false : true); - //lvi->setIcon(DEVCOL_RMMC, QIcon( si.MMCIn() ? *dotIcon : *dothIcon)); lvi->_recMMC = (lvi->_recMMC ? false : true); lvi->setIcon(DEVCOL_RMMC, QIcon( lvi->_recMMC ? *dotIcon : *dothIcon)); setDirty(); break; case DEVCOL_RMTC: - //si.setMTCIn(si.MTCIn() ? false : true); - //lvi->setIcon(DEVCOL_RMTC, QIcon( si.MTCIn() ? *dotIcon : *dothIcon)); lvi->_recMTC = (lvi->_recMTC ? false : true); lvi->setIcon(DEVCOL_RMTC, QIcon( lvi->_recMTC ? *dotIcon : *dothIcon)); setDirty(); @@ -1138,8 +984,6 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) case DEVCOL_TID: break; case DEVCOL_TCLK: - //si.setMCOut(si.MCOut() ? false : true); - //lvi->setIcon(DEVCOL_TCLK, QIcon( si.MCOut() ? *dotIcon : *dothIcon)); lvi->_sendMC = (lvi->_sendMC ? false : true); lvi->setIcon(DEVCOL_TCLK, QIcon( lvi->_sendMC ? *dotIcon : *dothIcon)); setDirty(); @@ -1150,15 +994,11 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) setDirty(); break; case DEVCOL_TMMC: - //si.setMMCOut(si.MMCOut() ? false : true); - //lvi->setIcon(DEVCOL_TMMC, QIcon( si.MMCOut() ? *dotIcon : *dothIcon)); lvi->_sendMMC = (lvi->_sendMMC ? false : true); lvi->setIcon(DEVCOL_TMMC, QIcon( lvi->_sendMMC ? *dotIcon : *dothIcon)); setDirty(); break; case DEVCOL_TMTC: - //si.setMTCOut(si.MTCOut() ? false : true); - //lvi->setIcon(DEVCOL_TMTC, QIcon( si.MTCOut() ? *dotIcon : *dothIcon)); lvi->_sendMTC = (lvi->_sendMTC ? false : true); lvi->setIcon(DEVCOL_TMTC, QIcon( lvi->_sendMTC ? *dotIcon : *dothIcon)); setDirty(); @@ -1183,21 +1023,13 @@ void MidiSyncConfig::dlvDoubleClicked(QTreeWidgetItem* item, int col) MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)item; - //if(col == DEVCOL_RID) - // lvi->startRename(DEVCOL_RID); - //else - //if(col == DEVCOL_TID) - // lvi->startRename(DEVCOL_TID); - bool ok = false; if(col == DEVCOL_RID) { - //int val = lvi->syncInfo().idIn(); int val = lvi->_idIn; int newval = QInputDialog::getInteger(this, "Muse: Sync info" , "Enter new id number (127 = all):", val, 0, 127, 1, &ok); if(ok) { - //lvi->syncInfo().setIdIn(newval); lvi->_idIn = newval; lvi->setText(DEVCOL_RID, QString().setNum(newval)); } @@ -1205,12 +1037,10 @@ void MidiSyncConfig::dlvDoubleClicked(QTreeWidgetItem* item, int col) else if(col == DEVCOL_TID) { - //int val = lvi->syncInfo().idOut(); int val = lvi->_idOut; int newval = QInputDialog::getInteger(this, "Muse: Sync info" , "Enter new id number (127 = global):", val, 0, 127, 1, &ok); if(ok) { - //lvi->syncInfo().setIdOut(newval); lvi->_idOut = newval; lvi->setText(DEVCOL_TID, QString().setNum(newval)); } @@ -1220,41 +1050,6 @@ void MidiSyncConfig::dlvDoubleClicked(QTreeWidgetItem* item, int col) setDirty(); } -/* -//--------------------------------------------------------- -// renameOk -//--------------------------------------------------------- -//void MidiSyncConfig::renameOk(QListViewItem* item, int col) -void MidiSyncConfig::renameOk(QListViewItem* item, int col, const QString & text) -{ - if(!item) - return; - - MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)item; - QString t = text; - bool ok; - int id = text.toInt(&ok); - if(!ok) - { - lvi->setText(t); - return; - } - if(col == DEVCOL_RID) - { - //lvi->syncInfo().setIdIn(id); - lvi->_idIn = id; - setDirty(); - } - else - if(col == DEVCOL_TID) - { - //lvi->syncInfo().setIdOut(id); - lvi->_idOut = id; - setDirty(); - } -} -*/ - //--------------------------------------------------------- // MidiSyncConfig::setDirty //--------------------------------------------------------- diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index bee05d51..9c82b5f5 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -215,7 +215,7 @@ MusEGlobal::GlobalConfigValues config = { QString("./"), // projectBaseFolder true, // projectStoreInFolder true, // useProjectSaveDialog - 64, // minControlProcessPeriod + 256, // minControlProcessPeriod false, // popupsDefaultStayOpen false, // leftMouseButtonCanDecrease false, // rangeMarkerWithoutMMB diff --git a/muse2/muse/widgets/scldraw.cpp b/muse2/muse/widgets/scldraw.cpp index 38adff25..aec769a0 100644 --- a/muse2/muse/widgets/scldraw.cpp +++ b/muse2/muse/widgets/scldraw.cpp @@ -636,7 +636,7 @@ int ScaleDraw::maxHeight(QPainter *p) const //------------------------------------------------------------ QRect ScaleDraw::maxBoundingRect(QPainter *p) const { - int i, wl,h,wmax; + int i, wl; //,wmax; int a, ar, amin, amax; double arc; @@ -645,7 +645,6 @@ QRect ScaleDraw::maxBoundingRect(QPainter *p) const QFontMetrics fm = p->fontMetrics(); wl = maxLabelWidth(p, TRUE); - h = fm.height(); switch(d_orient) { @@ -722,7 +721,7 @@ QRect ScaleDraw::maxBoundingRect(QPainter *p) const r.setBottom(MusECore::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)) + fm.height() ); - wmax = d_len + d_majLen + d_hpad + wl; + //wmax = d_len + d_majLen + d_hpad + wl; DELETETHIS r.setLeft(d_xorg - d_majLen - d_hpad - wl); r.setWidth(d_len + 2*(d_majLen + d_hpad + wl)); diff --git a/muse2/muse/widgets/sliderbase.cpp b/muse2/muse/widgets/sliderbase.cpp index 15497235..5909c64d 100644 --- a/muse2/muse/widgets/sliderbase.cpp +++ b/muse2/muse/widgets/sliderbase.cpp @@ -118,6 +118,7 @@ void SliderBase::wheelEvent(QWheelEvent *e) setValue(value()-inc); emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, (bool)(e->modifiers() & Qt::ShiftModifier)); } @@ -184,6 +185,7 @@ void SliderBase::mousePressEvent(QMouseEvent *e) d_mouseOffset = 0; DoubleRange::incPages(d_direction); emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, (bool)(e->modifiers() & Qt::ShiftModifier)); d_tmrID = startTimer(MusECore::qwtMax(250, 2 * d_updTime)); break; @@ -394,6 +396,7 @@ void SliderBase::mouseMoveEvent(QMouseEvent *e) } if (value() != prevValue()) emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, (bool)(e->modifiers() & Qt::ShiftModifier)); } } @@ -444,7 +447,10 @@ void SliderBase::timerEvent(QTimerEvent*) DoubleRange::incPages(d_direction); if (value() != prevValue()) + { emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, false); + } if (!d_timerTick) { @@ -456,7 +462,10 @@ void SliderBase::timerEvent(QTimerEvent*) DoubleRange::fitValue(value() + double(d_direction) * inc); if (value() != prevValue()) + { emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, false); + } if (!d_timerTick) { @@ -620,6 +629,7 @@ void SliderBase::stepPages(int pages) { DoubleRange::incPages(pages); emit sliderMoved(value(), _id); + emit sliderMoved(value(), _id, false); } @@ -722,7 +732,7 @@ void SliderBase::stepPages(int pages) // slider with the mouse. // //.u Syntax -//.f void SliderBase::sliderMoved(double value, int _id) +//.f void SliderBase::sliderMoved(double value, int _id [, bool shift]) // //.u Parameters //.p double value -- new value diff --git a/muse2/muse/widgets/sliderbase.h b/muse2/muse/widgets/sliderbase.h index 56c7a586..abea5dd6 100644 --- a/muse2/muse/widgets/sliderbase.h +++ b/muse2/muse/widgets/sliderbase.h @@ -86,6 +86,7 @@ class SliderBase : public QWidget, public DoubleRange void sliderPressed(int id); void sliderReleased(int id); void sliderMoved(double value, int id); + void sliderMoved(double value, int id, bool shift); void sliderRightClicked(const QPoint &p, int id); public: |