void PowerCepstrogram_paint (PowerCepstrogram me, Graphics g, double tmin, double tmax, double qmin, double qmax, double dBmaximum, int autoscaling, double dynamicRangedB, double dynamicCompression, int garnish) { if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; } if (qmax <= qmin) { qmin = my ymin; qmax = my ymax; } long itmin, itmax, ifmin, ifmax; if (! Matrix_getWindowSamplesX (me, tmin - 0.49999 * my dx, tmax + 0.49999 * my dx, & itmin, & itmax) || ! Matrix_getWindowSamplesY (me, qmin - 0.49999 * my dy, qmax + 0.49999 * my dy, & ifmin, & ifmax)) { return; } autoMatrix thee = Data_copy (me); double min = 1e308, max = -min; for (long i = 1; i <= my ny; i++) { for (long j = 1; j <= my nx; j++) { double val = TO10LOG (my z[i][j]); min = val < min ? val : min; max = val > max ? val : max; thy z[i][j] = val; } } double dBminimum = dBmaximum - dynamicRangedB; if (autoscaling) { dBminimum = min; dBmaximum = max; } for (long j = 1; j <= my nx; j++) { double lmax = thy z[1][j]; for (long i = 2; i <= my ny; i++) { if (thy z[i][j] > lmax) { lmax = thy z[i][j]; } } double factor = dynamicCompression * (max - lmax); for (long i = 1; i <= my ny; i++) { thy z[i][j] += factor; } } Graphics_setInner (g); Graphics_setWindow (g, tmin, tmax, qmin, qmax); Graphics_image (g, thy z, itmin, itmax, Matrix_columnToX (thee.get(), itmin - 0.5), Matrix_columnToX (thee.get(), itmax + 0.5), ifmin, ifmax, Matrix_rowToY (thee.get(), ifmin - 0.5), Matrix_rowToY (thee.get(), ifmax + 0.5), dBminimum, dBmaximum); Graphics_unsetInner (g); if (garnish) { Graphics_drawInnerBox (g); Graphics_textBottom (g, true, U"Time (s)"); Graphics_marksBottom (g, 2, true, true, false); Graphics_marksLeft (g, 2, true, true, false); Graphics_textLeft (g, true, U"Quefrency (s)"); } }
void PowerCepstrogram_paint (PowerCepstrogram me, Graphics g, double tmin, double tmax, double qmin, double qmax, double dBminimum, double dBmaximum, int garnish) { if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; } if (qmax <= qmin) { qmin = my ymin; qmax = my ymax; } long itmin, itmax, ifmin, ifmax; if (! Matrix_getWindowSamplesX (me, tmin - 0.49999 * my dx, tmax + 0.49999 * my dx, & itmin, & itmax) || ! Matrix_getWindowSamplesY (me, qmin - 0.49999 * my dy, qmax + 0.49999 * my dy, & ifmin, & ifmax)) { return; } autoMatrix thee = (Matrix) Data_copy (me); double min = 1e38, max = -min; for (long i = 1; i <= my ny; i++) { for (long j = 1; j <= my nx; j++) { double val = TO10LOG (my z[i][j]); min = val < min ? val : min; max = val > max ? val : max; thy z[i][j] = val; } } if (dBmaximum <= dBminimum) { dBminimum = min; dBmaximum = max; } Graphics_setInner (g); Graphics_setWindow (g, tmin, tmax, qmin, qmax); Graphics_image (g, thy z, itmin, itmax, Matrix_columnToX (thee.peek(), itmin - 0.5), Matrix_columnToX (thee.peek(), itmax + 0.5), ifmin, ifmax, Matrix_rowToY (thee.peek(), ifmin - 0.5), Matrix_rowToY (thee.peek(), ifmax + 0.5), dBminimum, dBmaximum); Graphics_unsetInner (g); if (garnish) { Graphics_drawInnerBox (g); Graphics_textBottom (g, 1, L"Time (s)"); Graphics_marksBottom (g, 2, 1, 1, 0); Graphics_marksLeft (g, 2, 1, 1, 0); Graphics_textLeft (g, 1, L"Quefrency (s)"); } }