本文整理汇总了C++中Annotation::extractSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ Annotation::extractSamples方法的具体用法?C++ Annotation::extractSamples怎么用?C++ Annotation::extractSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::extractSamples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Extract
//.........这里部分代码省略.........
FileProvider *provider = new FileProvider(writer);
reader->setProvider(SSI_FFMPEGREADER_AUDIO_PROVIDER_NAME, provider);
reader->connect();
reader->start();
reader->wait();
reader->stop();
reader->disconnect();
delete provider;
delete reader;
delete writer;
result = true;
}
else
{
result = FileTools::ReadStreamFile(inPath->getPathFull(), from);
}
if (result)
{
ssi_stream_t to;
if (annoPath)
{
Annotation annotation;
if (result &= annotation.load(annoPath->getPathFull()))
{
if (annotation.getScheme()->type != SSI_SCHEME_TYPE::DISCRETE)
{
ssi_wrn("cannot extract features from a continuous annotation");
return false;
}
if (!ssi_strcmp(params.step, "0")) {
ssi_size_t step = 0, left = 0, right = 0;
if (!ssi_parse_samples(params.step, step, from.sr)) {
ssi_wrn("could not parse step size '%s'", params.step);
return false;
}
if (!ssi_parse_samples(params.left, left, from.sr)) {
ssi_wrn("could not parse left size '%s'", params.left);
return false;
}
if (!ssi_parse_samples(params.right, right, from.sr)) {
ssi_wrn("could not parse right size '%s'", params.right);
return false;
}
ssi_time_t step_t = step / from.sr;
ssi_time_t left_t = left / from.sr;
ssi_time_t right_t = right / from.sr;
annotation.convertToFrames(step_t, params.restClassName[0] == '\0' ? 0 : params.restClassName);
if (left_t > 0.0 || right_t > 0.0)
{
annotation.addOffset(left_t, right_t);
}
}
SampleList samples;
if (result &= annotation.extractSamples(from, &samples))
{
ISTransform samples_t(&samples);
samples_t.setTransformer(0, *chain);
samples_t.callEnter();
result &= ModelTools::SaveSampleList(samples_t, toPath, params.ascii ? File::ASCII : File::BINARY);
samples_t.callFlush();
}
}
}
else
{
if (ssi_strcmp(params.step, "0"))
{
SignalTools::Transform(from, to, *chain, 0u);
}
else
{
SignalTools::Transform(from, to, *chain, params.step, params.left, params.right);
}
result &= FileTools::WriteStreamFile(params.ascii ? File::ASCII : File::BINARY, toPath, to);
ssi_stream_destroy(to);
}
ssi_stream_destroy(from);
}
delete[] toPath;
return result;
}