• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Melder_dup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PairDistribution_to_Stringses

void PairDistribution_to_Stringses (PairDistribution me, long nout, autoStrings *strings1_out, autoStrings *strings2_out) {
	try {
		long nin = my pairs -> size, iin;
		if (nin < 1)
			Melder_throw (U"No candidates.");
		if (nout < 1)
			Melder_throw (U"Number of generated string pairs should be positive.");
		double total = PairDistributions_getTotalWeight_checkPositive (me);
		autoStrings strings1 = Thing_new (Strings);
		strings1 -> numberOfStrings = nout;
		strings1 -> strings = NUMvector <char32 *> (1, nout);
		autoStrings strings2 = Thing_new (Strings);
		strings2 -> numberOfStrings = nout;
		strings2 -> strings = NUMvector <char32 *> (1, nout);
		for (long iout = 1; iout <= nout; iout ++) {
			do {
				double rand = NUMrandomUniform (0, total), sum = 0.0;
				for (iin = 1; iin <= nin; iin ++) {
					PairProbability prob = static_cast <PairProbability> (my pairs -> item [iin]);
					sum += prob -> weight;
					if (rand <= sum) break;
				}
			} while (iin > nin);   /* Guard against rounding errors. */
			PairProbability prob = static_cast <PairProbability> (my pairs -> item [iin]);
			if (! prob -> string1 || ! prob -> string2)
				Melder_throw (U"No string in probability pair ", iin, U".");
			strings1 -> strings [iout] = Melder_dup (prob -> string1);
			strings2 -> strings [iout] = Melder_dup (prob -> string2);
		}
		*strings1_out = strings1.move();
		*strings2_out = strings2.move();
	} catch (MelderError) {
		Melder_throw (me, U": generation of Stringses not performed.");
	}
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:35,代码来源:PairDistribution.cpp


示例2: FileInMemory_create

autoFileInMemory FileInMemory_create (MelderFile file) {
	try {
		if (! MelderFile_readable (file)) {
			Melder_throw (U"File not readable.");
		}
		long length = MelderFile_length (file);
		if (length <= 0) {
			Melder_throw (U"File is empty.");
		}
		autoFileInMemory me = Thing_new (FileInMemory);
		my d_path = Melder_dup (file -> path);
		my d_id = Melder_dup (MelderFile_name (file));
		my d_numberOfBytes = length;
		my ownData = true;
		my d_data = NUMvector <char> (0, my d_numberOfBytes);   // includes room for a final null byte in case the file happens to contain text
		MelderFile_open (file);
		for (long i = 0; i < my d_numberOfBytes; i++) {
			unsigned int number = bingetu1 (file -> filePointer);
			my d_data[i] = number;
		}
		my d_data[my d_numberOfBytes] = 0;   // one extra
		MelderFile_close (file);
		return me;
	} catch (MelderError) {
		Melder_throw (U"FileInMemory not created from \"", Melder_fileToPath (file), U"\".");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:27,代码来源:FileInMemory.cpp


示例3: PairProbability_create

autoPairProbability PairProbability_create (const char32 *string1, const char32 *string2, double weight) {
	autoPairProbability me = Thing_new (PairProbability);
	my string1 = Melder_dup (string1);
	my string2 = Melder_dup (string2);
	my weight = weight;
	return me;
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:7,代码来源:PairDistribution.cpp


示例4: ResultsMFC_removeUnsharedStimuli

autoResultsMFC ResultsMFC_removeUnsharedStimuli (ResultsMFC me, ResultsMFC thee) {
	try {
		autoResultsMFC him = ResultsMFC_create (thy numberOfTrials);
		his numberOfTrials = 0;
		for (long i = 1; i <= thy numberOfTrials; i ++) {
			bool present = false;
			for (long j = 1; j <= my numberOfTrials; j ++) {
				if (str32equ (thy result [i]. stimulus, my result [j]. stimulus)) {
					present = true;
					break;
				}
			}
			if (present) {
				his numberOfTrials ++;
				his result [his numberOfTrials]. stimulus = Melder_dup (thy result [i]. stimulus);
				his result [his numberOfTrials]. response = Melder_dup (thy result [i]. response);
			}
		}
		if (his numberOfTrials == 0)
			Melder_throw (U"No shared stimuli.");
		return him;
	} catch (MelderError) {
		Melder_throw (me, U" & ", thee, U": unshared stimuli not removed.");
	}
}
开发者ID:READSEARCH,项目名称:praat,代码行数:25,代码来源:ExperimentMFC.cpp


示例5: v_copy

void structFileInMemory :: v_copy (thou) {
	thouart (FileInMemory);
	FileInMemory_Parent :: v_copy (thee);
	thy d_path = Melder_dup (d_path);
	thy d_id = Melder_dup (d_id);
	thy d_numberOfBytes = d_numberOfBytes;
	thy d_data = NUMvector<char> (0, d_numberOfBytes);
	memcpy (thy d_data, d_data, d_numberOfBytes+1);
}
开发者ID:psibre,项目名称:praat,代码行数:9,代码来源:FileInMemory.cpp


示例6: v_copy

void structFileInMemory :: v_copy (Daata thee_Daata) {
	FileInMemory thee = static_cast <FileInMemory> (thee_Daata);
	our FileInMemory_Parent :: v_copy (thee);
	thy d_path = Melder_dup (our d_path);
	thy d_id = Melder_dup (our d_id);
	thy d_numberOfBytes = our d_numberOfBytes;
	thy ownData = our ownData;
	thy d_data = NUMvector<char> (0, our d_numberOfBytes);
	memcpy (thy d_data, our d_data, our d_numberOfBytes + 1);
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:10,代码来源:FileInMemory.cpp


示例7: LogisticRegression_create

autoLogisticRegression LogisticRegression_create (const char32 *dependent1, const char32 *dependent2) {
	try {
		autoLogisticRegression me = Thing_new (LogisticRegression);
		Regression_init (me.peek());
		my dependent1 = Melder_dup (dependent1);
		my dependent2 = Melder_dup (dependent2);
		return me;
	} catch (MelderError) {
		Melder_throw (U"LogisticRegression not created.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:11,代码来源:LogisticRegression.cpp


示例8: OTMultiEditor_create

OTMultiEditor OTMultiEditor_create (const char32 *title, OTMulti grammar) {
	try {
		autoOTMultiEditor me = Thing_new (OTMultiEditor);
		my data = grammar;
		my form1 = Melder_dup (U"");
		my form2 = Melder_dup (U"");
		HyperPage_init (me.peek(), title, grammar);
		return me.transfer();
	} catch (MelderError) {
		Melder_throw (U"OTMulti window not created.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:12,代码来源:OTMultiEditor.cpp


示例9: FileInMemory_createWithData

FileInMemory FileInMemory_createWithData (long numberOfBytes, const char *data, const char32 *path, const char32 *id) {
	try {
		autoFileInMemory me = Thing_new (FileInMemory);
		my d_path = Melder_dup (path);
		my d_id = Melder_dup (id);
		my d_numberOfBytes = numberOfBytes;
		my d_data = const_cast<char *> (data); // copy pointer to data only
		return me.transfer ();
	} catch (MelderError) {
		Melder_throw (U"FileInMemory not create from data.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:12,代码来源:FileInMemory.cpp


示例10: SpeechSynthesizer_create

autoSpeechSynthesizer SpeechSynthesizer_create (const char32 *voiceLanguageName, const char32 *voiceVariantName) {
	try {
		autoSpeechSynthesizer me = Thing_new (SpeechSynthesizer);
		(void) SpeechSynthesizer_getVoiceLanguageCodeFromName (me.get(), voiceLanguageName);
		(void) SpeechSynthesizer_getVoiceVariantCodeFromName (me.get(), voiceVariantName);
		my d_voiceLanguageName = Melder_dup (voiceLanguageName);
		my d_voiceVariantName = Melder_dup (voiceVariantName);
		SpeechSynthesizer_setTextInputSettings (me.get(), SpeechSynthesizer_INPUT_TEXTONLY, SpeechSynthesizer_PHONEMECODINGS_KIRSHENBAUM);
		SpeechSynthesizer_setSpeechOutputSettings (me.get(), 44100, 0.01, 50, 50, 175, true, SpeechSynthesizer_PHONEMECODINGS_IPA);
		SpeechSynthesizer_initEspeak ();
		return me;
	} catch (MelderError) {
		Melder_throw (U"SpeechSynthesizer not created.");
	}
}
开发者ID:PaulBoersma,项目名称:praat,代码行数:15,代码来源:SpeechSynthesizer.cpp


示例11: EditDistanceTable_to_TableOfReal

TableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me) {
    try {
        autoTableOfReal thee = TableOfReal_create (my numberOfRows, my numberOfColumns);
        for (long j = 1; j <= my numberOfColumns; j++) {
            thy columnLabels[j] = Melder_dup (my columnLabels[j]);
        }
        for (long i = 1; i <= my numberOfRows; i++) {
            thy rowLabels[i] = Melder_dup (my rowLabels[i]);
        }
        NUMmatrix_copyElements<double> (my data, thy data, 1, my numberOfRows, 1, my numberOfColumns);
        return thee.transfer();
    } catch (MelderError) {
        Melder_throw (me, U": no TableOfReal created.");
    }
}
开发者ID:psibre,项目名称:praat,代码行数:15,代码来源:EditDistanceTable.cpp


示例12: ERPTier_extractEventsWhereColumn_string

autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table,
	long columnNumber, int which_Melder_STRING, const char32 *criterion)
{
	try {
		Table_checkSpecifiedColumnNumberWithinRange (table, columnNumber);
		if (my events -> size != table -> rows -> size)
			Melder_throw (me, U" & ", table, U": the number of rows in the table (", table -> rows -> size,
				U") doesn't match the number of events (", my events -> size, U").");
		autoERPTier thee = Thing_new (ERPTier);
		Function_init (thee.peek(), my xmin, my xmax);
		thy numberOfChannels = my numberOfChannels;
		thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels);
		for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
		}
		thy events = SortedSetOfDouble_create ();
		for (long ievent = 1; ievent <= my events -> size; ievent ++) {
			ERPPoint oldEvent = my event (ievent);
			TableRow row = table -> row (ievent);
			if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which_Melder_STRING, criterion)) {
				autoERPPoint newEvent = Data_copy (oldEvent);
				Collection_addItem_move (thy events.get(), newEvent.move());
			}
		}
		if (thy events -> size == 0) {
			Melder_warning (U"No event matches criterion.");
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": events not extracted.");
	}
}
开发者ID:ffostertw,项目名称:praat,代码行数:32,代码来源:ERPTier.cpp


示例13: Strings_append

autoStrings Strings_append (Collection me) {
	try {
		long index = 1, numberOfStrings = 0;

		for (long i = 1; i <= my size; i++) {
			Strings s = (Strings) my item[i];
			numberOfStrings += s -> numberOfStrings;
		}

		autoStrings thee = Strings_createFixedLength (numberOfStrings);

		for (long i = 1; i <= my size; i++) {
			Strings s = (Strings) my item[i];
			for (long j = 1; j <= s -> numberOfStrings; j++, index++) {
				if (s -> strings[j] == 0) {
					continue;
				}
				thy strings [index] = Melder_dup (s -> strings[j]);
			}
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": not appended.");
	}
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:25,代码来源:Strings_extensions.cpp


示例14: Strings_to_Distributions

Distributions Strings_to_Distributions (Strings me) {
	try {
		autoDistributions thee = Distributions_create (my numberOfStrings, 1);
		long idist = 0;
		for (long i = 1; i <= my numberOfStrings; i ++) {
			char32 *string = my strings [i];
			long where = 0;
			long j = 1;
			for (; j <= idist; j ++)
				if (str32equ (thy rowLabels [j], string))
					{ where = j; break; }
			if (where) {
				thy data [j] [1] += 1.0;
			} else {
				thy rowLabels [++ idist] = Melder_dup (string);
				thy data [idist] [1] = 1.0;
			}
		}
		thy numberOfRows = idist;
		TableOfReal_sortByLabel (thee.peek(), 1, 0);
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (me, U": distribution not computed.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:25,代码来源:Distributions_and_Strings.cpp


示例15: Strings_readFromRawTextFile

autoStrings Strings_readFromRawTextFile (MelderFile file) {
	try {
		autoMelderReadText text = MelderReadText_createFromFile (file);

		/*
		 * Count number of strings.
		 */
		int64 n = MelderReadText_getNumberOfLines (text.peek());

		/*
		 * Create.
		 */
		autoStrings me = Thing_new (Strings);
		if (n > 0) my strings = NUMvector <char32 *> (1, n);
		my numberOfStrings = n;

		/*
		 * Read strings.
		 */
		for (long i = 1; i <= n; i ++) {
			char32 *line = MelderReadText_readLine (text.peek());
			my strings [i] = Melder_dup (line);
		}
		return me;
	} catch (MelderError) {
		Melder_throw (U"Strings not read from raw text file ", file, U".");
	}
}
开发者ID:mlufei,项目名称:praat,代码行数:28,代码来源:Strings.cpp


示例16: Movie_init

void Movie_init (Movie me, Sound sound, const char32 *folderName, Strings fileNames)
{
	Sampled_init (me, sound -> xmin, sound -> xmax, fileNames ? fileNames -> numberOfStrings : 0, 0.04, 0.0);
	my d_sound = sound;
	my d_folderName = Melder_dup (folderName);
	my d_fileNames = fileNames;
}
开发者ID:guilhermegarcia,项目名称:praat-1,代码行数:7,代码来源:Movie.cpp


示例17: ERPTier_extractEventsWhereColumn_number

autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, long columnNumber, int which_Melder_NUMBER, double criterion) {
	try {
		Table_checkSpecifiedColumnNumberWithinRange (table, columnNumber);
		Table_numericize_Assert (table, columnNumber);   // extraction should work even if cells are not defined
		if (my points.size != table -> rows.size)
			Melder_throw (me, U" & ", table, U": the number of rows in the table (", table -> rows.size,
				U") doesn't match the number of events (", my points.size, U").");
		autoERPTier thee = Thing_new (ERPTier);
		Function_init (thee.get(), my xmin, my xmax);
		thy numberOfChannels = my numberOfChannels;
		thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels);
		for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
		}
		for (long ievent = 1; ievent <= my points.size; ievent ++) {
			ERPPoint oldEvent = my points.at [ievent];
			TableRow row = table -> rows.at [ievent];
			if (Melder_numberMatchesCriterion (row -> cells [columnNumber]. number, which_Melder_NUMBER, criterion)) {
				autoERPPoint newEvent = Data_copy (oldEvent);
				thy points. addItem_move (newEvent.move());
			}
		}
		if (thy points.size == 0) {
			Melder_warning (U"No event matches criterion.");
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": events not extracted.");
	}
}
开发者ID:nullpunktTUD,项目名称:praat,代码行数:30,代码来源:ERPTier.cpp


示例18: ERPTier_extractERP

autoERP ERPTier_extractERP (ERPTier me, long eventNumber) {
	try {
		long numberOfEvents = my events -> size;
		if (numberOfEvents < 1)
			Melder_throw (U"No events.");
		ERPTier_checkEventNumber (me, eventNumber);
		ERPPoint event = my event (eventNumber);
		long numberOfChannels = event -> erp -> ny;
		long numberOfSamples = event -> erp -> nx;
		autoERP thee = Thing_new (ERP);
		event -> erp -> structSound :: v_copy (thee.peek());
		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
			double *oldChannel = event -> erp -> z [ichannel];
			double *newChannel = thy z [ichannel];
			for (long isample = 1; isample <= numberOfSamples; isample ++) {
				newChannel [isample] = oldChannel [isample];
			}
		}
		thy channelNames = NUMvector <char32 *> (1, thy ny);
		for (long ichan = 1; ichan <= thy ny; ichan ++) {
			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": ERP not extracted.");
	}
}
开发者ID:ffostertw,项目名称:praat,代码行数:27,代码来源:ERPTier.cpp


示例19: NUMstrings_copyElements

void NUMstrings_copyElements (char32 **from, char32 **to, long lo, long hi) {
	for (long i = lo; i <= hi; i++) {
		Melder_free (to[i]);
		if (from[i]) {
			to[i] = Melder_dup (from[i]);
		}
	}
}
开发者ID:psibre,项目名称:praat,代码行数:8,代码来源:NUMstring.cpp


示例20: ScriptEditor_init

void ScriptEditor_init (ScriptEditor me, Editor environment, const char32 *initialText) {
	if (environment) {
		my environmentName = Melder_dup (environment -> name);
		my editorClass = environment -> classInfo;
	}
	TextEditor_init (me, initialText);
	my interpreter = Interpreter_createFromEnvironment (environment);
	theReferencesToAllOpenScriptEditors. addItem_ref (me);
}
开发者ID:jjatria,项目名称:praat,代码行数:9,代码来源:ScriptEditor.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Melder_flushError函数代码示例发布时间:2022-05-30
下一篇:
C++ Melder_assert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap