-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(midi): Implemented a data oriented model&graph for processing MI…
…DI messages
- Loading branch information
Showing
45 changed files
with
910 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "ActivityIndicator.hpp" | ||
|
||
#include "imgui.h" | ||
|
||
#include <algorithm> | ||
|
||
void mc::ActivityIndicator::render() const | ||
{ | ||
constexpr double fade_time_ms = 1000; | ||
const auto ms_since_last_message = std::chrono::duration_cast<std::chrono::milliseconds>( | ||
std::chrono::system_clock::now() - m_last_trigger) | ||
.count(); | ||
const double percent = 1 - std::min(1., ms_since_last_message / fade_time_ms); | ||
const auto color = ImVec4(0, 1, 0, percent); | ||
ImGui::PushStyleColor(ImGuiCol_Button, color); | ||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, color); | ||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, color); | ||
ImGui::PushStyleVar(ImGuiStyleVar_DisabledAlpha, 1); | ||
ImGui::BeginDisabled(); | ||
ImGui::Button(" "); | ||
ImGui::EndDisabled(); | ||
ImGui::PopStyleVar(); | ||
ImGui::PopStyleColor(3); | ||
} | ||
|
||
void mc::ActivityIndicator::trigger() | ||
{ | ||
m_last_trigger = std::chrono::system_clock::now(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
#include <chrono> | ||
|
||
namespace mc | ||
{ | ||
|
||
class ActivityIndicator | ||
{ | ||
public: | ||
void render() const; | ||
void trigger(); | ||
|
||
private: | ||
std::chrono::time_point<std::chrono::system_clock> m_last_trigger; | ||
}; | ||
|
||
} // namespace mc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.