Пример #1
0
static void menu_cb_evaluate_noise_2_0 (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	Editor_save (me, U"Evaluate (noise 2.0)");
	OTMulti_newDisharmonies ((OTMulti) my data, 2.0);
	Graphics_updateWs (my g);
	Editor_broadcastDataChanged (me);
}
static void menu_cb_evaluate_tinyNoise (EDITOR_ARGS) {
	EDITOR_IAM (OTGrammarEditor);
	Editor_save (me, L"Evaluate (tiny noise)");
	OTGrammar_newDisharmonies ((OTGrammar) my data, 1e-9);
	Graphics_updateWs (my g);
	my broadcastDataChanged ();
}
Пример #3
0
static void menu_cb_editRanking (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	EDITOR_FORM (U"Edit ranking", 0)
		LABEL (U"constraint", U"");
		REAL (U"Ranking value", U"100.0");
		REAL (U"Disharmony", U"100.0");
	EDITOR_OK
		OTMulti grammar = (OTMulti) my data;
		OTConstraint constraint;
		if (my selectedConstraint < 1 || my selectedConstraint > grammar -> numberOfConstraints)
			Melder_throw (U"Select a constraint first.");
		constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]];
		SET_STRING (U"constraint", constraint -> name)
		SET_REAL (U"Ranking value", constraint -> ranking)
		SET_REAL (U"Disharmony", constraint -> disharmony)
	EDITOR_DO
		OTMulti grammar = (OTMulti) my data;
		OTConstraint constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]];
		Editor_save (me, U"Edit ranking");
		constraint -> ranking = GET_REAL (U"Ranking value");
		constraint -> disharmony = GET_REAL (U"Disharmony");
		OTMulti_sort (grammar);
		Graphics_updateWs (my g);
		Editor_broadcastDataChanged (me);
	EDITOR_END
}
Пример #4
0
static void menu_cb_evaluate_zeroNoise (EDITOR_ARGS) {
	EDITOR_IAM (OTGrammarEditor);
	Editor_save (me, U"Evaluate (zero noise)");
	OTGrammar_newDisharmonies ((OTGrammar) my data, 0.0);
	Graphics_updateWs (my g);
	Editor_broadcastDataChanged (me);
}
Пример #5
0
static void menu_cb_addToDynamicMenu (EDITOR_ARGS) {
	EDITOR_IAM (ScriptEditor);
	EDITOR_FORM (U"Add to dynamic menu", U"Add to dynamic menu...")
		WORD (U"Class 1", U"Sound")
		INTEGER (U"Number 1", U"0")
		WORD (U"Class 2", U"")
		INTEGER (U"Number 2", U"0")
		WORD (U"Class 3", U"")
		INTEGER (U"Number 3", U"0")
		SENTENCE (U"Command", U"Do it...")
		SENTENCE (U"After command", U"")
		INTEGER (U"Depth", U"0")
		LABEL (U"", U"Script file:")
		TEXTFIELD (U"Script", U"")
	EDITOR_OK
		if (my name [0])
			SET_STRING (U"Script", my name)
		else
			SET_STRING (U"Script", U"(please save your script first)")
	EDITOR_DO
		praat_addActionScript (GET_STRING (U"Class 1"), GET_INTEGER (U"Number 1"),
			GET_STRING (U"Class 2"), GET_INTEGER (U"Number 2"), GET_STRING (U"Class 3"),
			GET_INTEGER (U"Number 3"), GET_STRING (U"Command"), GET_STRING (U"After command"),
			GET_INTEGER (U"Depth"), GET_STRING (U"Script"));
		praat_show ();
	EDITOR_END
}
Пример #6
0
static void menu_cb_runSelection (EDITOR_ARGS) {
	EDITOR_IAM (ScriptEditor);
	if (my interpreter -> running)
		Melder_throw (U"The script is already running (paused). Please close or continue the pause or demo window.");
	autostring32 text = GuiText_getSelection (my textWidget);
	if (text.peek() == NULL)
		Melder_throw (U"No text selected.");
	structMelderFile file = { 0 };
	if (my name [0]) {
		Melder_pathToFile (my name, & file);
		MelderFile_setDefaultDir (& file);
	}
	Melder_includeIncludeFiles (& text);
	int npar = Interpreter_readParameters (my interpreter, text.peek());
	if (npar) {
		/*
		 * Pop up a dialog box for querying the arguments.
		 */
		forget (my argsDialog);
		my argsDialog = Interpreter_createForm (my interpreter, my d_windowForm, NULL, args_ok_selectionOnly, me, true);
		UiForm_do (my argsDialog, false);
	} else {
		autoPraatBackground background;
		if (my name [0]) MelderFile_setDefaultDir (& file);
		Interpreter_run (my interpreter, text.peek());
	}
}
Пример #7
0
static void menu_cb_print (EDITOR_ARGS) {
	EDITOR_IAM (HyperPage);
	EDITOR_FORM (L"Print", 0)
		SENTENCE (L"Left or inside header", L"")
		SENTENCE (L"Middle header", L"")
		LABEL (L"", L"Right or outside header:")
		TEXTFIELD (L"Right or outside header", L"")
		SENTENCE (L"Left or inside footer", L"")
		SENTENCE (L"Middle footer", L"")
		SENTENCE (L"Right or outside footer", L"")
		BOOLEAN (L"Mirror even/odd headers", TRUE)
		INTEGER (L"First page number", L"0 (= no page numbers)")
	EDITOR_OK
		my v_defaultHeaders (cmd);
		if (my d_printingPageNumber) SET_INTEGER (L"First page number", my d_printingPageNumber + 1)
	EDITOR_DO
		my insideHeader = GET_STRING (L"Left or inside header");
		my middleHeader = GET_STRING (L"Middle header");
		my outsideHeader = GET_STRING (L"Right or outside header");
		my insideFooter = GET_STRING (L"Left or inside footer");
		my middleFooter = GET_STRING (L"Middle footer");
		my outsideFooter = GET_STRING (L"Right or outside footer");
		my mirror = GET_INTEGER (L"Mirror even/odd headers");
		my d_printingPageNumber = GET_INTEGER (L"First page number");
		Printer_print (print, me);
	EDITOR_END
}
Пример #8
0
static void menu_cb_pitchSettings (EDITOR_ARGS) {
	EDITOR_IAM (FormantGridEditor);
	EDITOR_FORM (L"Source pitch settings", 0)
		LABEL (L"", L"These settings apply to the pitch curve")
		LABEL (L"", L"that you hear when playing the FormantGrid.")
		REAL (L"Starting time", L"0.0%")
		POSITIVE (L"Starting pitch (Hz)", L"150.0")
		REAL (L"Mid time", L"25.0%")
		POSITIVE (L"Mid pitch (Hz)", L"180.0")
		REAL (L"End time", L"100.0%")
		POSITIVE (L"End pitch (Hz)", L"120")
	EDITOR_OK
		SET_REAL (L"Starting time", my source.pitch.tStart)
		SET_REAL (L"Starting pitch", my source.pitch.f0Start)
		SET_REAL (L"Mid time", my source.pitch.tMid)
		SET_REAL (L"Mid pitch", my source.pitch.f0Mid)
		SET_REAL (L"End time", my source.pitch.tEnd)
		SET_REAL (L"End pitch", my source.pitch.f0End)
	EDITOR_DO
		preferences.source.pitch.tStart = my source.pitch.tStart = GET_REAL (L"Starting time");
		preferences.source.pitch.f0Start = my source.pitch.f0Start = GET_REAL (L"Starting pitch");
		preferences.source.pitch.tMid = my source.pitch.tMid = GET_REAL (L"Mid time");
		preferences.source.pitch.f0Mid = my source.pitch.f0Mid = GET_REAL (L"Mid pitch");
		preferences.source.pitch.tEnd = my source.pitch.tEnd = GET_REAL (L"End time");
		preferences.source.pitch.f0End = my source.pitch.f0End = GET_REAL (L"End pitch");
	EDITOR_END
}
Пример #9
0
static void menu_cb_addPointAtCursor (EDITOR_ARGS) {
	EDITOR_IAM (PointEditor);
	Editor_save (me, L"Add point");
	PointProcess_addPoint ((PointProcess) my data, 0.5 * (my d_startSelection + my d_endSelection));
	FunctionEditor_redraw (me);
	my broadcastDataChanged ();
}
Пример #10
0
static void menu_cb_pitchSettings (EDITOR_ARGS) {
	EDITOR_IAM (FormantGridEditor);
	EDITOR_FORM (U"Source pitch settings", 0)
		LABEL (U"", U"These settings apply to the pitch curve")
		LABEL (U"", U"that you hear when playing the FormantGrid.")
		REAL     (U"Starting time",       my default_source_pitch_tStart  ())
		POSITIVE (U"Starting pitch (Hz)", my default_source_pitch_f0Start ())
		REAL     (U"Mid time",            my default_source_pitch_tMid    ())
		POSITIVE (U"Mid pitch (Hz)",      my default_source_pitch_f0Mid   ())
		REAL     (U"End time",            my default_source_pitch_tEnd    ())
		POSITIVE (U"End pitch (Hz)",      my default_source_pitch_f0End   ())
	EDITOR_OK
		SET_REAL (U"Starting time",  my p_source_pitch_tStart)
		SET_REAL (U"Starting pitch", my p_source_pitch_f0Start)
		SET_REAL (U"Mid time",       my p_source_pitch_tMid)
		SET_REAL (U"Mid pitch",      my p_source_pitch_f0Mid)
		SET_REAL (U"End time",       my p_source_pitch_tEnd)
		SET_REAL (U"End pitch",      my p_source_pitch_f0End)
	EDITOR_DO
		my pref_source_pitch_tStart  () = my p_source_pitch_tStart  = GET_REAL (U"Starting time");
		my pref_source_pitch_f0Start () = my p_source_pitch_f0Start = GET_REAL (U"Starting pitch");
		my pref_source_pitch_tMid    () = my p_source_pitch_tMid    = GET_REAL (U"Mid time");
		my pref_source_pitch_f0Mid   () = my p_source_pitch_f0Mid   = GET_REAL (U"Mid pitch");
		my pref_source_pitch_tEnd    () = my p_source_pitch_tEnd    = GET_REAL (U"End time");
		my pref_source_pitch_f0End   () = my p_source_pitch_f0End   = GET_REAL (U"End pitch");
	EDITOR_END
}
Пример #11
0
static void menu_cb_editConstraint (EDITOR_ARGS) {
	EDITOR_IAM (OTGrammarEditor);
	EDITOR_FORM (U"Edit constraint", 0)
		LABEL (U"constraint", U"");
		REAL (U"Ranking value", U"100.0");
		REAL (U"Disharmony", U"100.0");
		REAL (U"Plasticity", U"1.0");
	EDITOR_OK
		OTGrammar ot = (OTGrammar) my data;
		OTGrammarConstraint constraint;
		if (my selected < 1 || my selected > ot -> numberOfConstraints)
			Melder_throw (U"Select a constraint first.");
		constraint = & ot -> constraints [ot -> index [my selected]];
		SET_STRING (U"constraint", constraint -> name)
		SET_REAL (U"Ranking value", constraint -> ranking)
		SET_REAL (U"Disharmony", constraint -> disharmony)
		SET_REAL (U"Plasticity", constraint -> plasticity)
	EDITOR_DO
		OTGrammar ot = (OTGrammar) my data;
		OTGrammarConstraint constraint = & ot -> constraints [ot -> index [my selected]];
		Editor_save (me, U"Edit constraint");
		constraint -> ranking = GET_REAL (U"Ranking value");
		constraint -> disharmony = GET_REAL (U"Disharmony");
		constraint -> plasticity = GET_REAL (U"Plasticity");
		OTGrammar_sort (ot);
		Graphics_updateWs (my g);
		Editor_broadcastDataChanged (me);
	EDITOR_END
}
Пример #12
0
static void menu_cb_evaluate_tinyNoise (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	Editor_save (me, U"Evaluate (tiny noise)");
	OTMulti_newDisharmonies ((OTMulti) my data, 1e-9);
	Graphics_updateWs (my g);
	Editor_broadcastDataChanged (me);
}
Пример #13
0
static void menu_cb_MoveCursorToZero (EDITOR_ARGS) {
	EDITOR_IAM (SoundEditor);
	double zero = Sound_getNearestZeroCrossing ((Sound) my data, 0.5 * (my d_startSelection + my d_endSelection), 1);   // STEREO BUG
	if (NUMdefined (zero)) {
		my d_startSelection = my d_endSelection = zero;
		FunctionEditor_marksChanged (me, true);
	}
}
Пример #14
0
static void menu_cb_ReverseSelection (EDITOR_ARGS) {
	EDITOR_IAM (SoundEditor);
	Editor_save (me, L"Reverse selection");
	Sound_reverse ((Sound) my data, my d_startSelection, my d_endSelection);
	my v_destroy_analysis ();
	FunctionEditor_redraw (me);
	Editor_broadcastDataChanged (me);
}
static void menu_cb_moveCursorToPeak (EDITOR_ARGS) {
	EDITOR_IAM (SpectrumEditor);
	double frequencyOfMaximum, heightOfMaximum;
	Spectrum_getNearestMaximum ((Spectrum) my data, 0.5 * (my d_startSelection + my d_endSelection), & frequencyOfMaximum, & heightOfMaximum);
	my d_startSelection = my d_endSelection = frequencyOfMaximum;
	my cursorHeight = heightOfMaximum;
	FunctionEditor_marksChanged (me, true);
}
Пример #16
0
static void menu_cb_octaveDown (EDITOR_ARGS) {
	EDITOR_IAM (PitchEditor);
	Pitch pitch = (Pitch) my data;
	Editor_save (me, U"Octave down");
	Pitch_step (pitch, 0.5, 0.1, my d_startSelection, my d_endSelection);
	FunctionEditor_redraw (me);
	Editor_broadcastDataChanged (me);
}
Пример #17
0
static void menu_cb_fifthDown (EDITOR_ARGS) {
    EDITOR_IAM (PitchEditor);
    Pitch pitch = (Pitch) my data;
    Editor_save (me, L"Fifth down");
    Pitch_step (pitch, 1 / 1.5, 0.1, my d_startSelection, my d_endSelection);
    FunctionEditor_redraw (me);
    my broadcastDataChanged ();
}
Пример #18
0
static void menu_cb_getPitch (EDITOR_ARGS) {
    EDITOR_IAM (PitchEditor);
    if (my d_startSelection == my d_endSelection) {
        Melder_informationReal (Pitch_getValueAtTime ((Pitch) my data, my d_startSelection, kPitch_unit_HERTZ, 1), L"Hz");
    } else {
        Melder_informationReal (Pitch_getMean ((Pitch) my data, my d_startSelection, my d_endSelection, kPitch_unit_HERTZ), L"Hz");
    }
}
Пример #19
0
static void menu_cb_octaveUp (EDITOR_ARGS) {
    EDITOR_IAM (PitchEditor);
    Pitch pitch = (Pitch) my data;
    Editor_save (me, L"Octave up");
    Pitch_step (pitch, 2.0, 0.1, my d_startSelection, my d_endSelection);
    FunctionEditor_redraw (me);
    my broadcastDataChanged ();
}
Пример #20
0
static void menu_cb_searchForPage (EDITOR_ARGS) {
	EDITOR_IAM (HyperPage);
	EDITOR_FORM (L"Search for page", 0)
		TEXTFIELD (L"Page", L"a")
	EDITOR_OK
	EDITOR_DO
		HyperPage_goToPage (me, GET_STRING (L"Page"));   // BUG
	EDITOR_END
}
Пример #21
0
static void menu_cb_addPointAtCursor (EDITOR_ARGS) {
	EDITOR_IAM (FormantGridEditor);
	Editor_save (me, U"Add point");
	FormantGrid grid = (FormantGrid) my data;
	Ordered tiers = my editingBandwidths ? grid -> bandwidths : grid -> formants;
	RealTier tier = (RealTier) tiers -> item [my selectedFormant];
	RealTier_addPoint (tier, 0.5 * (my d_startSelection + my d_endSelection), my ycursor);
	FunctionEditor_redraw (me);
	Editor_broadcastDataChanged (me);
}
Пример #22
0
static void menu_cb_removePoints (EDITOR_ARGS) {
	EDITOR_IAM (PointEditor);
	Editor_save (me, L"Remove point(s)");
	if (my d_startSelection == my d_endSelection)
		PointProcess_removePointNear ((PointProcess) my data, my d_startSelection);
	else
		PointProcess_removePointsBetween ((PointProcess) my data, my d_startSelection, my d_endSelection);
	FunctionEditor_redraw (me);
	my broadcastDataChanged ();
}
Пример #23
0
static void menu_cb_fontSize (EDITOR_ARGS) {
	EDITOR_IAM (HyperPage);
	EDITOR_FORM (L"Font size", 0)
		NATURAL (L"Font size (points)", L"12")
	EDITOR_OK
		SET_INTEGER (L"Font size", my fontSize)
	EDITOR_DO
		setFontSize (me, GET_INTEGER (L"Font size"));
	EDITOR_END
}
Пример #24
0
static void menu_cb_selectFormantOrBandwidth (EDITOR_ARGS) {
	EDITOR_IAM (FormantGridEditor);
	EDITOR_FORM (U"Select formant or bandwidth", 0)
		NATURAL (U"Formant number", U"1")
	EDITOR_OK
		SET_INTEGER (U"Formant number", my selectedFormant)
	EDITOR_DO
		selectFormantOrBandwidth (me, GET_INTEGER (U"Formant number"));
		FunctionEditor_redraw (me);
	EDITOR_END
}
Пример #25
0
static void menu_cb_expandIncludeFiles (EDITOR_ARGS) {
	EDITOR_IAM (ScriptEditor);
	structMelderFile file = { 0 };
	autostring32 text = GuiText_getString (my textWidget);
	if (my name [0]) {
		Melder_pathToFile (my name, & file);
		MelderFile_setDefaultDir (& file);
	}
	Melder_includeIncludeFiles (& text);
	GuiText_setString (my textWidget, text.peek());
}
Пример #26
0
static void menu_cb_removeConstraint (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	OTMulti grammar = (OTMulti) my data;
	if (my selectedConstraint < 1 || my selectedConstraint > grammar -> numberOfConstraints)
		Melder_throw (U"Select a constraint first.");
	OTConstraint constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]];
	Editor_save (me, U"Remove constraint");
	OTMulti_removeConstraint (grammar, constraint -> name);
	Graphics_updateWs (my g);
	Editor_broadcastDataChanged (me);
}
Пример #27
0
static void menu_cb_writeOneToHtmlFile (EDITOR_ARGS) {
	EDITOR_IAM (Manual);
	EDITOR_FORM_WRITE (L"Save as HTML file", 0)
		ManPages manPages = (ManPages) my data;
		wchar_t *p = defaultName;
		wcscpy (p, ((ManPage) manPages -> pages -> item [my path]) -> title);
		while (*p) { if (! isalnum (*p) && *p != '_') *p = '_'; p ++; }
		wcscat (defaultName, L".html");
	EDITOR_DO_WRITE
		ManPages_writeOneToHtmlFile ((ManPages) my data, my path, file);
	EDITOR_END
}
Пример #28
0
static void menu_cb_searchForPageList (EDITOR_ARGS) {
	EDITOR_IAM (Manual);
	EDITOR_FORM (L"Search for page", 0)
		ManPages manPages = (ManPages) my data;
		long numberOfPages;
		const wchar_t **pages = ManPages_getTitles (manPages, & numberOfPages);
		LIST (L"Page", manPages -> pages -> size, pages, 1)
	EDITOR_OK
	EDITOR_DO
		HyperPage_goToPage_i (me, GET_INTEGER (L"Page"));
	EDITOR_END
}
Пример #29
0
static void menu_cb_resetAllRankings (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	EDITOR_FORM (U"Reset all rankings", 0)
		REAL (U"Ranking", U"100.0")
	EDITOR_OK
	EDITOR_DO
		Editor_save (me, U"Reset all rankings");
		OTMulti_reset ((OTMulti) my data, GET_REAL (U"Ranking"));
		Graphics_updateWs (my g);
		Editor_broadcastDataChanged (me);
	EDITOR_END
}
Пример #30
0
static void menu_cb_evaluate (EDITOR_ARGS) {
	EDITOR_IAM (OTMultiEditor);
	EDITOR_FORM (U"Evaluate", 0)
		REAL (U"Evaluation noise", U"2.0")
	EDITOR_OK
	EDITOR_DO
		Editor_save (me, U"Evaluate");
		OTMulti_newDisharmonies ((OTMulti) my data, GET_REAL (U"Evaluation noise"));
		Graphics_updateWs (my g);
		Editor_broadcastDataChanged (me);
	EDITOR_END
}