commit c34a1639dd2e330969e33237a95bf42f809a7ab7
parent eba55005bb9b3b7212835e0d72c2cc2aeeab4a5d
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Wed, 15 Sep 2021 18:43:27 +0200
More work
Diffstat:
2 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/examples/plugins/gui/transport-proxy.cc b/examples/plugins/gui/transport-proxy.cc
@@ -5,7 +5,7 @@
TransportProxy::TransportProxy(QObject *parent) : QObject(parent) {}
void TransportProxy::update(bool hasTransport, const clap_event_transport &t) {
- update(_hasTransport, hasTransport, &TransportProxy::hasTransportChanged);
+ update<bool>(_hasTransport, hasTransport, &TransportProxy::hasTransportChanged);
update<bool>(_hasTempo, t.flags & CLAP_TRANSPORT_HAS_TEMPO, &TransportProxy::hasTempoChanged);
update<bool>(_hasBeatsTimeline,
diff --git a/examples/plugins/qml/transport-info/main.qml b/examples/plugins/qml/transport-info/main.qml
@@ -3,53 +3,60 @@ import QtQuick.Controls 2.1
import clap 1.0
Rectangle {
- width: 400
- height: 600
+ width: 450
+ height: 470
color: "#f8f8f8"
Text {
id: display
text: computeText()
+ font.pointSize: 20
}
function computeText() {
- var text = "Has transport: " + transport.hasTransport + "\n";
if (!transport.hasTransport)
- return text;
+ return "Free Running";
- text += "Is playing: " + transport.isPlaying + "\n";
- text += "Is recording: " + transport.isRecording + "\n";
- text += "Is loop active: " + transport.isLoopActive + "\n";
+ var text = "";
+ text += "Time Signature: " + computeTimeSignature() + "\n";
+ text += "Tempo: " + (transport.hasTempo ? (transport.tempo.toFixed(3) + " (bpm)") : "(none)") + "\n";
- if (transport.isLoopActive && transport.hasBeatsTimeline) {
- text += "Loop (beats): " + transport.loopStartBeats + " .. " + transport.loopEndBeats + "\n";
- }
+ if (transport.hasBeatsTimeline)
+ text += "song position (beats): " + transport.songPositionBeats.toFixed(3) + "\n";
+ else
+ text += "No timeline in beats\n";
- if (transport.isLoopActive && transport.hasSecondsTimeline) {
- text += "Loop (seconds): " + transport.loopStartSeconds + " .. " + transport.loopEndSeconds + "\n";
- }
+ if (transport.hasSecondsTimeline)
+ text += "song position (seconds): " + transport.songPositionSeconds.toFixed(3) + "s\n";
+ else
+ text += "No timeline in seconds\n";
- text += "Is within preroll: " + transport.isWithinPreRoll + "\n";
+ text += "\n";
- text += "Has tempo: " + transport.hasTempo + "\n";
- if (transport.hasTempo)
- text += "Tempo (bpm): " + transport.tempo + "\n";
+ text += "Is playing: " + transport.isPlaying + "\n";
+ text += "Is recording: " + transport.isRecording + "\n";
+ text += "Is within preroll: " + transport.isWithinPreRoll + "\n";
+ text += "\n";
- text += "Has beats timeline: " + transport.hasBeatsTimeline + "\n";
- if (transport.hasBeatsTimeline)
- text += "song position (beats): " + transport.songPositionBeats + "\n";
+ if (transport.isLoopActive) {
+ if (transport.hasBeatsTimeline)
+ text += "Loop (beats): " + transport.loopStartBeats.toFixed(3) + " .. " + transport.loopEndBeats.toFixed(3) + "\n";
- text += "Has seconds timeline: " + transport.hasSecondsTimeline + "\n";
- if (transport.hasSecondsTimeline)
- text += "song position (seconds): " + transport.songPositionSeconds + "\n";
+ if (transport.hasSecondsTimeline)
+ text += "Loop (seconds): " + transport.loopStartSeconds.toFixed(3) + "s .. " + transport.loopEndSeconds.toFixed(3) + "s\n";
- text += "Has Time Signature: " + transport.hasTimeSignature + "\n";
- if (transport.hasTimeSignature)
- text += "Time Signature: " + transport.timeSignatureNumerator + "/" + transport.timeSignatureDenominator + "\n";
+ text += "\n";
+ }
return text;
}
+ function computeTimeSignature() {
+ if (transport.hasTimeSignature)
+ return transport.timeSignatureNumerator + "/" + transport.timeSignatureDenominator;
+ return "(none)";
+ }
+
function updateText() {
display.text = computeText();
}