Skip to content

Commit

Permalink
release 3.6.12 preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolcl committed Jun 5, 2023
1 parent d07f6b3 commit a8c84f9
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 76 deletions.
132 changes: 70 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[=========================================================================[
Copyright (c) 2022 Pedro López-Cabanillas
Copyright (c) 2022-2023 Pedro López-Cabanillas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -16,9 +16,9 @@

cmake_minimum_required(VERSION 3.14)

project( sonivox
project( sonivox
LANGUAGES C CXX
VERSION 3.6.11.0
VERSION 3.6.12.0
)

# GoogleTest requires at least C++14
Expand All @@ -27,6 +27,7 @@ set(CMAKE_CXX_STANDARD 14)
option(BUILD_SONIVOX_STATIC "Build the static library" TRUE)
option(BUILD_SONIVOX_SHARED "Build the shared library" TRUE)
option(BUILD_TESTING "Build the unit tests" TRUE)
option(CMAKE_POSITION_INDEPENDENT_CODE "Whether to create position-independent targets" TRUE)

include(GNUInstallDirs)

Expand Down Expand Up @@ -55,62 +56,62 @@ else()
endif()

list(APPEND SOURCES
arm-wt-22k/host_src/eas_config.c
arm-wt-22k/host_src/eas_hostmm.c
#arm-wt-22k/host_src/eas_main.c
arm-wt-22k/host_src/eas_config.c
arm-wt-22k/host_src/eas_hostmm.c
#arm-wt-22k/host_src/eas_main.c
arm-wt-22k/host_src/eas_report.c
#arm-wt-22k/host_src/eas_wave.c
arm-wt-22k/lib_src/eas_chorus.c
arm-wt-22k/lib_src/eas_chorusdata.c
arm-wt-22k/lib_src/eas_data.c
arm-wt-22k/lib_src/eas_dlssynth.c
arm-wt-22k/lib_src/eas_flog.c
#arm-wt-22k/lib_src/eas_ima_tables.c
#arm-wt-22k/lib_src/eas_imaadpcm.c
#arm-wt-22k/lib_src/eas_imelody.c
#arm-wt-22k/lib_src/eas_imelodydata.c
arm-wt-22k/lib_src/eas_math.c
arm-wt-22k/lib_src/eas_mdls.c
arm-wt-22k/lib_src/eas_midi.c
arm-wt-22k/lib_src/eas_mididata.c
arm-wt-22k/lib_src/eas_data.c
arm-wt-22k/lib_src/eas_dlssynth.c
arm-wt-22k/lib_src/eas_flog.c
#arm-wt-22k/lib_src/eas_ima_tables.c
#arm-wt-22k/lib_src/eas_imaadpcm.c
#arm-wt-22k/lib_src/eas_imelody.c
#arm-wt-22k/lib_src/eas_imelodydata.c
arm-wt-22k/lib_src/eas_math.c
arm-wt-22k/lib_src/eas_mdls.c
arm-wt-22k/lib_src/eas_midi.c
arm-wt-22k/lib_src/eas_mididata.c
arm-wt-22k/lib_src/eas_mixbuf.c
arm-wt-22k/lib_src/eas_mixer.c
#arm-wt-22k/lib_src/eas_ota.c
#arm-wt-22k/lib_src/eas_otadata.c
arm-wt-22k/lib_src/eas_pan.c
arm-wt-22k/lib_src/eas_pcm.c
arm-wt-22k/lib_src/eas_pcmdata.c
arm-wt-22k/lib_src/eas_public.c
arm-wt-22k/lib_src/eas_reverb.c
arm-wt-22k/lib_src/eas_reverbdata.c
#arm-wt-22k/lib_src/eas_rtttl.c
#arm-wt-22k/lib_src/eas_rtttldata.c
arm-wt-22k/lib_src/eas_smf.c
arm-wt-22k/lib_src/eas_smfdata.c
arm-wt-22k/lib_src/eas_tcdata.c
arm-wt-22k/lib_src/eas_tonecontrol.c
arm-wt-22k/lib_src/eas_voicemgt.c
#arm-wt-22k/lib_src/eas_wavefile.c
#arm-wt-22k/lib_src/eas_wavefiledata.c
arm-wt-22k/lib_src/eas_wtengine.c
arm-wt-22k/lib_src/eas_wtsynth.c
#arm-wt-22k/lib_src/eas_xmf.c
#arm-wt-22k/lib_src/eas_xmfdata.c
#arm-wt-22k/lib_src/jet.c
arm-wt-22k/lib_src/wt_22khz.c
#arm-wt-22k/lib_src/eas_ota.c
#arm-wt-22k/lib_src/eas_otadata.c
arm-wt-22k/lib_src/eas_pan.c
arm-wt-22k/lib_src/eas_pcm.c
arm-wt-22k/lib_src/eas_pcmdata.c
arm-wt-22k/lib_src/eas_public.c
arm-wt-22k/lib_src/eas_reverb.c
arm-wt-22k/lib_src/eas_reverbdata.c
#arm-wt-22k/lib_src/eas_rtttl.c
#arm-wt-22k/lib_src/eas_rtttldata.c
arm-wt-22k/lib_src/eas_smf.c
arm-wt-22k/lib_src/eas_smfdata.c
arm-wt-22k/lib_src/eas_tcdata.c
arm-wt-22k/lib_src/eas_tonecontrol.c
arm-wt-22k/lib_src/eas_voicemgt.c
#arm-wt-22k/lib_src/eas_wavefile.c
#arm-wt-22k/lib_src/eas_wavefiledata.c
arm-wt-22k/lib_src/eas_wtengine.c
arm-wt-22k/lib_src/eas_wtsynth.c
#arm-wt-22k/lib_src/eas_xmf.c
#arm-wt-22k/lib_src/eas_xmfdata.c
#arm-wt-22k/lib_src/jet.c
arm-wt-22k/lib_src/wt_22khz.c
)

configure_file(arm-wt-22k/host_src/eas.cmake libsonivox/eas.h @ONLY)

list(APPEND HEADERS
list(APPEND HEADERS
${PROJECT_BINARY_DIR}/libsonivox/eas.h
arm-wt-22k/host_src/eas_chorus.h
arm-wt-22k/host_src/eas_reverb.h
arm-wt-22k/host_src/eas_types.h
#arm-wt-22k/host_src/jet.h
)

add_library( sonivox-objects OBJECT ${SOURCES} )
add_library( sonivox-objects OBJECT ${SOURCES} ${HEADERS} )

target_compile_definitions( sonivox-objects PRIVATE
UNIFIED_DEBUG_MESSAGES
Expand All @@ -137,8 +138,6 @@ target_include_directories( sonivox-objects PRIVATE
fakes
)

set_target_properties( sonivox-objects PROPERTIES POSITION_INDEPENDENT_CODE TRUE )

if (CMAKE_COMPILER_IS_GNUCC)
target_compile_options( sonivox-objects PRIVATE
-Wno-unused-parameter
Expand Down Expand Up @@ -188,52 +187,52 @@ endif()

if (BUILD_SONIVOX_STATIC)
configure_file(sonivox-static.pc.in ${PROJECT_BINARY_DIR}/sonivox-static.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/sonivox-static.pc
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/sonivox-static.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
endif()
if (BUILD_SONIVOX_SHARED)
configure_file(sonivox.pc.in ${PROJECT_BINARY_DIR}/sonivox.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/sonivox.pc
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/sonivox.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
endif()

install( TARGETS ${SONIVOX_TARGETS}
EXPORT sonivox-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sonivox
)

install( EXPORT sonivox-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

export( EXPORT sonivox-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake"
NAMESPACE ${PROJECT_NAME}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake"
NAMESPACE ${PROJECT_NAME}::
)

include( CMakePackageConfigHelpers )

write_basic_package_version_file(
${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
${PROJECT_NAME}-config.cmake.in
${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_NAME}-config.cmake.in
${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
)

install( FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

# Unit testing
Expand All @@ -250,11 +249,20 @@ if (BUILD_TESTING)
fakes
)

target_link_libraries( SonivoxTest
target_link_libraries( SonivoxTest PRIVATE
GTest::gtest_main
sonivox
)

if (BUILD_SONIVOX_STATIC)
target_link_libraries( SonivoxTest PRIVATE
sonivox-static
)
elseif (BUILD_SONIVOX_SHARED)
target_link_libraries( SonivoxTest PRIVATE
sonivox
)
endif()

include( GoogleTest )
gtest_discover_tests( SonivoxTest EXTRA_ARGS "-P${PROJECT_SOURCE_DIR}/test/res/" DISCOVERY_TIMEOUT 300 )
gtest_discover_tests( SonivoxTest EXTRA_ARGS "-P${PROJECT_SOURCE_DIR}/test/res/" DISCOVERY_TIMEOUT 300 )
endif()
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
This project is a fork of the Android Open Source Project 'platform_external_sonivox', including a CMake based build system to be used not on Android, but on any other computer Operating System.
Google licensed this work originally named Sonivox EAS (Embedded Audio Synthesis) from the company Sonic Network Inc. under the terms of the Apache License 2.0.

This is a Wave Table synthesizer, not using external soundfont files but embedded samples instead. It is also a real time GM synthesizer. It consumes very little resources, so it may be indicated in projects for small embedded devices.
This is a Wave Table synthesizer, not using external soundfont files by default but embedded samples. It also supports external DLS soundfont files for better rendering quality. It is also a real time GM synthesizer. It consumes very little resources, so it may be indicated in projects for small embedded devices.
There is neither MIDI input nor Audio output facilities included in the library. You need to provide your own input/output.

You may find several projects already using this library as a git submodule:

* [Drumstick::RT](https://github.com/pedrolcl/drumstick) multiplatform realtime MIDI library. It has a Sonivox output backend.
* [Linux-SonivoxEas](https://github.com/pedrolcl/Linux-SonivoxEas) with ALSA Sequencer MIDI input and Pulseaudio output.
* [multiplatform-sonivoxeas](https://github.com/pedrolcl/multiplatform-sonivoxeas) with Drumstick::RT MIDI input and Qt Multimedia audio output.

Expand All @@ -32,7 +33,18 @@ You may find and use the installed libraries with `pkg-config` or the `find_pack
The 'example' directory contains a simple command line utility to render standard MIDI files into raw PCM audio streams. This utility can be compiled after building and installing sonivox in some prefix like `/usr`, `/usr/local`, or `$HOME/Sonivox`.
The CMake script contains three alternatives: using CMake only, using `pkg-config` and using sonivox as a subdirectory.

Once compiled, you can use the program to listen MIDI files or to create MP3 files.
Once compiled, you can use the program to listen MIDI files or to create MP3 files. These are the available command line options:

~~~
$ ./sonivoxrender -h
Usage: ./sonivoxrender [-h] [-d file.dls] [-r 0..4] [-w 0..32765] file.mid ...
Render standard MIDI files into raw PCM audio.
Options:
-h this help message.
-d file.dls DLS soundfont.
-r n reverb preset: 0=no, 1=large hall, 2=hall, 3=chamber, 4=room.
-w n reverb wet: 0..32765.
~~~

Example 1: Render a MIDI file and save the rendered audio as a raw audio file:

Expand All @@ -54,22 +66,22 @@ It is **strongly** recommended that you run the test suite after changing some c

To run the tests, you may use this command:

$ cmake --build <build_directory> --target test
$ cmake --build <build_directory> --target test
or simply:

$ ctest
$ ctest

There are two environment variables that you may set before running the tests (mandatory for the Qt Creator integrated test runner).

TEMP < path to a temporary location with write permission for the output file >
TEST_RESOURCES < path to the location of the input MIDI files: source_directory/test/res/ for instance >
TEMP < path to a temporary location with write permission for the output file >
TEST_RESOURCES < path to the location of the input MIDI files: source_directory/test/res/ for instance >

## License

Copyright (c) 2022 Pedro López-Cabanillas.
Copyright (c) 2022-2023 Pedro López-Cabanillas.

Copyright (c) 2008-2022, The Android Open Source Project.
Copyright (c) 2008-2023, The Android Open Source Project.

Copyright (c) 2004-2006 Sonic Network Inc.

Expand Down
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[=========================================================================[
Copyright (c) 2022 Pedro López-Cabanillas
Copyright (c) 2022-2023 Pedro López-Cabanillas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions example/sonivoxrender.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Pedro López-Cabanillas
* Copyright (c) 2022-2023 Pedro López-Cabanillas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -264,10 +264,10 @@ int main (int argc, char **argv)
fprintf (stderr, "Usage: %s [-h] [-d file.dls] [-r 0..4] [-w 0..32765] file.mid ...\n"\
"Render standard MIDI files into raw PCM audio.\n"\
"Options:\n"\
"\t-h\tthis help message\n"\
"\t-d file.dls\tDLS soundfont\n"\
"\t-r n\treverb preset: 0=no, 1=large hall, 2=hall, 3=chamber, 4=room\n"\
"\t-w n\treverb wet: 0..32765\n", argv[0]);
"\t-h\t\tthis help message.\n"\
"\t-d file.dls\tDLS soundfont.\n"\
"\t-r n\t\treverb preset: 0=no, 1=large hall, 2=hall, 3=chamber, 4=room.\n"\
"\t-w n\t\treverb wet: 0..32765.\n", argv[0]);
return EXIT_FAILURE;
case 'd':
dls_path = optarg;
Expand Down

0 comments on commit a8c84f9

Please sign in to comment.