audio clip editor; add support for count-in display

This commit is contained in:
Paul Davis
2025-10-27 09:25:46 -06:00
parent d2b1b6f8ed
commit 5cdeaf6063
2 changed files with 51 additions and 1 deletions

View File

@@ -74,6 +74,7 @@ AudioClipEditor::ClipMetric::get_marks (std::vector<ArdourCanvas::Ruler::Mark>&
AudioClipEditor::AudioClipEditor (std::string const & name, bool with_transport)
: CueEditor (name, with_transport)
, overlay_text (nullptr)
, clip_metric (nullptr)
, scroll_fraction (0)
{
@@ -714,17 +715,65 @@ AudioClipEditor::end_write ()
}
void
AudioClipEditor::show_count_in (std::string const &)
AudioClipEditor::set_overlay_text (std::string const & str)
{
EC_LOCAL_TEMPO_SCOPE;
if (!overlay_text) {
overlay_text = new ArdourCanvas::Text (data_group);
Pango::FontDescription font ("Sans 200");
overlay_text->set_font_description (font);
overlay_text->set_color (0xff000088);
overlay_text->set ("0"); /* not shown, used for positioning math */
overlay_text->set_position (ArdourCanvas::Duple ((_visible_canvas_width / 2.0) - (overlay_text->text_width()/2.), (_visible_canvas_height / 2.0) - (overlay_text->text_height() / 2.)));
}
overlay_text->set (str);
show_overlay_text ();
}
void
AudioClipEditor::show_overlay_text ()
{
if (overlay_text) {
overlay_text->show ();
}
}
void
AudioClipEditor::hide_overlay_text ()
{
if (overlay_text) {
overlay_text->hide ();
}
}
void
AudioClipEditor::show_count_in (std::string const & str)
{
EC_LOCAL_TEMPO_SCOPE;
set_overlay_text (str);
}
void
AudioClipEditor::hide_count_in ()
{
EC_LOCAL_TEMPO_SCOPE;
hide_overlay_text ();
}
bool
AudioClipEditor::idle_data_captured ()
{
EC_LOCAL_TEMPO_SCOPE;
if (!ref.box()) {
return false;
}
CueEditor::idle_data_captured ();
return false;
}
void

View File

@@ -135,6 +135,7 @@ public:
private:
ArdourCanvas::Container* line_container;
ArdourCanvas::Text* overlay_text;
StartBoundaryRect* start_line;
EndBoundaryRect* end_line;
ArdourCanvas::Line* loop_line;