summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-12-13 22:04:25 +0000
committerWerner Schweer <ws.seh.de>2006-12-13 22:04:25 +0000
commit88dc42fb35ffcf2401990651cd32ce10253dfe7c (patch)
treeaa6efb84f2358cf728a09fb5fe17190c3c50c72b
parent657784c1a9bf557d2d8ac8f00ff9e2ee11cd2e0d (diff)
updates
-rw-r--r--muse/ChangeLog5
-rw-r--r--muse/al/tempo.h1
-rw-r--r--muse/muse/arranger/canvas.cpp20
-rw-r--r--muse/muse/audio.cpp140
-rw-r--r--muse/muse/audio.h58
-rw-r--r--muse/muse/audiotrack.cpp2
-rw-r--r--muse/muse/conf.cpp2
-rw-r--r--muse/muse/ctrl/ctrleditor.cpp8
-rw-r--r--muse/muse/ctrl/ctrleditor.h2
-rw-r--r--muse/muse/driver/audiodev.h4
-rw-r--r--muse/muse/driver/dummyaudio.cpp10
-rw-r--r--muse/muse/driver/jack.cpp29
-rw-r--r--muse/muse/driver/jackaudio.h7
-rw-r--r--muse/muse/globals.cpp11
-rw-r--r--muse/muse/globals.h11
-rw-r--r--muse/muse/midiedit/ecanvas.cpp4
-rw-r--r--muse/muse/midiinport.cpp17
-rw-r--r--muse/muse/midiout.cpp24
-rw-r--r--muse/muse/midiout.h4
-rw-r--r--muse/muse/midioutport.cpp16
-rw-r--r--muse/muse/midioutport.h4
-rw-r--r--muse/muse/midiseq.cpp7
-rw-r--r--muse/muse/miditrack.cpp30
-rw-r--r--muse/muse/miditrack.h3
-rw-r--r--muse/muse/song.cpp14
-rw-r--r--muse/muse/synth.cpp15
-rw-r--r--muse/muse/synth.h4
-rw-r--r--muse/muse/waveedit/waveview.cpp12
-rw-r--r--muse/muse/wavetrack.cpp2
29 files changed, 206 insertions, 260 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index eb68b20b..b07142db 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,4 +1,7 @@
-13.12 (ns) DeicsOnze 0.5.5
+13.12 (ws)
+ - changed (again) midi/audio time synchronisation
+ - fix: record midi controller only in controller list
+ (ns) DeicsOnze 0.5.5
- added filter for low quality
12.12 (ws)
- added possibility to define a new midicontroller
diff --git a/muse/al/tempo.h b/muse/al/tempo.h
index 68dcbb14..e2342003 100644
--- a/muse/al/tempo.h
+++ b/muse/al/tempo.h
@@ -98,3 +98,4 @@ extern TempoList tempomap;
}
#endif
+
diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp
index 5ea2efed..c9764822 100644
--- a/muse/muse/arranger/canvas.cpp
+++ b/muse/muse/arranger/canvas.cpp
@@ -62,7 +62,7 @@ PartCanvas::PartCanvas()
void PartCanvas::markerChanged(int val)
{
if (val == Song::MARKER_CUR)
- updateRuler();
+ updateRuler();
}
//---------------------------------------------------------
@@ -102,7 +102,7 @@ void PartCanvas::drawWavePart(QPainter& p, Part* wp, int y0, int th, int from, i
int samples = event.lenFrame();
int xScale = (samples + w/2)/w;
- int frame = pos.frame() - wp->frame()
+ int frame = pos.frame() - wp->frame()
- event.pos().frame() + event.spos();
if (h < 20) {
@@ -539,7 +539,7 @@ void PartCanvas::mousePress(QMouseEvent* me)
if (hit == HIT_SUBTRACK) {
TLSWidget* w = (TLSWidget*)(at->tw);
int y = wpos.y() + pos.y() - w->y();
- w->mousePress(QPoint(pos.x(), y), button, me->modifiers());
+ w->mousePress(QPoint(pos.x(), y), me);
// propagate drag events to subtrack if left button pressed:
if (me->button() == Qt::LeftButton)
state = S_SUBTRACK;
@@ -547,7 +547,7 @@ void PartCanvas::mousePress(QMouseEvent* me)
}
if (button & Qt::RightButton) {
- contextMenu(pos);
+ contextMenu(me->pos());
return;
}
@@ -880,17 +880,17 @@ void PartCanvas::renamePart(Part* part)
{
bool ok;
- QString s = QInputDialog::getText(this,
+ QString s = QInputDialog::getText(this,
tr("MusE: Change Part Name"),
tr("PartName:"),
QLineEdit::Normal,
- part->name(),
+ part->name(),
&ok
);
if (ok && s != part->name()) {
song->startUndo();
Part* newPart = new Part(*part);
- newPart->setName(s);
+ newPart->setName(s);
song->cmdChangePart(part, newPart);
widget()->update();
}
@@ -1105,7 +1105,7 @@ void PartCanvas::drop(QDropEvent* event)
dstPart->setTrack(track);
//
- // cw == 0 means that we are dropping to
+ // cw == 0 means that we are dropping to
// another application
unsigned tick;
@@ -1113,7 +1113,7 @@ void PartCanvas::drop(QDropEvent* event)
tick = AL::sigmap.raster(mapxDev(pos.x() - cw->dragOffset()), raster());
else
tick = AL::sigmap.raster(mapxDev(pos.x()), raster());
-
+
dstPart->setTick(tick);
Qt::DropAction da = event->proposedAction();
@@ -1128,7 +1128,7 @@ void PartCanvas::drop(QDropEvent* event)
}
else if (da == Qt::MoveAction)
event->setDropAction(Qt::MoveAction);
- else
+ else
event->setDropAction(Qt::CopyAction);
event->accept();
if (cw || needEndUndo)
diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp
index f706edcf..b2d54019 100644
--- a/muse/muse/audio.cpp
+++ b/muse/muse/audio.cpp
@@ -99,22 +99,7 @@ Audio::Audio()
_bounce = 0;
loopPassed = false;
- _pos.setType(AL::FRAMES);
- _pos.setFrame(~0); // make sure first seek is not optimized away
-
- _curTickPos = 0;
- _nextTickPos = 0;
-
- midiClick = 0;
- clickno = 0;
- clicksMeasure = 0;
- ticksBeat = 0;
-
- state = STOP;
- lmark = 0; // left loop position
- rmark = 0; // right loop position
- msg = 0;
-
+ _seqTime.pos.setType(AL::FRAMES);
startRecordPos.setType(AL::TICKS);
endRecordPos.setType(AL::TICKS);
@@ -152,16 +137,11 @@ bool Audio::start()
{
TrackList* tl = song->tracks();
- _curTickPos = 0;
- _nextTickPos = 0;
-
- midiClick = 0;
- clickno = 0;
- clicksMeasure = 0;
- ticksBeat = 0;
+ _seqTime.curTickPos = 0;
+ _seqTime.nextTickPos = 0;
+ _seqTime.pos.setFrame(~0); // make sure seek is not optimized away
msg = 0;
- _pos.setFrame(~0); // make sure seek is not optimized away
//
// init marker for synchronous loop processing
@@ -193,7 +173,6 @@ bool Audio::start()
//
InputList* itl = song->inputs();
for (iAudioInput i = itl->begin(); i != itl->end(); ++i) {
-// printf("reconnecting input %s\n", (*i)->name().toLatin1().data());
for (int x=0; x < (*i)->channels();x++) {
(*i)->setJackPort(Port(), x); // zero out the old connection
}
@@ -202,7 +181,6 @@ bool Audio::start()
OutputList* otl = song->outputs();
for (iAudioOutput i = otl->begin(); i != otl->end(); ++i) {
-// printf("reconnecting output %s\n", (*i)->name().toLatin1().data());
for (int x=0; x < (*i)->channels();x++)
(*i)->setJackPort(Port(), x); // zero out the old connection
(*i)->activate1();
@@ -258,7 +236,6 @@ bool Audio::sync(int jackState, unsigned frame)
if (state != START_PLAY) {
Pos p(frame, AL::FRAMES);
-// printf(" sync seek\n");
seek(p);
if (!_freewheel)
done = audioPrefetch->seekDone();
@@ -266,14 +243,13 @@ bool Audio::sync(int jackState, unsigned frame)
state = START_PLAY;
}
else {
- if (frame != _pos.frame()) {
+ if (frame != _seqTime.pos.frame()) {
// seek during seek
seek(Pos(frame, AL::FRAMES));
}
done = audioPrefetch->seekDone();
}
}
-// printf(" sync %s\n", done ? "done" : "busy");
return done;
}
@@ -300,12 +276,14 @@ printf("JACK: shutdown callback\n");
//---------------------------------------------------------
// process
-// process one audio buffer at position "_pos "
+// process one audio buffer at position "_seqTime._pos "
// of size "frames"
//---------------------------------------------------------
void Audio::process(unsigned frames, int jackState)
{
+ _seqTime.lastFrameTime = audioDriver->lastFrameTime();
+
extern int watchAudio;
++watchAudio; // make a simple watchdog happy
@@ -355,7 +333,6 @@ void Audio::process(unsigned frames, int jackState)
return;
}
- unsigned framePos = _pos.frame();
if (state == PLAY) {
//
// clear prefetch FIFO if left/right locators
@@ -369,21 +346,21 @@ void Audio::process(unsigned frames, int jackState)
// invalidate audio prefetch buffer
//
audioPrefetch->getFifo()->clear();
- audioPrefetch->msgSeek(framePos);
+ audioPrefetch->msgSeek(_seqTime.startFrame());
lmark = llmark;
rmark = rrmark;
}
}
if (isPlaying()) {
- if (_bounce == 1 && _pos >= song->rPos()) {
+ if (_bounce == 1 && _seqTime.pos >= song->rPos()) {
_bounce = 2;
sendMsgToGui(MSG_STOP_BOUNCE);
}
//
// check for end of song
//
- if ((_curTickPos >= song->len())
+ if ((_seqTime.curTickPos >= song->len())
&& !(song->record() || _bounce || song->loop())) {
audioDriver->stopTransport();
return;
@@ -393,7 +370,7 @@ void Audio::process(unsigned frames, int jackState)
// check for loop end
//
if (state == PLAY && song->loop() && !_bounce && !extSyncFlag) {
- unsigned n = rmark - framePos - (3 * frames);
+ unsigned n = rmark - _seqTime.startFrame() - (3 * frames);
if (n < frames) {
// loop end in current cycle
// adjust loop start so we get exact loop len
@@ -405,9 +382,9 @@ void Audio::process(unsigned frames, int jackState)
}
}
- Pos ppp(_pos);
+ Pos ppp(_seqTime.pos);
ppp += frames;
- _nextTickPos = ppp.tick();
+ _seqTime.nextTickPos = ppp.tick();
}
//
@@ -426,7 +403,7 @@ void Audio::process(unsigned frames, int jackState)
CtrlList* cl = track->controller();
for (iCtrl i = cl->begin(); i != cl->end(); ++i) {
Ctrl* c = i->second;
- float val = c->value(framePos).f;
+ float val = c->value(_seqTime.startFrame()).f;
if (val != c->curVal().f) {
c->setCurVal(val);
c->setChanged(true);
@@ -439,8 +416,6 @@ void Audio::process(unsigned frames, int jackState)
// process midi
//-----------------------------------------
- unsigned startFrame = _pos.frame();
- unsigned endFrame = startFrame + segmentSize;
SynthIList* sl = song->syntis();
{
MidiOutPortList* ol = song->midiOutPorts();
@@ -453,11 +428,11 @@ void Audio::process(unsigned frames, int jackState)
for (iMidiInPort i = mil->begin(); i != mil->end(); ++i)
(*i)->beforeProcess();
for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i)
- (*i)->processMidi(_curTickPos, _nextTickPos, startFrame, endFrame);
+ (*i)->processMidi(&_seqTime);
for (iMidiOutPort i = ol->begin(); i != ol->end(); ++i)
- (*i)->processMidi(_curTickPos, _nextTickPos, startFrame, endFrame);
+ (*i)->processMidi(&_seqTime);
for (iSynthI i = sl->begin(); i != sl->end(); ++i)
- (*i)->processMidi(_curTickPos, _nextTickPos, startFrame, endFrame);
+ (*i)->processMidi(&_seqTime);
for (iMidiInPort i = mil->begin(); i != mil->end(); ++i)
(*i)->afterProcess();
@@ -480,26 +455,26 @@ void Audio::process(unsigned frames, int jackState)
if (isPlaying() && !wl->empty()) {
Fifo1* fifo = audioPrefetch->getFifo();
if (fifo->count() == 0) {
- printf("MusE::Audio: fifo underflow at 0x%x\n", _curTickPos);
+ printf("MusE::Audio: fifo underflow at 0x%x\n", _seqTime.curTickPos);
audioPrefetch->msgTick();
}
else {
bool msg = true;
do {
unsigned fifoPos = fifo->readPos();
- if (fifoPos == framePos) {
+ if (fifoPos == _seqTime.startFrame()) {
_curReadIndex = fifo->readIndex();
break;
}
else {
if (msg) {
printf("Muse::Audio: wrong prefetch data 0x%x, expected 0x%x\n",
- fifoPos, framePos);
+ fifoPos, _seqTime.startFrame());
msg = false;
}
- if (fifoPos > framePos) {
+ if (fifoPos > _seqTime.startFrame()) {
// discard whole prefetch buffer
- seek(_pos + frames);
+ seek(_seqTime.pos + frames);
break;
}
fifo->pop(); // discard buffer
@@ -513,7 +488,7 @@ void Audio::process(unsigned frames, int jackState)
}
for (iAudioGroup i = gl->begin(); i != gl->end(); ++i)
(*i)->process();
-
+
OutputList* aol = song->outputs();
for (iAudioOutput i = aol->begin(); i != aol->end(); ++i)
(*i)->process();
@@ -533,8 +508,8 @@ void Audio::process(unsigned frames, int jackState)
}
if (recording && (_bounce == 0 || _bounce == 1))
audioWriteback->trigger();
- _pos += frames;
- _curTickPos = _nextTickPos;
+ _seqTime.pos += frames;
+ _seqTime.curTickPos = _seqTime.nextTickPos;
}
midiDriver->updateConnections();
}
@@ -585,7 +560,7 @@ void Audio::processMsg()
case SEQM_SET_TEMPO:
song->processMsg(msg);
if (isPlaying())
- _pos.setTick(_curTickPos);
+ _seqTime.pos.setTick(_seqTime.curTickPos);
break;
case SEQM_IDLE:
@@ -613,21 +588,21 @@ void Audio::processMsg()
void Audio::seek(const Pos& p)
{
- _pos.setFrame(p.frame());
- _curTickPos = _pos.tick();
- _nextTickPos = _curTickPos;
+ _seqTime.pos.setFrame(p.frame());
+ _seqTime.curTickPos = _seqTime.pos.tick();
+ _seqTime.nextTickPos = _seqTime.curTickPos;
updateController = true;
loopPassed = true; // for record loop mode
if (state != LOOP2 && !freewheel())
- audioPrefetch->msgSeek(_pos.frame());
+ audioPrefetch->msgSeek(_seqTime.pos.frame());
MidiOutPortList* ol = song->midiOutPorts();
for (iMidiOutPort i = ol->begin(); i != ol->end(); ++i)
- (*i)->seek(_curTickPos, _pos.frame());
+ (*i)->seek(_seqTime.curTickPos, _seqTime.pos.frame());
SynthIList* sl = song->syntis();
for (iSynthI i = sl->begin(); i != sl->end(); ++i)
- (*i)->seek(_curTickPos, _pos.frame());
+ (*i)->seek(_seqTime.curTickPos, _seqTime.pos.frame());
sendMsgToGui(MSG_SEEK);
}
@@ -637,9 +612,9 @@ void Audio::seek(const Pos& p)
void Audio::startRolling()
{
- startRecordPos = _pos;
+ startRecordPos = _seqTime.pos;
if (song->record()) {
- startRecordPos = _pos;
+ startRecordPos = _seqTime.pos;
recording = true;
TrackList* tracks = song->tracks();
for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
@@ -657,36 +632,6 @@ void Audio::startRolling()
SynthIList* sl = song->syntis();
for (iSynthI i = sl->begin(); i != sl->end(); ++i)
(*i)->start();
-
- if (precountEnableFlag
- && song->click()
- && !extSyncFlag
- && song->record()) {
-#if 0
- state = PRECOUNT;
- int z, n;
- if (precountFromMastertrackFlag)
- AL::sigmap.timesig(playTickPos, z, n);
- else {
- z = precountSigZ;
- n = precountSigN;
- }
- clickno = z * preMeasures;
- clicksMeasure = z;
- ticksBeat = (division * 4)/n;
-#endif
- }
- else {
- //
- // compute next midi metronome click position
- //
- int bar, beat;
- unsigned tick;
- AL::sigmap.tickValues(_curTickPos, &bar, &beat, &tick);
- if (tick)
- beat += 1;
- midiClick = AL::sigmap.bar2tick(bar, beat, 0);
- }
}
//---------------------------------------------------------
@@ -705,10 +650,10 @@ void Audio::stopRolling()
(*i)->stop();
recording = false;
- endRecordPos = _pos;
+ endRecordPos = _seqTime.pos;
_bounce = 0;
sendMsgToGui(MSG_STOP);
- seek(_pos);
+ seek(_seqTime.pos);
}
//---------------------------------------------------------
@@ -720,14 +665,3 @@ void Audio::sendMsgToGui(char c)
write(sigFd, &c, 1);
}
-//---------------------------------------------------------
-// timestamp
-// on stop we return a free running frame counter
-//---------------------------------------------------------
-
-unsigned Audio::timestamp() const
- {
- return audio->isPlaying() ? audioDriver->framePos()
- : audioDriver->frameTime();
- }
-
diff --git a/muse/muse/audio.h b/muse/muse/audio.h
index 56c85f05..1d248f03 100644
--- a/muse/muse/audio.h
+++ b/muse/muse/audio.h
@@ -24,6 +24,7 @@
#include "thread.h"
#include "midievent.h"
#include "route.h"
+#include "al/tempo.h"
#include "al/pos.h"
#include "event.h"
#include "ctrl.h"
@@ -138,6 +139,39 @@ struct AudioMsg : public ThreadMsg { // this should be an union
class AudioOutput;
+
+//---------------------------------------------------------
+// SeqTime
+// timing information for sequencer cycle
+//---------------------------------------------------------
+
+extern unsigned int segmentSize;
+
+struct SeqTime {
+ unsigned lastFrameTime; // free running counter
+
+ // transport values for current cycle:
+ 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 startFrame() const { return pos.frame(); }
+ unsigned endFrame() const { return startFrame() + segmentSize; }
+
+ //---------------------------------------------------------
+ // tick2frame
+ // translate from tick to frameTime, this event has to
+ // be scheduled
+ //---------------------------------------------------------
+
+ unsigned tick2frame(unsigned tick) {
+ return AL::tempomap.tick2frame(tick) - pos.frame() + lastFrameTime + segmentSize;
+ }
+ unsigned frame2tick(unsigned frame) {
+ return AL::tempomap.frame2tick(frame - lastFrameTime + pos.frame());
+ }
+ };
+
//---------------------------------------------------------
// Audio
//---------------------------------------------------------
@@ -156,18 +190,12 @@ class Audio {
unsigned lmark; // left loop position
unsigned rmark; // right loop position
- Pos _pos; // current play position
+ SeqTime _seqTime;
+ Pos startRecordPos;
+ Pos endRecordPos;
- 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
- unsigned midiClick;
- int clickno; // precount values
- int clicksMeasure;
- int ticksBeat;
-
State state;
bool updateController;
@@ -190,9 +218,6 @@ class Audio {
Audio();
virtual ~Audio() {}
- Pos startRecordPos;
- Pos endRecordPos;
-
void process(unsigned frames, int jackState);
bool sync(int state, unsigned frame);
void shutdown();
@@ -253,13 +278,9 @@ class Audio {
void msgRemoveController(Track*, int id, unsigned time);
void msgSetRtc();
- const Pos& pos() const { return _pos; }
const Pos& getStartRecordPos() const { return startRecordPos; }
const Pos& getEndRecordPos() const { return endRecordPos; }
- int curTickPos() const { return _curTickPos; }
- int nextTickPos() const { return _nextTickPos; }
-
bool freewheel() const { return _freewheel; }
void setFreewheel(bool val);
@@ -267,8 +288,9 @@ class Audio {
bool bounce() const { return _bounce != 0; }
MidiEvent* getMidiEvent();
void popMidiEvent();
- int curReadIndex() const { return _curReadIndex; }
- unsigned timestamp() const;
+ int curReadIndex() const { return _curReadIndex; }
+
+ const SeqTime* seqTime() const { return &_seqTime; }
};
extern int processAudio(unsigned long, void*);
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index 36efd4b3..2d01e42d 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -326,7 +326,7 @@ void AudioTrack::readRecfile(QDomNode node)
void AudioTrack::putFifo(int channels, unsigned long n, float** bp)
{
- if (fifo.put(channels, n, bp, audio->pos().frame())) {
+ if (fifo.put(channels, n, bp, audio->seqTime()->pos.frame())) {
printf("AudioTrack(%s)::putFifo(): overrun\n", name().toAscii().data());
}
}
diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp
index e53ea2c5..50c82950 100644
--- a/muse/muse/conf.cpp
+++ b/muse/muse/conf.cpp
@@ -260,6 +260,8 @@ void readConfiguration(QDomNode node)
config.projectPath = s;
else if (tag == "templatePath")
config.templatePath = s;
+ else if (tag == "instrumentPath")
+ config.instrumentPath = s;
else if (tag == "importMidiPath") {
config.importMidiPath = s;
lastMidiPath = museUser + "/" + s;
diff --git a/muse/muse/ctrl/ctrleditor.cpp b/muse/muse/ctrl/ctrleditor.cpp
index 1db70375..89e0fd89 100644
--- a/muse/muse/ctrl/ctrleditor.cpp
+++ b/muse/muse/ctrl/ctrleditor.cpp
@@ -212,8 +212,10 @@ void CtrlEditor::paint(QPainter& p, const QRect& r)
// mousePress
//---------------------------------------------------------
-void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers modifiers)
+void CtrlEditor::mousePress(const QPoint& pos, QMouseEvent* me)
{
+ int button = me->button();
+ Qt::KeyboardModifiers modifiers = me->modifiers();
Tool tool = tc()->tool();
if (button & Qt::RightButton) {
QMenu pop(tc());
@@ -232,10 +234,10 @@ void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers
a = pop.addAction("List Editor");
a->setData(1 << (TOOLS+1));
- a = pop.exec(tc()->mapToGlobal(pos));
+ a = pop.exec(me->globalPos());
if (a) {
int n = a->data().toInt();
- if (n == (1 << (TOOLS+1))) {
+ if (n == (1 << (TOOLS+1))) {
Pos t(tc()->pix2pos(pos.x()));
muse->showListEditor(t, track(), ctrl());
}
diff --git a/muse/muse/ctrl/ctrleditor.h b/muse/muse/ctrl/ctrleditor.h
index ecec5e1d..97f12861 100644
--- a/muse/muse/ctrl/ctrleditor.h
+++ b/muse/muse/ctrl/ctrleditor.h
@@ -62,7 +62,7 @@ class CtrlEditor {
virtual ~CtrlEditor() {}
void paint(QPainter& p, const QRect& r);
void setDrawCtrlName(bool val) { _drawCtrlName = val; }
- void mousePress(const QPoint&, int, Qt::KeyboardModifiers);
+ void mousePress(const QPoint&, QMouseEvent*);
void mouseRelease();
void mouseMove(const QPoint& pos);
};
diff --git a/muse/muse/driver/audiodev.h b/muse/muse/driver/audiodev.h
index e0bf554d..55830c14 100644
--- a/muse/muse/driver/audiodev.h
+++ b/muse/muse/driver/audiodev.h
@@ -36,9 +36,9 @@ class AudioDriver : public Driver {
virtual void start(int priority) = 0;
virtual bool restart() { return false; } // return true on error
virtual void stop () = 0;
-// virtual unsigned getCurFrame() = 0;
- virtual unsigned framePos() const = 0;
+ virtual unsigned curFrame() const = 0;
virtual unsigned frameTime() const = 0;
+ virtual unsigned lastFrameTime() const = 0;
virtual float* getBuffer(Port, unsigned long nframes) = 0;
virtual void registerClient() = 0;
virtual Port registerOutPort(const QString& name, bool midi) = 0;
diff --git a/muse/muse/driver/dummyaudio.cpp b/muse/muse/driver/dummyaudio.cpp
index 85997824..143b7918 100644
--- a/muse/muse/driver/dummyaudio.cpp
+++ b/muse/muse/driver/dummyaudio.cpp
@@ -54,12 +54,13 @@ class DummyAudio : public AudioDriver {
virtual bool init() { return true; }
virtual void start(int);
virtual void stop ();
- virtual unsigned framePos() const {
- return lrint((curTime()-startTime) * AL::sampleRate);
- }
virtual unsigned frameTime() const {
return lrint(curTime() * AL::sampleRate);
}
+ virtual unsigned lastFrameTime() const {
+ return lrint(startTime * AL::sampleRate);
+ }
+ virtual unsigned curFrame() const { return pos; }
virtual float* getBuffer(Port /*port*/, unsigned long nframes)
{
@@ -131,7 +132,6 @@ class DummyAudio : public AudioDriver {
else
return QString(iPorts[port.alsaPort() - 30]);
}
- virtual unsigned getCurFrame() { return pos; }
virtual int realtimePriority() const { return 40; }
virtual void startTransport() {
state = Audio::PLAY;
@@ -215,7 +215,7 @@ static void* dummyLoop(void*)
if ((policy = sched_getscheduler (0)) < 0) {
printf("cannot get current client scheduler for audio dummy thread: %s!\n", strerror(errno));
}
- else
+ else
{
if (policy != SCHED_FIFO)
printf("audio dummy thread _NOT_ running SCHED_FIFO\n");
diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp
index c67a42d9..4a8a6548 100644
--- a/muse/muse/driver/jack.cpp
+++ b/muse/muse/driver/jack.cpp
@@ -117,14 +117,14 @@ int JackAudio::getTransportState()
int jackState;
transportState = jack_transport_query(_client, &pos);
switch (jackAudio->transportState) {
- case JackTransportStopped:
+ case JackTransportStopped:
jackState = Audio::STOP;
break;
case JackTransportLooping:
- case JackTransportRolling:
+ case JackTransportRolling:
jackState = Audio::PLAY;
break;
- case JackTransportStarting:
+ case JackTransportStarting:
jackState = Audio::START_PLAY;
break;
default:
@@ -374,7 +374,7 @@ void JackAudio::graphChanged()
foreach(Route r, ra)
audio->msgAddRoute1(r);
rr.clear();
- ra.clear();
+ ra.clear();
OutputList* ol = song->outputs();
for (iAudioOutput ii = ol->begin(); ii != ol->end(); ++ii) {
@@ -473,7 +473,7 @@ void JackAudio::registerClient()
//---------------------------------------------------------
// registerInPort
//---------------------------------------------------------
-
+
Port JackAudio::registerInPort(const QString& name, bool midi)
{
const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
@@ -806,21 +806,14 @@ void JackAudio::putEvent(Port port, const MidiEvent& e)
e.dump();
}
void* pb = jack_port_get_buffer(port.jackPort(), segmentSize);
- unsigned ft;
- if (transportState == JackTransportRolling) {
- ft = e.time() - pos.frame;
- if (pos.frame > e.time()) {
-printf("time < 0 -- %d\n", pos.frame - e.time());
+ int ft = e.time() - lastFrameTime();
+ if (ft < 0 || ft >= segmentSize) {
+ printf("JackAudio::putEvent: time out of range %d\n", ft);
+ if (ft < 0)
ft = 0;
- }
- else if (ft >= segmentSize) {
+ if (ft > segmentSize)
ft = segmentSize - 1;
-printf("time >= segmentSize -- %d\n", segmentSize - ft);
- }
}
- else
- ft = 0;
-
switch(e.type()) {
case ME_NOTEON:
case ME_NOTEOFF:
@@ -838,7 +831,7 @@ printf("time >= segmentSize -- %d\n", segmentSize - ft);
p[2] = e.dataB();
}
break;
-
+
case ME_PROGRAM:
case ME_AFTERTOUCH:
{
diff --git a/muse/muse/driver/jackaudio.h b/muse/muse/driver/jackaudio.h
index c6835c0e..0322b3b8 100644
--- a/muse/muse/driver/jackaudio.h
+++ b/muse/muse/driver/jackaudio.h
@@ -78,10 +78,9 @@ class JackAudio : public AudioDriver {
virtual void putEvent(Port, const MidiEvent&);
virtual void startMidiCycle(Port);
- virtual unsigned framePos() const {
- return pos.frame + jack_frames_since_cycle_start(_client);
- }
- virtual unsigned frameTime() const { return jack_frame_time(_client); }
+ virtual unsigned lastFrameTime() const { return jack_last_frame_time(_client); }
+ virtual unsigned frameTime() const { return jack_frame_time(_client); }
+ virtual unsigned curFrame() const { return pos.frame; }
};
#endif
diff --git a/muse/muse/globals.cpp b/muse/muse/globals.cpp
index ca51a659..e919b933 100644
--- a/muse/muse/globals.cpp
+++ b/muse/muse/globals.cpp
@@ -129,17 +129,6 @@ QAction* punchoutAction;
QAction* recordAction;
QAction* panicAction;
-int preMeasures = 2;
-bool precountEnableFlag = false;
-bool precountFromMastertrackFlag = false;
-int precountSigZ = 4;
-int precountSigN = 4;
-bool precountPrerecord = false;
-bool precountPreroll = false;
-bool midiClickFlag = true;
-bool audioClickFlag = true;
-double audioClickVolume = 0.1f;
-
bool rcEnable = false;
bool midiSeqRunning = false;
diff --git a/muse/muse/globals.h b/muse/muse/globals.h
index fefa7311..eaf121d8 100644
--- a/muse/muse/globals.h
+++ b/muse/muse/globals.h
@@ -81,17 +81,6 @@ extern QAction* punchoutAction;
extern QAction* recordAction;
extern QAction* panicAction;
-extern int preMeasures;
-extern bool precountEnableFlag;
-extern bool precountFromMastertrackFlag;
-extern int precountSigZ;
-extern int precountSigN;
-extern bool precountPrerecord;
-extern bool precountPreroll;
-extern bool midiClickFlag;
-extern bool audioClickFlag;
-extern double audioClickVolume;
-
extern bool rcEnable;
#endif
diff --git a/muse/muse/midiedit/ecanvas.cpp b/muse/muse/midiedit/ecanvas.cpp
index ae99db11..965bbaa7 100644
--- a/muse/muse/midiedit/ecanvas.cpp
+++ b/muse/muse/midiedit/ecanvas.cpp
@@ -439,7 +439,7 @@ void EventCanvas::mousePressCanvasA(QMouseEvent* me)
if (curItem) {
drag = DRAG_RESIZE;
setCursor();
-
+
Pos p1(curItem->bbox.x(), timeType());
Pos p2(pix2pos(start.x()));
int w = p2.time(timeType()) - p1.time(timeType());
@@ -1180,7 +1180,7 @@ void EventCanvas::mousePress(QMouseEvent* me)
QRect r(rCanvasB.x(), rCanvasB.y() + c->y + splitWidth,
rCanvasB.width(), c->cheight());
if (r.contains(pos)) {
- c->mousePress(pos - r.topLeft(), me->button(), me->modifiers());
+ c->mousePress(pos - r.topLeft(), me);
break;
}
}
diff --git a/muse/muse/midiinport.cpp b/muse/muse/midiinport.cpp
index 878a5797..19365be6 100644
--- a/muse/muse/midiinport.cpp
+++ b/muse/muse/midiinport.cpp
@@ -102,7 +102,16 @@ void MidiInPort::eventReceived(snd_seq_event_t* ev)
{
MidiEvent event;
event.setB(0);
- event.setTime(audio->timestamp());
+ //
+ // move all events 2*segmentSize into the future to get
+ // jitterfree playback
+ //
+ // cycle n-1 n n+1
+ // -+----------+----------+----------+-
+ // ^ ^ ^
+ // catch process play
+ //
+ event.setTime(audioDriver->frameTime() + 2 * segmentSize);
switch(ev->type) {
case SND_SEQ_EVENT_NOTEON:
@@ -171,7 +180,7 @@ void MidiInPort::eventReceived(snd_seq_event_t* ev)
MidiEventList il, ol;
il.insert(event);
- pipeline()->apply(audio->curTickPos(), audio->nextTickPos(), &il, &ol);
+ pipeline()->apply(audio->seqTime()->curTickPos, audio->seqTime()->nextTickPos, &il, &ol);
//
// update midi activity
@@ -223,7 +232,7 @@ void MidiInPort::beforeProcess()
// getEvents
// called from jack process context
// This method can be called multiple times in a process
-// cycle so we have to empty the fifo at
+// cycle so we have to empty the fifo at
// "afterProcess()".
//---------------------------------------------------------
@@ -247,7 +256,7 @@ bool MidiInPort::checkActivity(int channel)
{
if (activity[channel])
--activity[channel];
- return activity[channel] != 0;
+ return activity[channel] != 0;
}
//---------------------------------------------------------
diff --git a/muse/muse/midiout.cpp b/muse/muse/midiout.cpp
index 0f0af9d7..db9789c3 100644
--- a/muse/muse/midiout.cpp
+++ b/muse/muse/midiout.cpp
@@ -245,8 +245,6 @@ void MidiOut::seek(unsigned tickPos, unsigned framePos)
void MidiOut::stop()
{
- int frame = AL::tempomap.tick2frame(audio->curTickPos());
-
//---------------------------------------------------
// stop all notes
//---------------------------------------------------
@@ -254,7 +252,7 @@ void MidiOut::stop()
for (iMidiEvent i = _schedEvents.begin(); i != _schedEvents.end(); ++i) {
MidiEvent ev = *i;
if (ev.isNoteOff()) {
- ev.setTime(frame);
+ ev.setTime(0);
track->routeEvent(ev);
}
}
@@ -288,7 +286,8 @@ void MidiOut::stop()
0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01,
0, 0, 0, 0, 0
};
- MTC mtc(double(frame) / double(AL::sampleRate));
+ double frame = double(audio->seqTime()->pos.frame());
+ MTC mtc(frame / double(AL::sampleRate));
mmcPos[6] = mtc.h() | (AL::mtcType << 5);
mmcPos[7] = mtc.m();
mmcPos[8] = mtc.s();
@@ -301,7 +300,7 @@ void MidiOut::stop()
// send STOP and
// "set song position pointer"
sendStop();
- sendSongpos(audio->curTickPos() * 4 / config.division);
+ sendSongpos(audio->seqTime()->curTickPos * 4 / config.division);
}
}
}
@@ -319,7 +318,7 @@ void MidiOut::start()
if (genMMC)
sendSysex(mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
if (genMCSync) {
- if (audio->curTickPos())
+ if (audio->seqTime()->curTickPos)
sendContinue();
else
sendStart();
@@ -353,23 +352,22 @@ void MidiOut::reset()
// note off events. The note off events maybe played later after the
// current process cycle.
// From _schedEvents queue copy all events for the current cycle
-// to all output routes. Events routed to ALSA go into the
+// to all output routes. Events routed to ALSA go into the
// _playEvents queue which is processed by the MidiSeq thread.
//-------------------------------------------------------------------
-void MidiOut::processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
- unsigned, unsigned)
+void MidiOut::processMidi(MidiEventList& el, const SeqTime* time)
{
while (!eventFifo.isEmpty())
el.insert(eventFifo.get());
// collect port controller
- if (track->autoRead() && (fromTick != toTick)) { // if rolling
+ if (track->autoRead() && (time->curTickPos != time->nextTickPos)) { // if rolling
CtrlList* cl = track->controller();
for (iCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
Ctrl* c = ic->second;
- iCtrlVal is = c->lowerBound(fromTick);
- iCtrlVal ie = c->lowerBound(toTick);
+ iCtrlVal is = c->lowerBound(time->curTickPos);
+ iCtrlVal ie = c->lowerBound(time->nextTickPos);
for (iCtrlVal ic = is; ic != ie; ++ic) {
unsigned frame = AL::tempomap.tick2frame(ic.key());
MidiEvent ev(frame, -1, ME_CONTROLLER, c->id(), ic.value().i);
@@ -384,7 +382,7 @@ void MidiOut::processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
if (t->isMute())
continue;
MidiEventList ell;
- t->getEvents(fromTick, toTick, r.src.channel, &ell);
+ t->getEvents(time->curTickPos, time->nextTickPos, r.src.channel, &ell);
int velo = 0;
for (iMidiEvent i = ell.begin(); i != ell.end(); ++i) {
MidiEvent ev(*i);
diff --git a/muse/muse/midiout.h b/muse/muse/midiout.h
index 75e9cbd6..8bf25261 100644
--- a/muse/muse/midiout.h
+++ b/muse/muse/midiout.h
@@ -25,6 +25,7 @@
class Track;
class MidiInstrument;
+class SeqTime;
//---------------------------------------------------------
// MidiOut
@@ -43,8 +44,7 @@ class MidiOut
MidiFifo eventFifo;
MidiOut();
- void processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
- unsigned fromFrame, unsigned toFrame);
+ void processMidi(MidiEventList&, const SeqTime*);
void seek(unsigned, unsigned);
void stop();
diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp
index 96984d48..a9cf9438 100644
--- a/muse/muse/midioutport.cpp
+++ b/muse/muse/midioutport.cpp
@@ -376,28 +376,30 @@ void MidiSeq::processMidiClock()
// note off events. The note off events maybe played after the
// current process cycle.
// From _schedEvents queue copy all events for the current cycle
-// to all output routes. Events routed to ALSA go into the
+// to all output routes. Events routed to ALSA go into the
// _playEvents queue which is processed by the MidiSeq thread.
//-------------------------------------------------------------------
-void MidiOutPort::processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame)
+void MidiOutPort::processMidi(const SeqTime* t)
{
if (track->mute())
return;
MidiEventList el;
- MidiOut::processMidi(el, fromTick, toTick, fromFrame, toFrame);
+ MidiOut::processMidi(el, t);
- pipeline()->apply(fromTick, toTick, &el, &_schedEvents);
+ pipeline()->apply(t->curTickPos, t->nextTickPos, &el, &_schedEvents);
//
// route events to destination
//
- int portVelo = 0;
- iMidiEvent i = _schedEvents.begin();
+ int portVelo = 0;
+ unsigned endFrame = t->lastFrameTime + segmentSize;
+ iMidiEvent i = _schedEvents.begin();
+
for (; i != _schedEvents.end(); ++i) {
- if (i->time() >= toFrame)
+ if (i->time() >= endFrame)
break;
routeEvent(*i);
if (i->type() == ME_NOTEON)
diff --git a/muse/muse/midioutport.h b/muse/muse/midioutport.h
index e77af2e5..31529349 100644
--- a/muse/muse/midioutport.h
+++ b/muse/muse/midioutport.h
@@ -24,6 +24,8 @@
#include "miditrackbase.h"
#include "midiout.h"
+struct SeqTime;
+
//---------------------------------------------------------
// MidiOutPort
//---------------------------------------------------------
@@ -57,7 +59,7 @@ class MidiOutPort : public MidiTrackBase, public MidiOut {
bool guiVisible() const;
bool hasGui() const;
- virtual void processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame);
+ virtual void processMidi(const SeqTime*);
};
typedef QList<MidiOutPort*> MidiOutPortList;
diff --git a/muse/muse/midiseq.cpp b/muse/muse/midiseq.cpp
index 205066ac..bfb03283 100644
--- a/muse/muse/midiseq.cpp
+++ b/muse/muse/midiseq.cpp
@@ -193,6 +193,8 @@ bool MidiSeq::start(int prio)
//---------------------------------------------------------
// midiTick
// schedule events in playEvents
+// "now" is the free running audioDriver->frameTime()
+// frame counter
//---------------------------------------------------------
void MidiSeq::midiTick(void* p, void*)
@@ -207,10 +209,9 @@ void MidiSeq::midiTick(void* p, void*)
at->playEvents.insert(at->fifo.get());
//
- // schedule all events upto framePos-segmentSize
- // (previous segment)
+ // schedule all events upto curFrame()
//
- unsigned curFrame = audioDriver->framePos() - segmentSize;
+ unsigned curFrame = audioDriver->frameTime();
iMidiOutEvent i = at->playEvents.begin();
for (; i != at->playEvents.end(); ++i) {
if (i->event.time() > curFrame)
diff --git a/muse/muse/miditrack.cpp b/muse/muse/miditrack.cpp
index 29319acf..b86aa904 100644
--- a/muse/muse/miditrack.cpp
+++ b/muse/muse/miditrack.cpp
@@ -409,7 +409,7 @@ void MidiTrack::stopRecording()
if (recordPart->lenTick() < (cpos-ptick)) {
//
// TODO: check for events outside part boundaries
- //
+ //
int endTick = song->roundUpBar(cpos);
recordPart->setLenTick(endTick - ptick);
}
@@ -476,13 +476,13 @@ bool MidiTrack::isMute() const
// processMidi
//---------------------------------------------------------
-void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
+void MidiTrack::processMidi(SeqTime* t)
{
schedEvents.clear();
//
// collect events only when transport is rolling
//
- if (from < to) {
+ if (t->curTickPos < t->nextTickPos) {
for (iPart p = parts()->begin(); p != parts()->end(); ++p) {
Part* part = p->second;
if (part->mute())
@@ -490,20 +490,20 @@ void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
DrumMap* dm = drumMap();
unsigned offset = _delay + part->tick();
- if (offset > to)
+ if (offset > t->nextTickPos)
break;
EventList* events = part->events();
- iEvent ie = events->lower_bound((offset > from) ? 0 : from - offset);
- iEvent iend = events->lower_bound(to - offset);
+ iEvent ie = events->lower_bound((offset > t->curTickPos) ? 0 : t->curTickPos - offset);
+ iEvent iend = events->lower_bound(t->nextTickPos - offset);
for (; ie != iend; ++ie) {
Event ev = ie->second;
if (ev.type() == Meta) // ignore meta events
continue;
unsigned tick = ev.tick() + offset;
- unsigned frame = AL::tempomap.tick2frame(tick);
+ unsigned frame = t->tick2frame(tick);
if (ev.type() == Note) {
if (dm) {
if (dm->entry(dm->outmap(ev.pitch()))->mute)
@@ -530,7 +530,7 @@ void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
elen = 1;
int veloOff = ev.veloOff();
- unsigned eframe = AL::tempomap.tick2frame(tick+elen);
+ unsigned eframe = t->tick2frame(tick+elen);
schedEvents.insert(MidiEvent(frame, 0, ME_NOTEON, pitch, velo));
schedEvents.insert(MidiEvent(eframe, 0, veloOff ? ME_NOTEOFF : ME_NOTEON, pitch, veloOff));
_meter[0] += velo/2;
@@ -548,10 +548,10 @@ void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
if (autoRead()) {
for (iCtrl ic = controller()->begin(); ic != controller()->end(); ++ic) {
Ctrl* c = ic->second;
- iCtrlVal is = c->lowerBound(from);
- iCtrlVal ie = c->lowerBound(to);
+ iCtrlVal is = c->lowerBound(t->curTickPos);
+ iCtrlVal ie = c->lowerBound(t->nextTickPos);
for (iCtrlVal ic = is; ic != ie; ++ic) {
- unsigned frame = AL::tempomap.tick2frame(ic.key());
+ unsigned frame = t->tick2frame(ic.key());
Event ev(Controller);
ev.setA(c->id());
ev.setB(ic.value().i);
@@ -571,13 +571,13 @@ void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
if (track->isMute())
continue;
MidiEventList el;
- track->getEvents(from, to, r.src.channel, &el);
+ track->getEvents(t->curTickPos, t->nextTickPos, r.src.channel, &el);
for (iMidiEvent ie = el.begin(); ie != el.end(); ++ie) {
MidiEvent event(*ie);
- int eventTime = event.time();
+ unsigned eventTime = event.time();
if (recordFlag() && audio->isRecording()) {
- unsigned time = AL::tempomap.frame2tick(eventTime);
+ unsigned time = t->frame2tick(eventTime);
event.setTime(time); // set tick time
recordFifo.put(event);
}
@@ -601,8 +601,6 @@ void MidiTrack::processMidi(unsigned from, unsigned to, unsigned, unsigned)
event.setB(velo);
}
}
- unsigned time = 0; // eventTime + segmentSize*(segmentCount-1);
- event.setTime(time);
schedEvents.insert(event);
}
}
diff --git a/muse/muse/miditrack.h b/muse/muse/miditrack.h
index 6aad602f..994c3c92 100644
--- a/muse/muse/miditrack.h
+++ b/muse/muse/miditrack.h
@@ -28,6 +28,7 @@
class Part;
class EventList;
class MidiOut;
+class SeqTime;
//---------------------------------------------------------
// MidiTrack
@@ -102,7 +103,7 @@ class MidiTrack : public MidiTrackBase {
virtual bool canRecord() const { return true; }
void playMidiEvent(MidiEvent*);
- virtual void processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame);
+ virtual void processMidi(SeqTime*);
virtual void getEvents(unsigned from, unsigned to, int channel, MidiEventList* dst);
bool useDrumMap() const { return _useDrumMap; }
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index 17d03fe3..01b09cb6 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -124,7 +124,9 @@ bool Song::addEvent(Event& event, Part* part)
}
}
}
- part->events()->add(event);
+ else {
+ part->events()->add(event);
+ }
return true;
}
@@ -697,7 +699,7 @@ void Song::beat()
{
updateFlags = 0;
if (audio->isPlaying()) {
- int tick = audio->curTickPos();
+ int tick = audio->seqTime()->curTickPos;
setPos(0, tick, true, false, true);
}
if (audio->isRecording()) {
@@ -1106,7 +1108,7 @@ void Song::seqSignal(int fd)
setRecord(true);
break;
case MSG_SEEK:
- setPos(0, audio->curTickPos(), true, false, !seekInProgress);
+ setPos(0, audio->seqTime()->curTickPos, true, false, !seekInProgress);
seekInProgress = false;
beat(); // update controller guis
break;
@@ -1166,7 +1168,7 @@ void Song::stopRolling()
for (iWaveTrack it = wl->begin(); it != wl->end(); ++it) {
WaveTrack* track = *it;
if (track->recordFlag() || bounceTrack == track) {
- track->stopRecording(audio->startRecordPos, audio->endRecordPos);
+ track->stopRecording(audio->getStartRecordPos(), audio->getEndRecordPos());
}
}
MidiTrackList* ml = midis();
@@ -1178,7 +1180,7 @@ void Song::stopRolling()
for (iAudioOutput io = ol->begin(); io != ol->end(); ++io) {
AudioOutput* ao = *io;
if (ao->recordFlag())
- ao->stopRecording(audio->startRecordPos, audio->endRecordPos);
+ ao->stopRecording(audio->getStartRecordPos(), audio->getEndRecordPos());
}
audio->msgIdle(false);
updateFlags |= SC_PART_MODIFIED;
@@ -1503,7 +1505,7 @@ void Song::restartJack()
" homepage which is available through the help menu)\n"
"\n"
"To proceed check the status of Jack and try to restart it and then .\n"
- "click on the Restart button."),
+ "click on the Restart button."),
"restart", "cancel", "save project"
);
if (btn == 0) {
diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp
index 1701c6df..ed56e1a0 100644
--- a/muse/muse/synth.cpp
+++ b/muse/muse/synth.cpp
@@ -35,6 +35,7 @@
#include "midiseq.h"
#include "midictrl.h"
#include "instruments/minstrument.h"
+#include "driver/audiodev.h"
std::vector<Synth*> synthis; // array of available synthis
@@ -402,7 +403,6 @@ void MessSynthIF::write(Xml& xml) const
if (len) {
xml.stag("midistate");
xml.stag(QString("event type=\"%1\" datalen=\"%2\"").arg(Sysex).arg(len));
- int col = 0;
xml.dump(len, p);
xml.etag("event");
xml.etag("midistate");
@@ -537,7 +537,7 @@ void MessSynthIF::getData(MidiEventList* el, unsigned pos, int ports, unsigned n
int frame = i->time();
if (frame >= endPos)
break;
- if (frame > curPos) {
+ if (frame > curPos) {
// Several following notes during same segmentsize?
_mess->process(buffer, curPos-pos, frame - curPos);
curPos = frame; // don't process this piece again
@@ -553,7 +553,7 @@ void MessSynthIF::getData(MidiEventList* el, unsigned pos, int ports, unsigned n
// this happens if the synth has stereo and we switch the
// channel to mono
- printf("MessSynthIF::getData - ports %d < channels %d\n",
+ printf("MessSynthIF::getData - ports %d < channels %d\n",
ports, channels());
}
}
@@ -584,9 +584,8 @@ bool MessSynthIF::putEvent(const MidiEvent& ev)
void SynthI::collectInputData()
{
bufferEmpty = false;
- unsigned pos = audio->isPlaying() ? audio->pos().frame()
- : audio->timestamp();
- _sif->getData(&_schedEvents, pos, channels(), segmentSize, buffer);
+ _sif->getData(&_schedEvents, audioDriver->frameTime(), channels(),
+ segmentSize, buffer);
}
//-------------------------------------------------------------------
@@ -597,10 +596,10 @@ void SynthI::collectInputData()
// current process cycle.
//-------------------------------------------------------------------
-void SynthI::processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame)
+void SynthI::processMidi(SeqTime* t)
{
if (mute())
return;
- MidiOut::processMidi(_schedEvents, fromTick, toTick, fromFrame, toFrame);
+ MidiOut::processMidi(_schedEvents, t);
}
diff --git a/muse/muse/synth.h b/muse/muse/synth.h
index 6d555233..cae9c417 100644
--- a/muse/muse/synth.h
+++ b/muse/muse/synth.h
@@ -119,7 +119,7 @@ class SynthIF {
class SynthI : public AudioTrack, public MidiOut, public MidiInstrument
{
Q_OBJECT
-
+
SynthIF* _sif;
protected:
@@ -179,7 +179,7 @@ class SynthI : public AudioTrack, public MidiOut, public MidiInstrument
void deactivate3();
bool isActivated() const { return synthesizer && _sif; }
virtual bool hasAuxSend() const { return _sif->hasAuxSend(); }
- virtual void processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame);
+ virtual void processMidi(SeqTime*);
virtual MidiOut* midiOut() { return this; }
virtual MidiInstrument* instrument() { return this; }
diff --git a/muse/muse/waveedit/waveview.cpp b/muse/muse/waveedit/waveview.cpp
index 14550c3d..eb5a744d 100644
--- a/muse/muse/waveedit/waveview.cpp
+++ b/muse/muse/waveedit/waveview.cpp
@@ -93,7 +93,7 @@ void WaveView::drawWavePart(QPainter& p, Part* wp, int y0, int th, int from, int
int samples = event.lenFrame();
int xScale = (samples + w/2)/w;
- int frame = pos.frame() - wp->frame()
+ int frame = pos.frame() - wp->frame()
- event.pos().frame() + event.spos();
if (h < 20) {
@@ -247,7 +247,7 @@ void WaveView::mousePress(QMouseEvent* me)
QRect r(rCanvasB.x(), rCanvasB.y() + c->y + splitWidth,
rCanvasB.width(), c->cheight());
if (r.contains(pos)) {
- c->mousePress(pos - r.topLeft(), me->button(), me->modifiers());
+ c->mousePress(pos - r.topLeft(), me);
break;
}
}
@@ -908,7 +908,7 @@ void WaveView::layout()
c->setHeight(sch);
layoutPanelB(c);
y += sch;
- }
+ }
}
//---------------------------------------------------------
@@ -926,7 +926,7 @@ void WaveView::layout1()
c->y = y;
y += c->height();
}
- resizeController(y);
+ resizeController(y);
}
//---------------------------------------------------------
@@ -970,7 +970,7 @@ void WaveView::addController(int id, int h)
{
ctrlHeight += h;
int n = ctrlEditList.size();
-
+
CtrlEdit* ce = new CtrlEdit(widget(), this, curPart->track());
ce->setHeight(h);
ce->setCtrl(id);
@@ -1026,7 +1026,7 @@ void WaveView::updatePartControllerList()
cc.ctrlId = (*i)->ctrlId;
cc.height = (*i)->height();
cl->push_back(cc);
- }
+ }
}
//---------------------------------------------------------
diff --git a/muse/muse/wavetrack.cpp b/muse/muse/wavetrack.cpp
index 9b7787a5..f4551f5a 100644
--- a/muse/muse/wavetrack.cpp
+++ b/muse/muse/wavetrack.cpp
@@ -364,7 +364,7 @@ void WaveTrack::process()
// record collected data for track
//
if (recordFlag() && audio->isRecording() && recFile()) {
- unsigned framePos = audio->pos().frame();
+ unsigned framePos = audio->seqTime()->pos.frame();
if (audio->freewheel()) {
// write data directly to file
_recFile->write(channels(), buffer, framePos);