本文整理汇总了C++中TimeRange::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeRange::end方法的具体用法?C++ TimeRange::end怎么用?C++ TimeRange::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeRange
的用法示例。
在下文中一共展示了TimeRange::end方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMarkers
void AudioMarkerProviderKeyframes::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
// Find first and last keyframes inside the range
auto a = lower_bound(markers.begin(), markers.end(), range.begin());
auto b = upper_bound(markers.begin(), markers.end(), range.end());
// Place pointers to the markers in the output vector
for (; a != b; ++a)
out.push_back(&*a);
}
示例2: GetMarkers
void SecondsMarkerProvider::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
if (!enabled->GetBool()) return;
if ((range.length() + 999) / 1000 > (int)markers.size())
markers.resize((range.length() + 999) / 1000, Marker(pen.get()));
size_t i = 0;
for (int time = ((range.begin() + 999) / 1000) * 1000; time < range.end(); time += 1000) {
markers[i].position = time;
out.push_back(&markers[i++]);
}
}
示例3: GetMarkers
void AudioTimingControllerKaraoke::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
size_t i;
for (i = 0; i < markers.size() && markers[i] < range.begin(); ++i) ;
for (; i < markers.size() && markers[i] < range.end(); ++i)
out.push_back(&markers[i]);
if (range.contains(start_marker)) out.push_back(&start_marker);
if (range.contains(end_marker)) out.push_back(&end_marker);
keyframes_provider.GetMarkers(range, out);
video_position_provider.GetMarkers(range, out);
}
示例4: PaintAudio
void AudioDisplay::PaintAudio(wxDC &dc, TimeRange updtime, wxRect updrect)
{
auto pt = style_ranges.upper_bound(updtime.begin());
auto pe = style_ranges.upper_bound(updtime.end());
if (pt != style_ranges.begin())
--pt;
while (pt != pe)
{
AudioRenderingStyle range_style = static_cast<AudioRenderingStyle>(pt->second);
int range_x1 = std::max(updrect.x, RelativeXFromTime(pt->first));
int range_x2 = (++pt == pe) ? updrect.x + updrect.width : RelativeXFromTime(pt->first);
if (range_x2 > range_x1)
{
audio_renderer->Render(dc, wxPoint(range_x1, audio_top), range_x1 + scroll_left, range_x2 - range_x1, range_style);
}
}
}
示例5: ScrollTimeRangeInView
void AudioDisplay::ScrollTimeRangeInView(const TimeRange &range)
{
int client_width = GetClientRect().GetWidth();
int range_begin = AbsoluteXFromTime(range.begin());
int range_end = AbsoluteXFromTime(range.end());
int range_len = range_end - range_begin;
// Remove 5 % from each side of the client area.
int leftadjust = client_width / 20;
int client_left = scroll_left + leftadjust;
client_width = client_width * 9 / 10;
// Is everything already in view?
if (range_begin >= client_left && range_end <= client_left+client_width)
return;
// The entire range can fit inside the view, center it
if (range_len < client_width)
{
ScrollPixelToLeft(range_begin - (client_width-range_len)/2 - leftadjust);
}
// Range doesn't fit in view and we're viewing a middle part of it, just leave it alone
else if (range_begin < client_left && range_end > client_left+client_width)
{
// nothing
}
// Right edge is in view, scroll it as far to the right as possible
else if (range_end >= client_left && range_end < client_left+client_width)
{
ScrollPixelToLeft(range_end - client_width - leftadjust);
}
// Nothing is in view or the left edge is in view, scroll left edge as far to the left as possible
else
{
ScrollPixelToLeft(range_begin - leftadjust);
}
}
示例6: SaveClip
void AudioController::SaveClip(wxString const& filename, TimeRange const& range) const
{
int64_t start_sample = SamplesFromMilliseconds(range.begin());
int64_t end_sample = SamplesFromMilliseconds(range.end());
if (filename.empty() || start_sample > provider->GetNumSamples() || range.length() == 0) return;
agi::io::Save outfile(STD_STR(filename), true);
std::ofstream& out(outfile.Get());
size_t bytes_per_sample = provider->GetBytesPerSample() * provider->GetChannels();
size_t bufsize = (end_sample - start_sample) * bytes_per_sample;
int intval;
short shortval;
out << "RIFF";
out.write((char*)&(intval=bufsize+36),4);
out<< "WAVEfmt ";
out.write((char*)&(intval=16),4);
out.write((char*)&(shortval=1),2);
out.write((char*)&(shortval=provider->GetChannels()),2);
out.write((char*)&(intval=provider->GetSampleRate()),4);
out.write((char*)&(intval=provider->GetSampleRate()*provider->GetChannels()*provider->GetBytesPerSample()),4);
out.write((char*)&(intval=provider->GetChannels()*provider->GetBytesPerSample()),2);
out.write((char*)&(shortval=provider->GetBytesPerSample()<<3),2);
out << "data";
out.write((char*)&bufsize,4);
//samples per read
size_t spr = 65536 / bytes_per_sample;
std::vector<char> buf(bufsize);
for(int64_t i = start_sample; i < end_sample; i += spr) {
size_t len = std::min<size_t>(spr, end_sample - i);
provider->GetAudio(&buf[0], i, len);
out.write(&buf[0], len * bytes_per_sample);
}
}
示例7: GetRenderingStyles
void AudioTimingControllerKaraoke::GetRenderingStyles(AudioRenderingStyleRanges &ranges) const
{
TimeRange sr = GetPrimaryPlaybackRange();
ranges.AddRange(sr.begin(), sr.end(), AudioStyle_Primary);
ranges.AddRange(start_marker, end_marker, AudioStyle_Selected);
}