Permalink
Browse files

-Fixed bug in Engine beat redraw, now syncs to JACK tempo

  • Loading branch information...
1 parent abd18bd commit 71e8f93de03fff80d3bafe428f040579429735c5 @harryhaaren harryhaaren committed Apr 14, 2012
Showing with 17 additions and 3 deletions.
  1. +1 −0 src/engineevent.cpp
  2. +3 −0 src/engineevent.hpp
  3. +5 −3 src/g_window.cpp
  4. +8 −0 src/time.cpp
View
@@ -24,6 +24,7 @@
void EngineEvent::addTrack (int newId){ ia = newId; type = EE_ADD_TRACK;}
void EngineEvent::setBpm (int bpm){ ia = bpm; type = EE_BPM;}
+void EngineEvent::setBeat (int beat){ ia = beat; type = EE_BEAT;}
void EngineEvent::setSceneNumber (int scene){ ia = scene; type = EE_SCENE_NUMBER;}
View
@@ -28,6 +28,7 @@ enum EngineEventType
EE_INVALID = 0,
EE_BPM,
+ EE_BEAT,
EE_SCENE_NUMBER,
@@ -116,6 +117,8 @@ class EngineEvent
void addTrack (int newId);
void setBpm (int bpm);
+ void setBeat (int beat);
+
void setSceneNumber (int scene);
void setAutomoveType (int track, int type);
View
@@ -441,13 +441,15 @@ int Window::handleEvent()
std::advance(i,e->ia);
(*i)->redraw();
}
+ else if ( e->type == EE_BEAT ) {
+ // update the new Beat to the GUI
+ masterProgress.setProgress( (e->ia % 4) / 4.f );
+ masterProgress.queue_draw();
+ }
else if ( e->type == EE_LOOPER_PROGRESS ) {
//cout << "Gui LOOPER_PROGRESS UID = " << e->ia << " value = " << e->fa << endl;
guiState.bufferAudioSourceState.at(e->ia).index = e->fa;
- // HACK, master progress should be updated independant of any looper
- masterProgress.setProgress(e->fa);
-
if ( e->ia < progressWidgetVector.size() )
{
progressWidgetVector.at(e->ia)->setValue( e->fa );
View
@@ -128,6 +128,14 @@ void Time::process(int frameNumber)
// here we handle *all* events that should occur on *a* beat
if ( newBeat != beat )
{
+ // send the new beat up to the GUI
+ EngineEvent* x = top->toEngineEmptyEventQueue.pull();
+ if ( x != 0 )
+ {
+ x->setBeat(newBeat);
+ top->toGuiQueue.push(x);
+ }
+
//cout << "Time:P() bpm = " << bpm << " FPB: " << framesPerBeat << " beat: " << newBeat << " Q1: " << q1.size() << " Q4: " << q4.size() << endl;
beat = newBeat;

0 comments on commit 71e8f93

Please sign in to comment.