summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-11-05 16:02:58 +0000
committerWerner Schweer <ws.seh.de>2006-11-05 16:02:58 +0000
commit8e6eef6c783cac7143093a9a2c6f7e036d20a663 (patch)
tree8d367f8711df4f1c053f93d01231d55be73f5a17
parent626e94cbfa05a4165f837c1f0d703d709485020a (diff)
fix pitchbend and controller recording
-rw-r--r--muse/muse/midiinport.cpp2
-rw-r--r--muse/muse/midioutport.cpp10
-rw-r--r--muse/muse/miditrack.cpp12
-rw-r--r--muse/muse/song.cpp5
-rw-r--r--muse/muse/song.h2
5 files changed, 19 insertions, 12 deletions
diff --git a/muse/muse/midiinport.cpp b/muse/muse/midiinport.cpp
index a84e4741..a63aaaa0 100644
--- a/muse/muse/midiinport.cpp
+++ b/muse/muse/midiinport.cpp
@@ -220,7 +220,7 @@ void MidiInPort::beforeProcess()
// called from jack process context
//---------------------------------------------------------
-void MidiInPort::getEvents(unsigned, unsigned, int ch, MidiEventList* dst)
+void MidiInPort::getEvents(unsigned, unsigned, int /*ch*/, MidiEventList* dst)
{
int tmpRecordRead = recordRead;
for (int i = 0; i < tmpRecordCount; ++i) {
diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp
index ff386c87..720256b5 100644
--- a/muse/muse/midioutport.cpp
+++ b/muse/muse/midioutport.cpp
@@ -181,7 +181,10 @@ void MidiOutPort::queueAlsaEvent(const MidiEvent& ev)
int chn = ev.channel();
unsigned t = ev.time();
- if (a == CTRL_PROGRAM) {
+ if (a == CTRL_PITCH) {
+ AO(MidiEvent(t, chn, ME_PITCHBEND, b, 0));
+ }
+ else if (a == CTRL_PROGRAM) {
// don't output program changes for GM drum channel
// if (!(song->mtype() == MT_GM && chn == 9)) {
int hb = (b >> 16) & 0xff;
@@ -273,7 +276,10 @@ void MidiOutPort::queueJackEvent(const MidiEvent& ev)
int chn = ev.channel();
unsigned t = ev.time();
- if (a == CTRL_PROGRAM) {
+ if (a == CTRL_PITCH) {
+ JO(MidiEvent(t, chn, ME_PITCHBEND, b, 0));
+ }
+ else if (a == CTRL_PROGRAM) {
// don't output program changes for GM drum channel
// if (!(song->mtype() == MT_GM && chn == 9)) {
int hb = (b >> 16) & 0xff;
diff --git a/muse/muse/miditrack.cpp b/muse/muse/miditrack.cpp
index 50605b5b..546173d0 100644
--- a/muse/muse/miditrack.cpp
+++ b/muse/muse/miditrack.cpp
@@ -271,7 +271,7 @@ void MidiTrack::recordBeat()
}
else if (me.type() == ME_CONTROLLER) {
Event event(Controller);
- event.setTick(time);
+ event.setTick(time + ptick);
switch(me.dataA()) {
case CTRL_HBANK:
hbank = me.dataB();
@@ -283,7 +283,6 @@ void MidiTrack::recordBeat()
case CTRL_HDATA:
datah = me.dataB();
- event.setType(Controller);
event.setA(dataType | (rpnh << 8) | rpnl);
event.setB(datah);
audio->msgAddEvent(event, recordPart, false);
@@ -320,7 +319,6 @@ void MidiTrack::recordBeat()
break;
default:
- event.setType(Controller);
event.setA(me.dataA());
event.setB(me.dataB());
audio->msgAddEvent(event, recordPart, false);
@@ -331,7 +329,7 @@ void MidiTrack::recordBeat()
}
else if (me.type() == ME_PROGRAM) {
Event event(Controller);
- event.setTick(time);
+ event.setTick(time + ptick);
event.setA(CTRL_PROGRAM);
event.setB((hbank << 16) | (lbank << 8) | me.dataA());
audio->msgAddEvent(event, recordPart, false);
@@ -340,7 +338,7 @@ void MidiTrack::recordBeat()
}
else if (me.type() == ME_PITCHBEND) {
Event event(Controller);
- event.setTick(time);
+ event.setTick(time + ptick);
event.setA(CTRL_PITCH);
event.setB(me.dataA());
audio->msgAddEvent(event, recordPart, false);
@@ -349,7 +347,7 @@ void MidiTrack::recordBeat()
}
else if (me.type() == ME_SYSEX) {
Event event(Sysex);
- event.setTick(time);
+ event.setTick(time + ptick);
event.setData(me.data(), me.len());
audio->msgAddEvent(event, recordPart, false);
++recordedEvents;
@@ -357,7 +355,7 @@ void MidiTrack::recordBeat()
}
else if (me.type() == ME_AFTERTOUCH) {
Event event(CAfter);
- event.setTick(time);
+ event.setTick(time + ptick);
event.setA(me.dataA());
audio->msgAddEvent(event, recordPart, false);
++recordedEvents;
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index b4b3cdb0..2b9f9ff9 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -168,8 +168,9 @@ bool Song::addEvent(Event& event, Part* part)
val.i = event.dataB();
if (mc && !mc->addControllerVal(cntrl, tick, val)) {
mc->addMidiController(mc->port()->instrument(), cntrl);
- if (!mc->addControllerVal(cntrl, tick, val))
+ if (!mc->addControllerVal(cntrl, tick, val)) {
return false;
+ }
}
}
part->events()->add(event);
@@ -1265,6 +1266,7 @@ void Song::seqSignal(int fd)
}
}
+#if 0
//---------------------------------------------------------
// recordEvent
//---------------------------------------------------------
@@ -1308,6 +1310,7 @@ void Song::recordEvent(MidiTrack* mt, Event& event)
event.setTick(tick);
audio->msgAddEvent(event, part);
}
+#endif
//---------------------------------------------------------
// stopRolling
diff --git a/muse/muse/song.h b/muse/muse/song.h
index 5ab3f14b..d06aad88 100644
--- a/muse/muse/song.h
+++ b/muse/muse/song.h
@@ -326,7 +326,7 @@ class Song : public QObject {
void insertTrack1(Track*, int idx);
void insertTrack2(Track*);
void readRoute(QDomNode);
- void recordEvent(MidiTrack*, Event&);
+// void recordEvent(MidiTrack*, Event&);
std::vector<QString>* synthesizer() const;
void deselectTracks();