Skip to content

Instantly share code, notes, and snippets.

@kfigiela
Created July 6, 2017 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfigiela/7f8fa0f942b8da0a7a37b0b163d79dc9 to your computer and use it in GitHub Desktop.
Save kfigiela/7f8fa0f942b8da0a7a37b0b163d79dc9 to your computer and use it in GitHub Desktop.
Traktor bar markers
diff --git a/Screens/Views/Waveform/Stripe.qml b/Screens/Views/Waveform/Stripe.qml
index 6561d2b..c3d9204 100755
--- a/Screens/Views/Waveform/Stripe.qml
+++ b/Screens/Views/Waveform/Stripe.qml
@@ -26,6 +26,7 @@ Traktor.Stripe {
AppProperty { id: trackLength; path: "app.traktor.decks." + (deckId + 1) + ".track.content.track_length" }
AppProperty { id: propTrackSampleLength; path: "app.traktor.decks." + (deckId + 1) + ".track.content.sample_count" }
+ AppProperty { id: trackBPM; path: "app.traktor.decks." + (deckId+1) + ".tempo.base_bpm" }
//--------------------------------------------------------------------------------------------------------------------
@@ -108,7 +109,7 @@ Traktor.Stripe {
Rectangle {
id: posIndicatorBox
- property int roundedX: (relativePlayPos * (parent.width - posIndicator.width) - 0.5*width)
+ property int roundedX: Math.floor((relativePlayPos * (stripe.width))) - 0.5*width
readonly property real relativePlayPos: elapsedTime.value / trackLength.value
AppProperty { id: elapsedTime; path: "app.traktor.decks." + (deckId+1) + ".track.player.elapsed_time" }
@@ -146,6 +147,25 @@ Traktor.Stripe {
}
}
+ Repeater {
+ model: 64
+ Rectangle {
+
+ property int roundedX: Math.floor((relativePlayPos * (stripe.width))) + Math.floor(barDelta)
+ readonly property real relativePlayPos: elapsedTime.value / trackLength.value
+ readonly property real barDelta: (index - 32) * (60.0*16.0 / trackBPM.value) / trackLength.value * (stripe.width)
+
+ x: roundedX
+ anchors.bottom: parent.bottom
+ height: (index % 2 == 0) ? 2 : 1
+ width: 1
+
+ radius: 1
+ color: Qt.rgba(0.5,0.5,0.5,1.0)
+ antialiasing: false
+
+ }
+ }
//--------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment