Page 1 of 6
Display label count
Posted: Wed Oct 22, 2014 5:59 am
by Edgar
One of the things I do frequently is convert vinyl to digital. I record the whole side in one go – unattended (I'll be listening on the monitor while I garden). After a bit of cleanup (hands and recording) I Analyze Silence to split it up into tracks. I always do a reality check to see that the number of labels is equal to the number of tracks on the vinyl side. I either have to visually count the labels or open the Label Editor.
Adding 6 lines of code to srcTrackPanel.cpp somewhere vaguely near line number 8070 (in the function: void TrackInfo::DrawTitleBar (…)) as the very last lines of the function:
Code: Select all
AColor::BevelTrackInfo(*dc, !down, bev);
//efm5 start
if (((LabelTrack *)t)->GetKind() == Track::Label) {
int numberOfLabels = ((LabelTrack *)t)->GetNumLabels();
wxString number;
number.Printf(wxT("Labels: %d"), numberOfLabels);
dc->DrawText(number, r.x + 3, r.y + textHeight + 3);
}
//efm5 end
}
Gives us something which looks like this:

- numbers.png (6.48 KiB) Viewed 2693 times
Notice that right below the title of the Label Track there is the word string "Labels:" followed by two spaces and then the number of labels. Please ignore all the exotic colors – my eyes are getting bored!
Re: Display label count
Posted: Wed Oct 22, 2014 6:28 am
by Edgar
Of course, in support of my never ceasing desire to give "power to the people" (especially those of us with poor eyesight) it would make some kind of sense to honor the users' choice of font family, size and style (since some Developer went to all the trouble to allow us to change the font for labels):

- larger.png (10.37 KiB) Viewed 2691 times
I leave centering, error checking for a number string which is too wide to fit in the Track Info Panel etc. as an exercise for the student. I did remove the verbiage "Label:" because at my preferred font size of 16 and adding two spaces after the colon there was only room for 1 digit; I tried "#:" but it just looked wrong. Translating "Label" could very easily yield a string which was too long.
Re: Display label count
Posted: Wed Oct 22, 2014 11:45 am
by Gale Andrews
I've no objection to having a "Track Info Panel" for the label track - more useful than saying nothing.
As a refinement, how about a separate count of number of region and point labels? That would give a warning if you have a miniscule region label which will mess up Export Multiple.
Gale
Re: Display label count
Posted: Wed Oct 22, 2014 3:50 pm
by steve
Label track info sounds like a good enhancement. +1
Perhaps more than necessary, but to go the whole hog:
- Number of characters in the label text. This could be useful for VIPs to quickly check if they have numbered all of the labels.
- Number of labels without text (empty labels). An alternative to (1)
- Number of overlapping regions. This could give a check if regions are supposed to butt up to each other and not overlap.
- Notification of labels before zero - Normally undesirable.
- Notification of labels after end of audio/MIDI - Normally undesirable.
Re: Display label count
Posted: Wed Oct 22, 2014 5:04 pm
by Edgar
In Experimental.h, at or near line number 154 (just above the final #endif):
Code: Select all
#define EXPERIMENTAL_LABEL_TRACKINFOPANEL
Our code in Track Panel grows considerably; with more than one number we will need to label them and translate the labels (for my needs a single letter for each suffices):
Code: Select all
#ifdef EXPERIMENTAL_LABEL_TRACKINFOPANEL
if (((LabelTrack *)t)->GetKind() == Track::Label) {
int numberOfLabels = ((LabelTrack *)t)->GetNumLabels();
if (numberOfLabels != 0) {
dc->SetFont(((LabelTrack *)t)->GetFont());
#define VERTICAL_SPACING 3
#define LEFT_MARGIN (r.x + 3)
int top = r.y + textHeight + VERTICAL_SPACING ;
wxString numberString;
int numberOfPoints = ((LabelTrack *)t)->GetNumberOfPointLabels();
if (numberOfPoints != 0) {
numberString.Printf(_("P: %d"), numberOfPoints);
dc->DrawText(numberString, LEFT_MARGIN , top);
}
int numberOfRegions = ((LabelTrack *)t)->GetNumberOfRegionLabels();
if (numberOfRegions != 0) {
top += VERTICAL_SPACING + textHeight;
numberString.Printf(_("R: %d"), numberOfRegions);
dc->DrawText(numberString, LEFT_MARGIN , top);
}
SetTrackInfoFont(dc);
}
}
#endif
}
in LabelTrack.h, as the very last lines of the class LabelTrack, at or near line #258:
Code: Select all
#ifdef EXPERIMENTAL_LABEL_TRACKINFOPANEL
public:
wxFont GetFont(){return msFont;};
int GetNumberOfPointLabels(){return 5;};// efm5 debug actually iterate through the label list and get a real value
int GetNumberOfRegionLabels(){return 125;};// efm5 debug ditto
#endif
The two new functions Get Number… () need to be fleshed out.
Re: Display label count
Posted: Wed Oct 22, 2014 5:14 pm
by waxcylinder
Gale Andrews wrote:As a refinement, how about a separate count of number of region and point labels? That would give a warning if you have a miniscule region label which will mess up Export Multiple.
+1
I've fallen into this particular bear-trap more than once
Peter
Re: Display label count
Posted: Wed Oct 22, 2014 5:27 pm
by Edgar
labeling options:

- options.png (4.25 KiB) Viewed 2684 times
I see that text height spacing is not taking adequate consideration of descenders.
Re: Display label count
Posted: Thu Oct 23, 2014 3:24 am
by Edgar
The patch against SVN HEAD 13478:
Shows number of Point labels, Region labels and those labels which are before or partially before 0 on the timeline. I do not know how to create a label which is before 0 so I could not test that feature. It looks something like this:

- points.png (29.69 KiB) Viewed 2675 times
Re: Display label count
Posted: Thu Oct 23, 2014 4:21 am
by steve
Edgar wrote:I do not know how to create a label which is before 0
Easiest way:
1) Create a label near the start of an audio track.
2) Enable "Sync-Lock".
3) Time shift the audio track to the left until the label is behind zero.
Re: Display label count
Posted: Thu Oct 23, 2014 5:23 pm
by Edgar
steve wrote:
3) Time shift the audio track to the left until the label is behind zero.
Cool - never used that tool before. The new feature does work by showing that there is a label before zero. In fact it actually updates live while you're shifting the track pre- & post-zero in time.

- zero.png (8.13 KiB) Viewed 2654 times
The above image brings up an interesting feature request. Since a label track has no vertical ruler it might be nice to devote that area to the general trackinfopanel. As you can see, drawing a long string bleeds over into this area anyway (but the vertical bar makes it look ugly). What you may not do is left click in this region to select the Label Track.