Skip to content

Commit

Permalink
🔀 Merge pull request #79 from CoolLibs/midi
Browse files Browse the repository at this point in the history
Midi
  • Loading branch information
JulesFouchy authored Sep 29, 2023
2 parents 07a47c3 + 040de0e commit 4693b0b
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 113 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/create_release_executables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
- name: Install OpenSSL
run: sudo apt-get install libssl-dev

- name: Install MIDI dependencies
run: sudo apt install libasound2-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D COOLLAB_REQUIRE_ALL_FEATURES=ON -D CPACK_GENERATOR=STGZ

Expand Down
2 changes: 1 addition & 1 deletion Cool
Submodule Cool updated 41 files
+3 −0 .gitmodules
+4 −0 CMakeLists.txt
+1 −0 lib/RtMidiWrapper
+3 −3 res/shaders/hexagonal_grid.glsl
+16 −4 src/Cool/AppManager/AppManager.cpp
+6 −0 src/Cool/DebugOptions/generate_debug_options.py
+24 −0 src/Cool/DebugOptions/generated/DebugOptions.inl
+5 −5 src/Cool/Dependencies/InputProvider_Ref.h
+1 −3 src/Cool/Gpu/OpenGL/ComputeShader.h
+1 −1 src/Cool/Gpu/OpenGL/FullscreenPipeline.cpp
+7 −4 src/Cool/Gpu/OpenGL/Shader.cpp
+2 −0 src/Cool/Gpu/OpenGL/Shader.h
+1 −1 src/Cool/Gpu/OpenGL/preprocess_shader_source.cpp
+3 −3 src/Cool/Input/MouseCoordinates.h
+1 −1 src/Cool/InputParser/InputParser.cpp
+20 −0 src/Cool/Midi/MidiChannel.h
+193 −0 src/Cool/Midi/MidiManager.cpp
+62 −0 src/Cool/Midi/MidiManager.h
+2 −2 src/Cool/Nodes/EditorImpl.cpp
+1 −1 src/Cool/Nodes/UniqueEdContext.h
+1 −1 src/Cool/Nodes/utilities/builders.cpp
+1 −1 src/Cool/Nodes/utilities/drawing.cpp
+3 −4 src/Cool/Nodes/utilities/widgets.cpp
+2 −2 src/Cool/Nodes/utilities/widgets.h
+2 −0 src/Cool/Variables/TestVariables.cpp
+25 −0 src/Cool/Variables/Variable_MidiChannel.cpp
+3 −0 src/Cool/Variables/Variable_MidiChannel.h
+2 −1 src/Cool/Variables/generated/AnyInput.inl
+2 −1 src/Cool/Variables/generated/AnyInputDefinition.inl
+2 −1 src/Cool/Variables/generated/AnyInputRef.inl
+2 −1 src/Cool/Variables/generated/AnyInputRefToConst.inl
+2 −1 src/Cool/Variables/generated/AnyVariable.inl
+2 −1 src/Cool/Variables/generated/VariableRegistries.inl
+30 −0 src/Cool/Variables/generated/Variable_MidiChannel.inl
+6 −0 src/Cool/Variables/generated/glsl_type.inl
+3 −0 src/Cool/Variables/generated/requires_shader_code_generation.inl
+1 −0 src/Cool/Variables/generated/variables_includes.inl
+8 −0 src/Cool/Variables/generator_variables.py
+74 −72 src/Cool/type_from_string/generated/evaluate_function_template.inl
+1 −0 src/Cool/type_from_string/generated/includes.inl
+5 −0 src/Cool/type_from_string/generated/string_to_type_associations.inl
8 changes: 8 additions & 0 deletions Nodes/70 Input/Midi.clbnode
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// To learn how to write nodes, see https://coollab-art.com/Tutorials/Writing%20Nodes/Intro

INPUT Midi 'Midi Index';

float main()
{
return 'Midi Index';
}
241 changes: 131 additions & 110 deletions User data Default/imgui.ini

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

## 🐣beta-9 WIP

- ✨ Added Midi support!
- ✨ Added an Output window that you can project during live shows, while still having your View window on your screen to move the camera and the widgets. To open this window, go in the `Commands` menu and select `Open output window`.
- ✨ Added "Load Backup" in case you accidentally refused to save your unsaved changes.
- 🐛 Fix: the transparency information was sometimes getting lost between nodes.
Expand Down
12 changes: 12 additions & 0 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Cool/ImGui/ImGuiExtras.h"
#include "Cool/Input/MouseCoordinates.h"
#include "Cool/Log/Message.h"
#include "Cool/Midi/MidiManager.h"
#include "Cool/Tips/TipsManager.h"
#include "Cool/Tips/test_tips.h"
#include "Cool/View/View.h"
Expand Down Expand Up @@ -68,6 +69,9 @@ App::App(Cool::WindowManager& windows, Cool::ViewsManager& views)
_project.clock.pause(); // Make sure the new project will be paused.

_project.camera_manager.hook_events(_nodes_view.mouse_events(), _project.variable_registries, command_executor(), [this]() { trigger_rerender(); });
Cool::midi_manager().set_additional_midi_callback([&]() {
trigger_rerender();
});
hook_camera2D_events(
_nodes_view.mouse_events(),
_project.camera2D.value(),
Expand Down Expand Up @@ -435,6 +439,8 @@ void App::imgui_windows_only_when_inputs_are_allowed()
ImGui::End();
// Webcams
Cool::WebcamsConfigs::instance().imgui_window();
// Midi
Cool::midi_manager().imgui_window_config();
// Tips
_tips_manager.imgui_windows(all_tips());
// Nodes
Expand Down Expand Up @@ -499,6 +505,10 @@ void App::imgui_windows_only_when_inputs_are_allowed()
Cool::test_markdown_formatting();
});

Cool::DebugOptions::emulate_midi_keyboard([]() {
Cool::midi_manager().imgui_emulate_midi_keyboard();
});

Cool::DebugOptions::test_tips([this]() {
test_tips(_tips_manager);
});
Expand Down Expand Up @@ -589,6 +599,8 @@ void App::commands_menu()
_tips_manager.open_all_tips_window();
if (ImGui::Selectable("Open webcams config"))
Cool::WebcamsConfigs::instance().open_imgui_window();
if (ImGui::Selectable("Open MIDI config"))
Cool::midi_manager().open_config_window();
if (ImGui::Selectable("Open output window"))
_output_view.open();
ImGui::EndMenu();
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/generated/register_set_variable_commands.inl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ LAB_REGISTER_COMMAND(Lab::Command_SetVariable<Cool::MathExpression>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariable<glm::mat2>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariable<glm::mat3>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariable<glm::mat4>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariable<Cool::MidiChannel>)

LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<bool>)
LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<int>)
Expand All @@ -50,3 +51,4 @@ LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<Cool::MathExp
LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<glm::mat2>)
LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<glm::mat3>)
LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<glm::mat4>)
LAB_REGISTER_REVERSIBLE_COMMAND(Lab::ReversibleCommand_SetVariable<Cool::MidiChannel>)
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ LAB_REGISTER_COMMAND(Lab::Command_SetVariableMetadata<Cool::MathExpression>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariableMetadata<glm::mat2>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariableMetadata<glm::mat3>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariableMetadata<glm::mat4>)
LAB_REGISTER_COMMAND(Lab::Command_SetVariableMetadata<Cool::MidiChannel>)
2 changes: 1 addition & 1 deletion src/Module_Nodes/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static auto gen_value_inputs(
) -> tl::expected<Properties, std::string>
{
using fmt::literals::operator""_a;
Properties res{};
Properties res{};

size_t property_index{0};
for (auto const& prop : node.value_inputs())
Expand Down
2 changes: 1 addition & 1 deletion src/Module_Nodes/CodeGen_default_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static auto maybe_generate_default(FunctionSignature current_signature, std::str
auto gen_default_function(FunctionSignature signature, CodeGenContext& context)
-> ExpectedFunctionName
{
using fmt::literals::operator""_a;
using fmt::literals:: operator""_a;
static constexpr std::string_view signed_to_float = "antialised_step(sd)";
{
auto const func = maybe_generate_default(
Expand Down

0 comments on commit 4693b0b

Please sign in to comment.