本文整理汇总了C++中Segment::GetChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ Segment::GetChannel方法的具体用法?C++ Segment::GetChannel怎么用?C++ Segment::GetChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segment
的用法示例。
在下文中一共展示了Segment::GetChannel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBasicAccessor
/**
* Test the basics accessor to the
* objects info
*/
void TestSegment::testBasicAccessor()
{
Segment* seg = Segment::CreateWithDuration(0, 0, NULL);
seg->SetSpeakerId("bob");
seg->SetChannel("A");
seg->SetSource("test");
assert(seg->GetSpeakerId() == "bob");
assert(seg->GetChannel() == "A");
assert(seg->GetSource() == "test");
delete(seg);
}
示例2:
/**
* Return the segments of this speech by the given time
*/
vector<Segment*> Speech::GetSegmentsByTime(const int& start, const int& end, const string& source, const string& channel)
{
vector<Segment*> res;
for (size_t i=0 ; i < m_segments.size() ; ++i)
{
Segment *currentSegment = m_segments[i];
if (currentSegment->GetSource() == source && currentSegment->GetChannel() == channel)
{
int s_mid = ((currentSegment->GetEndTime()+currentSegment->GetStartTime()) / 2);
if (s_mid >= start && s_mid < end)
{
res.push_back(currentSegment);
}
}
}
return res;
}
示例3: NextSegment
/**
* Return the next Segment starting at the specified time for
* the specified source and channel. If the time is in the middle of
* A segment return the segment itself.
*/
Segment* Speech::NextSegment(const int& time, const string& source, const string& channel)
{
int last_endTime = 0;
for (size_t i=0 ; i < m_segments.size() ; ++i)
{
Segment *currentSegment = m_segments[i];
if (currentSegment->GetSource() == source && currentSegment->GetChannel() == channel)
{
if (currentSegment->GetEndTime() > time && last_endTime <= time)
{
return currentSegment;
}
last_endTime = currentSegment->GetEndTime();
}
}
return NULL;
}