[med-svn] [Git][med-team/praat][upstream] New upstream version 6.2.10

Rafael Laboissière (@rafael) gitlab at salsa.debian.org
Wed Mar 30 09:34:30 BST 2022



Rafael Laboissière pushed to branch upstream at Debian Med / praat


Commits:
e8dd0820 by Rafael Laboissière at 2022-03-29T10:07:12-03:00
New upstream version 6.2.10
- - - - -


13 changed files:

- LPC/praat_LPC_init.cpp
- fon/Formant.cpp
- fon/Praat_tests.cpp
- fon/TextGridEditor.cpp
- fon/manual_tutorials.cpp
- fon/praat_Sound.cpp
- melder/melder_debug.cpp
- sys/DemoEditor.cpp
- sys/DemoEditor.h
- sys/GraphicsScreen.cpp
- sys/praat_objectMenus.cpp
- sys/praat_version.h
- + test/manually/TextGridWindow.praat


Changes:

=====================================
LPC/praat_LPC_init.cpp
=====================================
@@ -714,7 +714,7 @@ FORM (CONVERT_EACH_TO_ONE__PowerCepstrogram_to_PowerCepstrum_slice, U"PowerCepst
 DO
 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
 		autoPowerCepstrum result = PowerCepstrogram_to_PowerCepstrum_slice (me, time);
-	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time));
+	CONVERT_EACH_TO_ONE_END (my name.get(), U"_", NUMnumber_as_stringWithDotReplacedByUnderscore (time));
 }
 
 FORM (LIST__PowerCepstrogram_listCPP, U"PowerCepstrogram: List cepstral peak prominences", U"PowerCepstrogram: To Table (cepstral peak prominences)...") {
@@ -1045,7 +1045,7 @@ FORM (CONVERT_EACH_TO_ONE__LPC_to_Polynomial_slice, U"LPC: To Polynomial", U"LPC
 DO
 	CONVERT_EACH_TO_ONE (LPC)
 		autoPolynomial result = LPC_to_Polynomial (me, time);
-	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
+	CONVERT_EACH_TO_ONE_END (my name.get(), U"_", NUMnumber_as_stringWithDotReplacedByUnderscore (time))
 }
 
 FORM (CONVERT_EACH_TO_ONE__LPC_to_Spectrum_slice, U"LPC: To Spectrum", U"LPC: To Spectrum (slice)...") {
@@ -1057,7 +1057,7 @@ FORM (CONVERT_EACH_TO_ONE__LPC_to_Spectrum_slice, U"LPC: To Spectrum", U"LPC: To
 DO
 	CONVERT_EACH_TO_ONE (LPC)
 		autoSpectrum result = LPC_to_Spectrum (me, time, minimumFrequencyResolution, bandwidthReduction, deemphasisFrequency);
-	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
+	CONVERT_EACH_TO_ONE_END (my name.get(), U"_", NUMnumber_as_stringWithDotReplacedByUnderscore (time))
 }
 
 FORM (CONVERT_EACH_TO_ONE__LPC_to_Spectrogram, U"LPC: To Spectrogram", U"LPC: To Spectrogram...") {
@@ -1080,7 +1080,7 @@ FORM (CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice_special, U"LPC: To VocalTract
 DO
 	CONVERT_EACH_TO_ONE (LPC)
 		autoVocalTract result = LPC_to_VocalTract_slice_special (me, time, glottalDamping, radiationDamping, internalDamping);
-	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
+	CONVERT_EACH_TO_ONE_END (my name.get(), U"_", NUMnumber_as_stringWithDotReplacedByUnderscore (time))
 }
 
 FORM (CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice, U"LPC: To VocalTract", U"LPC: To VocalTract (slice)...") {
@@ -1090,7 +1090,7 @@ FORM (CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice, U"LPC: To VocalTract", U"LPC
 DO
 	CONVERT_EACH_TO_ONE (LPC)
 		autoVocalTract result = LPC_to_VocalTract_slice (me, time, length);
-	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
+	CONVERT_EACH_TO_ONE_END (my name.get(), U"_", NUMnumber_as_stringWithDotReplacedByUnderscore (time))
 }
 
 DIRECT (CONVERT_EACH_TO_ONE__LPC_downto_Matrix_lpc) {


=====================================
fon/Formant.cpp
=====================================
@@ -1,6 +1,6 @@
 /* Formant.cpp
  *
- * Copyright (C) 1992-2009,2011,2012,2014-2020 Paul Boersma
+ * Copyright (C) 1992-2009,2011,2012,2014-2020,2022 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -401,8 +401,8 @@ void Formant_scatterPlot (Formant me, Graphics g, double tmin, double tmax,
 		const Formant_Frame frame = & my frames [iframe];
 		if (iformant1 > frame -> numberOfFormants || iformant2 > frame -> numberOfFormants)
 			continue;
-		double x = frame -> formant [iformant1]. frequency;
-		double y = frame -> formant [iformant2]. frequency;
+		const double x = frame -> formant [iformant1]. frequency;
+		const double y = frame -> formant [iformant2]. frequency;
 		if (x == 0.0 || y == 0.0)
 			continue;
 		Graphics_mark (g, x, y, size_mm, mark);
@@ -488,7 +488,8 @@ autoFormant Formant_tracker (Formant me, integer ntrack,
 	try {
 		integer nformmin = Formant_getMinNumFormants (me);
 		struct fparm parm;
-		if (ntrack > nformmin) Melder_throw (U"Number of tracks (", ntrack, U") should not exceed minimum number of formants (", nformmin, U").");
+		Melder_require (ntrack <= nformmin,
+			U"Number of tracks (", ntrack, U") should not exceed minimum number of formants (", nformmin, U").");
 		autoFormant thee = Formant_create (my xmin, my xmax, my nx, my dx, my x1, ntrack);
 		for (integer iframe = 1; iframe <= thy nx; iframe ++) {
 			thy frames [iframe]. formant = newvectorzero <structFormant_Formant> (ntrack);
@@ -524,13 +525,18 @@ autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers,
 		autoTable thee = Table_createWithoutColumnNames (my nx, includeFrameNumbers + includeTimes + includeIntensity +
 			includeNumberOfFormants + my maxnFormants * (1 + includeBandwidths));
 		integer icol = 0;
-		if (includeFrameNumbers)     Table_setColumnLabel (thee.get(), ++ icol, U"frame");
-		if (includeTimes)            Table_setColumnLabel (thee.get(), ++ icol, U"time(s)");
-		if (includeIntensity)        Table_setColumnLabel (thee.get(), ++ icol, U"intensity");
-		if (includeNumberOfFormants) Table_setColumnLabel (thee.get(), ++ icol, U"nformants");
+		if (includeFrameNumbers)
+			Table_setColumnLabel (thee.get(), ++ icol, U"frame");
+		if (includeTimes)
+			Table_setColumnLabel (thee.get(), ++ icol, U"time(s)");
+		if (includeIntensity)
+			Table_setColumnLabel (thee.get(), ++ icol, U"intensity");
+		if (includeNumberOfFormants)
+			Table_setColumnLabel (thee.get(), ++ icol, U"nformants");
 		for (integer iformant = 1; iformant <= my maxnFormants; iformant ++) {
 			Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (U"F", iformant, U"(Hz)"));
-			if (includeBandwidths) { Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (U"B", iformant, U"(Hz)")); }
+			if (includeBandwidths)
+				Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (U"B", iformant, U"(Hz)"));
 		}
 		for (integer iframe = 1; iframe <= my nx; iframe ++) {
 			icol = 0;
@@ -569,8 +575,9 @@ void Formant_list (Formant me, bool includeFrameNumbers,
 {
 	try {
 		autoTable table = Formant_downto_Table (me, includeFrameNumbers, includeTimes, timeDecimals,
-				includeIntensity, intensityDecimals,
-				includeNumberOfFormants, frequencyDecimals, includeBandwidths);
+			includeIntensity, intensityDecimals,
+			includeNumberOfFormants, frequencyDecimals, includeBandwidths
+		);
 		Table_list (table.get(), false);
 	} catch (MelderError) {
 		Melder_throw (me, U": not listed.");


=====================================
fon/Praat_tests.cpp
=====================================
@@ -740,10 +740,6 @@ public:
 	//const Vec (const Vec& other) = default;   // attempt to copy a const Vec to a const Vec, but constructors cannot have a return type
 };
 
-static Vec copy (Vec x) {
-	return x;
-}
-
 /*static void tryVec () {
 	Vec x = Vec (nullptr, 0);
 	x [1] = 3.0;


=====================================
fon/TextGridEditor.cpp
=====================================
@@ -1858,8 +1858,8 @@ bool structTextGridEditor :: v_mouseInWideDataView (GuiDrawingArea_MouseEvent ev
 				because we are not 'nearBoundaryOrPoint'.
 			*/
 			Melder_assert (isdefined (our startSelection));   // precondition of v_updateText()
-			our v_updateText();
 			insertBoundaryOrPoint (this, mouseTier, our startSelection, our startSelection, false);
+			our v_updateText();
 			//Melder_assert (isdefined (our startSelection));   // precondition of FunctionEditor_marksChanged()
 			//FunctionEditor_marksChanged (this, true);
 			Editor_broadcastDataChanged (this);


=====================================
fon/manual_tutorials.cpp
=====================================
@@ -22,8 +22,11 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20220215)
+MAN_BEGIN (U"What's new?", U"ppgb", 20220317)
 INTRO (U"Latest changes in Praat.")
+NORMAL (U"##6.2.10# (17 March 2022)")
+LIST_ITEM (U"• TextGrid window: restored the splitting of labels.")
+LIST_ITEM (U"• Save Demo Window as PDF file... (Goodies menu).")
 NORMAL (U"##6.2.09# (15 February 2022)")
 LIST_ITEM (U"• Windows: support for a screen resolution of 204 dpi.")
 NORMAL (U"##6.2.08# (5 February 2022)")
@@ -3142,9 +3145,9 @@ NORMAL (U"As with R scripts, Python scripts, and quite generally any kinds of sc
 	"if you completely trust that script or plug-in and its creators.")
 MAN_END
 
-MAN_BEGIN (U"Checking for updates", U"ppgb", 20220121)
+MAN_BEGIN (U"Checking for updates", U"ppgb", 20220217)
 INTRO (U"Updates for Praat are available from $$www.praat.org$.")
-NORMAL (U"Your current version is " stringize(PRAAT_VERSION_STR)
+NORMAL (U"Your current version (if you are reading this from the manual inside the Praat program, rather than from the website) is " stringize(PRAAT_VERSION_STR)
 	", from " stringize(PRAAT_MONTH) " " stringize(PRAAT_DAY) ", " stringize(PRAAT_YEAR) ". "
 	"Given that we tend to release new Praat versions once or twice a month, "
 	"you can probably guess whether it would be worth your while to have a look at $$www.praat.org$ "


=====================================
fon/praat_Sound.cpp
=====================================
@@ -2147,6 +2147,7 @@ void praat_Sound_init () {
 	praat_addMenuCommand (U"Objects", U"Open", U"Read from special sound file", nullptr, 0, nullptr);
 		praat_addMenuCommand (U"Objects", U"Open", U"Read Sound from raw Alaw file...", nullptr, praat_DEPTH_1, READ1_Sound_readFromRawAlawFile);
 
+	praat_addMenuCommand (U"Objects", U"Goodies", U"-- sound goodies --", nullptr, 0, nullptr);
 	praat_addMenuCommand (U"Objects", U"Goodies", U"Stop playing sound", nullptr, GuiMenu_ESCAPE,
 			PLAY__stopPlayingSound);
 	praat_addMenuCommand (U"Objects", U"Preferences", U"-- sound prefs --", nullptr, 0, nullptr);


=====================================
melder/melder_debug.cpp
=====================================
@@ -1,6 +1,6 @@
 /* melder_debug.cpp
  *
- * Copyright (C) 2000-2021 Paul Boersma
+ * Copyright (C) 2000-2022 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -104,7 +104,8 @@ the behaviour of Praat will temporarily change in the following ways:
  * also, we need no newline nativization, as Melder_32to8_inplace() does..
  */
 conststring8 MelderTrace::_peek32to8 (conststring32 string) {
-	if (! string) return "";
+	if (! string)
+		return "";
 	static char *buffer { nullptr };
 	static int64 bufferSize { 0 };
 	int64 n = str32len (string);
@@ -147,7 +148,8 @@ conststring8 MelderTrace::_peek32to8 (conststring32 string) {
 }
 #ifdef _WIN32
 conststring16 MelderTrace::_peek32to16 (conststring32 string) {
-	if (! string) return u"";
+	if (! string)
+		return u"";
 	static char16 *buffer { nullptr };
 	static int64 bufferSize { 0 };
 	int64 n = str32len (string);


=====================================
sys/DemoEditor.cpp
=====================================
@@ -1,6 +1,6 @@
 /* DemoEditor.cpp
  *
- * Copyright (C) 2009-2021 Paul Boersma
+ * Copyright (C) 2009-2022 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -279,7 +279,8 @@ void Demo_waitForInput (Interpreter interpreter) {
 }
 
 void Demo_peekInput (Interpreter interpreter) {
-	if (! theReferenceToTheOnlyDemoEditor) return;
+	if (! theReferenceToTheOnlyDemoEditor)
+		return;
 	if (theReferenceToTheOnlyDemoEditor -> waitingForInput) {
 		Melder_throw (U"You cannot work with the Demo window while it is waiting for input. "
 			U"Please click or type into the Demo window or close it.");
@@ -447,8 +448,28 @@ bool Demo_clickedIn (double left, double right, double bottom, double top) {
 	}
 	if (! theReferenceToTheOnlyDemoEditor -> clicked)
 		return false;
-	double xWC = Demo_x (), yWC = Demo_y ();
+	const double xWC = Demo_x (), yWC = Demo_y ();
 	return xWC >= left && xWC < right && yWC >= bottom && yWC < top;
 }
 
+void Demo_saveToPdfFile (MelderFile file) {
+	if (! theReferenceToTheOnlyDemoEditor)
+		return;
+	if (! theReferenceToTheOnlyDemoEditor -> graphics)
+		return;   // could be the case in the very beginning
+	const double resolution = theReferenceToTheOnlyDemoEditor -> graphics -> resolution;
+	autoGraphics pdfGraphics = Graphics_create_pdffile (file, resolution,
+		undefined, GuiControl_getWidth (theReferenceToTheOnlyDemoEditor -> drawingArea) / resolution,
+		undefined, GuiControl_getHeight (theReferenceToTheOnlyDemoEditor -> drawingArea) / resolution
+	);
+	pdfGraphics -> d_x2DCmax = 1e9;
+	pdfGraphics -> d_y2DCmax = 1e9;
+	Graphics_setWsWindow (pdfGraphics.get(), 0.0, 100.0, 0.0, 100.0);
+	Graphics_setWsViewport (pdfGraphics.get(),
+		0.0, GuiControl_getWidth (theReferenceToTheOnlyDemoEditor -> drawingArea),
+		0.0, GuiControl_getHeight (theReferenceToTheOnlyDemoEditor -> drawingArea)
+	);
+	Graphics_play (theReferenceToTheOnlyDemoEditor -> graphics.get(), pdfGraphics.get());
+}
+
 /* End of file DemoEditor.cpp */


=====================================
sys/DemoEditor.h
=====================================
@@ -2,7 +2,7 @@
 #define _DemoEditor_h_
 /* DemoEditor.h
  *
- * Copyright (C) 2009-2011,2012,2015-2018,2020 Paul Boersma
+ * Copyright (C) 2009-2011,2012,2015-2018,2020,2022 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -74,5 +74,7 @@ bool Demo_input (conststring32 keys);
 bool Demo_clickedIn (double left, double right, double bottom, double top);
 void Demo_timer (double duration);
 
+void Demo_saveToPdfFile (MelderFile file);
+
 /* End of file DemoEditor.h */
 #endif


=====================================
sys/GraphicsScreen.cpp
=====================================
@@ -1,6 +1,6 @@
 /* GraphicsScreen.cpp
  *
- * Copyright (C) 1992-2021 Paul Boersma, 2013 Tom Naughton
+ * Copyright (C) 1992-2022 Paul Boersma, 2013 Tom Naughton
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -220,21 +220,28 @@ void structGraphicsScreen :: v_clearWs () {
 			rect.y = our d_y2DC;
 			rect.height = our d_y1DC - our d_y2DC;
 		}
-		if (d_cairoGraphicsContext) {
-			cairo_set_source_rgb (d_cairoGraphicsContext, 1.0, 1.0, 1.0);
-			cairo_rectangle (d_cairoGraphicsContext, rect.x, rect.y, rect.width, rect.height);
-			cairo_fill (d_cairoGraphicsContext);
-			cairo_set_source_rgb (d_cairoGraphicsContext, 0.0, 0.0, 0.0);
+		if (our d_cairoGraphicsContext) {
+			cairo_set_source_rgb (our d_cairoGraphicsContext, 1.0, 1.0, 1.0);
+			cairo_rectangle (our d_cairoGraphicsContext, rect.x, rect.y, rect.width, rect.height);
+			cairo_fill (our d_cairoGraphicsContext);
+			cairo_set_source_rgb (our d_cairoGraphicsContext, 0.0, 0.0, 0.0);
 		}
 	#elif gdi
 		RECT rect;
 		rect. left = rect. top = 0;
 		rect. right = d_x2DC - d_x1DC;
 		rect. bottom = d_y2DC - d_y1DC;
-		FillRect (d_gdiGraphicsContext, & rect, GetStockBrush (WHITE_BRUSH));
-		/*if (d_winWindow) SendMessage (d_winWindow, WM_ERASEBKGND, (WPARAM) d_gdiGraphicsContext, 0);*/
+		FillRect (our d_gdiGraphicsContext, & rect, GetStockBrush (WHITE_BRUSH));
+		/*if (our d_winWindow) SendMessage (our d_winWindow, WM_ERASEBKGND, (WPARAM) our d_gdiGraphicsContext, 0);*/
 	#elif quartz
-		GuiCocoaDrawingArea *cocoaDrawingArea = (GuiCocoaDrawingArea *) d_drawingArea -> d_widget;
+		if (! our d_drawingArea) {
+			Melder_assert (!! our d_macGraphicsContext);
+			CGContextSetAlpha (our d_macGraphicsContext, 1.0);
+			CGContextSetRGBFillColor (our d_macGraphicsContext, 1.0, 1.0, 1.0, 1.0);
+			CGContextFillRect (d_macGraphicsContext, CGRectMake (our d_x1DC, our d_y2DC, our d_x2DC - our d_x1DC, our d_y1DC - our d_y2DC));
+			return;
+		}
+		GuiCocoaDrawingArea *cocoaDrawingArea = (GuiCocoaDrawingArea *) our d_drawingArea -> d_widget;
 		if (cocoaDrawingArea && ! [cocoaDrawingArea isHiddenOrHasHiddenAncestor]) {   // can be called at destruction time
 			Melder_assert (!! our d_macGraphicsContext);
 			CGContextSetAlpha (our d_macGraphicsContext, 1.0);


=====================================
sys/praat_objectMenus.cpp
=====================================
@@ -24,6 +24,7 @@
 #include "DataEditor.h"
 #include "site.h"
 #include "GraphicsP.h"
+#include "DemoEditor.h"
 
 #define EDITOR  theCurrentPraatObjects -> list [IOBJECT]. editors
 
@@ -365,6 +366,11 @@ DO
 	INFO_NONE_END
 }
 
+FORM_SAVE (GRAPHICS_saveDemoWindowAsPdfFile, U"Save Demo window as PDF file", nullptr, U"praatDemoWindow.pdf") {
+	Demo_saveToPdfFile (file);
+	END_NO_NEW_DATA
+}
+
 /********** Callbacks of the Technical menu. **********/
 
 FORM (PREFS__debug, U"Set debugging options", nullptr) {
@@ -788,6 +794,8 @@ void praat_addMenus (GuiWindow window) {
 	praat_addMenuCommand (U"Objects", U"Goodies", U"Calculator...", nullptr, 'U',
 			INFO_NONE__praat_calculator);
 	praat_addMenuCommand (U"Objects", U"Goodies", U"Report difference of two proportions...", nullptr, 0, INFO_reportDifferenceOfTwoProportions);
+	praat_addMenuCommand (U"Objects", U"Goodies", U"-- demo window --", nullptr, 0, nullptr);
+	praat_addMenuCommand (U"Objects", U"Goodies", U"Save Demo window as PDF file...", nullptr, 0, GRAPHICS_saveDemoWindowAsPdfFile);
 
 	menuItem = praat_addMenuCommand (U"Objects", U"Praat", U"Preferences", nullptr, praat_UNHIDABLE, nullptr);
 	preferencesMenu = menuItem ? menuItem -> d_menu : nullptr;


=====================================
sys/praat_version.h
=====================================
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.2.09
-#define PRAAT_VERSION_NUM 6209
+#define PRAAT_VERSION_STR 6.2.10
+#define PRAAT_VERSION_NUM 6210
 #define PRAAT_YEAR 2022
-#define PRAAT_MONTH February
-#define PRAAT_DAY 15
+#define PRAAT_MONTH March
+#define PRAAT_DAY 17


=====================================
test/manually/TextGridWindow.praat
=====================================
@@ -0,0 +1,25 @@
+#! Praat script TextGridWindow.praat
+# Paul Boersma 2022-02-19
+
+exitScript: "Please run this script only in parts."
+
+#
+# Text-cursor-based label splitting.
+#
+Create Sound from formula: "sineWithNoise", 1, 0.0, 1.0, 44100, ~1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)
+To TextGrid: "single", ""
+Set interval text: 1, 1, "abcd"
+selectObject: "Sound sineWithNoise", "TextGrid sineWithNoise"
+View & Edit
+#
+# If:
+#    you put the text cursor between "ab" and "cd" in the text field,
+#    then click on the boundary insertion circle
+# Then:
+#    a boundary should appear,
+#    with "ab" in the interval on its left,
+#    and "cd" in the interval on its right
+#
+# (last checked 2022-02-19 for Mac, Windows, Linux)
+#
+removeObject: "Sound sineWithNoise", "TextGrid sineWithNoise"
\ No newline at end of file



View it on GitLab: https://salsa.debian.org/med-team/praat/-/commit/e8dd0820ab1ae9177e31477bcc91892253f72730

-- 
View it on GitLab: https://salsa.debian.org/med-team/praat/-/commit/e8dd0820ab1ae9177e31477bcc91892253f72730
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220330/24b5c20c/attachment-0001.htm>


More information about the debian-med-commit mailing list