GUI: improve note input timing
during playback, it rounds to nearest cell now this greatly enhances the recording experience to-do: test on higher latencies and see if we have to compensate somehow...
This commit is contained in:
parent
6deee95d87
commit
ad8d1b5060
|
@ -2393,6 +2393,15 @@ void DivEngine::getPlayPos(int& order, int& row) {
|
|||
playPosLock.unlock();
|
||||
}
|
||||
|
||||
void DivEngine::getPlayPosTick(int& order, int& row, int& tick, int& speed) {
|
||||
playPosLock.lock();
|
||||
order=prevOrder;
|
||||
row=prevRow;
|
||||
tick=ticks;
|
||||
speed=nextSpeed;
|
||||
playPosLock.unlock();
|
||||
}
|
||||
|
||||
int DivEngine::getElapsedBars() {
|
||||
return elapsedBars;
|
||||
}
|
||||
|
|
|
@ -965,6 +965,7 @@ class DivEngine {
|
|||
|
||||
// synchronous get order/row
|
||||
void getPlayPos(int& order, int& row);
|
||||
void getPlayPosTick(int& order, int& row, int& tick, int& speed);
|
||||
|
||||
// get beat/bar
|
||||
int getElapsedBars();
|
||||
|
|
|
@ -1257,10 +1257,23 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
|
|||
int ch=cursor.xCoarse;
|
||||
int ord=curOrder;
|
||||
int y=cursor.y;
|
||||
int tick=0;
|
||||
int speed=0;
|
||||
|
||||
if (e->isPlaying()) {
|
||||
e->getPlayPos(ord,y);
|
||||
e->getPlayPosTick(ord,y,tick,speed);
|
||||
if (tick<=(speed/2)) { // round
|
||||
// TODO: detect 0Dxx/0Bxx?
|
||||
if (++y>=e->curSubSong->patLen) {
|
||||
y=0;
|
||||
if (++ord>=e->curSubSong->ordersLen) {
|
||||
ord=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logV("chan %d, %d:%d %d/%d",ch,ord,y,tick,speed);
|
||||
|
||||
DivPattern* pat=e->curPat[ch].getPattern(e->curOrders->ord[ch][ord],true);
|
||||
bool removeIns=false;
|
||||
|
|
Loading…
Reference in a new issue