5 void drawPitchTier(cairo_t
*cr
, gchar
*filename
, gint width
, gint height
, gdouble top
) {
8 // g_debug("%s welcomes %s!", __func__, filename);
9 if (g_file_get_contents(filename
, &contents
, &length
, NULL
) != TRUE
) {
11 gdouble scalex
= 0, scaley
= 0;
22 if (contents
[i
] == '\n') {
23 gchar
* this = g_strndup(&contents
[m
], i
-m
);
29 fromx
= g_strtod(this, NULL
);
33 endx
= g_strtod(this, NULL
);
34 scalex
= width
/ endx
;
35 scaley
= height
/ top
;
36 cairo_move_to(cr
, fromx
*scalex
, 0);
42 middlex
= g_strtod(this, NULL
);
47 middley
= g_strtod(this, NULL
);
49 to
= height
- (middley
*scaley
);
51 if ((middlex
- fromx
) < 0.015 && fromy
!= -1 && middley
!= -1) {
52 cairo_line_to(cr
, middlex
*scalex
, to
);
54 cairo_move_to(cr
, middlex
*scalex
, to
);
68 // g_debug("%s for %s done!\n", __func__, filename);
73 #include "frompraat.h"
75 void drawPitchTier(cairo_t
*cr
, gchar
*filename
, gint width
, gint height
, gdouble top
) {
79 // g_debug("%s welcomes %s!", __func__, filename);
81 if (g_access(filename
, F_OK
) == 0) {
82 structMelderFile file
;
83 Pitch melderPitchFromFile
;
85 __declspec(dllimport
) Pitch_Table classPitch
;
88 Thing_recognizeClassesByName (classPitch
, NULL
);
89 Melder_pathToFile(filename
, & file
);
90 melderPitchFromFile
= Data_readFromTextFile (& file
);
94 if (melderPitchFromFile
!= NULL
) {
96 Sampled_drawInside_cairo (melderPitchFromFile
, cr
, 0.0, width
, 0.0, height
, Pitch_LEVEL_FREQUENCY
, Pitch_UNIT_HERTZ
);
97 forget(melderPitchFromFile
);
100 Melder_clearError ();
101 // g_debug("%s for %s done!\n", __func__, filename);