diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index af2f118..2e522eb 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -29,6 +29,8 @@ jobs: run: | mkdir firmware cp build/src/kyma/Release/kyma.bin firmware + cp build/src/hades/Release/hades.bin firmware + cp build/src/astra/Release/astra.bin firmware - name: Upload coverage artifacts uses: actions/upload-artifact@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fc01b2..b624862 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,4 +26,7 @@ add_subdirectory(${LIBDAISY_DIR}) add_subdirectory(3rd_party/tetl/include) add_subdirectory(lib) + +add_subdirectory(src/astra) +add_subdirectory(src/hades) add_subdirectory(src/kyma) diff --git a/src/astra/CMakeLists.txt b/src/astra/CMakeLists.txt new file mode 100644 index 0000000..d25aec4 --- /dev/null +++ b/src/astra/CMakeLists.txt @@ -0,0 +1,57 @@ +project(astra) + +add_executable(astra) + +target_sources(astra + PRIVATE + main.cpp +) + +target_link_libraries(astra + PRIVATE + daisy + mc::audio +) + +set_target_properties(astra PROPERTIES + SUFFIX + ".elf" + LINK_DEPENDS + ${LINKER_SCRIPT} +) + +target_link_options(astra PUBLIC + -T ${LINKER_SCRIPT} + -Wl,-Map=astra.map,--cref + -Wl,--check-sections + -Wl,--unresolved-symbols=report-all + -Wl,--warn-common + -Wl,--warn-section-align + -Wl,--print-memory-usage +) + +add_custom_command(TARGET astra POST_BUILD + COMMAND + ${CMAKE_OBJCOPY} + ARGS + -O ihex -S $ $.hex + BYPRODUCTS + astra.hex + COMMENT + "Generating HEX image" + VERBATIM +) + +add_custom_command(TARGET astra POST_BUILD + COMMAND + ${CMAKE_OBJCOPY} + ARGS + -O binary -S $ $.bin + WORKING_DIRECTORY + $ + BYPRODUCTS + astra.bin + COMMENT + "Generating binary image" + VERBATIM +) diff --git a/src/astra/main.cpp b/src/astra/main.cpp new file mode 100644 index 0000000..5cd46dd --- /dev/null +++ b/src/astra/main.cpp @@ -0,0 +1,37 @@ +#include + +namespace astra +{ + +static constexpr auto BLOCK_SIZE = 16U; +static constexpr auto SAMPLE_RATE = 96'000.0F; + +auto patch = daisy::patch_sm::DaisyPatchSM{}; + +auto audioCallback(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffer out, size_t size) -> void +{ + patch.ProcessAllControls(); + + for (size_t i = 0; i < size; ++i) + { + auto const left = IN_L[i]; + auto const right = IN_R[i]; + + OUT_L[i] = left; + OUT_R[i] = right; + } +} + +} // namespace astra + +auto main() -> int +{ + using namespace astra; + + patch.Init(); + patch.SetAudioSampleRate(SAMPLE_RATE); + patch.SetAudioBlockSize(BLOCK_SIZE); + patch.StartAudio(audioCallback); + + while (true) {} +} diff --git a/src/hades/CMakeLists.txt b/src/hades/CMakeLists.txt new file mode 100644 index 0000000..85bdf4c --- /dev/null +++ b/src/hades/CMakeLists.txt @@ -0,0 +1,57 @@ +project(hades) + +add_executable(hades) + +target_sources(hades + PRIVATE + main.cpp +) + +target_link_libraries(hades + PRIVATE + daisy + mc::audio +) + +set_target_properties(hades PROPERTIES + SUFFIX + ".elf" + LINK_DEPENDS + ${LINKER_SCRIPT} +) + +target_link_options(hades PUBLIC + -T ${LINKER_SCRIPT} + -Wl,-Map=hades.map,--cref + -Wl,--check-sections + -Wl,--unresolved-symbols=report-all + -Wl,--warn-common + -Wl,--warn-section-align + -Wl,--print-memory-usage +) + +add_custom_command(TARGET hades POST_BUILD + COMMAND + ${CMAKE_OBJCOPY} + ARGS + -O ihex -S $ $.hex + BYPRODUCTS + hades.hex + COMMENT + "Generating HEX image" + VERBATIM +) + +add_custom_command(TARGET hades POST_BUILD + COMMAND + ${CMAKE_OBJCOPY} + ARGS + -O binary -S $ $.bin + WORKING_DIRECTORY + $ + BYPRODUCTS + hades.bin + COMMENT + "Generating binary image" + VERBATIM +) diff --git a/src/hades/main.cpp b/src/hades/main.cpp new file mode 100644 index 0000000..5f49f22 --- /dev/null +++ b/src/hades/main.cpp @@ -0,0 +1,37 @@ +#include + +namespace hades +{ + +static constexpr auto BLOCK_SIZE = 16U; +static constexpr auto SAMPLE_RATE = 96'000.0F; + +auto patch = daisy::patch_sm::DaisyPatchSM{}; + +auto audioCallback(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffer out, size_t size) -> void +{ + patch.ProcessAllControls(); + + for (size_t i = 0; i < size; ++i) + { + auto const left = IN_L[i]; + auto const right = IN_R[i]; + + OUT_L[i] = left; + OUT_R[i] = right; + } +} + +} // namespace hades + +auto main() -> int +{ + using namespace hades; + + patch.Init(); + patch.SetAudioSampleRate(SAMPLE_RATE); + patch.SetAudioBlockSize(BLOCK_SIZE); + patch.StartAudio(audioCallback); + + while (true) {} +}