void AudioDisplay::PaintMarkers(wxDC &dc, TimeRange updtime) { AudioMarkerVector markers; controller->GetTimingController()->GetMarkers(updtime, markers); if (markers.empty()) return; wxDCPenChanger pen_retainer(dc, wxPen()); wxDCBrushChanger brush_retainer(dc, wxBrush()); for (const auto marker : markers) { int marker_x = RelativeXFromTime(marker->GetPosition()); dc.SetPen(marker->GetStyle()); dc.DrawLine(marker_x, audio_top, marker_x, audio_top+audio_height); if (marker->GetFeet() == AudioMarker::Feet_None) continue; dc.SetBrush(wxBrush(marker->GetStyle().GetColour())); dc.SetPen(*wxTRANSPARENT_PEN); if (marker->GetFeet() & AudioMarker::Feet_Left) PaintFoot(dc, marker_x, -1); if (marker->GetFeet() & AudioMarker::Feet_Right) PaintFoot(dc, marker_x, 1); } }
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); }
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); }
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++]); } }
void GetMarkers(const SampleRange &range, AudioMarkerVector &out) const { // Find first and last keyframes inside the range std::vector<AudioMarkerKeyframe>::const_iterator a = std::lower_bound( keyframe_samples.begin(), keyframe_samples.end(), range.begin()); std::vector<AudioMarkerKeyframe>::const_iterator b = std::upper_bound( keyframe_samples.begin(), keyframe_samples.end(), range.end()); // Place pointers to the markers in the output vector for (; a != b; ++a) out.push_back(&*a); }
void VideoPositionMarkerProvider::GetMarkers(const TimeRange &range, AudioMarkerVector &out) const { if (marker && range.contains(*marker)) out.push_back(marker.get()); }