summaryrefslogtreecommitdiff
path: root/muse2/muse/mididev.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-07-01 16:42:16 +0000
committerFlorian Jung <flo@windfisch.org>2012-07-01 16:42:16 +0000
commit9c4664d162c537ba4dd4fd8220971c0fb727103a (patch)
tree37a28b7cd4e4d8984ad4934a4884cd7b4da0505c /muse2/muse/mididev.cpp
parente87fedf1be804f7ec774071d844b1f163be30b96 (diff)
final merge
Diffstat (limited to 'muse2/muse/mididev.cpp')
-rw-r--r--muse2/muse/mididev.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp
index becab6f7..5ff8bf94 100644
--- a/muse2/muse/mididev.cpp
+++ b/muse2/muse/mididev.cpp
@@ -46,7 +46,6 @@
namespace MusEGlobal {
MusECore::MidiDeviceList midiDevices;
-extern unsigned int volatile lastExtMidiSyncTick;
}
namespace MusECore {
@@ -215,10 +214,14 @@ void MidiDevice::beforeProcess()
void MidiDevice::recordEvent(MidiRecordEvent& event)
{
- // TODO: Tested, but record resolution not so good. Switch to wall clock based separate list in MidiDevice. And revert this line.
- //event.setTime(MusEGlobal::audio->timestamp());
- event.setTime(MusEGlobal::extSyncFlag.value() ? MusEGlobal::lastExtMidiSyncTick : MusEGlobal::audio->timestamp());
-
+ // TODO: Tested, but record resolution not so good. Switch to wall clock based separate list in MidiDevice.
+ unsigned frame_ts = MusEGlobal::audio->timestamp();
+#ifndef _AUDIO_USE_TRUE_FRAME_
+ if(MusEGlobal::audio->isPlaying())
+ frame_ts += MusEGlobal::segmentSize; // Shift forward into this period if playing
+#endif
+ event.setTime(frame_ts);
+ event.setTick(MusEGlobal::lastExtMidiSyncTick);
if(MusEGlobal::audio->isPlaying())
event.setLoopNum(MusEGlobal::audio->loopCount());
@@ -300,7 +303,7 @@ void MidiDevice::recordEvent(MidiRecordEvent& event)
// Split the events up into channel fifos. Special 'channel' number 17 for sysex events.
unsigned int ch = (typ == ME_SYSEX)? MIDI_CHANNELS : event.channel();
- if(_recordFifo[ch].put(MidiPlayEvent(event)))
+ if(_recordFifo[ch].put(event))
printf("MidiDevice::recordEvent: fifo channel %d overflow\n", ch);
}