本文整理汇总了C++中Melder_integer函数的典型用法代码示例。如果您正苦于以下问题:C++ Melder_integer函数的具体用法?C++ Melder_integer怎么用?C++ Melder_integer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Melder_integer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Pitch_difference
void Pitch_difference (Pitch me, Pitch thee) {
long nuvtov = 0, nvtouv = 0, ndfdown = 0, ndfup = 0;
if (my nx != thy nx || my dx != thy dx || my x1 != thy x1) {
Melder_flushError ("Pitch_difference: these Pitches are not aligned.");
return;
}
for (long i = 1; i <= my nx; i ++) {
double myf = my frame [i]. candidate [1]. frequency, thyf = thy frame [i]. candidate [1]. frequency;
int myUnvoiced = myf == 0 || myf > my ceiling;
int thyUnvoiced = thyf == 0 || thyf > thy ceiling;
double t = Sampled_indexToX (me, i);
if (myUnvoiced && ! thyUnvoiced) {
Melder_casual ("Frame %ld time %f: unvoiced to voiced.", i, t);
nuvtov ++;
} else if (! myUnvoiced && thyUnvoiced) {
Melder_casual ("Frame %ld time %f: voiced to unvoiced.", i, t);
nvtouv ++;
} else if (! myUnvoiced && ! thyUnvoiced) {
if (myf > thyf) {
//Melder_casual ("Frame %ld time %f: downward frequency jump from %.5g Hz to %.5g Hz.", i, t, myf, thyf);
ndfdown ++;
} else if (myf < thyf) {
//Melder_casual ("Frame %ld time %f: upward frequency jump from %.5g Hz to %.5g Hz.", i, t, myf, thyf);
ndfup ++;
}
}
}
MelderInfo_open ();
MelderInfo_writeLine (L"Difference between two Pitches:");
MelderInfo_writeLine (L"Unvoiced to voiced: ", Melder_integer (nuvtov), L" frames.");
MelderInfo_writeLine (L"Voiced to unvoiced: ", Melder_integer (nvtouv), L" frames.");
MelderInfo_writeLine (L"Downward frequency jump: ", Melder_integer (ndfdown), L" frames.");
MelderInfo_writeLine (L"Upward frequency jump: ", Melder_integer (ndfup), L" frames.");
MelderInfo_close ();
}
示例2: Distributions_Transition_map
Distributions Distributions_Transition_map (Distributions me, Transition map) {
Distributions thee = NULL;
/*
* Preconditions: matrix matching.
*/
if (map -> numberOfStates != my numberOfRows)
error5 (L"Number of data (", Melder_integer (map -> numberOfStates), L") in mapping matrix "
"does not match number of data (", Melder_integer (my numberOfRows), L") in distribution.")
/*
* Create the output object.
*/
thee = (structDistributions *)Data_copy (me); cherror
/*
* Compute the elements of the surface distributions.
*/
for (long row = 1; row <= my numberOfRows; row ++) for (long col = 1; col <= my numberOfColumns; col ++) {
thy data [row] [col] = 0.0;
for (long m = 1; m <= map -> numberOfStates; m ++)
thy data [row] [col] += my data [m] [col] * map -> data [m] [row];
}
end:
iferror {
forget (thee);
return (structDistributions *)Melder_errorp1 (L"Distributions & Transition: Mapping not performed.");
}
return thee;
}
示例3: v_info
void structWordList :: v_info () {
structData :: v_info ();
long n = WordList_count (this);
if (! length) length = wcslen (string);
MelderInfo_writeLine2 (L"Number of words: ", Melder_integer (n));
MelderInfo_writeLine2 (L"Number of characters: ", Melder_integer (length - n));
}
示例4: MelderString_empty
void ButtonEditor::drawMenuCommand (praat_Command cmd, long i) {
static MelderString text = { 0 };
int isAdded = cmd -> uniqueID != 0 || cmd -> script != NULL;
int isHidden = cmd -> hidden;
int isToggled = cmd -> toggled;
const wchar_t *clickText = isHidden ? (isToggled ? (isAdded ? L"REMOVED" : L"HIDDEN") : L"hidden") :
(isToggled ? L"SHOWN" : (isAdded ? (cmd -> uniqueID ? L"ADDED" : L"START-UP") : L"shown"));
MelderString_empty (& text);
if (cmd -> unhidable) {
MelderString_append1 (& text, L"#unhidable ");
} else {
MelderString_append5 (& text, L"@@m", Melder_integer (i), L"|", clickText, L"@ ");
}
MelderString_append2 (& text, cmd -> window, L": ");
if (cmd -> menu) {
MelderString_append2 (& text, cmd -> menu, L": ");
}
if (cmd -> title) {
if (cmd -> executable) {
MelderString_append5 (& text, L"@@p", Melder_integer (i), L"|", cmd -> title, L"@");
} else {
MelderString_append1 (& text, cmd -> title);
}
} else {
MelderString_append1 (& text, L"---------");
}
if (cmd -> after) {
MelderString_append3 (& text, L", %%%%after \"", cmd -> after, L"\"%%");
}
if (cmd -> script) {
MelderString_append3 (& text, L", script \"", Melder_peekExpandBackslashes (cmd -> script), L"\"");
}
any (text.string, _font, _fontSize, cmd -> callback ? 0 : Graphics_ITALIC, 0.0,
cmd -> depth * 0.3, 0.4, 0.0, 0.0, 0);
}
示例5: Minimizer_minimizeManyTimes
void Minimizer_minimizeManyTimes (Minimizer me, long numberOfTimes, long maxIterationsPerTime, double tolerance) {
double fopt = my minimum;
int monitorSingle = numberOfTimes == 1;
autoNUMvector<double> popt (NUMvector_copy<double> (my p, 1, my nParameters), 1);
if (! monitorSingle) {
Melder_progress (0.0, L"Minimize many times");
}
/* on first iteration start with current parameters 27/11/97 */
for (long i = 1; i <= numberOfTimes; i++) {
Minimizer_minimize (me, maxIterationsPerTime, tolerance, monitorSingle);
Melder_casual ("Current %ld: minimum = %.17g", i, my minimum);
if (my minimum < fopt) {
NUMvector_copyElements (my p, popt.peek(), 1, my nParameters);
fopt = my minimum;
}
Minimizer_reset (me, 0);
if (! monitorSingle) {
try {
Melder_progress ( (double) i / numberOfTimes, Melder_integer (i), L" from ",
Melder_integer (numberOfTimes)); therror
} catch (MelderError) {
Melder_clearError (); // interrurpt, no error
break;
}
}
}
if (! monitorSingle) {
Melder_progress (1.0, 0);
}
Minimizer_reset (me, popt.peek());
}
示例6: v_writeText
void structPolygon :: v_writeText (MelderFile file) {
texputi4 (file, our numberOfPoints, U"numberOfPoints", 0,0,0,0,0);
for (long i = 1; i <= our numberOfPoints; i ++) {
texputr4 (file, our x [i], U"x [", Melder_integer (i), U"]", 0,0,0);
texputr4 (file, our y [i], U"y [", Melder_integer (i), U"]", 0,0,0);
}
}
示例7: CCA_and_TableOfReal_scores
TableOfReal CCA_and_TableOfReal_scores (CCA me, TableOfReal thee, long numberOfFactors)
{
TableOfReal him = NULL;
long n = thy numberOfRows;
long nx = my x -> dimension, ny = my y -> dimension;
if (ny + nx != thy numberOfColumns) return Melder_errorp7 (L"The number "
"of columns in the table (", Melder_integer (thy numberOfColumns), L") does not agree with "
"the dimensions of the CCA object (ny + nx = ", Melder_integer (ny), L" + ", Melder_integer (nx), L").");
if (numberOfFactors == 0) numberOfFactors = my numberOfCoefficients;
if (numberOfFactors < 1 || numberOfFactors > my numberOfCoefficients)
return Melder_errorp3 (L"The number of factors must be in interval "
"[1, ", Melder_integer (my numberOfCoefficients), L"].");
him = TableOfReal_create (n, 2 * numberOfFactors);
if (him == NULL) return NULL;
if (! NUMstrings_copyElements (thy rowLabels, his rowLabels, 1, thy numberOfRows) ||
! Eigen_and_TableOfReal_project_into (my y, thee, 1, ny, &him, 1, numberOfFactors) ||
! Eigen_and_TableOfReal_project_into (my x, thee, ny + 1,
thy numberOfColumns, &him, numberOfFactors + 1, his numberOfColumns) ||
! TableOfReal_setSequentialColumnLabels (him, 1, numberOfFactors, L"y_", 1, 1) ||
! TableOfReal_setSequentialColumnLabels (him, numberOfFactors + 1,
his numberOfColumns, L"x_", 1, 1)) forget (him);
return him;
}
示例8: info
static void info (I)
{
iam (CCA);
classData -> info (me);
MelderInfo_writeLine2 (L"Number of coefficients: ", Melder_integer (my numberOfCoefficients));
MelderInfo_writeLine2 (L"ny: ", Melder_integer (my y -> dimension));
MelderInfo_writeLine2 (L"nx: ", Melder_integer (my x -> dimension));
}
示例9: FFNet_createNameFromTopology
void FFNet_createNameFromTopology (FFNet me, MelderString *name)
{
MelderString_append1 (name, Melder_integer (my nUnitsInLayer[0]));
for (long i = 1; i <= my nLayers; i++)
{
MelderString_append2 (name, L"-", Melder_integer (my nUnitsInLayer[i]));
}
}
示例10: v_info
void structTube :: v_info () {
structData :: v_info ();
MelderInfo_writeLine5 (L"Time domain: ", Melder_double (xmin), L" to ", Melder_double (xmax), L" seconds");
MelderInfo_writeLine2 (L"Maximum number of segments: ", Melder_integer (maxnSegments));
MelderInfo_writeLine2 (L"Number of frames: ", Melder_integer (nx));
MelderInfo_writeLine3 (L"Time step: ", Melder_double (dx), L" seconds");
MelderInfo_writeLine3 (L"First frame at: ", Melder_double (x1), L" seconds");
}
示例11: v_info
void structLPC :: v_info () {
structData :: v_info ();
MelderInfo_writeLine (L"Time domain: ", Melder_double (xmin), L" to ", Melder_double (xmax),
L" (s).");
MelderInfo_writeLine (L"Prediction order: ", Melder_integer (maxnCoefficients));
MelderInfo_writeLine (L"Number of frames: ", Melder_integer (nx));
MelderInfo_writeLine (L"Time step: ", Melder_double (dx), L" (s).");
MelderInfo_writeLine (L"First frame at: ", Melder_double (x1), L" (s).");
}
示例12: v_info
void structCrossCorrelationTables :: v_info () {
structOrdered :: v_info ();
CrossCorrelationTable thee = (CrossCorrelationTable) item[1];
MelderInfo_writeLine (L" Number of rows and columns: ", Melder_integer (thy numberOfRows));
for (long i = 1; i <= size; i++) {
double dm = CrossCorrelationTable_getDiagonalityMeasure ( (CrossCorrelationTable) item[i]);
MelderInfo_writeLine (L"Diagonality measure for item ", Melder_integer (i), L": ", Melder_double (dm));
}
}
示例13: _Sound_to_LPC
static LPC _Sound_to_LPC (Sound me, int predictionOrder, double analysisWidth, double dt,
double preEmphasisFrequency, int method, double tol1, double tol2) {
double t1, samplingFrequency = 1.0 / my dx;
double windowDuration = 2 * analysisWidth; /* gaussian window */
long nFrames, frameErrorCount = 0;
if (floor (windowDuration / my dx) < predictionOrder + 1) Melder_throw ("Analysis window duration too short.\n"
"For a prediction order of ", predictionOrder, " the analysis window duration has to be greater than ", my dx * (predictionOrder + 1),
"Please increase the analysis window duration or lower the prediction order.");
// Convenience: analyse the whole sound into one LPC_frame
if (windowDuration > my dx * my nx) {
windowDuration = my dx * my nx;
}
Sampled_shortTermAnalysis (me, windowDuration, dt, & nFrames, & t1);
autoSound sound = Data_copy (me);
autoSound sframe = Sound_createSimple (1, windowDuration, samplingFrequency);
autoSound window = Sound_createGaussian (windowDuration, samplingFrequency);
autoLPC thee = LPC_create (my xmin, my xmax, nFrames, dt, t1, predictionOrder, my dx);
autoMelderProgress progress (L"LPC analysis");
if (preEmphasisFrequency < samplingFrequency / 2) {
Sound_preEmphasis (sound.peek(), preEmphasisFrequency);
}
for (long i = 1; i <= nFrames; i++) {
LPC_Frame lpcframe = (LPC_Frame) & thy d_frames[i];
double t = Sampled_indexToX (thee.peek(), i);
LPC_Frame_init (lpcframe, predictionOrder);
Sound_into_Sound (sound.peek(), sframe.peek(), t - windowDuration / 2);
Vector_subtractMean (sframe.peek());
Sounds_multiply (sframe.peek(), window.peek());
if (method == LPC_METHOD_AUTO) {
if (! Sound_into_LPC_Frame_auto (sframe.peek(), lpcframe)) {
frameErrorCount++;
}
} else if (method == LPC_METHOD_COVAR) {
if (! Sound_into_LPC_Frame_covar (sframe.peek(), lpcframe)) {
frameErrorCount++;
}
} else if (method == LPC_METHOD_BURG) {
if (! Sound_into_LPC_Frame_burg (sframe.peek(), lpcframe)) {
frameErrorCount++;
}
} else if (method == LPC_METHOD_MARPLE) {
if (! Sound_into_LPC_Frame_marple (sframe.peek(), lpcframe, tol1, tol2)) {
frameErrorCount++;
}
}
if ( (i % 10) == 1) {
Melder_progress ( (double) i / nFrames, L"LPC analysis of frame ",
Melder_integer (i), L" out of ", Melder_integer (nFrames), L".");
}
}
return thee.transfer();
}
示例14: TextGrid_checkStartAndEndTimesOfTiers
static void TextGrid_checkStartAndEndTimesOfTiers (TextGrid me) {
for (long itier = 1; itier <= my tiers -> size; itier++) {
Function tier = (Function) my tiers -> item[itier];
if (tier -> xmin != my xmin) {
Melder_throw (me, ": the start time of tier ", Melder_integer (itier), " does not match the start time of its TextGrid.");
} else if (tier -> xmax != my xmax) {
Melder_throw (me, ": the end time of tier ", Melder_integer (itier), " does not match the end time of its TextGrid.");
}
}
}
示例15: v_info
void structCC :: v_info () {
structData :: v_info ();
MelderInfo_writeLine5 (L"Time domain:", Melder_double (xmin), L" to ", Melder_double (xmax), L" seconds");
MelderInfo_writeLine2 (L"Number of frames: ", Melder_integer (nx));
MelderInfo_writeLine3 (L"Time step: ", Melder_double (dx), L" seconds");
MelderInfo_writeLine3 (L"First frame at: ", Melder_double (x1), L" seconds");
MelderInfo_writeLine2 (L"Number of coefficients: ", Melder_integer (maximumNumberOfCoefficients));
MelderInfo_writeLine3 (L"Minimum frequency: ", Melder_double (fmin), L" Hz");
MelderInfo_writeLine3 (L"Maximum frequency: ", Melder_double (fmax), L" Hz");
}