mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Timelines of metro-synched media player
This commit is contained in:
@@ -965,59 +965,6 @@ bool ImGuiToolkit::TimelineSlider (const char* label, guint64 *time, guint64 beg
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//void ImGuiToolkit::Timeline (const char* label, guint64 time, guint64 begin, guint64 end, guint64 step, const float width)
|
|
||||||
//{
|
|
||||||
// // get window
|
|
||||||
// ImGuiWindow* window = ImGui::GetCurrentWindow();
|
|
||||||
// if (window->SkipItems)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// // get style & id
|
|
||||||
// const ImGuiContext& g = *GImGui;
|
|
||||||
// const ImGuiStyle& style = g.Style;
|
|
||||||
// const float fontsize = g.FontSize;
|
|
||||||
// const ImGuiID id = window->GetID(label);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // FIRST PREPARE ALL data structures
|
|
||||||
// //
|
|
||||||
|
|
||||||
// // widget bounding box
|
|
||||||
// const float height = 2.f * (fontsize + style.FramePadding.y);
|
|
||||||
// ImVec2 pos = window->DC.CursorPos;
|
|
||||||
// ImVec2 size = ImVec2(width, height);
|
|
||||||
// ImRect bbox(pos, pos + size);
|
|
||||||
// ImGui::ItemSize(size, style.FramePadding.y);
|
|
||||||
// if (!ImGui::ItemAdd(bbox, id))
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// // cursor size
|
|
||||||
// const float cursor_width = 0.5f * fontsize;
|
|
||||||
|
|
||||||
// // TIMELINE is inside the bbox, in a slightly smaller bounding box
|
|
||||||
// ImRect timeline_bbox(bbox);
|
|
||||||
// timeline_bbox.Expand( ImVec2() - style.FramePadding );
|
|
||||||
|
|
||||||
// // units conversion: from time to float (calculation made with higher precision first)
|
|
||||||
// guint64 duration = end - begin;
|
|
||||||
// float time_ = static_cast<float> ( static_cast<double>(time - begin) / static_cast<double>(duration) );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // THIRD RENDER
|
|
||||||
// //
|
|
||||||
|
|
||||||
// // Render the bounding box
|
|
||||||
// ImGui::RenderFrame(bbox.Min, bbox.Max, ImGui::GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
||||||
|
|
||||||
// // render the timeline
|
|
||||||
// RenderTimeline(window, timeline_bbox, begin, end, step);
|
|
||||||
|
|
||||||
// // draw the cursor
|
|
||||||
// if ( time_ > -FLT_EPSILON && time_ < 1.f ) {
|
|
||||||
// pos = ImLerp(timeline_bbox.GetTL(), timeline_bbox.GetTR(), time_) - ImVec2(cursor_width, 2.f);
|
|
||||||
// ImGui::RenderArrow(window->DrawList, pos, ImGui::GetColorU32(ImGuiCol_SliderGrab), ImGuiDir_Up);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool ImGuiToolkit::InvisibleSliderInt (const char* label, uint *index, uint min, uint max, ImVec2 size)
|
bool ImGuiToolkit::InvisibleSliderInt (const char* label, uint *index, uint min, uint max, ImVec2 size)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ namespace ImGuiToolkit
|
|||||||
bool TimelineSlider (const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width, double tempo = 0, double quantum = 0);
|
bool TimelineSlider (const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width, double tempo = 0, double quantum = 0);
|
||||||
void RenderTimeline (struct ImGuiWindow* window, struct ImRect timeline_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
void RenderTimeline (struct ImGuiWindow* window, struct ImRect timeline_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
||||||
void RenderTimelineBPM (struct ImGuiWindow* window, struct ImRect timeline_bbox, double tempo, double quantum, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
void RenderTimelineBPM (struct ImGuiWindow* window, struct ImRect timeline_bbox, double tempo, double quantum, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
||||||
// void Timeline (const char* label, guint64 time, guint64 begin, guint64 end, guint64 step, const float width);
|
|
||||||
bool InvisibleSliderInt(const char* label, uint *index, uint min, uint max, const ImVec2 size);
|
bool InvisibleSliderInt(const char* label, uint *index, uint min, uint max, const ImVec2 size);
|
||||||
bool EditPlotLines(const char* label, float *array, int values_count, float values_min, float values_max, const ImVec2 size);
|
bool EditPlotLines(const char* label, float *array, int values_count, float values_min, float values_max, const ImVec2 size);
|
||||||
bool EditPlotHistoLines(const char* label, float *histogram_array, float *lines_array, int values_count, float values_min, float values_max, guint64 begin, guint64 end, bool cut, bool *released, const ImVec2 size);
|
bool EditPlotHistoLines(const char* label, float *histogram_array, float *lines_array, int values_count, float values_min, float values_max, guint64 begin, guint64 end, bool cut, bool *released, const ImVec2 size);
|
||||||
|
|||||||
@@ -2572,7 +2572,8 @@ void DrawTimeScale(const char* label, guint64 duration, double width_ratio)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list< std::pair<float, guint64> > DrawTimeline(const char* label, Timeline *timeline, guint64 time, double width_ratio, float height)
|
std::list< std::pair<float, guint64> > DrawTimeline(const char* label, Timeline *timeline, guint64 time,
|
||||||
|
double width_ratio, float height, double tempo = 0, double quantum = 0)
|
||||||
{
|
{
|
||||||
std::list< std::pair<float, guint64> > ret;
|
std::list< std::pair<float, guint64> > ret;
|
||||||
|
|
||||||
@@ -2640,6 +2641,10 @@ std::list< std::pair<float, guint64> > DrawTimeline(const char* label, Timeline
|
|||||||
|
|
||||||
// adjust bbox of section and render a timeline
|
// adjust bbox of section and render a timeline
|
||||||
ImRect section_bbox(section_bbox_min, section_bbox_max);
|
ImRect section_bbox(section_bbox_min, section_bbox_max);
|
||||||
|
// render the timeline
|
||||||
|
if (tempo > 0 && quantum > 0)
|
||||||
|
ImGuiToolkit::RenderTimelineBPM(window, section_bbox, tempo, quantum, section->begin, section->end, timeline->step());
|
||||||
|
else
|
||||||
ImGuiToolkit::RenderTimeline(window, section_bbox, section->begin, section->end, timeline->step());
|
ImGuiToolkit::RenderTimeline(window, section_bbox, section->begin, section->end, timeline->step());
|
||||||
|
|
||||||
// draw the cursor
|
// draw the cursor
|
||||||
@@ -2770,7 +2775,14 @@ void SourceController::RenderSelection(size_t i)
|
|||||||
|
|
||||||
// draw the mediaplayer's timeline, with the indication of cursor position
|
// draw the mediaplayer's timeline, with the indication of cursor position
|
||||||
// NB: use the same width/time ratio for all to ensure timing vertical correspondance
|
// NB: use the same width/time ratio for all to ensure timing vertical correspondance
|
||||||
DrawTimeline("##timeline_mediaplayer", mp->timeline(), mp->position(), width_ratio / fabs(mp->playSpeed()), framesize.y);
|
|
||||||
|
if (mp->syncToMetronome() > Metronome::SYNC_NONE)
|
||||||
|
DrawTimeline("##timeline_mediaplayer_bpm", mp->timeline(), mp->position(),
|
||||||
|
width_ratio / fabs(mp->playSpeed()), framesize.y,
|
||||||
|
Metronome::manager().tempo(), Metronome::manager().quantum());
|
||||||
|
else
|
||||||
|
DrawTimeline("##timeline_mediaplayer", mp->timeline(), mp->position(),
|
||||||
|
width_ratio / fabs(mp->playSpeed()), framesize.y);
|
||||||
|
|
||||||
if ( w > maxframewidth ) {
|
if ( w > maxframewidth ) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user