Skip to content

Commit

Permalink
add ac data mount, analyze music with radar on fly
Browse files Browse the repository at this point in the history
  • Loading branch information
GEEKiDoS committed Dec 20, 2024
1 parent 3d5c2f4 commit 8eb5a51
Show file tree
Hide file tree
Showing 10 changed files with 468 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,10 @@
#include <utils/memory.hpp>
#include <game/game.hpp>

#include "chart_modifier.hpp"
#include "analyze.hpp"

namespace notes_radar
namespace iidx::analyze
{
struct chart_analyze_data_t
{
size_t note_count;
float total_seconds;

struct
{
float min;
float max;
} bpm;

struct
{
float notes;
float peak;
float scratch;
float soflan;
float charge;
float chord;
} radar;
};

float notes(const std::vector<iidx::event_t>& chart)
{
int notes = 0, total_tick = 0;
Expand Down Expand Up @@ -325,25 +303,36 @@ namespace notes_radar
}

results[i] = ((radar[i] - last_threshold) / (threshold - last_threshold)) * radar_thresholds[preset][j][6] + radar_thresholds[preset][j][7];
results[i] *= 10000.f;
results[i] *= 2.f;
break;
}
}

return results;
}

void analyze_chart(const std::vector<iidx::event_t>& chart, chart_analyze_data_t& result)
void analyze_chart(const std::vector<iidx::event_t>& chart, chart_analyze_data_t& result, bool calc_radar)
{
float radar_my_raw[6] = {
notes(chart), peak(chart), scratch(chart), soflan(chart), charge(chart), chord(chart),
};

float radar_my[6];
normalize_radar_data(radar_my_raw, radar_my, 0);
if (calc_radar)
{
float radar_my_raw[6] = {
notes(chart), peak(chart), scratch(chart), soflan(chart), charge(chart), chord(chart),
};

float radar_my[6];
normalize_radar_data(radar_my_raw, radar_my, 0);

result.radar.notes = radar_my[0];
result.radar.peak = radar_my[1];
result.radar.scratch = radar_my[2];
result.radar.soflan = radar_my[3];
result.radar.charge = radar_my[4];
result.radar.chord = radar_my[5];
}

result.bpm.min = 100000;
result.bpm.max = -100000;
result.note_count = 0;

for (const auto& ev : chart)
{
Expand All @@ -369,12 +358,5 @@ namespace notes_radar

result.note_count++;
}

result.radar.notes = radar_my[0];
result.radar.peak = radar_my[1];
result.radar.scratch = radar_my[2];
result.radar.soflan = radar_my[3];
result.radar.charge = radar_my[4];
result.radar.chord = radar_my[5];
}
}
29 changes: 29 additions & 0 deletions src/client/component/iidx/analyze.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

namespace iidx::analyze
{
struct chart_analyze_data_t
{
size_t note_count;
float total_seconds;

struct
{
float min;
float max;
} bpm;

struct
{
float notes;
float peak;
float scratch;
float soflan;
float charge;
float chord;
} radar;
};

int map_chart(int in);
void analyze_chart(const std::vector<iidx::event_t>& chart, chart_analyze_data_t& result, bool calc_radar);
}
11 changes: 5 additions & 6 deletions src/client/component/iidx/custom_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ namespace iidx::custom_resolution

int width()
{
static auto w = mode() == 1 ?
static auto w = mode() == IIDX_DISPLAY_MODE_FULLSCREEN_WINDOWED ?
GetSystemMetrics(SM_CXSCREEN) : std::stoi(game::environment::get_param("IIDX_RESOLTION_W"));
w = w ? w : GetSystemMetrics(SM_CXSCREEN);
return w;

return w ? w : GetSystemMetrics(SM_CXSCREEN);
}

int height()
{
static auto h = mode() == 1 ?
static auto h = mode() == IIDX_DISPLAY_MODE_FULLSCREEN_WINDOWED ?
GetSystemMetrics(SM_CYSCREEN) : std::stoi(game::environment::get_param("IIDX_RESOLTION_H"));
h = h ? h : GetSystemMetrics(SM_CXSCREEN);

return h;
return h ? h : GetSystemMetrics(SM_CYSCREEN);
}

IIDX_GRAPHICS_API_ graphics_api()
Expand Down
Loading

0 comments on commit 8eb5a51

Please sign in to comment.