mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
The preprocessing is done sointu-cli and (almost) nothing is done by the NASM preprocessor anymore (some .strucs are still there. Now, sointu-cli loads the .yml song, defines bunch of macros (go functions / variables) and passes the struct to text/template parses. This a lot more powerful way to generate .asm code than trying to fight with the nasm preprocessor. At the moment, tests pass but the repository is a bit of monster, as the library is still compiled using the old approach. Go should generate the library also from the templates.
188 lines
7.8 KiB
CMake
188 lines
7.8 KiB
CMake
function(regression_test testname)
|
|
|
|
if(${ARGC} LESS 4)
|
|
set(source ${testname}.yml)
|
|
set(asmfile ${testname}.asm)
|
|
set (headerfile ${CMAKE_CURRENT_BINARY_DIR}/${testname}.h)
|
|
|
|
if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
|
set(arch "-arch=amd64")
|
|
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
|
set(arch "-arch=amd64")
|
|
else()
|
|
set(arch "-arch=386")
|
|
endif()
|
|
|
|
add_custom_command(
|
|
OUTPUT ${asmfile}
|
|
COMMAND ${sointuexe} -a -c -w ${arch} -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${source}
|
|
DEPENDS ${source} ${sointuexe}
|
|
)
|
|
|
|
add_executable(${testname} test_renderer.c ${asmfile})
|
|
target_compile_definitions(${testname} PUBLIC TEST_HEADER=<${testname}.h>)
|
|
else()
|
|
set(source ${ARGV3})
|
|
add_executable(${testname} ${source} test_renderer.c)
|
|
endif()
|
|
|
|
add_test(${testname} ${testname})
|
|
target_link_libraries(${testname} ${HEADERLIB})
|
|
|
|
set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/expected_output/${testname}.raw)
|
|
set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/expected_output/${testname}.raw)
|
|
|
|
add_custom_target(${testname}_rawcopy
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${rawinput} ${rawoutput}
|
|
)
|
|
|
|
add_dependencies(${testname} ${testname}_rawcopy)
|
|
|
|
target_include_directories(${testname} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
|
target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}")
|
|
|
|
if(ARGC GREATER 1)
|
|
if (ARGV1)
|
|
message("${testname} requires ${ARGV1}")
|
|
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED "${ARGV1}")
|
|
endif()
|
|
endif()
|
|
|
|
if(ARGC GREATER 2)
|
|
if (ARGV2)
|
|
message("${testname} setups ${ARGV2}")
|
|
set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP "${ARGV2}")
|
|
endif()
|
|
endif()
|
|
endfunction(regression_test)
|
|
|
|
if(WIN32)
|
|
set(sointuexe ${CMAKE_CURRENT_BINARY_DIR}/sointu-cli.exe)
|
|
else()
|
|
set(sointuexe ${CMAKE_CURRENT_BINARY_DIR}/sointu-cli)
|
|
endif()
|
|
|
|
# the tests include the entire ASM but we still want to rebuild when they change
|
|
file(GLOB templates ${PROJECT_SOURCE_DIR}/templates/*.asm)
|
|
file(GLOB go4k "${PROJECT_SOURCE_DIR}/go4k/*.go" "${PROJECT_SOURCE_DIR}/go4k/cmd/sointu-cli/*.go")
|
|
|
|
message("templates=${templates}")
|
|
message("go4k=${go4k}")
|
|
|
|
# Build sointu-cli only once because go run has everytime quite a bit of delay when
|
|
# starting
|
|
add_custom_command(
|
|
OUTPUT ${sointuexe}
|
|
COMMAND go build -o ${sointuexe} ${PROJECT_SOURCE_DIR}/go4k/cmd/sointu-cli/main.go
|
|
DEPENDS "${templates}" "${go4k}"
|
|
)
|
|
|
|
regression_test(test_envelope "" ENVELOPE)
|
|
regression_test(test_envelope_stereo ENVELOPE)
|
|
regression_test(test_loadval "" LOADVAL)
|
|
regression_test(test_loadval_stereo LOADVAL LOADVAL_STEREO)
|
|
regression_test(test_gain LOADVAL GAIN)
|
|
regression_test(test_gain_stereo GAIN)
|
|
regression_test(test_invgain LOADVAL INVGAIN)
|
|
regression_test(test_invgain_stereo INVGAIN)
|
|
regression_test(test_send LOADVAL SEND)
|
|
regression_test(test_send_stereo SEND)
|
|
regression_test(test_send_global SEND)
|
|
regression_test(test_receive SEND RECEIVE)
|
|
regression_test(test_receive_stereo RECEIVE)
|
|
regression_test(test_in LOADVAL IN)
|
|
regression_test(test_in_stereo IN)
|
|
regression_test(test_outaux IN OUTAUX)
|
|
regression_test(test_outaux_stereo OUTAUX)
|
|
regression_test(test_aux LOADVAL AUX)
|
|
regression_test(test_aux_stereo AUX)
|
|
regression_test(test_panning ENVELOPE PANNING)
|
|
regression_test(test_panning_stereo PANNING)
|
|
regression_test(test_multiple_instruments ENVELOPE)
|
|
regression_test(test_pop LOADVAL POP)
|
|
regression_test(test_pop_stereo POP)
|
|
regression_test(test_addp LOADVAL)
|
|
regression_test(test_addp_stereo LOADVAL)
|
|
regression_test(test_mulp LOADVAL FOP_MULP)
|
|
regression_test(test_mulp_stereo LOADVAL FOP_MULP2)
|
|
regression_test(test_push "LOADVAL;POP" FOP_PUSH)
|
|
regression_test(test_push_stereo PUSH)
|
|
regression_test(test_xch LOADVAL)
|
|
regression_test(test_xch_stereo LOADVAL)
|
|
regression_test(test_add LOADVAL)
|
|
regression_test(test_add_stereo LOADVAL)
|
|
regression_test(test_mul LOADVAL)
|
|
regression_test(test_mul_stereo LOADVAL)
|
|
regression_test(test_loadnote)
|
|
regression_test(test_loadnote_stereo)
|
|
regression_test(test_noise ENVELOPE NOISE)
|
|
regression_test(test_noise_stereo NOISE)
|
|
regression_test(test_oscillat_sine ENVELOPE VCO_SINE)
|
|
regression_test(test_oscillat_trisaw ENVELOPE)
|
|
regression_test(test_oscillat_pulse ENVELOPE VCO_PULSE)
|
|
regression_test(test_oscillat_gate ENVELOPE)
|
|
regression_test(test_oscillat_stereo ENVELOPE)
|
|
if(WIN32) # The samples are currently only GMDLs based, and thus require Windows.
|
|
regression_test(test_oscillat_sample ENVELOPE)
|
|
regression_test(test_oscillat_sample_stereo ENVELOPE)
|
|
endif()
|
|
regression_test(test_oscillat_unison ENVELOPE)
|
|
regression_test(test_oscillat_unison_stereo ENVELOPE)
|
|
regression_test(test_oscillat_lfo "ENVELOPE;VCO_SINE;VCO_PULSE;FOP_MULP2")
|
|
regression_test(test_oscillat_transposemod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
regression_test(test_oscillat_detunemod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
regression_test(test_oscillat_phasemod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
regression_test(test_oscillat_colormod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
regression_test(test_oscillat_shapemod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
regression_test(test_oscillat_gainmod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND")
|
|
|
|
regression_test(test_distort ENVELOPE)
|
|
regression_test(test_distort_mod "VCO_SINE;ENVELOPE;SEND")
|
|
regression_test(test_distort_stereo ENVELOPE)
|
|
|
|
regression_test(test_hold ENVELOPE HOLD)
|
|
regression_test(test_hold_mod "VCO_SINE;ENVELOPE;SEND")
|
|
regression_test(test_hold_stereo HOLD)
|
|
|
|
regression_test(test_clip "VCO_SINE;ENVELOPE;FOP_MULP;INVGAIN" CLIP)
|
|
regression_test(test_clip_stereo CLIP)
|
|
|
|
regression_test(test_crush "VCO_SINE;ENVELOPE;FOP_MULP;INVGAIN" CRUSH)
|
|
regression_test(test_crush_stereo CRUSH)
|
|
|
|
regression_test(test_compressor "" COMPRESSOR)
|
|
regression_test(test_compressor_stereo COMPRESSOR)
|
|
|
|
regression_test(test_filter_band "VCO_SINE;ENVELOPE;FOP_MULP")
|
|
regression_test(test_filter_low "VCO_SINE;ENVELOPE;FOP_MULP")
|
|
regression_test(test_filter_high "VCO_SINE;ENVELOPE;FOP_MULP")
|
|
regression_test(test_filter_peak "VCO_SINE;ENVELOPE;FOP_MULP")
|
|
regression_test(test_filter_stereo "VCO_SINE;ENVELOPE;FOP_MULP")
|
|
regression_test(test_filter_freqmod "VCO_SINE;ENVELOPE;FOP_MULP;SEND")
|
|
regression_test(test_filter_resmod "VCO_SINE;ENVELOPE;FOP_MULP;SEND")
|
|
|
|
regression_test(test_delay "ENVELOPE;FOP_MULP;PANNING;VCO_SINE")
|
|
regression_test(test_delay_stereo "ENVELOPE;FOP_MULP;PANNING;VCO_SINE")
|
|
regression_test(test_delay_notetracking "ENVELOPE;FOP_MULP;PANNING;NOISE")
|
|
regression_test(test_delay_reverb "ENVELOPE;FOP_MULP;PANNING;VCO_SINE")
|
|
regression_test(test_delay_feedbackmod "ENVELOPE;FOP_MULP;PANNING;VCO_SINE;SEND")
|
|
regression_test(test_delay_pregainmod "ENVELOPE;FOP_MULP;PANNING;VCO_SINE;SEND")
|
|
regression_test(test_delay_dampmod "ENVELOPE;FOP_MULP;PANNING;VCO_SINE;SEND")
|
|
regression_test(test_delay_drymod "ENVELOPE;FOP_MULP;PANNING;VCO_SINE;SEND")
|
|
regression_test(test_delay_flanger "ENVELOPE;FOP_MULP;PANNING;VCO_SINE;SEND")
|
|
|
|
regression_test(test_envelope_mod "VCO_SINE;ENVELOPE;SEND")
|
|
regression_test(test_envelope_16bit ENVELOPE)
|
|
|
|
regression_test(test_polyphony "ENVELOPE;VCO_SINE")
|
|
regression_test(test_chords "ENVELOPE;VCO_SINE")
|
|
regression_test(test_speed "ENVELOPE;VCO_SINE")
|
|
|
|
regression_test(test_render_samples ENVELOPE "" test_render_samples.c)
|
|
target_link_libraries(test_render_samples ${STATICLIB})
|
|
target_compile_definitions(test_render_samples PUBLIC TEST_HEADER="test_render_samples.h")
|
|
|
|
add_executable(test_render_samples_api test_render_samples_api.c)
|
|
target_link_libraries(test_render_samples_api ${STATICLIB})
|
|
add_test(test_render_samples_api test_render_samples_api)
|