summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-12-06 21:09:43 +0000
committerWerner Schweer <ws.seh.de>2006-12-06 21:09:43 +0000
commit0a1f84719373e027ff3e6a9e0f37b93d82eecc5e (patch)
tree17759ff6cf2ba1b56148bb986d389773b3c0398a
parent036482a3fea264fdc7a4c9404466be9f49904100 (diff)
updates
-rw-r--r--muse/muse/instruments/editinstrument.cpp42
-rw-r--r--muse/muse/instruments/editinstrument.h2
-rw-r--r--muse/muse/synth.cpp3
3 files changed, 40 insertions, 7 deletions
diff --git a/muse/muse/instruments/editinstrument.cpp b/muse/muse/instruments/editinstrument.cpp
index 4736f918..0a39e66b 100644
--- a/muse/muse/instruments/editinstrument.cpp
+++ b/muse/muse/instruments/editinstrument.cpp
@@ -49,7 +49,7 @@ EditInstrument::EditInstrument(QWidget* parent)
connect(listController, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
SLOT(controllerChanged(QListWidgetItem*)));
connect(sysexList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
- SLOT(sysexChanged(QListWidgetItem*)));
+ SLOT(sysexChanged(QListWidgetItem*, QListWidgetItem*)));
connect(instrumentName, SIGNAL(textChanged(const QString&)), SLOT(instrumentNameChanged(const QString&)));
connect(fileSaveAsAction, SIGNAL(triggered()), SLOT(fileSaveAs()));
connect(fileSaveAction, SIGNAL(triggered()), SLOT(fileSave()));
@@ -441,7 +441,7 @@ void EditInstrument::newSysexClicked()
QString sysexName;
for (int i = 1;; ++i) {
- sysexName = QString("Sysex-%d").arg(i);
+ sysexName = QString("Sysex-%1").arg(i);
bool found = false;
foreach(const SysEx* s, instrument->sysex()) {
@@ -458,7 +458,7 @@ void EditInstrument::newSysexClicked()
instrument->addSysex(nsysex);
item = new QListWidgetItem(sysexName);
- QVariant v = QVariant::fromValue((void*)item);
+ QVariant v = QVariant::fromValue((void*)nsysex);
item->setData(Qt::UserRole, v);
sysexList->addItem(item);
sysexList->setCurrentItem(item);
@@ -525,7 +525,7 @@ void EditInstrument::instrumentChanged(QListWidgetItem* sel, QListWidgetItem* ol
}
if (!instrument->sysex().isEmpty()) {
sysexList->setItemSelected(sysexList->item(0), true);
- sysexChanged(sysexList->item(0));
+ sysexChanged(sysexList->item(0), 0);
}
if (!cl->empty()) {
listController->setItemSelected(listController->item(0), true);
@@ -644,9 +644,39 @@ void EditInstrument::controllerChanged(QListWidgetItem* sel)
// sysexChanged
//---------------------------------------------------------
-void EditInstrument::sysexChanged(QListWidgetItem*)
+void EditInstrument::sysexChanged(QListWidgetItem* sel, QListWidgetItem* old)
{
- printf("sysexChanged\n");
+ if (old) {
+ QListWidgetItem* item = instrumentList->currentItem();
+ if (item == 0)
+ return;
+ MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+ SysEx* so = (SysEx*)old->data(Qt::UserRole).value<void*>();
+ if (sysexName->text() != so->name) {
+ so->name = sysexName->text();
+ instrument->setDirty(true);
+ }
+ if (sysexComment->toPlainText() != so->comment) {
+ so->comment = sysexComment->toPlainText();
+ instrument->setDirty(true);
+ }
+ // TODO: check hex values
+ }
+ if (sel == 0) {
+ sysexName->setText("");
+ sysexComment->setText("");
+ sysexData->setText("");
+ sysexName->setEnabled(false);
+ sysexComment->setEnabled(false);
+ sysexData->setEnabled(false);
+ return;
+ }
+ sysexName->setEnabled(true);
+ sysexComment->setEnabled(true);
+ sysexData->setEnabled(true);
+ SysEx* sx = (SysEx*)sel->data(Qt::UserRole).value<void*>();
+ sysexName->setText(sx->name);
+ sysexComment->setText(sx->comment);
}
//---------------------------------------------------------
diff --git a/muse/muse/instruments/editinstrument.h b/muse/muse/instruments/editinstrument.h
index 660ba3cc..f1bd7766 100644
--- a/muse/muse/instruments/editinstrument.h
+++ b/muse/muse/instruments/editinstrument.h
@@ -43,7 +43,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase {
void instrumentChanged(QListWidgetItem*, QListWidgetItem*);
void patchChanged(QTreeWidgetItem*, QTreeWidgetItem*);
void controllerChanged(QListWidgetItem* sel);
- void sysexChanged(QListWidgetItem* sel);
+ void sysexChanged(QListWidgetItem*, QListWidgetItem*);
void instrumentNameChanged(const QString&);
void deletePatchClicked();
void newPatchClicked();
diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp
index 14610669..208b24f4 100644
--- a/muse/muse/synth.cpp
+++ b/muse/muse/synth.cpp
@@ -538,6 +538,9 @@ void MessSynthIF::getData(MidiEventList* el, unsigned pos, int ports, unsigned n
synti->putFifo.remove();
}
+ while (_mess->eventsPending())
+ _mess->processEvent(_mess->receiveEvent());
+
if (ports >= channels()) {
iMidiEvent i = el->begin();
for (; i != el->end(); ++i) {