Display label count

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Display label count

Post by Edgar » Wed Oct 22, 2014 5:59 am

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
numbers.png (6.48 KiB) Viewed 2651 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!
Last edited by Edgar on Tue Oct 28, 2014 1:48 am, edited 1 time in total.

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Display label count

Post by Edgar » Wed Oct 22, 2014 6:28 am

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
larger.png (10.37 KiB) Viewed 2649 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.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Display label count

Post by Gale Andrews » Wed Oct 22, 2014 11:45 am

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
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

steve
Site Admin
Posts: 80804
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Display label count

Post by steve » Wed Oct 22, 2014 3:50 pm

Label track info sounds like a good enhancement. +1

Perhaps more than necessary, but to go the whole hog:
  1. Number of characters in the label text. This could be useful for VIPs to quickly check if they have numbered all of the labels.
  2. Number of labels without text (empty labels). An alternative to (1)
  3. Number of overlapping regions. This could give a check if regions are supposed to butt up to each other and not overlap.
  4. Notification of labels before zero - Normally undesirable.
  5. Notification of labels after end of audio/MIDI - Normally undesirable.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Display label count

Post by Edgar » Wed Oct 22, 2014 5:04 pm

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.
Last edited by Edgar on Tue Oct 28, 2014 2:26 am, edited 1 time in total.

waxcylinder
Forum Staff
Posts: 14598
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Display label count

Post by waxcylinder » Wed Oct 22, 2014 5:14 pm

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 :oops: :roll:

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Display label count

Post by Edgar » Wed Oct 22, 2014 5:27 pm

labeling options:
options.png
options.png (4.25 KiB) Viewed 2642 times
I see that text height spacing is not taking adequate consideration of descenders.

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Display label count

Post by Edgar » Thu Oct 23, 2014 3:24 am

The patch against SVN HEAD 13478:
labeltrackinfopanel1.patch
(5.76 KiB) Downloaded 84 times
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
points.png (29.69 KiB) Viewed 2633 times

steve
Site Admin
Posts: 80804
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Display label count

Post by steve » Thu Oct 23, 2014 4:21 am

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Display label count

Post by Edgar » Thu Oct 23, 2014 5:23 pm

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
zero.png (8.13 KiB) Viewed 2612 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.

Locked