static void menu_cb_DrawSelectedSound (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Draw selected sound", nullptr) my v_form_pictureWindow (cmd); LABEL (U"", U"Sound:") BOOLEAN (U"Preserve times", my default_picture_preserveTimes ()); REAL (U"left Vertical range", my default_picture_bottom ()); REAL (U"right Vertical range", my default_picture_top ()); my v_form_pictureMargins (cmd); BOOLEAN (U"Garnish", my default_picture_garnish ()); EDITOR_OK my v_ok_pictureWindow (cmd); SET_INTEGER (U"Preserve times", my pref_picture_preserveTimes ()); SET_REAL (U"left Vertical range", my pref_picture_bottom ()); SET_REAL (U"right Vertical range", my pref_picture_top ()); my v_ok_pictureMargins (cmd); SET_INTEGER (U"Garnish", my pref_picture_garnish ()); EDITOR_DO my v_do_pictureWindow (cmd); my pref_picture_preserveTimes () = GET_INTEGER (U"Preserve times"); my pref_picture_bottom () = GET_REAL (U"left Vertical range"); my pref_picture_top () = GET_REAL (U"right Vertical range"); my v_do_pictureMargins (cmd); my pref_picture_garnish () = GET_INTEGER (U"Garnish"); if (! my d_longSound.data && ! my d_sound.data) Melder_throw (U"There is no sound to draw."); autoSound publish = my d_longSound.data ? LongSound_extractPart (my d_longSound.data, my d_startSelection, my d_endSelection, my pref_picture_preserveTimes ()) : Sound_extractPart (my d_sound.data, my d_startSelection, my d_endSelection, kSound_windowShape_RECTANGULAR, 1.0, my pref_picture_preserveTimes ()); Editor_openPraatPicture (me); Sound_draw (publish.peek(), my pictureGraphics, 0.0, 0.0, my pref_picture_bottom (), my pref_picture_top (), my pref_picture_garnish (), U"Curve"); Editor_closePraatPicture (me); EDITOR_END }
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 }
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 }
static void menu_cb_setBandwidthRange (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Set bandwidth range", nullptr) REAL (U"Minimum bandwidth (Hz)", my default_bandwidthFloor ()) REAL (U"Maximum bandwidth (Hz)", my default_bandwidthCeiling ()) EDITOR_OK SET_REAL (U"Minimum bandwidth", my p_bandwidthFloor) SET_REAL (U"Maximum bandwidth", my p_bandwidthCeiling) EDITOR_DO my pref_bandwidthFloor () = my p_bandwidthFloor = GET_REAL (U"Minimum bandwidth"); my pref_bandwidthCeiling () = my p_bandwidthCeiling = GET_REAL (U"Maximum bandwidth"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_setFormantRange (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Set formant range", nullptr) REAL (U"Minimum formant (Hz)", my default_formantFloor ()) REAL (U"Maximum formant (Hz)", my default_formantCeiling ()) EDITOR_OK SET_REAL (U"Minimum formant", my p_formantFloor) SET_REAL (U"Maximum formant", my p_formantCeiling) EDITOR_DO my pref_formantFloor () = my p_formantFloor = GET_REAL (U"Minimum formant"); my pref_formantCeiling () = my p_formantCeiling = GET_REAL (U"Maximum formant"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_setFormantRange (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Set formant range", 0) REAL (L"Minimum formant (Hz)", L"0.0") REAL (L"Maximum formant (Hz)", L"11000.0") EDITOR_OK SET_REAL (L"Minimum formant", my formantFloor) SET_REAL (L"Maximum formant", my formantCeiling) EDITOR_DO preferences.formantFloor = my formantFloor = GET_REAL (L"Minimum formant"); preferences.formantCeiling = my formantCeiling = GET_REAL (L"Maximum formant"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_setBandwidthRange (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Set bandwidth range", 0) REAL (L"Minimum bandwidth (Hz)", L"0.0") REAL (L"Maximum bandwidth (Hz)", L"1000.0") EDITOR_OK SET_REAL (L"Minimum bandwidth", my bandwidthFloor) SET_REAL (L"Maximum bandwidth", my bandwidthCeiling) EDITOR_DO preferences.bandwidthFloor = my bandwidthFloor = GET_REAL (L"Minimum bandwidth"); preferences.bandwidthCeiling = my bandwidthCeiling = GET_REAL (L"Maximum bandwidth"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_addPointAt (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Add point", nullptr) REAL (U"Time (s)", U"0.0") POSITIVE (U"Frequency (Hz)", U"200.0") EDITOR_OK SET_REAL (U"Time", 0.5 * (my d_startSelection + my d_endSelection)) SET_REAL (U"Frequency", my ycursor) EDITOR_DO Editor_save (me, U"Add point"); FormantGrid grid = (FormantGrid) my data; Ordered tiers = my editingBandwidths ? grid -> bandwidths.get() : grid -> formants.get(); RealTier tier = (RealTier) tiers -> item [my selectedFormant]; RealTier_addPoint (tier, GET_REAL (U"Time"), GET_REAL (U"Frequency")); FunctionEditor_redraw (me); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_addPointAt (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Add point", 0) REAL (L"Time (s)", L"0.0") POSITIVE (L"Frequency (Hz)", L"200.0") EDITOR_OK SET_REAL (L"Time", 0.5 * (my startSelection + my endSelection)) SET_REAL (L"Frequency", my ycursor) EDITOR_DO Editor_save (me, L"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, GET_REAL (L"Time"), GET_REAL (L"Frequency")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
/* Set link style variables */ void set_link_vars(void) { SET_BOOL(link_dashed); SET_BOOL(link_spline); SET_COLOUR(link_colour); SET_COLOUR(link_text_colour); SET_FONT(link_text_font); SET_FONTSIZE(link_text_fontsize); SET_REAL(link_arrow_size); SET_REAL(link_line_width); SET_STRING(link_inout_string); SET_STRING(link_updown_string); }
static void menu_cb_soundScaling (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Sound scaling", nullptr) OPTIONMENU_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ()) LABEL (U"", U"For \"fixed height\":"); POSITIVE (U"Height", my default_sound_scaling_height ()) LABEL (U"", U"For \"fixed range\":"); REAL (U"Minimum", my default_sound_scaling_minimum ()) REAL (U"Maximum", my default_sound_scaling_maximum ()) EDITOR_OK SET_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy) SET_REAL (U"Height", my p_sound_scaling_height) SET_REAL (U"Minimum", my p_sound_scaling_minimum) SET_REAL (U"Maximum", my p_sound_scaling_maximum) EDITOR_DO my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = GET_ENUM (kTimeSoundEditor_scalingStrategy, U"Scaling strategy"); my pref_sound_scaling_height () = my p_sound_scaling_height = GET_REAL (U"Height"); my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = GET_REAL (U"Minimum"); my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = GET_REAL (U"Maximum"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_addPointAt (PointEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Add point", nullptr) REAL (U"Position", U"0.0"); EDITOR_OK SET_REAL (U"Position", 0.5 * (my startSelection + my endSelection)); EDITOR_DO Editor_save (me, U"Add point"); PointProcess_addPoint ((PointProcess) my data, GET_REAL (U"Position")); FunctionEditor_redraw (me); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_setDynamicRange (EDITOR_ARGS) { EDITOR_IAM (SpectrumEditor); EDITOR_FORM (L"Set dynamic range", 0) POSITIVE (L"Dynamic range (dB)", my default_dynamicRange ()) EDITOR_OK SET_REAL (L"Dynamic range", my p_dynamicRange) EDITOR_DO my pref_dynamicRange () = my p_dynamicRange = GET_REAL (L"Dynamic range"); updateRange (me); FunctionEditor_redraw (me); EDITOR_END }
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 }
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 }
static void menu_cb_addPointAt (EDITOR_ARGS) { EDITOR_IAM (PointEditor); EDITOR_FORM (L"Add point", 0) REAL (L"Position", L"0.0"); EDITOR_OK SET_REAL (L"Position", 0.5 * (my d_startSelection + my d_endSelection)); EDITOR_DO Editor_save (me, L"Add point"); PointProcess_addPoint ((PointProcess) my data, GET_REAL (L"Position")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_stopBand (EDITOR_ARGS) { EDITOR_IAM (SpectrumEditor); EDITOR_FORM (L"Filter (stop Hann band)", 0) REAL (L"Band smoothing (Hz)", my default_bandSmoothing ()) EDITOR_OK SET_REAL (L"Band smoothing", my p_bandSmoothing) EDITOR_DO my pref_bandSmoothing () = my p_bandSmoothing = GET_REAL (L"Band smoothing"); if (my d_endSelection <= my d_startSelection) Melder_throw (L"To apply a band-stop filter, first make a selection."); Editor_save (me, L"Stop band"); Spectrum_stopHannBand ((Spectrum) my data, my d_startSelection, my d_endSelection, my p_bandSmoothing); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_setCeiling (EDITOR_ARGS) { EDITOR_IAM (PitchEditor); EDITOR_FORM (L"Change ceiling", 0) POSITIVE (L"Ceiling (Hz)", L"600") EDITOR_OK Pitch pitch = (Pitch) my data; SET_REAL (L"Ceiling", pitch -> ceiling) EDITOR_DO Pitch pitch = (Pitch) my data; Editor_save (me, L"Change ceiling"); Pitch_setCeiling (pitch, GET_REAL (L"Ceiling")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
/* Set room style variables */ void set_room_vars(void) { SET_BOOL(room_border_dashed); SET_BOOL(show_items); SET_COLOUR(item_text_colour); SET_COLOUR(room_border_colour); SET_COLOUR(room_colour); SET_COLOUR(room_exit_colour); SET_COLOUR(room_shadow_colour); SET_COLOUR(room_text_colour); SET_FONT(item_text_font); SET_FONT(room_text_font); SET_FONTSIZE(item_text_fontsize); SET_FONTSIZE(room_text_fontsize); SET_REAL(room_border_width); SET_REAL(room_exit_width); SET_REAL(room_shadow_xoff); SET_REAL(room_shadow_yoff); }
static void menu_cb_ExtractSelectedSoundForOverlap (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Extract selected sound for overlap)", nullptr) WORD (U"Name", U"slice") POSITIVE (U"Overlap (s)", my default_extract_overlap ()) EDITOR_OK SET_REAL (U"Overlap", my pref_extract_overlap ()) EDITOR_DO Sound sound = my d_sound.data; Melder_assert (sound); my pref_extract_overlap () = GET_REAL (U"Overlap"); autoSound extract = Sound_extractPartForOverlap (sound, my d_startSelection, my d_endSelection, my pref_extract_overlap ()); Thing_setName (extract.peek(), GET_STRING (U"Name")); Editor_broadcastPublication (me, extract.transfer()); EDITOR_END }
/* Set map style variables */ void set_map_vars(void) { SET_BOOL(show_page_border); SET_BOOL(show_page_title); SET_BOOL(show_map_border); SET_BOOL(show_map_title); SET_BOOL(show_tags); SET_COLOUR(map_background_colour); SET_COLOUR(map_border_colour); SET_COLOUR(map_title_colour); SET_COLOUR(page_background_colour); SET_COLOUR(page_border_colour); SET_COLOUR(page_title_colour); SET_FONT(map_title_font); SET_FONT(page_title_font); SET_REAL(font_scale); font_scale = V_MAX(font_scale, 0.1); SET_REAL(page_margin); SET_FONTSIZE(map_title_fontsize); SET_FONTSIZE(page_title_fontsize); SET_STRING(page_size); if (!get_papersize(page_size, &page_width, &page_height)) fatal("invalid paper size: %s", page_size); if (VAR_DEF("page_width")) SET_REAL(page_width); if (VAR_DEF("page_height")) SET_REAL(page_height); SET_REAL(room_size); room_size = V_MAX(room_size, 0.1); SET_REAL(room_width); SET_REAL(room_height); }
int Printer_postScriptSettings (void) { static UiForm *dia; if (dia == NULL) { UiForm::UiField *radio; dia = new UiForm (theCurrentPraatApplication -> topShell, L"PostScript settings", DO_Printer_postScriptSettings, NULL, L"PostScript settings...", L"PostScript settings..."); #if defined (_WIN32) || defined (macintosh) BOOLEAN (L"Allow direct PostScript", TRUE); #endif RADIO_ENUM (L"Grey resolution", kGraphicsPostscript_spots, DEFAULT) #if defined (UNIX) RADIO_ENUM (L"Paper size", kGraphicsPostscript_paperSize, DEFAULT); RADIO_ENUM (L"Orientation", kGraphicsPostscript_orientation, DEFAULT); POSITIVE (L"Magnification", L"1.0"); LABEL (L"label", L"Print command:"); #if defined (linux) TEXTFIELD (L"printCommand", L"lpr %s"); #else TEXTFIELD (L"printCommand", L"lp -c %s"); #endif #endif RADIO_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, DEFAULT); #if defined (macintosh) BOOLEAN (L"EPS files include preview", TRUE); #endif dia->finish (); } #if defined (_WIN32) || defined (macintosh) SET_INTEGER (L"Allow direct PostScript", thePrinter. allowDirectPostScript); #endif SET_ENUM (L"Grey resolution", kGraphicsPostscript_spots, thePrinter. spots); #if defined (UNIX) SET_ENUM (L"Paper size", kGraphicsPostscript_paperSize, thePrinter. paperSize); SET_ENUM (L"Orientation", kGraphicsPostscript_orientation, thePrinter. orientation); SET_REAL (L"Magnification", thePrinter. magnification); SET_STRING (L"printCommand", Site_getPrintCommand ()); #endif SET_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, thePrinter. fontChoiceStrategy); #if defined (macintosh) SET_INTEGER (L"EPS files include preview", thePrinter. epsFilesHavePreview); #endif dia->do_ (false); return 1; }
static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Extract selected sound (windowed)", nullptr) WORD (U"Name", U"slice") OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ()) POSITIVE (U"Relative width", my default_extract_relativeWidth ()) BOOLEAN (U"Preserve times", my default_extract_preserveTimes ()) EDITOR_OK SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ()) SET_REAL (U"Relative width", my pref_extract_relativeWidth ()) SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ()) EDITOR_DO Sound sound = my d_sound.data; Melder_assert (sound); my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape"); my pref_extract_relativeWidth () = GET_REAL (U"Relative width"); my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times"); autoSound extract = Sound_extractPart (sound, my d_startSelection, my d_endSelection, my pref_extract_windowShape (), my pref_extract_relativeWidth (), my pref_extract_preserveTimes ()); Thing_setName (extract.peek(), GET_STRING (U"Name")); Editor_broadcastPublication (me, extract.transfer()); EDITOR_END }
static void menu_cb_pathFinder (EDITOR_ARGS) { EDITOR_IAM (PitchEditor); EDITOR_FORM (L"Path finder", 0) REAL (L"Silence threshold", L"0.03") REAL (L"Voicing threshold", L"0.45") REAL (L"Octave cost", L"0.01") REAL (L"Octave-jump cost", L"0.35") REAL (L"Voiced/unvoiced cost", L"0.14") POSITIVE (L"Ceiling (Hz)", L"600") BOOLEAN (L"Pull formants", 0) EDITOR_OK Pitch pitch = (Pitch) my data; SET_REAL (L"Ceiling", pitch -> ceiling) EDITOR_DO Pitch pitch = (Pitch) my data; Editor_save (me, L"Path finder"); Pitch_pathFinder (pitch, GET_REAL (L"Silence threshold"), GET_REAL (L"Voicing threshold"), GET_REAL (L"Octave cost"), GET_REAL (L"Octave-jump cost"), GET_REAL (L"Voiced/unvoiced cost"), GET_REAL (L"Ceiling"), GET_INTEGER (L"Pull formants")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }