sointu/tests/CMakeLists.txt
Veikko Sariola e0a793ea6d Reorganize the project folder structure and how go packages are organized.
Sointu.asm / lib stuff lives at the root folder. There is a folder called "go4k", which is where
all go stuff lives. Following the ideas from https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1
the go4k folder is the "domain-model" of the go side, and should have no dependencies.
It contains Unit, Instrument, Synth interface etc. Putting go4k under a sub-folder is actually
in the spirit of Ben, as go4k adds dependency to the go language.

Bridge ties the domain-model to the sointulib through cgo. It returns C.Synth, but
makes sure the C.Synth implements the Synth interface, so others are able to use the
Synth no matter how it actually is done. MockSynth and WebProxy synth are good
prospects for other implementations of Synth.

It is a bit fuzzy where methods like "Play" that have no dependencies other than domain
model structs should go. They probably should live in the go4k package as well.

The file-organization on the Go-side is not at all finalized. But how packages are broken
into files is mostly a documentation issue; it does not affect the users of the packages at
all.

BTW: The name go4k was chosen because Ben advocated naming the subpackages
according to the dependency they introduce AND because the prototype of 4klang was
called go4k (there are still some defines in the 4klang source revealing this). go4k thus
honors our roots but is also not so bad name: it's the main package of a 4k synth tracker,
written in go.
2020-10-31 22:05:47 +02:00

160 lines
7.1 KiB
CMake

function(regression_test testname)
if(${ARGC} LESS 4)
set(source ${testname}.asm)
else()
set(source ${ARGV3})
endif()
add_executable(${testname} ${source} test_renderer.c)
# the tests include the entire ASM but we still want to rebuild when they change
file(GLOB SOINTU ${PROJECT_SOURCE_DIR}/src/*.inc
${PROJECT_SOURCE_DIR}/src/*.asm
${PROJECT_SOURCE_DIR}/src/opcodes/*.asm
${PROJECT_SOURCE_DIR}/src/opcodes/*.inc
${PROJECT_SOURCE_DIR}/src/win32/*.asm
${PROJECT_SOURCE_DIR}/src/win32/*.inc
${PROJECT_SOURCE_DIR}/src/win64/*.asm
${PROJECT_SOURCE_DIR}/src/win64/*.inc)
set_source_files_properties(${source}.asm PROPERTIES OBJECT_DEPENDS "${SOINTU}")
set_source_files_properties(${FOURKLANG} PROPERTIES HEADER_FILE_ONLY TRUE)
add_test(${testname} ${testname})
target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}" SU_USE_INTROSPECTION SU_USE_PLAYER)
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)
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)
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)
target_compile_definitions(test_oscillat_sample PUBLIC INCLUDE_GMDLS)
regression_test(test_oscillat_sample_stereo ENVELOPE)
target_compile_definitions(test_oscillat_sample_stereo PUBLIC INCLUDE_GMDLS)
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 "" test_envelope.asm)
target_compile_definitions(test_envelope_16bit PUBLIC SU_USE_16BIT_OUTPUT)
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})
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)