Skip to content

Commit fad3e9a

Browse files
committed
More code idk what
1 parent b42e01c commit fad3e9a

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

Chikara/Config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void Config::Load(std::string& path) {
3232
note_speed = GetFloat(reader, "Chikara", "NoteSpeed", note_speed);
3333
rainbow_speed = GetFloat(reader, "Chikara", "RainbowSpeed", rainbow_speed);
3434
start_delay = GetFloat(reader, "Chikara", "StartDelay", start_delay);
35+
loader_buffer = GetFloat(reader, "Chikara", "LoaderBuffer", loader_buffer);
3536

3637
config_path = path;
3738
}
@@ -57,6 +58,7 @@ bool Config::Save() {
5758
WriteFloat(ini, "NoteSpeed", note_speed);
5859
WriteFloat(ini, "RainbowSpeed", rainbow_speed);
5960
WriteFloat(ini, "StartDelay", start_delay);
61+
WriteFloat(ini, "LoaderBuffer", loader_buffer);
6062

6163
fclose(ini);
6264

Chikara/Config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Config {
2626
float note_speed = 0.15;
2727
float rainbow_speed = 100;
2828
float start_delay = 1;
29+
float loader_buffer = 10;
2930
private:
3031
glm::vec3 GetVec3(INIReader& reader, const std::string& section, const std::string& name, glm::vec3& default_value);
3132
float GetFloat(INIReader& reader, const std::string& section, const std::string& name, float& default_value);

Chikara/GlobalTime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ void GlobalTime::resume()
4141

4242
void GlobalTime::changeSpeed(float speed)
4343
{
44-
syncTime();
4544
this->speed = speed;
45+
syncTime();
4646
}
4747

4848
void GlobalTime::skipForward(float seconds)

Chikara/Main.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ void Main::run(int argc, wchar_t** argv)
6060
std::cout << "RPC Enabled: 0 (Discord Not Installed)" << std::endl;
6161
Config::GetConfig().discord_rpc = false;
6262
}
63+
64+
try
65+
{
66+
if(Config::GetConfig().loader_buffer < 0)
67+
{
68+
Config::GetConfig().loader_buffer = 0;
69+
Config::GetConfig().Save();
70+
}
71+
}
72+
catch (const std::exception& e)
73+
{
74+
//Config didn't exist, expecting it to just be 10;
75+
}
6376

6477
wchar_t* filename_temp = _wcsdup(filename.c_str());
6578
midi = new Midi(filename_temp);

Chikara/Midi.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "Main.h"
33
#include "Midi.h"
44
#include "KDMAPI.h"
5+
#include "Config.h"
56
#include <fmt/locale.h>
67
#include <fmt/format.h>
78

@@ -309,7 +310,7 @@ void Midi::LoaderThread()
309310
while(true)
310311
{
311312
memset(tracks_ended, 0, track_count);
312-
while(seconds < renderer_time.load() + 10.0f)
313+
while(seconds < renderer_time.load() + (Config::GetConfig().loader_buffer >= 0 ? Config::GetConfig().loader_buffer : 0))
313314
{
314315
for(int i = 0; i < track_count; i++)
315316
{

Chikara/Renderer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,10 +2050,13 @@ void Renderer::ImGuiFrame(GlobalTime* _gt)
20502050
ImGui::Checkbox("Toggle Discord Rich Presence*", &Config::GetConfig().discord_rpc);
20512051
ImGui::SliderFloat("Start Delay (Seconds)*", &Config::GetConfig().start_delay, 0, 60);
20522052
ImGui::SliderFloat("Note Speed", &Config::GetConfig().note_speed, 10, 0.01);
2053+
if(ImGui::SliderFloat("Note Buffer (Seconds)", &Config::GetConfig().loader_buffer, 1, 100)) if(Config::GetConfig().loader_buffer < 0) Config::GetConfig().loader_buffer = 0;
20532054
ImGui::Checkbox("Rainbow Bar", &Config::GetConfig().rainbow_bar);
20542055
ImGui::ColorEdit3("Background Color*", &Config::GetConfig().clear_color.r, ImGuiColorEditFlags_RGB);
20552056
ImGui::ColorEdit3("Bar Color", &Config::GetConfig().bar_color.r, ImGuiColorEditFlags_RGB); // haha undefined behavior go Segmentation fault
20562057
if(Config::GetConfig().rainbow_bar) ImGui::SliderFloat("Rainbow Speed", &Config::GetConfig().rainbow_speed, 1, 1000);
2058+
ImGui::Separator();
2059+
ImGui::Text("Note: Increasing the Note Buffer increases ram usage");
20572060
ImGui::EndTabItem();
20582061
}
20592062
if(ImGui::BeginTabItem("Playback"))

0 commit comments

Comments
 (0)