summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-08-28 18:34:58 +0000
committerWerner Schweer <ws.seh.de>2006-08-28 18:34:58 +0000
commit0c493461b6b2f5156909bd36bfbbb6451c7424a7 (patch)
treee6912b4b8d5bb3ff3278e15f0997777530312b96
parent4e7eb2f00be1d5258cd1642279c4aa8140eb8c8a (diff)
supply correct position information for midi plugins in midi input
strip
-rw-r--r--muse/CMakeLists.txt4
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/audio.cpp20
-rw-r--r--muse/muse/audio.h8
-rw-r--r--muse/muse/midi.cpp2
-rw-r--r--muse/muse/midiport.cpp2
-rw-r--r--muse/muse/midiseq.cpp8
-rw-r--r--muse/muse/song.cpp4
8 files changed, 27 insertions, 23 deletions
diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt
index bd5a66ea..0867579e 100644
--- a/muse/CMakeLists.txt
+++ b/muse/CMakeLists.txt
@@ -21,8 +21,8 @@
project(muse)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.1)
-# set(CMAKE_BUILD_TYPE Debug)
-set(CMAKE_BUILD_TYPE Release)
+set(CMAKE_BUILD_TYPE Debug)
+# set(CMAKE_BUILD_TYPE Release)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
diff --git a/muse/ChangeLog b/muse/ChangeLog
index b9c1ba5d..0b95f357 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,4 +1,6 @@
28.8 (ws)
+ * supply correct position information to midi plugins in midi input
+ strips
* fixed: playing synti from midi track
22.8 (rj)
* playing with midi plugins, one new example plugin: trigg
diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp
index a14e4d47..bf86cf9c 100644
--- a/muse/muse/audio.cpp
+++ b/muse/muse/audio.cpp
@@ -100,8 +100,8 @@ Audio::Audio()
_pos.setType(AL::FRAMES);
_pos.setFrame(~0); // make sure first seek is not optimized away
- curTickPos = 0;
- nextTickPos = 0;
+ _curTickPos = 0;
+ _nextTickPos = 0;
midiClick = 0;
clickno = 0;
@@ -392,7 +392,7 @@ void Audio::process(unsigned frames)
//
// check for end of song
//
- if ((curTickPos >= song->len())
+ if ((_curTickPos >= song->len())
&& !(song->record() || _bounce || song->loop())) {
audioDriver->stopTransport();
return;
@@ -416,7 +416,7 @@ void Audio::process(unsigned frames)
Pos ppp(_pos);
ppp += frames;
- nextTickPos = ppp.tick();
+ _nextTickPos = ppp.tick();
}
//
@@ -471,7 +471,7 @@ void Audio::process(unsigned frames)
Fifo1* fifo = audioPrefetch->getFifo();
// printf("process %3d\n", fifo->count());
if (fifo->count() == 0) {
- printf("MusE::Audio: fifo underflow at 0x%x\n", curTickPos);
+ printf("MusE::Audio: fifo underflow at 0x%x\n", _curTickPos);
audioPrefetch->msgTick();
}
else {
@@ -540,7 +540,7 @@ void Audio::process(unsigned frames)
if (recording && (_bounce == 0 || _bounce == 1))
audioWriteback->trigger();
_pos += frames;
- curTickPos = nextTickPos;
+ _curTickPos = _nextTickPos;
}
}
@@ -591,7 +591,7 @@ void Audio::processMsg(AudioMsg* msg)
case SEQM_SET_TEMPO:
song->processMsg(msg);
if (isPlaying()) {
- _pos.setTick(curTickPos);
+ _pos.setTick(_curTickPos);
int framePos = _pos.frame();
syncFrame = audioDriver->framePos();
syncTime = curTime();
@@ -619,8 +619,8 @@ void Audio::seek(const Pos& p)
_pos.setFrame(p.frame());
syncFrame = audioDriver->framePos();
frameOffset = syncFrame - _pos.frame();
- curTickPos = _pos.tick();
- nextTickPos = curTickPos;
+ _curTickPos = _pos.tick();
+ _nextTickPos = _curTickPos;
loopPassed = true; // for record loop mode
if (state != LOOP2 && !freewheel())
@@ -679,7 +679,7 @@ void Audio::startRolling()
//
int bar, beat;
unsigned tick;
- AL::sigmap.tickValues(curTickPos, &bar, &beat, &tick);
+ AL::sigmap.tickValues(_curTickPos, &bar, &beat, &tick);
if (tick)
beat += 1;
midiClick = AL::sigmap.bar2tick(bar, beat, 0);
diff --git a/muse/muse/audio.h b/muse/muse/audio.h
index 0e436227..a4066b26 100644
--- a/muse/muse/audio.h
+++ b/muse/muse/audio.h
@@ -162,8 +162,8 @@ class Audio {
Pos _pos; // current play position
- unsigned curTickPos; // pos at start of frame during play/record
- unsigned nextTickPos; // pos at start of next frame during play/record
+ unsigned _curTickPos; // pos at start of frame during play/record
+ unsigned _nextTickPos; // pos at start of next frame during play/record
int _curReadIndex;
//metronome values
@@ -264,7 +264,9 @@ class Audio {
const Pos& getStartRecordPos() const { return startRecordPos; }
const Pos& getEndRecordPos() const { return endRecordPos; }
- int tickPos() const { return curTickPos; }
+ int curTickPos() const { return _curTickPos; }
+ int nextTickPos() const { return _nextTickPos; }
+
int timestamp() const;
unsigned curFrame() const;
bool freewheel() const { return _freewheel; }
diff --git a/muse/muse/midi.cpp b/muse/muse/midi.cpp
index 6a7c7d57..ced92d9e 100644
--- a/muse/muse/midi.cpp
+++ b/muse/muse/midi.cpp
@@ -638,7 +638,7 @@ void Audio::processMidi(unsigned frames)
{
MidiOutPortList* ol = song->midiOutPorts();
for (iMidiOutPort id = ol->begin(); id != ol->end(); ++id) {
- (*id)->process(curTickPos, nextTickPos, _pos, frames);
+ (*id)->process(_curTickPos, _nextTickPos, _pos, frames);
}
MidiInPortList* il = song->midiInPorts();
diff --git a/muse/muse/midiport.cpp b/muse/muse/midiport.cpp
index b25e95aa..a4746d18 100644
--- a/muse/muse/midiport.cpp
+++ b/muse/muse/midiport.cpp
@@ -637,7 +637,7 @@ void MidiInPort::eventReceived(snd_seq_event_t* ev)
MPEventList il, ol;
il.insert(event);
- pipeline()->apply(0, 0, &il, &ol);
+ pipeline()->apply(audio->curTickPos(), audio->nextTickPos(), &il, &ol);
//
// update midi meter
diff --git a/muse/muse/midiseq.cpp b/muse/muse/midiseq.cpp
index 0895096b..bf774698 100644
--- a/muse/muse/midiseq.cpp
+++ b/muse/muse/midiseq.cpp
@@ -128,7 +128,7 @@ void MidiSeq::processStart()
if (genMMC)
mp->sendSysex(mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
if (genMCSync) {
- if (audio->tickPos())
+ if (audio->curTickPos())
mp->sendContinue();
else
mp->sendStart();
@@ -193,7 +193,7 @@ void MidiSeq::processStop()
0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01,
0, 0, 0, 0, 0
};
- int frame = AL::tempomap.tick2frame(audio->tickPos());
+ int frame = AL::tempomap.tick2frame(audio->curTickPos());
MTC mtc(double(frame) / double(AL::sampleRate));
mmcPos[6] = mtc.h() | (AL::mtcType << 5);
mmcPos[7] = mtc.m();
@@ -207,7 +207,7 @@ void MidiSeq::processStop()
// send STOP and
// "set song position pointer"
mp->sendStop();
- mp->sendSongpos(audio->tickPos() * 4 / config.division);
+ mp->sendSongpos(audio->curTickPos() * 4 / config.division);
}
}
}
@@ -234,7 +234,7 @@ void MidiSeq::resetDevices()
void MidiSeq::processSeek()
{
- int pos = audio->tickPos();
+ int pos = audio->curTickPos();
if (genMCSync) {
MidiOutPortList* ol = song->midiOutPorts();
for (iMidiOutPort i = ol->begin(); i != ol->end(); ++i) {
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index 87ec8523..1ab80764 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -812,7 +812,7 @@ void Song::beat()
{
updateFlags = 0;
if (audio->isPlaying()) {
- int tick = audio->tickPos();
+ int tick = audio->curTickPos();
setPos(0, tick, true, false, true);
}
if (audio->isRecording()) {
@@ -1226,7 +1226,7 @@ void Song::seqSignal(int fd)
setRecord(true);
break;
case MSG_SEEK:
- setPos(0, audio->tickPos(), true, false, !seekInProgress);
+ setPos(0, audio->curTickPos(), true, false, !seekInProgress);
seekInProgress = false;
beat(); // update controller guis
break;