当前位置: 首页>>代码示例>>C++>>正文


C++ Thing_new函数代码示例

本文整理汇总了C++中Thing_new函数的典型用法代码示例。如果您正苦于以下问题:C++ Thing_new函数的具体用法?C++ Thing_new怎么用?C++ Thing_new使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Thing_new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Configuration_create

autoConfiguration Configuration_create (long numberOfPoints, long numberOfDimensions) {
	try {
		autoConfiguration me = Thing_new (Configuration);
		TableOfReal_init (me.peek(), numberOfPoints, numberOfDimensions);
		my w = NUMvector<double> (1, numberOfDimensions);
		TableOfReal_setSequentialRowLabels (me.peek(), 0, 0, nullptr, 1, 1);
		TableOfReal_setSequentialColumnLabels (me.peek(), 0, 0, U"dimension ", 1, 1);

		my metric = 2;
		Configuration_setDefaultWeights (me.peek());
		Configuration_randomize (me.peek());
		return me;
	} catch (MelderError) {
		Melder_throw (U"Configuration not created.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:16,代码来源:Configuration.cpp

示例2: FujisakiPitch_create

FujisakiPitch FujisakiPitch_create (double tmin, double tmax,
                                    double baseFrequency, double alpha, double beta, double gamma)
{
    try {
        autoFujisakiPitch me = Thing_new (FujisakiPitch);
        Function_init (me.peek(), tmin, tmax);
        my baseFrequency = baseFrequency;
        my alpha = alpha;
        my beta = beta;
        my gamma = gamma;
        my phraseCommands = SortedSetOfDouble_create ();
        my accentCommands = SortedSetOfDouble_create ();
        return me.transfer();
    } catch (MelderError) {
        Melder_throw ("FujisakiPitch not created.");
    }
}
开发者ID:Crisil,项目名称:praat,代码行数:17,代码来源:FujisakiPitch.cpp

示例3: Strings_to_Categories

autoCategories Strings_to_Categories (Strings me) {
	try {
		if (my numberOfStrings < 1) {
			Melder_throw (U"Empty strings.");
		}
		autoCategories thee = Thing_new (Categories);
		thy _grow (my numberOfStrings);

		for (long i = 1; i <= my numberOfStrings; i++) {
			autoSimpleString s = SimpleString_create (my strings [i]);
			thy addItem_move (s.move());
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": not converted.");
	}
}
开发者ID:READSEARCH,项目名称:praat,代码行数:17,代码来源:Categories_and_Strings.cpp

示例4: espeakdata_voices_getNames

Strings espeakdata_voices_getNames (Table me, long column) {
	try {
		if (column < 0 || column > 2) {
			Melder_throw (U"Illegal columnn.");
		}
		autoStrings thee = Thing_new (Strings);
		thy strings = NUMvector <char32 *> (1, my rows -> size);
		thy numberOfStrings = 0;
		for (long irow = 1; irow <= my rows -> size; irow++) {
			thy strings[irow] = Melder_dup (Table_getStringValue_Assert (me, irow, column));
			thy numberOfStrings++;
		}
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (U"Espeakdata: voices not initialized.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:17,代码来源:espeakdata_FileInMemory.cpp

示例5: SPINET_create

autoSPINET SPINET_create (double tmin, double tmax, long nt, double dt, double t1, double minimumFrequency, double maximumFrequency, long nFilters, double excitationErbProportion, double inhibitionErbProportion) {
    try {
        autoSPINET me = Thing_new (SPINET);
        double minErb = NUMhertzToErb (minimumFrequency);
        double maxErb = NUMhertzToErb (maximumFrequency);
        double dErb = (maxErb - minErb) / nFilters;
        SampledXY_init (me.peek(), tmin, tmax, nt, dt, t1, minErb - dErb / 2.0, maxErb + dErb / 2.0, nFilters, dErb, minErb);
        my y = NUMmatrix<double> (1, nFilters, 1, nt);
        my s = NUMmatrix<double> (1, nFilters, 1, nt);
        my gamma = 4;
        my excitationErbProportion = excitationErbProportion;
        my inhibitionErbProportion = inhibitionErbProportion;
        return me;
    } catch (MelderError) {
        Melder_throw (U"SPINET not created.");
    }
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:17,代码来源:SPINET.cpp

示例6: Categories_to_Strings

autoStrings Categories_to_Strings (Categories me) {
	try {
		if (my size < 1) {
			Melder_throw (U"No elements.");
		}
		autoStrings thee = Thing_new (Strings);
		thy strings = NUMvector<char32 *> (1, my size);
		thy numberOfStrings = my size;

		for (long i = 1; i <= my size; i ++) {
			SimpleString s = my at [i];
			thy strings [i] = Melder_dup (s -> string);
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": not converted to Strings.");
	}
}
开发者ID:READSEARCH,项目名称:praat,代码行数:18,代码来源:Categories_and_Strings.cpp

示例7: IntervalTier_to_Strings_withOriginData

static autoStrings IntervalTier_to_Strings_withOriginData (IntervalTier me, long *from) {
	try {
		autoStrings thee = Thing_new (Strings);
		thy strings = NUMvector<char32 *> (1, my intervals.size);
		for (long i = 1; i <= my intervals.size; i ++) {
			TextInterval ti = my intervals.at [i];
			if (ti -> text && ti -> text [0] != U'\0') {
				thy strings [++ thy numberOfStrings] = Melder_dup (ti -> text);
				if (from) {
					from [thy numberOfStrings] = i;
				}
			}
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": no Strings created.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:18,代码来源:SpeechSynthesizer_and_TextGrid.cpp

示例8: KlattGrid_FormantGridEditor_create

autoKlattGrid_FormantGridEditor KlattGrid_FormantGridEditor_create (const char32 *title, KlattGrid data, int formantType) {
	try {
		Melder_assert (data);
		autoFormantGrid* fg = KlattGrid_getAddressOfFormantGrid (data, formantType);
		if (! fg) {
			Melder_throw (U"Formant type unknown.");
		}
		if (FormantGrid_isEmpty (fg -> get())) {
			Melder_throw (U"Cannot edit an empty formant grid.");
		}
		autoKlattGrid_FormantGridEditor me = Thing_new (KlattGrid_FormantGridEditor);
		my klattgrid = data;
		FormantGridEditor_init (me.peek(), title, fg->get());
		return me;
	} catch (MelderError) {
		Melder_throw (U"KlattGrid formant window not created.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:18,代码来源:KlattGridEditors.cpp

示例9: Spectrum_to_Ltas

Ltas Spectrum_to_Ltas (Spectrum me, double bandWidth) {
	try {
		long numberOfBands = ceil ((my xmax - my xmin) / bandWidth);
		if (bandWidth <= my dx)
			Melder_throw ("Bandwidth must be greater than ", my dx, ".");
		autoLtas thee = Thing_new (Ltas);
		Matrix_init (thee.peek(), my xmin, my xmax, numberOfBands, bandWidth, my xmin + 0.5 * bandWidth, 1, 1, 1, 1, 1);
		for (long iband = 1; iband <= numberOfBands; iband ++) {
			double fmin = thy xmin + (iband - 1) * bandWidth;
			double meanEnergyDensity = Sampled_getMean (me, fmin, fmin + bandWidth, 0, 1, FALSE);
			double meanPowerDensity = meanEnergyDensity * my dx;   // as an approximation for a division by the original duration
			thy z [1] [iband] = meanPowerDensity == 0.0 ? -300.0 : 10.0 * log10 (meanPowerDensity / 4.0e-10);
		}
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (me, ": not converted to Ltas.");
	}
}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:18,代码来源:Ltas.cpp

示例10: RunnerMFC_create

RunnerMFC RunnerMFC_create (const wchar_t *title, Ordered experiments) {
	try {
		autoRunnerMFC me = Thing_new (RunnerMFC);
		Editor_init (me.peek(), 0, 0, 2000, 2000, title, NULL);
		my experiments = experiments;
		my graphics = Graphics_create_xmdrawingarea (my d_drawingArea);

struct structGuiDrawingAreaResizeEvent event = { my d_drawingArea, 0 };
event. width  = my d_drawingArea -> f_getWidth  ();
event. height = my d_drawingArea -> f_getHeight ();
gui_drawingarea_cb_resize (me.peek(), & event);

		my iexperiment = 1;
		RunnerMFC_startExperiment (me.peek());
		return me.transfer();
	} catch (MelderError) {
		Melder_throw ("Experiment window not created.");
	}
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:19,代码来源:RunnerMFC.cpp

示例11: Pitch_create

autoPitch Pitch_create (double tmin, double tmax, long nt, double dt, double t1,
	double ceiling, int maxnCandidates)
{
	try {
		autoPitch me = Thing_new (Pitch);
		Sampled_init (me.peek(), tmin, tmax, nt, dt, t1);
		my ceiling = ceiling;
		my maxnCandidates = maxnCandidates;
		my frame = NUMvector <structPitch_Frame> (1, nt);

		/* Put one candidate in every frame (unvoiced, silent). */
		for (long it = 1; it <= nt; it ++) {
			Pitch_Frame_init (& my frame [it], 1);
		}

		return me;
	} catch (MelderError) {
		Melder_throw (U"Pitch not created.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:20,代码来源:Pitch.cpp

示例12: Strings_insertAndExpand

static Strings Strings_insertAndExpand (Strings me, long position, const char32 *newstring) {
	try {
		if (position == 0) position = my numberOfStrings + 1;
		Melder_assert (position >= 1);
		Melder_assert (position <= my numberOfStrings + 1);
		autoStrings thee = Thing_new (Strings);
		thy strings = NUMvector<char32 *> (1, my numberOfStrings + 1);
		for (long i = 1, from = 1; i <= my numberOfStrings + 1; i++, from++) {
			const char32 *to_copy = my strings[from];
			if (i == position) {
				to_copy = newstring; from--;
			}
			thy strings[i] = Melder_dup (to_copy);
		}
		thy numberOfStrings = my numberOfStrings + 1;
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (me, U" not expanded.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:20,代码来源:espeakdata_FileInMemory.cpp

示例13: Matrix_eigen

void Matrix_eigen (Matrix me, autoMatrix *out_eigenvectors, autoMatrix *out_eigenvalues) {
	try {
		if (my nx != my ny)
			Melder_throw (U"(Matrix not square.");

		autoEigen eigen = Thing_new (Eigen);
		Eigen_initFromSymmetricMatrix (eigen.peek(), my z, my nx);
		autoMatrix eigenvectors = Data_copy (me);
		autoMatrix eigenvalues = Matrix_create (1.0, 1.0, 1, 1.0, 1.0, my ymin, my ymax, my ny, my dy, my y1);
		for (long i = 1; i <= my nx; i ++) {
			eigenvalues -> z [i] [1] = eigen -> eigenvalues [i];
			for (long j = 1; j <= my nx; j ++)
				eigenvectors -> z [i] [j] = eigen -> eigenvectors [j] [i];
		}
		*out_eigenvectors = eigenvectors.move();
		*out_eigenvalues = eigenvalues.move();
	} catch (MelderError) {
		Melder_throw (me, U": eigenstructure not computed.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:20,代码来源:Matrix.cpp

示例14: VDSmagtMinimizer_create

autoVDSmagtMinimizer VDSmagtMinimizer_create (long nParameters, Daata object, double (*func) (Daata object, const double x[]), void (*dfunc) (Daata object, const double x[], double dx[])) {
	try {
		autoVDSmagtMinimizer me = Thing_new (VDSmagtMinimizer);
		Minimizer_init (me.peek(), nParameters, object);
		my dp = NUMvector<double> (1, nParameters);
		my pc = NUMvector<double> (1, nParameters);
		my gc = NUMvector<double> (1, nParameters);
		my g0 = NUMvector<double> (1, nParameters);
		my s = NUMvector<double> (1, nParameters);
		my srst = NUMvector<double> (1, nParameters);
		my grst = NUMvector<double> (1, nParameters);
		my func = func;
		my dfunc = dfunc;
		my lineSearchGradient = 0.9;
		my lineSearchMaxNumOfIterations = 5;
		return me;
	} catch (MelderError) {
		Melder_throw (U"VDSmagtMinimizer not created.");
	}
}
开发者ID:jjatria,项目名称:praat,代码行数:20,代码来源:Minimizers.cpp

示例15: Movie_openFromSoundFile

autoMovie Movie_openFromSoundFile (MelderFile file)
{
	try {
		autoMovie me = Thing_new (Movie);
		autoSound sound = Sound_readFromSoundFile (file);
		autoMelderString fileNameHead;
		MelderString_copy (& fileNameHead, Melder_fileToPath (file));
		char32 *extensionLocation = str32rchr (fileNameHead.string, U'.');
		if (! extensionLocation)
			extensionLocation = & fileNameHead.string [fileNameHead.length];
		*extensionLocation = U'\0';
		fileNameHead.length = extensionLocation - fileNameHead.string;
		autoStrings strings = Strings_createAsFileList (Melder_cat (fileNameHead.string, U"*.png"));
		struct structMelderDir folder;
		MelderFile_getParentDir (file, & folder);
		Movie_init (me.peek(), sound.transfer(), Melder_dirToPath (& folder), strings.transfer());
		return me;
	} catch (MelderError) {
		Melder_throw (U"Movie object not read from file ", file, U".");
	}
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:21,代码来源:Movie.cpp


注:本文中的Thing_new函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。