diff options
-rw-r--r-- | muse/muse/ctrl/CMakeLists.txt | 4 | ||||
-rw-r--r-- | muse/muse/ctrl/configmidictrl.cpp | 14 | ||||
-rw-r--r-- | muse/muse/ctrl/configmidictrl.h | 1 | ||||
-rw-r--r-- | muse/muse/ctrl/configmidictrl.ui | 208 | ||||
-rw-r--r-- | muse/muse/ctrl/ctrldialog.cpp | 66 | ||||
-rw-r--r-- | muse/muse/ctrl/ctrldialog.h | 5 | ||||
-rw-r--r-- | muse/muse/ctrl/ctrldialog.ui | 13 | ||||
-rw-r--r-- | muse/muse/ctrl/ctrledit.cpp | 21 | ||||
-rw-r--r-- | muse/muse/ctrl/definemidictrl.ui | 294 | ||||
-rw-r--r-- | muse/muse/wave.cpp | 17 | ||||
-rw-r--r-- | muse/muse/waveedit/waveview.cpp | 1 |
11 files changed, 482 insertions, 162 deletions
diff --git a/muse/muse/ctrl/CMakeLists.txt b/muse/muse/ctrl/CMakeLists.txt index 17f3f2b9..e9e10702 100644 --- a/muse/muse/ctrl/CMakeLists.txt +++ b/muse/muse/ctrl/CMakeLists.txt @@ -20,20 +20,24 @@ QT4_WRAP_CPP (ctrl_mocs configmidictrl.h + definemidictrl.h ctrldialog.h ctrledit.h ) QT4_WRAP_UI (ctrl_ui_headers configmidictrl.ui + definemidictrl.ui ctrldialog.ui ) add_library ( ctrl STATIC configmidictrl.cpp + definemidictrl.cpp ctrldialog.cpp ctrldialog.h ctrleditor.cpp configmidictrl.h + definemidictrl.h ctrleditor.h ctrledit.cpp ${ctrl_mocs} diff --git a/muse/muse/ctrl/configmidictrl.cpp b/muse/muse/ctrl/configmidictrl.cpp index 1bbc2241..f5d2247d 100644 --- a/muse/muse/ctrl/configmidictrl.cpp +++ b/muse/muse/ctrl/configmidictrl.cpp @@ -19,6 +19,7 @@ //============================================================================= #include "configmidictrl.h" +#include "definemidictrl.h" #include "miditrack.h" #include "midioutport.h" #include "midictrl.h" @@ -72,6 +73,7 @@ ConfigMidiCtrl::ConfigMidiCtrl(MidiTrack* t) connect(buttonRemove, SIGNAL(clicked()), SLOT(removeClicked())); connect(availableController, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(availableSelected(QListWidgetItem*))); connect(managedController, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(managedSelected(QListWidgetItem*))); + connect(defineButton, SIGNAL(clicked()), SLOT(defineClicked())); } //--------------------------------------------------------- @@ -182,3 +184,15 @@ void ConfigMidiCtrl::done(int code) QDialog::done(code); } +//--------------------------------------------------------- +// defineClicked +//--------------------------------------------------------- + +void ConfigMidiCtrl::defineClicked() + { + printf("define clicked\n"); + DefineMidiCtrl dc(track, this); + if (dc.exec()) + QDialog::done(0); + } + diff --git a/muse/muse/ctrl/configmidictrl.h b/muse/muse/ctrl/configmidictrl.h index 28560d79..0af11e36 100644 --- a/muse/muse/ctrl/configmidictrl.h +++ b/muse/muse/ctrl/configmidictrl.h @@ -40,6 +40,7 @@ class ConfigMidiCtrl : public QDialog, public Ui::ConfigMidiCtrlBase { void availableSelected(QListWidgetItem*); void managedSelected(QListWidgetItem*); virtual void done(int); + void defineClicked(); public: ConfigMidiCtrl(MidiTrack*); diff --git a/muse/muse/ctrl/configmidictrl.ui b/muse/muse/ctrl/configmidictrl.ui index d76fe457..1960c490 100644 --- a/muse/muse/ctrl/configmidictrl.ui +++ b/muse/muse/ctrl/configmidictrl.ui @@ -1,156 +1,126 @@ <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> <class>ConfigMidiCtrlBase</class> <widget class="QDialog" name="ConfigMidiCtrlBase" > <property name="geometry" > <rect> <x>0</x> <y>0</y> - <width>463</width> - <height>448</height> + <width>506</width> + <height>355</height> </rect> </property> <property name="windowTitle" > <string>MusE: Config Midi Controller</string> </property> - <layout class="QVBoxLayout" > + <layout class="QGridLayout" > <property name="margin" > - <number>8</number> + <number>9</number> </property> <property name="spacing" > <number>6</number> </property> - <item> - <layout class="QHBoxLayout" > + <item row="0" column="0" colspan="3" > + <layout class="QGridLayout" > <property name="margin" > <number>0</number> </property> <property name="spacing" > <number>6</number> </property> - <item> - <widget class="QLabel" name="label_3" > + <item row="1" column="0" > + <widget class="QLabel" name="label_4" > <property name="text" > - <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Midi Port:</p></body></html></string> + <string>Midi Instrument:</string> </property> </widget> </item> - <item> - <widget class="QLabel" name="portName" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape" > - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> + <item row="0" column="1" > + <widget class="QLineEdit" name="portName" > + <property name="readOnly" > + <bool>true</bool> </property> - <property name="lineWidth" > - <number>2</number> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="instrumentName" > + <property name="readOnly" > + <bool>true</bool> </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label_3" > <property name="text" > - <string>TextLabel</string> + <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Midi Port:</p></body></html></string> </property> </widget> </item> </layout> </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> + <item row="1" column="2" > + <widget class="QLabel" name="label_2" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="spacing" > - <number>6</number> + <property name="text" > + <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Automated Controller:</p></body></html></string> </property> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="text" > - <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Available Controller:</p></body></html></string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="availableController" /> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="buttonAdd" > - <property name="text" > - <string>Add</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonRemove" > - <property name="text" > - <string>Remove</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_2" > - <property name="text" > - <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Automated Controller:</p></body></html></string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="managedController" /> - </item> - </layout> - </item> - </layout> + </widget> </item> - <item> + <item rowspan="3" row="2" column="2" > + <widget class="QListWidget" name="managedController" /> + </item> + <item rowspan="2" row="1" column="1" > + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>75</width> + <height>81</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Available Controller:</p></body></html></string> + </property> + </widget> + </item> + <item rowspan="3" row="2" column="0" > + <widget class="QListWidget" name="availableController" /> + </item> + <item row="4" column="1" > + <widget class="QPushButton" name="buttonRemove" > + <property name="text" > + <string>Remove</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QPushButton" name="buttonAdd" > + <property name="text" > + <string>Add</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="3" > <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -159,6 +129,13 @@ <number>6</number> </property> <item> + <widget class="QPushButton" name="defineButton" > + <property name="text" > + <string>Define new Controller</string> + </property> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Horizontal</enum> @@ -189,7 +166,6 @@ </item> </layout> </widget> - <pixmapfunction></pixmapfunction> <resources/> <connections> <connection> diff --git a/muse/muse/ctrl/ctrldialog.cpp b/muse/muse/ctrl/ctrldialog.cpp index f1117469..6982ddaa 100644 --- a/muse/muse/ctrl/ctrldialog.cpp +++ b/muse/muse/ctrl/ctrldialog.cpp @@ -25,26 +25,43 @@ #include "audiotrack.h" #include "plugin.h" #include "pipeline.h" +#include "ctrl/configmidictrl.h" //--------------------------------------------------------- // CtrlDialog //--------------------------------------------------------- -CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) +CtrlDialog::CtrlDialog(Track* track, int ci, QWidget* parent) : QDialog(parent) { + t = track; + currentId = ci; setupUi(this); QTreeWidgetItem* header = tw->headerItem(); header->setTextAlignment(0, Qt::AlignLeft); header->setTextAlignment(1, Qt::AlignHCenter); - /* COMMENT: setSizeHint does not work in qt4.1, Scheduled for 4.2.0 */ - header->setSizeHint(1, QSize(30, 20)); + tw->header()->setResizeMode(0, QHeaderView::Stretch); header->setToolTip(0, tr("controller name")); header->setToolTip(1, tr("flag if controller contains data")); + updateController(); + otherButton->setEnabled(track->type() == Track::MIDI); + connect(tw, + SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), + SLOT(itemDoubleClicked(QTreeWidgetItem*, int))); + connect(otherButton, SIGNAL(clicked()), SLOT(otherClicked())); + } + +//--------------------------------------------------------- +// updateController +//--------------------------------------------------------- + +void CtrlDialog::updateController() + { + tw->clear(); QTreeWidgetItem* ci; - if (track->type() == Track::MIDI) { + if (t->type() == Track::MIDI) { // // add special controll for midi tracks // @@ -54,7 +71,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) tw->setCurrentItem(ci); tw->setItemSelected(ci, true); } - if (((MidiTrack*)(track))->drumMap()) { + if (((MidiTrack*)(t))->drumMap()) { ci = new QTreeWidgetItem(tw, CTRL_SVELOCITY); ci->setText(0, "Single Velocity"); @@ -64,7 +81,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) } } } - else if (!track->isMidiTrack()) { + else if (!t->isMidiTrack()) { // // aux send streams // @@ -72,7 +89,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) // // present plugin parameter // - Pipeline* pl = ((AudioTrack*)track)->prePipe(); + Pipeline* pl = ((AudioTrack*)t)->prePipe(); int idx = 0; foreach (PluginI* plugin, *pl) { ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL); @@ -83,7 +100,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) int id = (idx + 1) * 0x1000 + i; QTreeWidgetItem* cci = new QTreeWidgetItem(ci, id); cci->setText(0, name); - Ctrl* ctrl = track->getController(id); + Ctrl* ctrl = t->getController(id); if (!ctrl->empty()) cci->setText(1, "*"); if (id == currentId) { @@ -92,7 +109,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) } } } - pl = ((AudioTrack*)track)->postPipe(); + pl = ((AudioTrack*)t)->postPipe(); idx = 0; foreach (PluginI* plugin, *pl) { ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL); @@ -103,7 +120,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) int id = (idx + 1) * 0x1000 + i; QTreeWidgetItem* cci = new QTreeWidgetItem(ci, id); cci->setText(0, name); - Ctrl* ctrl = track->getController(id); + Ctrl* ctrl = t->getController(id); if (!ctrl->empty()) cci->setText(1, "*"); if (id == currentId) { @@ -114,11 +131,11 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) } } - ControllerNameList* cn = track->controllerNames(); + ControllerNameList* cn = t->controllerNames(); for (iControllerName i = cn->begin(); i != cn->end(); ++i) { ci = new QTreeWidgetItem(tw, i->id); ci->setText(0, i->name); - Ctrl* ctrl = track->getController(i->id); + Ctrl* ctrl = t->getController(i->id); if (!ctrl->empty()) ci->setText(1, "*"); @@ -127,12 +144,6 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent) tw->setItemSelected(ci, true); } } - - ci = new QTreeWidgetItem(tw, CTRL_OTHER); - ci->setText(0, tr("other")); - connect(tw, - SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), - SLOT(itemDoubleClicked(QTreeWidgetItem*, int))); } //--------------------------------------------------------- @@ -157,4 +168,23 @@ int CtrlDialog::curId() const return item->type(); } +//--------------------------------------------------------- +// otherClicked +// Add another controller to the list of "managed" +// controllers. +//--------------------------------------------------------- + +void CtrlDialog::otherClicked() + { + QTreeWidgetItem* item = tw->currentItem(); + if (item) + currentId = item->type(); + // + // present the list of available controller for + // the selected midi instrument + // + ConfigMidiCtrl mce((MidiTrack*)t); + mce.exec(); + updateController(); + } diff --git a/muse/muse/ctrl/ctrldialog.h b/muse/muse/ctrl/ctrldialog.h index d3889580..3cb51ef2 100644 --- a/muse/muse/ctrl/ctrldialog.h +++ b/muse/muse/ctrl/ctrldialog.h @@ -32,8 +32,13 @@ class Track; class CtrlDialog : public QDialog, public Ui_CtrlDialogBase { Q_OBJECT + Track* t; + int currentId; + void updateController(); + private slots: void itemDoubleClicked(QTreeWidgetItem*, int); + void otherClicked(); public: CtrlDialog(Track*, int, QWidget* parent = 0); diff --git a/muse/muse/ctrl/ctrldialog.ui b/muse/muse/ctrl/ctrldialog.ui index cdb3c5b8..a3d36304 100644 --- a/muse/muse/ctrl/ctrldialog.ui +++ b/muse/muse/ctrl/ctrldialog.ui @@ -1,14 +1,11 @@ <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> <class>CtrlDialogBase</class> <widget class="QDialog" name="CtrlDialogBase" > <property name="geometry" > <rect> <x>0</x> <y>0</y> - <width>400</width> + <width>390</width> <height>300</height> </rect> </property> @@ -54,6 +51,13 @@ <number>6</number> </property> <item> + <widget class="QPushButton" name="otherButton" > + <property name="text" > + <string>Other</string> + </property> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Horizontal</enum> @@ -84,7 +88,6 @@ </item> </layout> </widget> - <pixmapfunction></pixmapfunction> <resources/> <connections> <connection> diff --git a/muse/muse/ctrl/ctrledit.cpp b/muse/muse/ctrl/ctrledit.cpp index 06b28472..cbd0275c 100644 --- a/muse/muse/ctrl/ctrledit.cpp +++ b/muse/muse/ctrl/ctrledit.cpp @@ -109,20 +109,13 @@ void CtrlEdit::showControllerList() id = c->id(); else id = CTRL_NO_CTRL; - for (;;) { - CtrlDialog cd(_track, id); - int rv = cd.exec(); - if (rv != 1) - return; - id = cd.curId(); - if (id == CTRL_NO_CTRL) - return; - if (id != CTRL_OTHER) - break; - ConfigMidiCtrl* mce = new ConfigMidiCtrl((MidiTrack*)_track); - mce->exec(); - delete mce; - } + CtrlDialog cd(_track, id); + int rv = cd.exec(); + if (rv != 1) + return; + id = cd.curId(); + if (id == CTRL_NO_CTRL) + return; changeController(id); } diff --git a/muse/muse/ctrl/definemidictrl.ui b/muse/muse/ctrl/definemidictrl.ui new file mode 100644 index 00000000..20269956 --- /dev/null +++ b/muse/muse/ctrl/definemidictrl.ui @@ -0,0 +1,294 @@ +<ui version="4.0" > + <class>DefineMidiCtrlBase</class> + <widget class="QDialog" name="DefineMidiCtrlBase" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>463</width> + <height>301</height> + </rect> + </property> + <property name="windowTitle" > + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="2" > + <widget class="QLineEdit" name="lineEdit" /> + </item> + <item row="1" column="2" > + <widget class="QComboBox" name="comboBox" > + <item> + <property name="text" > + <string>7-Bit</string> + </property> + </item> + <item> + <property name="text" > + <string>14-Bit</string> + </property> + </item> + <item> + <property name="text" > + <string>7-Bit RPN</string> + </property> + </item> + <item> + <property name="text" > + <string>14-Bit RPN</string> + </property> + </item> + <item> + <property name="text" > + <string>7-Bit NRPN</string> + </property> + </item> + <item> + <property name="text" > + <string>14-Bit NRPN</string> + </property> + </item> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Controller Name:</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Controller Type:</string> + </property> + </widget> + </item> + <item rowspan="2" row="0" column="0" > + <widget class="QLabel" name="label_13" > + <property name="font" > + <font> + <pointsize>24</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <property name="lineWidth" > + <number>5</number> + </property> + <property name="text" > + <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:24pt; font-weight:600; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:400;"> </span><span style=" font-weight:400;">CTRL </span></p></body></html></string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="2" > + <widget class="QLabel" name="label_8" > + <property name="text" > + <string>0x00</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QSpinBox" name="spinBox_2" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_4" > + <property name="text" > + <string>Id LSB</string> + </property> + </widget> + </item> + <item row="1" column="2" > + <widget class="QLabel" name="label_9" > + <property name="text" > + <string>0x00</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QSpinBox" name="spinBox" /> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label_3" > + <property name="text" > + <string>Id MSB</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="2" column="1" > + <widget class="QSpinBox" name="spinBox_5" /> + </item> + <item row="2" column="2" > + <widget class="QLabel" name="label_12" > + <property name="text" > + <string>0x00</string> + </property> + </widget> + </item> + <item row="1" column="2" > + <widget class="QLabel" name="label_11" > + <property name="text" > + <string>0x00</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="label_7" > + <property name="text" > + <string>Init Value</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QSpinBox" name="spinBox_4" /> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label_5" > + <property name="text" > + <string>Min.Value</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QSpinBox" name="spinBox_3" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_6" > + <property name="text" > + <string>Max.Value</string> + </property> + </widget> + </item> + <item row="0" column="2" > + <widget class="QLabel" name="label_10" > + <property name="text" > + <string>0x00</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>16</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::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>DefineMidiCtrlBase</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>DefineMidiCtrlBase</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/muse/muse/wave.cpp b/muse/muse/wave.cpp index f0e360c7..41682d88 100644 --- a/muse/muse/wave.cpp +++ b/muse/muse/wave.cpp @@ -289,8 +289,10 @@ bool SndFile::openRead() sfUI = sf_open(p.toAscii().data(), SFM_READ, &sfinfo); sfinfo.format = 0; sfRT = sf_open(p.toAscii().data(), SFM_READ, &sfinfo); - if (sfUI == 0 || sfRT == 0) + if (sfUI == 0 || sfRT == 0) { + printf("SndFile::openRead(): failed\n"); return true; + } writeFlag = false; openFlag = true; QString cacheName = _finfo.absolutePath() + QString("/") + _finfo.baseName() + QString(".wca"); @@ -442,10 +444,9 @@ void SndFile::read(SampleV* s, int mag, unsigned pos) { int srcChannels = channels(); int dstChannels = sfinfo.channels; - size_t n = mag; float** dst = fp; - float buffer[n * dstChannels]; - size_t rn = sf_readf_float(sfUI, buffer, n); + float buffer[mag * dstChannels]; + size_t rn = sf_readf_float(sfUI, buffer, mag); float* src = buffer; if (srcChannels == dstChannels) { @@ -705,15 +706,15 @@ QString SndFile::strerror() const } //--------------------------------------------------------- -// getSnd +// getWave //--------------------------------------------------------- SndFile* SndFile::getWave(const QString& inName, bool writeFlag) { QString name = song->absoluteProjectPath() + "/" + inName; -// printf("=====%s %s\n", inName.toLatin1().data(), name.toLatin1().data()); SndFile* f = sndFiles.value(name); +// printf("SndFile::getWave: %p writeFlag %d %s %s\n", f, writeFlag, inName.toLatin1().data(), name.toLatin1().data()); if (f == 0) { if (!QFile::exists(name)) { fprintf(stderr, "wave file <%s> not found\n", @@ -723,9 +724,9 @@ SndFile* SndFile::getWave(const QString& inName, bool writeFlag) f = new SndFile(name); bool error; if (writeFlag) - error = f->openRead(); - else error = f->openWrite(); + else + error = f->openRead(); if (error) { fprintf(stderr, "open wave file(%s) for %s failed: %s\n", name.toLatin1().data(), diff --git a/muse/muse/waveedit/waveview.cpp b/muse/muse/waveedit/waveview.cpp index 6659274d..14550c3d 100644 --- a/muse/muse/waveedit/waveview.cpp +++ b/muse/muse/waveedit/waveview.cpp @@ -132,7 +132,6 @@ void WaveView::drawWavePart(QPainter& p, Part* wp, int y0, int th, int from, int f.read(sa, xScale, frame); frame += xScale; for (unsigned k = 0; k < channels; ++k) { - // peak = (sa[k].peak * h) / 256; int peak = (sa[k].peak * (h - 1)) >> 8; int rms = (sa[k].rms * (h - 1)) >> 8; p.setPen(QColor(Qt::darkGray)); |