add a new time display format : "seconds + milliseconds"
Posted: Tue Nov 18, 2014 4:23 pm
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 :

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

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) :
Second possibility (adding a new format) :
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
Audacity already offers several "time display formats", the default one being "hh:mm:ss + milliseconds", by example :

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

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")
},
{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;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