Skip to content

Commit 22b67c0

Browse files
committed
Add an interactive demo
1 parent 72fb60e commit 22b67c0

10 files changed

+79445
-11
lines changed

CMakeLists.txt

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
cmake_minimum_required (VERSION 3.4)
33
project(LabSoundDemo)
44

5+
# Don't report that sample file installation up to date
6+
set(CMAKE_INSTALL_MESSAGE LAZY)
7+
58
set(LABSOUNDDEMO_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
69
configure_file("${LABSOUNDDEMO_ROOT}/LabSoundDemo.config.h" "${LABSOUNDDEMO_ROOT}/LabSoundDemo.h" @ONLY)
710

8-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
911
add_subdirectory(LabSound)
1012

1113
add_executable(LabSoundStarter LabSoundStarter.cpp)
@@ -17,3 +19,16 @@ add_executable(LabSoundDemo LabSoundDemo.cpp)
1719
target_link_libraries(LabSoundDemo Lab::Sound)
1820
target_include_directories(LabSoundDemo PRIVATE "${LABSOUNDDEMO_ROOT}")
1921
install(TARGETS LabSoundDemo RUNTIME DESTINATION bin)
22+
23+
add_executable(LabSoundInteractive
24+
LabSoundInteractive.cpp ImGuiGridSlider.cpp ImGuiGridSlider.h imgui-app/imgui_app.cpp)
25+
target_link_libraries(LabSoundInteractive Lab::Sound)
26+
target_include_directories(LabSoundInteractive PRIVATE "${LABSOUNDDEMO_ROOT}")
27+
if(WIN32)
28+
target_compile_definitions(LabSoundInteractive PRIVATE SOKOL_D3D11 SOKOL_WIN32_FORCE_MAIN)
29+
elseif(APPLE)
30+
target_compile_definitions(LabSoundInteractive PRIVATE SOKOL_METAL)
31+
elseif(UNIX)
32+
target_compile_definitions(LabSoundInteractive PRIVATE SOKOL_GLCORE33)
33+
endif()
34+
install(TARGETS LabSoundInteractive RUNTIME DESTINATION bin)

ImGuiGridSlider.cpp

+618
Large diffs are not rendered by default.

ImGuiGridSlider.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#include "imgui-app/imgui.h"
3+
bool InputVec3(char const* pLabel, ImVec4* pValue, ImVec4 const vMinValue, ImVec4 const vMaxValue, float const fScale /*= 1.0f*/);

LabSoundDemo.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ struct ex_peak_compressor : public labsound_example
744744

745745
hihat_node->setBus(r, hihat);
746746
context->connect(filter, hihat_node, 0, 0);
747-
hihat_node->gain()->setValue(0.2f);
747+
//hihat_node->gain()->setValue(0.2f);
748748

749749
snare_node->setBus(r, snare);
750750
context->connect(filter, snare_node, 0, 0);
@@ -803,7 +803,7 @@ struct ex_stereo_panning : public labsound_example
803803

804804
audioClipNode->setBus(r, audioClip);
805805
context->connect(stereoPanner, audioClipNode, 0, 0);
806-
audioClipNode->schedule(0.0);
806+
audioClipNode->schedule(0.0, -1); // -1 to loop forever
807807

808808
context->connect(context->device(), stereoPanner, 0, 0);
809809
}
@@ -813,8 +813,6 @@ struct ex_stereo_panning : public labsound_example
813813
_nodes.push_back(audioClipNode);
814814
_nodes.push_back(stereoPanner);
815815

816-
audioClipNode->isLooping()->setBool(true, false);
817-
818816
const int seconds = 8;
819817

820818
std::thread controlThreadTest([&stereoPanner, seconds]() {
@@ -865,16 +863,14 @@ struct ex_hrtf_spatialization : public labsound_example
865863

866864
audioClipNode->setBus(r, audioClip);
867865
context->connect(panner, audioClipNode, 0, 0);
868-
audioClipNode->schedule(0.0);
866+
audioClipNode->schedule(0.0, -1); // -1 to loop forever
869867
}
870868

871869
if (audioClipNode)
872870
{
873871
_nodes.push_back(audioClipNode);
874872
_nodes.push_back(panner);
875873

876-
audioClipNode->isLooping()->setBool(true, false);
877-
878874
context->listener()->setPosition({0, 0, 0});
879875
panner->setVelocity(4, 0, 0);
880876

@@ -999,7 +995,7 @@ struct ex_misc : public labsound_example
999995
{
1000996
ContextRenderLock r(context.get(), "ex_misc");
1001997

1002-
pingping->BuildSubgraph(context);
998+
pingping->BuildSubgraph(*context.get());
1003999
pingping->SetFeedback(.75f);
10041000
pingping->SetDelayIndex(lab::TempoSync::TS_16);
10051001

@@ -1692,7 +1688,7 @@ int main(int argc, char *argv[]) try
16921688
// We can optionally play for a number of iterations as a way of testing lifetime & memory issues.
16931689
for (int i = 0; i < iterations; ++i)
16941690
{
1695-
simple.ex->play(argc, argv);
1691+
granulation.ex->play(argc, argv);
16961692
}
16971693

16981694
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)