mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-03-01 07:50:25 +01:00
Only show the very first BPM in the Adjust Sync Menu
This commit is contained in:
parent
8e9c075287
commit
03eb055464
@ -243,6 +243,14 @@ namespace better {
|
||||
return Timing{{{bpm, 0}}, -1 * offset};
|
||||
};
|
||||
|
||||
Timing::keys_by_beats_type::const_iterator Timing::cbegin() const {
|
||||
return events_by_beats.cbegin();
|
||||
}
|
||||
|
||||
Timing::keys_by_beats_type::const_iterator Timing::cend() const {
|
||||
return events_by_beats.cend();
|
||||
}
|
||||
|
||||
void Timing::reconstruct(const std::vector<BPMAtBeat>& events, const Decimal& offset) {
|
||||
reload_events_from(events);
|
||||
set_offset(offset);
|
||||
|
@ -93,6 +93,9 @@ namespace better {
|
||||
|
||||
static Timing load_from_memon_1_0_0(const nlohmann::json& json);
|
||||
static Timing load_from_memon_legacy(const nlohmann::json& metadata);
|
||||
|
||||
keys_by_beats_type::const_iterator cbegin() const;
|
||||
keys_by_beats_type::const_iterator cend() const;
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_event_between(const Fraction& first, const Fraction& last, const Callback& cb) const {
|
||||
|
@ -1144,15 +1144,12 @@ void EditorState::display_history() {
|
||||
|
||||
void EditorState::display_sync_menu() {
|
||||
if (ImGui::Begin("Adjust Sync", &show_sync_menu, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
auto bpm = std::visit(
|
||||
[&](const auto& pos){return applicable_timing->bpm_at(pos);},
|
||||
playback_position
|
||||
);
|
||||
auto intial_bpm = applicable_timing->cbegin()->get_bpm();
|
||||
ImGui::PushItemWidth(-70.0f);
|
||||
if (feis::InputDecimal("Initial BPM", &bpm, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
if (bpm > 0) {
|
||||
if (feis::InputDecimal("Initial BPM", &intial_bpm, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
if (intial_bpm > 0) {
|
||||
auto new_timing = *applicable_timing;
|
||||
new_timing.insert(better::BPMAtBeat{bpm, current_snaped_beats()});
|
||||
new_timing.insert(better::BPMAtBeat{intial_bpm, new_timing.cbegin()->get_beats()});
|
||||
replace_applicable_timing_with(new_timing);
|
||||
}
|
||||
}
|
||||
@ -1243,6 +1240,9 @@ void EditorState::display_sync_menu() {
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
if (loading) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::Button("Guess BPM", {ImGui::GetContentRegionAvail().x * 0.5f, 0.0f})) {
|
||||
const auto path = full_audio_path();
|
||||
tempo_candidates.reset();
|
||||
@ -1250,6 +1250,9 @@ void EditorState::display_sync_menu() {
|
||||
tempo_candidates_loader = std::async(std::launch::async, guess_tempo, *path);
|
||||
}
|
||||
}
|
||||
if (loading) {
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
const bool tempo_candidate_was_selected_before_pressing = selected_tempo_candidate.has_value();
|
||||
if (not tempo_candidate_was_selected_before_pressing) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user