summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2012-12-29 15:47:30 +0000
committerRobert Jonsson <spamatica@gmail.com>2012-12-29 15:47:30 +0000
commit6e5e3f9216120582e25f032c1626f670355dd604 (patch)
tree2b0fe6f9ed3502d962e0f9a43eb4b1b5f2cf7dba
parent097a5219543b09ae11b27ccba2cea7a66bf369d2 (diff)
write automation paramters names
-rw-r--r--muse2/muse/arranger/pcanvas.cpp41
-rw-r--r--muse2/muse/arranger/tlist.cpp13
-rw-r--r--muse2/muse/midiseq.cpp5
3 files changed, 42 insertions, 17 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index ccd727aa..b842a532 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -3564,7 +3564,8 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, MusECore::AudioTra
{
//p.restore();
return;
- }
+ }
+
int xpixel = oldX;
int oldY = -1;
int ypixel = oldY;
@@ -3575,24 +3576,30 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, MusECore::AudioTra
QPen pen2(cl->color(), 2);
pen2.setCosmetic(true);
- // First check that there ARE automation, ic == cl->end means no automation
- if (ic == cl->end())
+ // Store first value for later
+ double yfirst;
{
- double y;
- if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
- y = logToVal(cl->curVal(), min, max); // represent volume between 0 and 1
- if (y < 0) y = 0.0;
- }
- else
- y = (cl->curVal() - min)/(max-min); // we need to set curVal between 0 and 1
- ypixel = oldY = bottom - rmapy_f(y) * height;
+ if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
+ yfirst = logToVal(cl->curVal(), min, max); // represent volume between 0 and 1
+ if (yfirst < 0) yfirst = 0.0;
+ }
+ else {
+ yfirst = (cl->curVal() - min)/(max-min); // we need to set curVal between 0 and 1
+ }
+ yfirst = oldY = bottom - rmapy_f(yfirst) * height;
+ }
+
+ // Check that there IS automation, ic == cl->end means no automation
+ if (ic == cl->end())
+ {
+ ypixel = yfirst;
}
else
{
for (; ic !=cl->end(); ++ic)
{
double y = ic->second.val;
- if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
+ if (cl->valueType() == MusECore::VAL_LOG ) {
y = logToVal(y, min, max); // represent volume between 0 and 1
if (y < 0) y = 0.0;
}
@@ -3617,8 +3624,6 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, MusECore::AudioTra
break;
// draw a square around the point
- //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-2, (rr.bottom()-2)-prevVal*height-2, 5, 5);
- //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-1, (rr.bottom()-1)-prevVal*height-2, 3, 3);
pen2.setColor((automation.currentCtrlValid && automation.currentCtrlList == cl &&
automation.currentCtrlFrameList.contains(ic->second.frame)) ?
Qt::white : cl->color());
@@ -3637,10 +3642,16 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, MusECore::AudioTra
if (cl->valueType() == MusECore::VAL_LOG) {
val = MusECore::fast_log10(ic->second.val) * 20.0;
}
- p.drawText(textRect, QString("Value: %1").arg(val));
+ p.drawText(textRect, QString("Param: %1, Value: %2").arg(cl->name()).arg(val));
}
}
}
+
+ p.setPen(pen1);
+ //int xTextPos = mapx(0) > rmapx(0) ? mapx(0) + 5 : rmapx(0) + 5; // follow window..(doesn't work very well)
+ int xTextPos = mapx(0) + 5;
+ p.drawText(xTextPos,yfirst,100,height-2,0,cl->name());
+
if (xpixel <= rr.right())
{
p.setPen(pen1);
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index cbc1614f..262527a9 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -1446,7 +1446,18 @@ void TList::changeAutomation(QAction* act)
if (id == cl->id()) // got it, change state
cl->setVisible(act->isChecked());
}
- MusEGlobal::song->update(SC_TRACK_MODIFIED);
+
+ // if automation is OFF for the track we change it to READ as a convenience
+ // hopefully this confuses users far less than not understanding why the
+ // automation does not do anything.
+ if (((MusECore::AudioTrack*)editAutomation)->automationType() == AUTO_OFF)
+ {
+ MusEGlobal::audio->msgSetTrackAutomationType((MusECore::AudioTrack*)editAutomation, AUTO_READ);
+ if (MusEGlobal::debugMsg)
+ printf("Changing automation from OFF to READ\n");
+ }
+
+ MusEGlobal::song->update(SC_TRACK_MODIFIED|SC_AUTOMATION);
}
//---------------------------------------------------------
diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp
index 8e636658..8d0427d8 100644
--- a/muse2/muse/midiseq.cpp
+++ b/muse2/muse/midiseq.cpp
@@ -481,7 +481,9 @@ void MidiSeq::threadStop()
int MidiSeq::setRtcTicks()
{
int gotTicks = timer->setTimerFreq(MusEGlobal::config.rtcTicks);
-
+ if (MusEGlobal::config.rtcTicks-24 > gotTicks) {
+ printf("INFO: Could not get the wanted frequency %d, got %d, still it should suffice.\n", MusEGlobal::config.rtcTicks, gotTicks);
+ }
timer->startTimer();
return gotTicks;
}
@@ -507,6 +509,7 @@ void MidiSeq::start(int priority)
void MidiSeq::checkAndReportTimingResolution()
{
int freq = timer->getTimerFreq();
+ printf("Aquired timer frequency: %d\n", freq);
if (freq < 500) {
if(MusEGlobal::config.warnIfBadTiming)
{