Page 1 of 1

add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 4:23 pm
by suizokukan
Hi, before submitting a patch and since it would be my first attempt to contribute to Audacity, I'd like to know what the devs and the users think about a new feature I need.

Audacity already offers several "time display formats", the default one being "hh:mm:ss + milliseconds", by example :
Image

For reasons explained below, I need to read these informations as if they was displayed as "seconds + milliseconds", something like :
Image

Why do I need such a time display format ? I have to "cut" long audio recordings into small extracts by reading the start/end positions; these informations are stored in some (xml) files and read by another software(1) that accepts anything but the "seconds + milliseconds" format. Of course I can do the maths but it's too bad to convert by myself 00:57:03.291 into 3423,291 seconds if Audacity can achieve this instantly.
I'm not the first to have this idea(2) but if you follow the link, you'll see it has been already rejected without any discussion. However, I discussed this very idea to some (French) devs and it was well received(3) : some of the participants to the talk even remembered they already faced the same problem.

So, what's my proposal ?

As far as I know, the time display formats are entirely described in the src/widgets/NumericTextCtrl.cpp file(4).
I see two possibilities : either I modified the "seconds" format either I create a new format.

First possibility ("seconds" being modified) :

Code: Select all

--- audacity-read-only/src/widgets/NumericTextCtrl.cpp	2014-11-18 16:53:31.596869299 +0100
+++ audacity-modified/src/widgets/NumericTextCtrl.cpp	2014-11-18 19:10:56.424959578 +0100
@@ -275,12 +275,15 @@
  *  list of formats to choose from in the control.          */
 const BuiltinFormatString TimeConverterFormats[] =  {
    {
-   /* i18n-hint: Name of time display format that shows time in seconds */
+   /* i18n-hint: Name of time display format that shows time in seconds 
+    * and in milliseconds.
+    */
    _("seconds"),
-   /* i18n-hint: Format string for displaying time in seconds. Change the comma
-    * in the middle to the 1000s separator for your locale, and the 'seconds'
-    * on the end to the word for seconds. Don't change the numbers. */
-   _("01000,01000 seconds")
+   /* i18n-hint: Format string for displaying time in seconds and in 
+    * milliseconds (1/1000 second). Change the comma in the middle to the
+    * 1000s separator for your locale, and the 'seconds' on the end to the word
+    * for seconds. Don't change the numbers. */
+   _("01000,01000.01000 seconds")
    },
 
    {
Second possibility (adding a new format) :

Code: Select all

--- audacity-read-only/src/widgets/NumericTextCtrl.cpp	2014-11-18 16:53:31.596869299 +0100
+++ audacity-modified/src/widgets/NumericTextCtrl.cpp	2014-11-18 18:24:12.850344044 +0100
@@ -284,6 +284,16 @@
    },
 
    {
+   /* i18n-hint: Name of time display format that shows time in seconds,
+    * and milliseconds (1/1000 second) */
+   _("ss + milliseconds"),
+   /* i18n-hint: Format string for displaying time in seconds and milliseconds.
+    * Change the comma in the middle to the 1000s separator for your locale, and the 'seconds'
+    * on the end to the word for seconds. Don't change the numbers. */
+   _("01000,01000.01000 seconds")
+   },
+
+   {
    /* i18n-hint: Name of time display format that shows time in hours, minutes
     * and seconds */
    _("hh:mm:ss"),
@@ -532,7 +542,7 @@
          mBuiltinFormatStrings = TimeConverterFormats;
          mNBuiltins = sizeof(TimeConverterFormats) /
             sizeof (TimeConverterFormats[0]);
-         mDefaultNdx = 4; // Default to "hh:mm:ss + milliseconds".
+         mDefaultNdx = 5; // Default to "hh:mm:ss + milliseconds".
          break;
       case FREQUENCY:
          mBuiltinFormatStrings = FrequencyConverterFormats;
To conclude, I have to add that I leave out the problem of the locales' update !

What do you think about my request ? Should I submit a patch ?

(1) https://github.com/suizokukan/dipylonreader
(2) http://audacity.238276.n2.nabble.com/Bu ... 38910.html
(3) http://linuxfr.org/news/modeste-contrib ... -des-temps
(4) https://code.google.com/p/audacity/sour ... xtCtrl.cpp

Re: add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 6:09 pm
by Edgar
suizokukan wrote: First possibility ("seconds" being modified)
Second possibility (adding a new format)

What do you think about my request ? Should I submit a patch ?
I do not think you should modify the current "seconds" format; I think you should add the new format. I also think you should submit a patch, but do not get your hopes up. I believe that the user should have access to many more formats:
control.png
control.png (25.19 KiB) Viewed 6293 times
The above image shows what I provide for my clients.

Re: add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 6:18 pm
by suizokukan
@Edgar > why do think I should
not get [my] hopes up
? Do you think this kind of patch is considered as irrelevant by the devs' team ?

Re: add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 6:49 pm
by steve
Edgar wrote:I believe that the user should have access to many more formats:
That image doesn't fit on my display.
Other than for testing purposes, I only ever use 4 settings, though of course, probably not the same 4 as you ;)
I think there must be a more user friendly way of providing choice than one massive list.

Re: add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 7:19 pm
by Edgar
suizokukan wrote:@Edgar > why do think I should
not get [my] hopes up
? Do you think this kind of patch is considered as irrelevant by the devs' team ?
The Audacity Development Team members are generally resistant to adding features unless they are thought to be relevant to a large percentage of the Audacity users. However, since we now have folks here on the forum who can review, compile and test a patch with all three platforms (Windows, Mac & Linux), if we can prove that your patch works and we cannot find any bugs (your patch looks fine to me), you would be encouraged to present your patch to the developers. There are two methods of presenting a patch: (best and easiest) you can post it on -devel (the formal Audacity development mailing list; for information on how to join & post look here: https://lists.sourceforge.net/lists/lis ... city-devel ; you can add the patch to a Bugzilla entry (but to do so there must be an entry; since there is not, you would need to get someone with permission to create such an entry), this would be more appropriate if the feature were expected to be worked on by numerous folks or was still in a state of design flux.

Re: add a new time display format : "seconds + milliseconds"

Posted: Tue Nov 18, 2014 7:42 pm
by Edgar
steve wrote:
Edgar wrote:I believe that the user should have access to many more formats:
That image doesn't fit on my display.
Sorry, on my high-resolution monitor it only consumes about two thirds of the vertical space on my monitor. I also give my users control over the font used for this control:
all.png
all.png (22.95 KiB) Viewed 6286 times
default Audacity:
default.png
default.png (20.66 KiB) Viewed 6286 times
steve wrote:I think there must be a more user friendly way of providing choice than one massive list.
Off the top of my head, the only thing I can think of would be a dialog which opens in place of the drop-down list being displayed. Personally, I prefer the current drop-down given that it fits on my monitor. If it did not fit on my monitor I would go to the extreme of adding a new pane to preferences which allowed the user to choose between a drop-down list (with toggles to control which formats were on the list) and a dialog which showed all the formats (regardless of which formats the user might have toggled off for the drop-down list).

My apologies to suizokukan for hijacking this thread <grin>. This is a perfect example of why a Bugzilla entry might be more appropriate – we started out talking about adding a trivial improvement/modification but the discussion led us to think about improving the user's experience with the Selection control in general.

Re: add a new time display format : "seconds + milliseconds"

Posted: Wed Nov 19, 2014 5:31 pm
by suizokukan
Ok, thanks for all these details.

I will submit a patch next week.

Re: add a new time display format : "seconds + milliseconds"

Posted: Sun Nov 23, 2014 10:44 am
by Gale Andrews
The patch built and worked OK for me on Windows.


Gale

Re: add a new time display format : "seconds + milliseconds"

Posted: Sun Nov 23, 2014 11:14 pm
by suizokukan
Thank you very much ! Glad to see someone else than me trying this patch. On my Linux system (Archlinux), it works perfectly well.