Skip to content

Commit

Permalink
Add quick buttons for different frequencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aceiii committed Apr 25, 2024
1 parent af26466 commit 35d869e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,34 @@ void WaveGeneratorSource::render() {
}
ImGui::PlotLines("Sound", samples.data(), samples.size(), 0, nullptr, -1.5f, 1.5f, ImVec2(0, 80.0f));
ImGui::SliderFloat("Volume", &volume, 0.0f, 100.0f);
ImGui::SliderFloat("Frequency", &frequency, 10.0f, 2048.0f);
ImGui::SliderFloat("Frequency", &frequency, 20.0f, 15000.0f);
if (ImGui::Button("20Hz")) {
frequency = 20.0f;
}
ImGui::SameLine();
if (ImGui::Button("50Hz")) {
frequency = 50.0f;
}
ImGui::SameLine();
if (ImGui::Button("100Hz")) {
frequency = 100.0f;
}
ImGui::SameLine();
if (ImGui::Button("220Hz")) {
frequency = 220.0f;
}
ImGui::SameLine();
if (ImGui::Button("440Hz")) {
frequency = 440.0f;
}
ImGui::SameLine();
if (ImGui::Button("1kHz")) {
frequency = 1000.0f;
}
ImGui::SameLine();
if (ImGui::Button("11.5kHz")) {
frequency = 11500.0f;
}
ImGui::Checkbox("Force Play", &force_play);
}

Expand Down

0 comments on commit 35d869e

Please sign in to comment.