├── .azure ├── Dockerfile.azure-alpine ├── azure-pipelines-alpine.yml ├── azure-pipelines-android.yml ├── azure-pipelines-mac.yml ├── azure-pipelines-vcpkg.yml ├── azure-pipelines-win.yml └── cmake-android.yml ├── .cirrus.yml ├── .clang-format ├── .clang-tidy ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml ├── issue_template.md └── workflows │ ├── api_doc_build.yml │ ├── codeql-analysis.yml │ ├── codespell.yml │ ├── linux.yml │ ├── sonarcloud.yml │ └── windows.yml ├── .gitignore ├── .gitmodules ├── .obs └── workflows.yml ├── AUTHORS ├── CMakeLists.txt ├── CONTRIBUTING.md ├── ChangeLog.old ├── FluidSynthConfig.cmake.in ├── LICENSE ├── README.cmake.md ├── README.md ├── THANKS ├── TODO ├── android ├── config.h └── src │ └── bindings │ └── fluid_cmd.c ├── build_all_android.sh ├── cmake_admin ├── CheckDIRSymbolExists.cmake ├── CheckPrototypeExists.cmake ├── CheckSTDC.cmake ├── CodeCoverage.cmake ├── DefaultDirs.cmake ├── FindFLAC.cmake ├── FindGLib2.cmake ├── FindInstPatch.cmake ├── FindJack.cmake ├── FindMidiShare.cmake ├── FindOgg.cmake ├── FindOpenSLES.cmake ├── FindOpus.cmake ├── FindPipeWire.cmake ├── FindPortAudio.cmake ├── FindReadline.cmake ├── FindSndFileLegacy.cmake ├── FindSystemd.cmake ├── FindVorbis.cmake ├── Findlibffi.cmake ├── Findmp3lame.cmake ├── Findmpg123.cmake ├── Findoboe.cmake ├── FluidUnitTest.cmake ├── GetSDL2VersionFromHeaders.cmake ├── PkgConfigHelpers.cmake ├── README.md ├── RunOutputTest.cmake ├── SCMRevision.cmake ├── TestInline.cmake ├── TestVLA.cmake ├── VersionResource.rc.in ├── cmake_uninstall.cmake.in └── report.cmake ├── contrib ├── baselibs.conf ├── debian.changelog ├── debian.compat ├── debian.control ├── debian.copyright ├── debian.fluidsynth.install ├── debian.libfluidsynth-dev.install ├── debian.libfluidsynth1.install ├── debian.rules ├── debian.series ├── fluidsynth.dsc └── fluidsynth.spec ├── doc ├── CMakeLists.txt ├── Doxyfile.cmake ├── FluidMixer.ppt ├── FluidProfile_0004.pdf ├── FluidSostenuto-005.pdf ├── FluidSynth Thread safety paper for LAC 2011.odt ├── README ├── android │ ├── .gitignore │ ├── Makefile.android │ ├── README.md │ ├── fluidsynth-assetloader │ │ ├── CMakeLists.txt │ │ ├── ext-build.sh │ │ ├── fluid_androidasset.c │ │ └── fluid_androidasset.h │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ └── oboe-1.0.pc ├── doxygen │ ├── custom.css │ ├── fluidsettings.xsl │ ├── footer.html │ └── layout.xml.cmake ├── examples │ ├── CMakeLists.txt │ ├── example.c │ ├── fluidsynth_arpeggio.c │ ├── fluidsynth_enumsettings.cxx │ ├── fluidsynth_fx.c │ ├── fluidsynth_instruments.c │ ├── fluidsynth_metronome.c │ ├── fluidsynth_process.c │ ├── fluidsynth_register_adriver.c │ ├── fluidsynth_sfload_mem.c │ └── fluidsynth_simple.c ├── fluidsettings.xml ├── fluidsettings.xsl ├── fluidsynth-v20-devdoc.txt ├── fluidsynth.1 ├── images │ └── fluid_mixer.svg ├── ladspa.md ├── polymono │ ├── FluidPolyMono-0004.pdf │ ├── leg_00.txt │ ├── leg_01.txt │ ├── leg_por_00.txt │ ├── leg_por_01.txt │ ├── poly_mono_0.txt │ ├── poly_mono_1.txt │ ├── poly_mono_2.txt │ ├── poly_mono_3.txt │ ├── poly_mono_4.txt │ ├── poly_mono_5.txt │ └── readme.txt ├── recent_changes.txt └── usage │ ├── _overview.txt │ ├── advanced.txt │ ├── audio_driver.txt │ ├── creating_settings.txt │ ├── creating_synth.txt │ ├── file_renderer.txt │ ├── loading_soundfonts.txt │ ├── manual_rendering.txt │ ├── midi_player.txt │ ├── midi_player_mem.txt │ ├── midi_router.txt │ ├── multi_channel.txt │ ├── realtime_midi.txt │ ├── sending_midi.txt │ ├── sequencer.txt │ ├── shell.txt │ └── synth_context.txt ├── fluidsynth.conf.in ├── fluidsynth.pc.in ├── fluidsynth.service.in ├── fluidsynth.tmpfiles.in ├── include ├── fluidsynth.cmake └── fluidsynth │ ├── audio.h │ ├── event.h │ ├── gen.h │ ├── ladspa.h │ ├── log.h │ ├── midi.h │ ├── misc.h │ ├── mod.h │ ├── seq.h │ ├── seqbind.h │ ├── settings.h │ ├── sfont.h │ ├── shell.h │ ├── synth.h │ ├── types.h │ ├── version.h.in │ └── voice.h ├── prefab ├── fluidsynth-android-VERSION.pom └── fluidsynth-android-VERSION │ ├── AndroidManifest.xml │ └── prefab │ ├── modules │ └── fluidsynth │ │ ├── libs │ │ ├── android.arm64-v8a │ │ │ └── abi.json │ │ ├── android.armeabi-v7a │ │ │ └── abi.json │ │ ├── android.x86 │ │ │ └── abi.json │ │ └── android.x86_64 │ │ │ └── abi.json │ │ └── module.json │ └── prefab.json ├── prefab_build.sh ├── sf2 ├── COPYRIGHT.txt ├── VintageDreamsWaves-v2.sf2 ├── VintageDreamsWaves-v2.sf2.yml ├── VintageDreamsWaves-v2.sf3 ├── VintageDreamsWaves-v2.sf3.yml ├── VìntàgèDrèàmsWàvès-v2.sf2 └── ■VintageDreamsWaves-v2■.sf2 ├── sonar-project.properties ├── src ├── CMakeLists.txt ├── bindings │ ├── fluid_cmd.c │ ├── fluid_cmd.h │ ├── fluid_filerenderer.c │ ├── fluid_ladspa.c │ ├── fluid_ladspa.h │ ├── fluid_rtkit.c │ └── fluid_rtkit.h ├── config.cmake ├── drivers │ ├── fluid_adriver.c │ ├── fluid_adriver.h │ ├── fluid_alsa.c │ ├── fluid_aufile.c │ ├── fluid_coreaudio.c │ ├── fluid_coremidi.c │ ├── fluid_dart.c │ ├── fluid_dsound.c │ ├── fluid_jack.c │ ├── fluid_kai.c │ ├── fluid_mdriver.c │ ├── fluid_mdriver.h │ ├── fluid_midishare.c │ ├── fluid_oboe.cpp │ ├── fluid_opensles.c │ ├── fluid_oss.c │ ├── fluid_pipewire.c │ ├── fluid_portaudio.c │ ├── fluid_pulse.c │ ├── fluid_sdl2.c │ ├── fluid_sdl3.c │ ├── fluid_sndmgr.c │ ├── fluid_wasapi.c │ ├── fluid_waveout.c │ └── fluid_winmidi.c ├── fluid_wasapi_device_enumerate.c ├── fluidsynth.c ├── gentables │ ├── CMakeLists.txt │ ├── gen_conv.c │ ├── gen_rvoice_dsp.c │ ├── make_tables.c │ └── make_tables.h ├── midi │ ├── fluid_midi.c │ ├── fluid_midi.h │ ├── fluid_midi_router.c │ ├── fluid_midi_router.h │ ├── fluid_seq.c │ ├── fluid_seq_queue.cpp │ ├── fluid_seq_queue.h │ ├── fluid_seqbind.c │ ├── fluid_seqbind_notes.cpp │ └── fluid_seqbind_notes.h ├── rvoice │ ├── fluid_adsr_env.c │ ├── fluid_adsr_env.h │ ├── fluid_chorus.c │ ├── fluid_chorus.h │ ├── fluid_iir_filter.c │ ├── fluid_iir_filter.h │ ├── fluid_iir_filter_impl.cpp │ ├── fluid_lfo.c │ ├── fluid_lfo.h │ ├── fluid_phase.h │ ├── fluid_rev.c │ ├── fluid_rev.h │ ├── fluid_rvoice.c │ ├── fluid_rvoice.h │ ├── fluid_rvoice_dsp.cpp │ ├── fluid_rvoice_dsp_tables.h │ ├── fluid_rvoice_event.c │ ├── fluid_rvoice_event.h │ ├── fluid_rvoice_mixer.c │ └── fluid_rvoice_mixer.h ├── sfloader │ ├── fluid_defsfont.c │ ├── fluid_defsfont.h │ ├── fluid_instpatch.c │ ├── fluid_instpatch.h │ ├── fluid_samplecache.c │ ├── fluid_samplecache.h │ ├── fluid_sffile.c │ ├── fluid_sffile.h │ ├── fluid_sfont.c │ └── fluid_sfont.h ├── synth │ ├── fluid_chan.c │ ├── fluid_chan.h │ ├── fluid_event.c │ ├── fluid_event.h │ ├── fluid_gen.c │ ├── fluid_gen.h │ ├── fluid_mod.c │ ├── fluid_mod.h │ ├── fluid_synth.c │ ├── fluid_synth.h │ ├── fluid_synth_monopoly.c │ ├── fluid_tuning.c │ ├── fluid_tuning.h │ ├── fluid_voice.c │ └── fluid_voice.h └── utils │ ├── fluid_conv.c │ ├── fluid_conv.h │ ├── fluid_conv_tables.h │ ├── fluid_hash.c │ ├── fluid_hash.h │ ├── fluid_list.c │ ├── fluid_list.h │ ├── fluid_ringbuffer.c │ ├── fluid_ringbuffer.h │ ├── fluid_settings.c │ ├── fluid_settings.h │ ├── fluid_sys.c │ ├── fluid_sys.h │ └── fluidsynth_priv.h ├── test-android ├── .gitignore ├── README.md ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── org │ │ │ └── fluidsynth │ │ │ └── fluidsynth_tests │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── cpp │ │ │ ├── CMakeLists.txt │ │ │ └── native-lib.cpp │ │ ├── java │ │ │ └── org │ │ │ │ └── fluidsynth │ │ │ │ └── fluidsynthtests │ │ │ │ ├── MainActivity.kt │ │ │ │ └── TestRunner.kt │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── themes.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── fluidsynth │ │ └── fluidsynth_tests │ │ └── ExampleUnitTest.kt ├── build-scripts │ ├── .gitignore │ ├── build-all-archs.sh │ ├── build-call-cmake.sh │ ├── build-env.sh │ ├── build.sh │ ├── download.sh │ └── extract.sh ├── build.gradle ├── convert-tests.sh ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle └── test ├── CMakeLists.txt ├── README.md ├── cmake ├── CMakeLists.txt ├── README.md └── main.c ├── dump_sfont.c ├── test.h ├── test_bug_635.c ├── test_ct2hz.c ├── test_fast_render.c ├── test_jack_obtaining_synth.c ├── test_pointer_alignment.c ├── test_preset_pinning.c ├── test_preset_sample_loading.c ├── test_sample_cache.c ├── test_sample_rate_change.c ├── test_sample_validate.c ├── test_seq_event_queue_remove.c ├── test_seq_event_queue_sort.c ├── test_seq_evt_order.c ├── test_seq_scale.c ├── test_seqbind_unregister.c ├── test_settings_unregister_callback.c ├── test_sf3_sfont_loading.c ├── test_sfont_loading.c ├── test_sfont_unloading.c ├── test_sfont_zone.c ├── test_snprintf.c ├── test_synth_chorus_reverb.c ├── test_synth_process.c ├── test_synth_reset_cc.c ├── test_utf8_open.c ├── èmpty.mid └── ⓉⒺⓈⓉ.mid /.azure/Dockerfile.azure-alpine: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE=alpine:3.18 2 | FROM ${BASE_IMAGE} 3 | 4 | RUN apk add --no-cache --virtual .pipeline-deps readline linux-pam \ 5 | && apk add bash sudo shadow \ 6 | && apk add \ 7 | cmake make \ 8 | glib-dev \ 9 | dbus-dev \ 10 | ladspa-dev \ 11 | libsndfile-dev \ 12 | sdl2-dev \ 13 | nodejs-current \ 14 | gcc g++ \ 15 | pkgconf \ 16 | && apk del .pipeline-deps 17 | 18 | LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node" 19 | 20 | CMD [ "node" ] 21 | -------------------------------------------------------------------------------- /.azure/cmake-android.yml: -------------------------------------------------------------------------------- 1 | 2 | parameters: 3 | - name: cmakeArgs 4 | type: string 5 | default: '' 6 | - name: sourceDir 7 | type: string 8 | default: '' 9 | - name: workDir 10 | type: string 11 | default: $(DEV) 12 | - name: condition 13 | type: string 14 | default: and(succeeded(), ne(variables.CACHE_RESTORED, 'true')) 15 | - name: installCommand 16 | type: string 17 | default: 'make install' 18 | 19 | steps: 20 | - script: | 21 | set -ex 22 | 23 | pushd ${{ parameters.sourceDir }} 24 | mkdir -p build 25 | pushd build 26 | 27 | # Invoke cmake in the most correctest way I've could find while try and erroring: 28 | # 29 | # The biggest pain point is that CMake does not seem to respect our existing cross compilation CFLAGS and LDFLAGS. 30 | # Hence we are passing them manually, once via Android flags and once for "Required" flags. The latter is necessary 31 | # to let cmake correctly probe for any existing header, function, library, etc. 32 | # Watch out: Sometimes the flags are passed as ;-limited list! 33 | cmake -G "Unix Makefiles" \ 34 | -DCMAKE_MAKE_PROGRAM=make \ 35 | -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ 36 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ 37 | -DANDROID_NATIVE_API_LEVEL=${ANDROID_API} \ 38 | -DANDROID_ABI=${ANDROID_ABI_CMAKE} \ 39 | -DANDROID_TOOLCHAIN=${CC} \ 40 | -DANDROID_NDK=${NDK} \ 41 | -DANDROID_COMPILER_FLAGS="${CFLAGS// /;}" \ 42 | -DANDROID_LINKER_FLAGS="${LDFLAGS// /;}" \ 43 | -DANDROID_STL="c++_shared" \ 44 | -DCMAKE_REQUIRED_FLAGS="${CFLAGS}" \ 45 | -DCMAKE_REQUIRED_LINK_OPTIONS="${LDFLAGS// /;}" \ 46 | -DCMAKE_INSTALL_PREFIX=${PREFIX} \ 47 | -DCMAKE_STAGING_PREFIX=${PREFIX} \ 48 | -DCMAKE_VERBOSE_MAKEFILE=1 \ 49 | -DBUILD_SHARED_LIBS=1 \ 50 | -DLIB_SUFFIX= \ 51 | ${{ parameters.cmakeArgs }} .. 52 | make -j$((`nproc`+1)) 53 | ${{ parameters.installCommand }} 54 | popd 55 | popd 56 | displayName: 'Compile ${{ parameters.sourceDir }}' 57 | workingDirectory: ${{ parameters.workDir }} 58 | condition: ${{ parameters.condition }} 59 | 60 | - script: | 61 | ls -la ${{ parameters.sourceDir }}/build/CMakeFiles/ 62 | cat ${{ parameters.sourceDir }}/build/CMakeFiles/CMakeError.log 63 | cat ${{ parameters.sourceDir }}/build/CMakeFiles/CMakeOutput.log 64 | true 65 | displayName: 'Print ${{ parameters.sourceDir }} Cmake Error Log' 66 | condition: or(${{ parameters.condition }}, failed()) 67 | workingDirectory: ${{ parameters.workDir }} 68 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | 2 | task: 3 | name: FreeBSD 4 | freebsd_instance: 5 | matrix: 6 | image_family: freebsd-14-2 7 | image_family: freebsd-13-4 8 | 9 | install_script: pwd && ls -la && pkg update --force && pkg install -y cmake glib alsa-lib ladspa portaudio pulseaudio pkgconf sdl2 10 | 11 | compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -Werror=dev -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 -DNO_GUI=1 .. && make -j4 && make check && make install 12 | 13 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | AccessModifierOffset: 0 2 | AlignEscapedNewlinesLeft: true 3 | AlignTrailingComments: true 4 | AllowAllParametersOfDeclarationOnNextLine: false 5 | AllowShortFunctionsOnASingleLine: false 6 | AllowShortIfStatementsOnASingleLine: false 7 | AllowShortLoopsOnASingleLine: false 8 | AlwaysBreakBeforeMultilineStrings: false 9 | AlwaysBreakTemplateDeclarations: false 10 | BinPackArguments: false 11 | BinPackParameters: false 12 | BreakBeforeBinaryOperators: false 13 | BreakBeforeTernaryOperators: false 14 | BreakConstructorInitializersBeforeComma: false 15 | 16 | BreakBeforeBraces: Custom 17 | BraceWrapping: 18 | AfterClass: true 19 | AfterControlStatement: true 20 | AfterEnum: true 21 | AfterFunction: true 22 | AfterNamespace: true 23 | AfterStruct: true 24 | AfterUnion: true 25 | BeforeCatch: true 26 | BeforeElse: true 27 | IndentBraces: false 28 | 29 | ColumnLimit: 100 30 | CommentPragmas: '' 31 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 32 | ConstructorInitializerIndentWidth: 0 33 | ContinuationIndentWidth: 0 34 | Cpp11BracedListStyle: false 35 | DerivePointerAlignment: false 36 | IndentCaseLabels: true 37 | IndentWidth: 4 38 | Language: Cpp 39 | MaxEmptyLinesToKeep: 2 40 | NamespaceIndentation: All 41 | PenaltyBreakBeforeFirstCallParameter: 100 42 | PenaltyBreakComment: 100 43 | PenaltyBreakFirstLessLess: 0 44 | PenaltyBreakString: 100 45 | PenaltyExcessCharacter: 1 46 | PenaltyReturnTypeOnItsOwnLine: 20 47 | SpaceAfterCStyleCast: false 48 | SpaceAfterTemplateKeyword: false 49 | SpaceBeforeAssignmentOperators: true 50 | SpaceBeforeParens: ControlStatements 51 | SpaceInEmptyParentheses: false 52 | SpacesBeforeTrailingComments: 1 53 | SpacesInAngles: false 54 | SpacesInCStyleCastParentheses: false 55 | SpacesInContainerLiterals: false 56 | SpacesInParentheses: false 57 | SpacesInSquareBrackets: false 58 | SortIncludes: false 59 | Standard: Cpp11 60 | TabWidth: 4 61 | UseTab: Never 62 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | 27 | 28 | ### FluidSynth version 29 | _Execute `fluidsynth -V` and provide the output._ 30 | 31 | ### Describe the bug 32 | _Provide a clear and concise description of the current situation, e.g. how the bug manifests._ 33 | 34 | ### Expected behavior 35 | _Provide a clear and concise description of what you expected to happen._ 36 | 37 | ### Steps to reproduce 38 | _Please explain the steps required to duplicate the issue, esp. if you are able to provide a sample application. E.g. how to start fluidsynth, what shell commands to enter, what midi events to send, etc._ 39 | 40 | ### Additional context 41 | _If you are able to illustrate the bug with an example, please provide simple 42 | source code below or as attached file. List any other information that is relevant to your issue, e.g. stack traces, related issues, build logs, suggestions on how to fix, links to related discussions at fluid-dev, etc._ 43 | 44 | ``` 45 | insert code snippets, soundfonts or anything relevant here, or attach it as extra file(s) if it's too much 46 | ``` 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest a concrete feature 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | 27 | 28 | ### Related discussion 29 | _Feature requests should be discussed by the community, either on the mailing 30 | list or via a GitHub Discussion. Please bring up your ideas there before 31 | opening tickets. In case you already did that, please provide a link to the 32 | thread._ 33 | 34 | ### Is your feature request related to a problem? 35 | _A clear and concise description of what the problem is._ 36 | 37 | ### Describe the solution you'd like 38 | _A clear and concise description of what you want to happen._ 39 | 40 | ### Describe alternatives you've considered 41 | _A clear and concise description of any alternative solutions or features you've considered._ 42 | 43 | ### Additional context 44 | _Add any other context or screenshots about the feature request here._ 45 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Keep GitHub Actions up to date with GitHub's Dependabot... 2 | # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 3 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem 4 | version: 2 5 | updates: 6 | - package-ecosystem: github-actions 7 | directory: / 8 | groups: 9 | github-actions: 10 | patterns: 11 | - "*" # Group all Actions updates into a single larger pull request 12 | schedule: 13 | interval: weekly 14 | ignore: 15 | - dependency-name: "SonarSource/sonarcloud-github-c-cpp" 16 | # Version 3 of that task causes the scanner to throw a Java exception... 17 | versions: 18 | - "3.x" 19 | - "3" 20 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | _This issue tracker is only for bug reports and concrete feature requests. 2 | DO NOT SUBMIT SUPPORT REQUESTS OR "HOW TO" QUESTIONS HERE! 3 | Else it might be closed without further notice._ 4 | 5 | _If you have a question look into our wiki 6 | ( https://github.com/FluidSynth/fluidsynth/wiki ) 7 | or the developer resources 8 | ( https://www.fluidsynth.org/api/ )_ 9 | 10 | If you still have a question, need support or want to discuss ideas, contact our mailing list 11 | https://lists.nongnu.org/mailman/listinfo/fluid-dev 12 | 13 | or start a GitHub Discussion: 14 | https://github.com/FluidSynth/fluidsynth/discussions 15 | 16 | _Below is a form that shall help getting relevant information for bugs and feature requests together. 17 | We strongly recommend to use it! Feel free to edit or remove inapplicable/unneeded parts._ 18 | 19 | ### FluidSynth version 20 | 2.0.x 21 | 22 | ### Current behavior 23 | 24 | 25 | ### Expected behavior 26 | 28 | 29 | ### Steps to reproduce 30 | 33 | 34 | ### Other information 35 | 44 | -------------------------------------------------------------------------------- /.github/workflows/api_doc_build.yml: -------------------------------------------------------------------------------- 1 | name: API Doc Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | env: 9 | BUILD_TYPE: Release 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-22.04 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | with: 18 | persist-credentials: false 19 | 20 | - name: Install Dependencies 21 | run: sudo apt-get install doxygen xsltproc 22 | 23 | - name: Create Build Environment 24 | run: cmake -E make_directory ${{runner.workspace}}/build 25 | 26 | - name: Configure CMake 27 | shell: bash 28 | working-directory: ${{runner.workspace}}/build 29 | run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE 30 | 31 | - name: Build 32 | shell: bash 33 | working-directory: ${{runner.workspace}}/build 34 | run: cmake --build . --config $BUILD_TYPE --target doxygen 35 | 36 | - name: Publish API Docs to GH Pages 37 | uses: JamesIves/github-pages-deploy-action@v4 38 | with: 39 | folder: ${{runner.workspace}}/build/doc/api/html/ 40 | repository-name: FluidSynth/fluidsynth.github.io 41 | branch: main 42 | target-folder: api/ 43 | ssh-key: ${{ secrets.DEPLOY_API_TOKEN }} 44 | clean: true 45 | commit-message: Updating API doc from fluidsynth master 46 | git-config-name: API Doc Deploy 47 | git-config-email: fluid-api-deploy@fluidsynth.github.io 48 | -------------------------------------------------------------------------------- /.github/workflows/codespell.yml: -------------------------------------------------------------------------------- 1 | name: Codespell Linter 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - '**' 7 | 8 | jobs: 9 | codespell: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | # Run Codespell to check for typos 17 | - name: Run Codespell 18 | uses: codespell-project/actions-codespell@v2 19 | with: 20 | ignore_words_list: READD,caf,rin,datas,Claus 21 | skip: ./.git,*.pdf,./AUTHORS,./THANKS,./contrib 22 | -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Fluidsynth Windows 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | paths-ignore: 8 | - '.azure/**' 9 | - '.circleci/**' 10 | - '.github/workflows/sonarcloud.yml' 11 | - '.cirrus.yml' 12 | - 'README.md' 13 | 14 | env: 15 | BUILD_TYPE: RelWithDebInfo 16 | INSTALL_LOCATION: fluidsynth_install 17 | 18 | jobs: 19 | build: 20 | runs-on: windows-latest 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | include: 25 | - { icon: '⬛', sys: mingw32 } 26 | - { icon: '🟦', sys: mingw64 } 27 | - { icon: '🟨', sys: ucrt64 } 28 | - { icon: '🟧', sys: clang64 } 29 | name: 🚧${{ matrix.icon }} ${{ matrix.sys }} 30 | defaults: 31 | run: 32 | shell: msys2 {0} 33 | 34 | steps: 35 | - uses: actions/checkout@v4 36 | 37 | - name: '${{ matrix.icon }} Setup MSYS2' 38 | uses: msys2/setup-msys2@v2 39 | with: 40 | release: false 41 | msystem: ${{matrix.sys}} 42 | install: >- 43 | make 44 | libreadline 45 | pacboy: >- 46 | toolchain:p 47 | cmake:p 48 | ninja:p 49 | glib2:p 50 | libsndfile:p 51 | 52 | - name: '${{ matrix.icon }} Configure CMake' 53 | run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} 54 | 55 | - name: '${{ matrix.icon }} Build' 56 | run: cmake --build build --config ${{env.BUILD_TYPE}} 57 | 58 | - name: '${{ matrix.icon }} Test' 59 | run: cmake --build build --target check 60 | 61 | - name: '${{ matrix.icon }} Demo' 62 | run: cmake --build build --target demo 63 | 64 | - name: '${{ matrix.icon }} Install' 65 | run: cmake --install build && ls -la $INSTALL_LOCATION 66 | 67 | - name: '' 68 | shell: bash 69 | working-directory: ${{env.INSTALL_LOCATION}} 70 | run: | 71 | if [ ! -f "bin/libfluidsynth-3.dll" ] || [ ! -f "lib/libfluidsynth-3.dll.a" ]; then 72 | echo "Fluidsynth library has unexpected filename!" 73 | ls -la . bin lib 74 | exit -1 75 | fi 76 | 77 | - name: '${{ matrix.icon }} Upload Artifacts' 78 | uses: actions/upload-artifact@v4 79 | with: 80 | name: ${{env.INSTALL_LOCATION}}-${{matrix.sys}} 81 | path: ${{env.INSTALL_LOCATION}} 82 | retention-days: 14 83 | overwrite: true 84 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build/ 3 | 4 | CMakeCache.txt 5 | CMakeFiles 6 | Makefile 7 | cmake_install.cmake 8 | install_manifest.txt 9 | 10 | # Object files 11 | *.o 12 | *.ko 13 | *.obj 14 | *.elf 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | 26 | # Shared objects (inc. Windows DLLs) 27 | *.dll 28 | *.so 29 | *.so.* 30 | *.dylib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | *.i*86 37 | *.x86_64 38 | *.hex 39 | 40 | # ProjectFiles 41 | *.pro.user* 42 | *.user 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/manual"] 2 | path = test/manual 3 | url = https://github.com/FluidSynth/testdata.git 4 | -------------------------------------------------------------------------------- /.obs/workflows.yml: -------------------------------------------------------------------------------- 1 | main_workflow: 2 | steps: 3 | - branch_package: 4 | source_project: home:derselbst:anmp 5 | source_package: fluidsynth 6 | target_project: home:derselbst:anmp:github-ci 7 | filters: 8 | event: pull_request 9 | rebuild_master: 10 | steps: 11 | - rebuild_package: 12 | project: home:derselbst:anmp 13 | package: fluidsynth 14 | filters: 15 | event: push 16 | branches: 17 | only: 18 | - master 19 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | For the list of authors that contributed to the code, please read the 2 | file AUTHORS. 3 | 4 | 5 | We would like to thank the Fondation Daniel Langlois for their 6 | funding. Their help made this project to get of the ground. Without it 7 | would simply not exist. Many thanks! 8 | (https://www.fondation-langlois.org) 9 | 10 | In alphabetic order: 11 | 12 | Paul Barton-Davis 13 | Samuel Bianchini 14 | Raoul Bonisch 15 | Rui Nuno Capela 16 | Jake Commander 17 | Francois Dechelle 18 | Ken Ellinwood 19 | Tim Goetze 20 | Anthony Green 21 | Josh Green 22 | Bob Ham 23 | Peter Hanappe 24 | Jezar 25 | Fernando Pablo Lopez-Lezcano 26 | Johnathan Lee 27 | Stephane Letz 28 | Ebrahim Mayat 29 | Sven Meier 30 | Juergen Mueller 31 | Markus Nentwig 32 | David Olofson 33 | Sergey Pavlishin 34 | Dave Phillips 35 | Daniel Pressnitzer 36 | Gerald Pye 37 | Norbert Schnell 38 | Joshua Scholar 39 | Antoine Schmitt 40 | Werner Schweer 41 | Stephan Tassart 42 | Martin Uddén 43 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | New features 2 | ------------ 3 | - Audio level metering 4 | - Active voice count monitoring 5 | 6 | Synthesis 7 | --------- 8 | - Improve voice stealing algorithm 9 | - Dynamic voice killing (based on CPU usage) 10 | - Batch voice activation (stereo synch. as per SoundFont spec) 11 | - Pitch control on stereo samples not managed as should 12 | 13 | Drivers 14 | ------- 15 | - libao audio output driver 16 | - Windows DirectMusic component 17 | - ASIO driver 18 | - DirectSound 3D and EAX 19 | 20 | Bugs to mash 21 | ------------ 22 | - Investigate why MIDI rendering causes burst of notes at start 23 | 24 | Documentation 25 | ------------- 26 | - Write documentation on tuning 27 | - User and system configuration file 28 | 29 | Misc 30 | ---- 31 | - Remove dependency of settings on audio driver and other (see 32 | fluid_settings_init()) 33 | - set loop on/off on a sample (set_gen GEN_SAMPLEMODE?) 34 | 35 | 36 | FluidSynth Next Generation 37 | -------------------------------------------- 38 | 39 | Top of the list 40 | - 3D audio output 41 | 42 | MIDI player 43 | - Add API to manipulate and query MIDI file list 44 | - generalize use of fluid_event_t, remove fluid_midi_event_t 45 | 46 | Shell & command handler 47 | - Add "note" command that plays a note with a duration (sequencer) 48 | - MIDI file player commands (load/play/stop) 49 | - Allow settings to be loaded before the synthesizer is created 50 | 51 | MIDI Specs 52 | - sample dump 53 | - MIDI thru 54 | - Scalable Polyphony MIDI (SP-MIDI) 55 | 56 | 57 | Unsorted 58 | - rewrite midi file using new sequencer 59 | -------------------------------------------------------------------------------- /android/src/bindings/fluid_cmd.c: -------------------------------------------------------------------------------- 1 | #include "fluid_synth.h" 2 | #include "fluid_settings.h" 3 | 4 | void fluid_shell_settings(fluid_settings_t* settings) 5 | { 6 | // NOOP 7 | } 8 | -------------------------------------------------------------------------------- /build_all_android.sh: -------------------------------------------------------------------------------- 1 | # Script to build FluidSynth for multiple Android ABIs and prepare them for distribution 2 | # via Prefab (github.com/google/prefab) 3 | # 4 | # Ensure that ANDROID_NDK environment variable is set to your Android NDK location 5 | # e.g. /Library/Android/sdk/ndk-bundle 6 | 7 | #!/bin/bash 8 | 9 | if [ -z "$ANDROID_NDK" ]; then 10 | echo "Please set ANDROID_NDK to the Android NDK folder" 11 | exit 1 12 | fi 13 | 14 | # Directories, paths and filenames 15 | BUILD_DIR=build 16 | 17 | CMAKE_ARGS="-H. \ 18 | -DBUILD_SHARED_LIBS=true \ 19 | -DCMAKE_BUILD_TYPE=Release \ 20 | -DANDROID_TOOLCHAIN=clang \ 21 | -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON \ 22 | -DANDROID_STL=c++_shared \ 23 | -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ 24 | -DCMAKE_INSTALL_PREFIX=." 25 | 26 | function build_fluidsynth { 27 | 28 | ABI=$1 29 | MINIMUM_API_LEVEL=$2 30 | ABI_BUILD_DIR=build/${ABI} 31 | STAGING_DIR=staging 32 | 33 | echo "Building FluidSynth for ${ABI}" 34 | 35 | mkdir -p ${ABI_BUILD_DIR} ${ABI_BUILD_DIR}/${STAGING_DIR} 36 | 37 | cmake -B${ABI_BUILD_DIR} \ 38 | -DANDROID_ABI=${ABI} \ 39 | -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${STAGING_DIR}/lib/${ABI} \ 40 | -DANDROID_PLATFORM=android-${MINIMUM_API_LEVEL}\ 41 | ${CMAKE_ARGS} 42 | 43 | pushd ${ABI_BUILD_DIR} 44 | make -j5 45 | make install 46 | popd 47 | } 48 | 49 | build_fluidsynth armeabi-v7a 16 50 | build_fluidsynth arm64-v8a 21 51 | build_fluidsynth x86 16 52 | build_fluidsynth x86_64 21 -------------------------------------------------------------------------------- /cmake_admin/CheckPrototypeExists.cmake: -------------------------------------------------------------------------------- 1 | # - Check if the prototype for a function exists. 2 | # CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE) 3 | # 4 | # FUNCTION - the name of the function you are looking for 5 | # HEADER - the header(s) where the prototype should be declared 6 | # VARIABLE - variable to store the result 7 | # 8 | # The following variables may be set before calling this macro to 9 | # modify the way the check is run: 10 | # 11 | # CMAKE_REQUIRED_FLAGS = string of compile command line flags 12 | # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) 13 | # CMAKE_REQUIRED_INCLUDES = list of include directories 14 | 15 | # Copyright (c) 2006, Alexander Neundorf, 16 | # 17 | # Redistribution and use is allowed according to the terms of the BSD license. 18 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 19 | 20 | 21 | INCLUDE(CheckCSourceCompiles) 22 | 23 | MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT) 24 | SET(_INCLUDE_FILES) 25 | FOREACH (it ${_HEADER}) 26 | SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") 27 | ENDFOREACH (it) 28 | 29 | SET(_CHECK_PROTO_EXISTS_SOURCE_CODE " 30 | ${_INCLUDE_FILES} 31 | int main() 32 | { 33 | #ifndef ${_SYMBOL} 34 | int i = sizeof(&${_SYMBOL}); 35 | #endif 36 | return 0; 37 | } 38 | ") 39 | 40 | CHECK_C_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT}) 41 | ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT) 42 | -------------------------------------------------------------------------------- /cmake_admin/CheckSTDC.cmake: -------------------------------------------------------------------------------- 1 | message(STATUS "Checking whether system has ANSI C header files") 2 | include(CheckPrototypeExists) 3 | include(CheckIncludeFiles) 4 | 5 | check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" StandardHeadersExist) 6 | if(StandardHeadersExist) 7 | check_prototype_exists(memchr string.h memchrExists) 8 | if(memchrExists) 9 | check_prototype_exists(free stdlib.h freeExists) 10 | if(freeExists) 11 | message(STATUS "ANSI C header files - found") 12 | set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files") 13 | set(HAVE_STRINGS_H 1) 14 | set(HAVE_STRING_H 1) 15 | set(HAVE_FLOAT_H 1) 16 | set(HAVE_STDLIB_H 1) 17 | set(HAVE_STDDEF_H 1) 18 | set(HAVE_STDINT_H 1) 19 | set(HAVE_INTTYPES_H 1) 20 | endif(freeExists) 21 | endif(memchrExists) 22 | endif(StandardHeadersExist) 23 | 24 | if(NOT STDC_HEADERS) 25 | message(STATUS "ANSI C header files - not found") 26 | set(STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files") 27 | endif(NOT STDC_HEADERS) 28 | 29 | check_include_files(unistd.h HAVE_UNISTD_H) 30 | 31 | include(CheckDIRSymbolExists) 32 | check_dirsymbol_exists("sys/stat.h;sys/types.h;dirent.h" HAVE_DIRENT_H) 33 | if (HAVE_DIRENT_H) 34 | set(HAVE_SYS_STAT_H 1) 35 | set(HAVE_SYS_TYPES_H 1) 36 | endif (HAVE_DIRENT_H) 37 | -------------------------------------------------------------------------------- /cmake_admin/DefaultDirs.cmake: -------------------------------------------------------------------------------- 1 | # Provides install directory variables as defined by the GNU Coding Standards 2 | include ( GNUInstallDirs ) 3 | 4 | # Several directory names used by FluidSynth to install files 5 | # the variable names are similar to the KDE4 build system 6 | 7 | # DEFAULT_SOUNDFONT - automatically loaded in some use cases 8 | if ( WIN32 ) 9 | set (DEFAULT_SOUNDFONT "C:\\\\ProgramData\\\\soundfonts\\\\default.sf2" CACHE STRING 10 | "Default soundfont file") 11 | else ( WIN32 ) 12 | set (DEFAULT_SOUNDFONT "${CMAKE_INSTALL_FULL_DATADIR}/soundfonts/default.sf2" CACHE STRING 13 | "Default soundfont file") 14 | endif ( WIN32 ) 15 | mark_as_advanced (DEFAULT_SOUNDFONT) 16 | 17 | set(FRAMEWORK_INSTALL_PREFIX "") 18 | if ( CMAKE_VERSION VERSION_GREATER "3.7.0" AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) 19 | set(FRAMEWORK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) 20 | endif() 21 | 22 | # BUNDLE_INSTALL_DIR - Mac only: the directory for application bundles 23 | set (BUNDLE_INSTALL_DIR "Applications" CACHE STRING 24 | "The install dir for application bundles") 25 | mark_as_advanced (BUNDLE_INSTALL_DIR) 26 | 27 | # FRAMEWORK_INSTALL_DIR - Mac only: the directory for framework bundles 28 | set (FRAMEWORK_INSTALL_DIR "Library/Frameworks" CACHE STRING 29 | "The install dir for framework bundles") 30 | mark_as_advanced (FRAMEWORK_INSTALL_DIR) 31 | 32 | # XDG_APPS_INSTALL_DIR - the XDG apps dir, where .desktop files are installed 33 | set (XDG_APPS_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/applications" CACHE STRING "The XDG apps dir") 34 | mark_as_advanced (XDG_APPS_INSTALL_DIR) 35 | 36 | # XDG_MIME_INSTALL_DIR - the XDG mimetypes install dir 37 | set (XDG_MIME_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/mime/packages" CACHE STRING 38 | "The install dir for the xdg mimetypes") 39 | mark_as_advanced (XDG_MIME_INSTALL_DIR) 40 | 41 | # DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces are 42 | # installed 43 | set (DBUS_INTERFACES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/dbus-1/interfaces" CACHE STRING 44 | "The dbus interfaces install dir") 45 | mark_as_advanced (DBUS_INTERFACES_INSTALL_DIR) 46 | 47 | # DBUS_SERVICES_INSTALL_DIR - the directory where dbus services are installed 48 | set (DBUS_SERVICES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services" CACHE STRING 49 | "The dbus services install dir") 50 | mark_as_advanced (DBUS_SERVICES_INSTALL_DIR) 51 | 52 | # DBUS_SYSTEM_SERVICES_INSTALL_DIR - the directory where dbus system services 53 | # are installed 54 | set (DBUS_SYSTEM_SERVICES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/dbus-1/system-services" 55 | CACHE STRING "The dbus system services install dir") 56 | mark_as_advanced (DBUS_SYSTEM_SERVICES_INSTALL_DIR) 57 | -------------------------------------------------------------------------------- /cmake_admin/FindJack.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindJack 3 | ------- 4 | 5 | Finds the Jack library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``Jack::Jack`` 13 | The Jack library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``Jack_FOUND`` 21 | True if the system has the Jack library. 22 | 23 | #]=======================================================================] 24 | 25 | # Use pkg-config if available 26 | find_package(PkgConfig QUIET) 27 | pkg_check_modules(PC_JACK QUIET jack) 28 | 29 | # Find the headers and library 30 | find_path( 31 | Jack_INCLUDE_DIR 32 | NAMES "jack/jack.h" 33 | HINTS "${PC_JACK_INCLUDEDIR}") 34 | 35 | find_library( 36 | Jack_LIBRARY 37 | NAMES "jack" 38 | HINTS "${PC_JACK_LIBDIR}" "${PC_JACK_LIBRARY_DIRS}") 39 | 40 | # Handle transitive dependencies 41 | if(PC_JACK_FOUND) 42 | get_target_properties_from_pkg_config("${Jack_LIBRARY}" "PC_JACK" "_jack") 43 | else() 44 | set(_jack_link_libraries "Threads::Threads") 45 | endif() 46 | 47 | # Forward the result to CMake 48 | include(FindPackageHandleStandardArgs) 49 | find_package_handle_standard_args(Jack REQUIRED_VARS "Jack_LIBRARY" 50 | "Jack_INCLUDE_DIR") 51 | 52 | # Create the target 53 | if(Jack_FOUND AND NOT TARGET Jack::Jack) 54 | add_library(Jack::Jack UNKNOWN IMPORTED) 55 | set_target_properties( 56 | Jack::Jack 57 | PROPERTIES IMPORTED_LOCATION "${Jack_LIBRARY}" 58 | INTERFACE_COMPILE_OPTIONS "${_jack_compile_options}" 59 | INTERFACE_INCLUDE_DIRECTORIES "${Jack_INCLUDE_DIR}" 60 | INTERFACE_LINK_LIBRARIES "${_jack_link_libraries}" 61 | INTERFACE_LINK_DIRECTORIES "${_jack_link_directories}") 62 | endif() 63 | 64 | mark_as_advanced(Jack_INCLUDE_DIR Jack_LIBRARY) 65 | -------------------------------------------------------------------------------- /cmake_admin/FindMidiShare.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindMidiShare 3 | ------- 4 | 5 | Finds the MidiShare library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``MidiShare::MidiShare`` 13 | The MidiShare library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``MidiShare_FOUND`` 21 | True if the system has the MidiShare library. 22 | ``MidiShare_VERSION`` 23 | The version of the MidiShare library which was found. 24 | 25 | #]=======================================================================] 26 | 27 | # Find headers and library 28 | find_path(MidiShare_INCLUDE_DIR NAMES "MidiShare.h") 29 | find_library(MidiShare_LIBRARY NAMES "MidiShare") 30 | 31 | # Forward the result to CMake 32 | include(FindPackageHandleStandardArgs) 33 | find_package_handle_standard_args( 34 | MidiShare REQUIRED_VARS "MidiShare_LIBRARY" "MidiShare_INCLUDE_DIR") 35 | 36 | # Create the target 37 | if(MidiShare_FOUND AND NOT TARGET MidiShare::MidiShare) 38 | add_library(MidiShare::MidiShare UNKNOWN IMPORTED) 39 | set_target_properties( 40 | MidiShare::MidiShare 41 | PROPERTIES IMPORTED_LOCATION "${MidiShare_LIBRARY}" 42 | INTERFACE_INCLUDE_DIRECTORIES "${MidiShare_INCLUDE_DIR}") 43 | endif() 44 | 45 | mark_as_advanced(MidiShare_INCLUDE_DIR MidiShare_LIBRARY) 46 | -------------------------------------------------------------------------------- /cmake_admin/FindOgg.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindOgg 3 | ------- 4 | 5 | Finds the Ogg library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``Ogg::ogg`` 13 | The Ogg library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``Ogg_FOUND`` 21 | True if the system has the Ogg library. 22 | 23 | For compatibility with upstream, the following variables are also set: 24 | 25 | ``Ogg_INCLUDE_DIR`` 26 | ``Ogg_INCLUDE_DIRS`` 27 | ``Ogg_LIBRARY`` 28 | ``Ogg_LIBRARIES`` 29 | ``OGG_INCLUDE_DIR`` 30 | ``OGG_INCLUDE_DIRS`` 31 | ``OGG_LIBRARY`` 32 | ``OGG_LIBRARIES`` 33 | ``OGG_FOUND`` 34 | 35 | #]=======================================================================] 36 | 37 | # Use pkg-config if available 38 | find_package(PkgConfig QUIET) 39 | pkg_check_modules(PC_OGG QUIET ogg) 40 | 41 | # Find the headers and library 42 | find_path( 43 | Ogg_INCLUDE_DIR 44 | NAMES "ogg/ogg.h" 45 | HINTS "${PC_OGG_INCLUDEDIR}") 46 | 47 | find_library( 48 | _ogg_library 49 | NAMES "ogg" 50 | HINTS "${PC_OGG_LIBDIR}") 51 | 52 | # Extract additional flags if pkg-config is available 53 | if(PC_OGG_FOUND) 54 | get_target_properties_from_pkg_config("${_ogg_library}" "PC_OGG" "_ogg") 55 | endif() 56 | 57 | # Forward the result to CMake 58 | include(FindPackageHandleStandardArgs) 59 | find_package_handle_standard_args(Ogg REQUIRED_VARS "_ogg_library" 60 | "Ogg_INCLUDE_DIR") 61 | 62 | # Create the target 63 | if(Ogg_FOUND AND NOT TARGET Ogg::ogg) 64 | add_library(Ogg::ogg UNKNOWN IMPORTED) 65 | set_target_properties( 66 | Ogg::ogg 67 | PROPERTIES IMPORTED_LOCATION "${_ogg_library}" 68 | INTERFACE_COMPILE_OPTIONS "${_ogg_compile_options}" 69 | INTERFACE_INCLUDE_DIRECTORIES "${Ogg_INCLUDE_DIR}" 70 | INTERFACE_LINK_LIBRARIES "${_ogg_link_libraries}" 71 | INTERFACE_LINK_DIRECTORIES "${_ogg_link_directories}") 72 | 73 | # Set additional variables for compatibility with upstream config 74 | set(Ogg_INCLUDE_DIRS "${Ogg_INCLUDE_DIR}") 75 | set(Ogg_LIBRARY Ogg::ogg) 76 | set(Ogg_LIBRARIES Ogg::ogg) 77 | set(OGG_INCLUDE_DIR "${${Ogg_INCLUDE_DIR}}") 78 | set(OGG_INCLUDE_DIRS "${${Ogg_INCLUDE_DIR}}") 79 | set(OGG_LIBRARY Ogg::ogg) 80 | set(OGG_LIBRARIES Ogg::ogg) 81 | set(OGG_FOUND TRUE) 82 | endif() 83 | 84 | mark_as_advanced(_ogg_library) 85 | -------------------------------------------------------------------------------- /cmake_admin/FindOpenSLES.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindOpenSLES 3 | ------- 4 | 5 | Finds the OpenSLES library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``OpenSLES::libOpenSLES`` 13 | The OpenSLES library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``OpenSLES_FOUND`` 21 | True if the system has the OpenSLES library. 22 | 23 | #]=======================================================================] 24 | 25 | # Find the headers and library 26 | find_path(OpenSLES_INCLUDE_DIR NAMES "SLES/OpenSLES.h") 27 | 28 | find_library(OpenSLES_LIBRARY NAMES "OpenSLES") 29 | 30 | # Forward the result to CMake 31 | include(FindPackageHandleStandardArgs) 32 | find_package_handle_standard_args(OpenSLES REQUIRED_VARS "OpenSLES_LIBRARY" 33 | "OpenSLES_INCLUDE_DIR") 34 | 35 | # Create the target 36 | if(OpenSLES_FOUND AND NOT TARGET OpenSLES::OpenSLES) 37 | add_library(OpenSLES::OpenSLES UNKNOWN IMPORTED) 38 | set_target_properties( 39 | OpenSLES::OpenSLES 40 | PROPERTIES IMPORTED_LOCATION "${OpenSLES_LIBRARY}" 41 | INTERFACE_INCLUDE_DIRECTORIES "${OpenSLES_INCLUDE_DIR}") 42 | endif() 43 | 44 | mark_as_advanced(OpenSLES_INCLUDE_DIR OpenSLES_LIBRARY) 45 | -------------------------------------------------------------------------------- /cmake_admin/FindPortAudio.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindPortAudio 3 | ------- 4 | 5 | Finds the PortAudio library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``PortAudio::PortAudio`` 13 | The PortAudio library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``PortAudio_FOUND`` 21 | True if the system has the PortAudio library. 22 | ``PortAudio_VERSION`` 23 | The version of the PortAudio library which was found. 24 | 25 | #]=======================================================================] 26 | 27 | # Use pkg-config if available 28 | find_package(PkgConfig QUIET) 29 | pkg_check_modules(PC_PORTAUDIO QUIET portaudio-2.0) 30 | 31 | # Find the headers and library 32 | find_path( 33 | PortAudio_INCLUDE_DIR 34 | NAMES "portaudio.h" 35 | HINTS "${PC_PORTAUDIO_INCLUDEDIR}") 36 | 37 | find_library( 38 | PortAudio_LIBRARY 39 | NAMES "portaudio" 40 | HINTS "${PC_PORTAUDIO_LIBDIR}") 41 | 42 | # Handle transitive dependencies 43 | if(PC_PORTAUDIO_FOUND) 44 | get_target_properties_from_pkg_config("${PortAudio_LIBRARY}" "PC_PORTAUDIO" 45 | "_portaudio") 46 | else() 47 | set(_portaudio_link_libraries "ALSA::ALSA" ${MATH_LIBRARY} "Threads::Threads") 48 | endif() 49 | 50 | # Forward the result to CMake 51 | include(FindPackageHandleStandardArgs) 52 | find_package_handle_standard_args( 53 | PortAudio REQUIRED_VARS "PortAudio_LIBRARY" "PortAudio_INCLUDE_DIR") 54 | 55 | if(PortAudio_FOUND AND NOT TARGET PortAudio::PortAudio) 56 | add_library(PortAudio::PortAudio UNKNOWN IMPORTED) 57 | set_target_properties( 58 | PortAudio::PortAudio 59 | PROPERTIES IMPORTED_LOCATION "${PortAudio_LIBRARY}" 60 | INTERFACE_COMPILE_OPTIONS "${_portaudio_compile_options}" 61 | INTERFACE_INCLUDE_DIRECTORIES "${PortAudio_INCLUDE_DIR}" 62 | INTERFACE_LINK_LIBRARIES "${_portaudio_link_libraries}" 63 | INTERFACE_LINK_DIRECTORIES "${_portaudio_link_directories}") 64 | endif() 65 | 66 | mark_as_advanced(PortAudio_INCLUDE_DIR PortAudio_LIBRARY) 67 | -------------------------------------------------------------------------------- /cmake_admin/FindSystemd.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | FindSystemd 3 | ------- 4 | 5 | Finds the Systemd library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``Systemd::libsystemd`` 13 | The Systemd library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``Systemd_FOUND`` 21 | True if the system has the Systemd library. 22 | 23 | #]=======================================================================] 24 | 25 | # Use pkg-config if available 26 | find_package(PkgConfig QUIET) 27 | pkg_check_modules(PC_SYSTEMD QUIET libsystemd) 28 | 29 | # Find the headers and library 30 | find_path( 31 | Systemd_INCLUDE_DIR 32 | NAMES "systemd/sd-daemon.h" 33 | HINTS "${PC_SYSTEMD_INCLUDEDIR}") 34 | 35 | find_library( 36 | Systemd_LIBRARY 37 | NAMES "systemd" 38 | HINTS "${PC_SYSTEMD_LIBDIR}") 39 | 40 | # Extract additional flags if pkg-config is available 41 | if(PC_SYSTEMD_FOUND) 42 | get_target_properties_from_pkg_config("${Systemd_LIBRARY}" "PC_SYSTEMD" 43 | "_systemd") 44 | endif() 45 | 46 | # Forward the result to CMake 47 | include(FindPackageHandleStandardArgs) 48 | find_package_handle_standard_args(Systemd REQUIRED_VARS "Systemd_LIBRARY" 49 | "Systemd_INCLUDE_DIR") 50 | 51 | if(Systemd_FOUND AND NOT TARGET Systemd::libsystemd) 52 | add_library(Systemd::libsystemd UNKNOWN IMPORTED) 53 | set_target_properties( 54 | Systemd::libsystemd 55 | PROPERTIES IMPORTED_LOCATION "${Systemd_LIBRARY}" 56 | INTERFACE_COMPILE_OPTIONS "${_systemd_compile_options}" 57 | INTERFACE_INCLUDE_DIRECTORIES "${Systemd_INCLUDE_DIR}" 58 | INTERFACE_LINK_LIBRARIES "${_systemd_link_libraries}" 59 | INTERFACE_LINK_DIRECTORIES "${_systemd_link_directories}") 60 | endif() 61 | 62 | mark_as_advanced(Systemd_INCLUDE_DIR Systemd_LIBRARY) 63 | -------------------------------------------------------------------------------- /cmake_admin/Findlibffi.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | Findlibffi 3 | ------- 4 | 5 | Finds the libffi library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``libffi`` 13 | The ffi library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``libffi_FOUND`` 21 | True if the system has the Ffi library. 22 | 23 | #]=======================================================================] 24 | 25 | # Use pkg-config if available 26 | find_package(PkgConfig QUIET) 27 | pkg_check_modules(PC_LIBFFI QUIET libffi) 28 | 29 | # Find the headers and library 30 | find_path( 31 | libffi_INCLUDE_DIR 32 | NAMES "ffi.h" 33 | HINTS "${PC_LIBFFI_INCLUDE_DIR}") 34 | 35 | find_library( 36 | libffi_LIBRARY 37 | NAMES "ffi" "libffi" 38 | HINTS "${PC_FFI_LIBDIR}") 39 | 40 | # Extract additional flags if pkg-config is available 41 | if(PC_FFI_FOUND) 42 | get_target_properties_from_pkg_config("${libffi_LIBRARY}" "PC_FFI" "_libffi") 43 | endif() 44 | 45 | # Forward the result to CMake 46 | include(FindPackageHandleStandardArgs) 47 | find_package_handle_standard_args(libffi REQUIRED_VARS "libffi_LIBRARY" 48 | "libffi_INCLUDE_DIR") 49 | 50 | if(libffi_FOUND AND NOT TARGET libffi) 51 | add_library(libffi UNKNOWN IMPORTED) 52 | set_target_properties( 53 | libffi 54 | PROPERTIES IMPORTED_LOCATION "${libffi_LIBRARY}" 55 | INTERFACE_COMPILE_OPTIONS "${_libffi_compile_options}" 56 | INTERFACE_INCLUDE_DIRECTORIES "${libffi_INCLUDE_DIR}" 57 | INTERFACE_LINK_LIBRARIES "${_libffi_link_libraries}" 58 | INTERFACE_LINK_DIRECTORIES "${_libffi_link_directories}") 59 | endif() 60 | 61 | mark_as_advanced(libffi_LIBRARY libffi_INCLUDE_DIR) 62 | -------------------------------------------------------------------------------- /cmake_admin/Findmp3lame.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | Findmp3lame 3 | ------- 4 | 5 | Finds the mp3lame library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``mp3lame::mp3lame`` 13 | The mp3lame library. 14 | ``mp3lame::mpghip`` 15 | The mpghip library. 16 | 17 | Result Variables 18 | ^^^^^^^^^^^^^^^^ 19 | 20 | This will define the following variables: 21 | 22 | ``mp3lame_FOUND`` 23 | True if the mp3lame library was found. 24 | ``mp3lame_mpghip_FOUND`` 25 | True if the mpghip library was found. 26 | 27 | #]=======================================================================] 28 | 29 | # Find the headers and libraries 30 | find_path(mp3lame_INCLUDE_DIR NAMES "lame/lame.h") 31 | 32 | find_library(mp3lame_mp3lame_LIBRARY NAMES "mp3lame" "libmp3lame" 33 | "libmp3lame-static") 34 | find_library(mp3lame_mpghip_LIBRARY NAMES "mpghip" "libmpghip" 35 | "libmpghip-static") 36 | 37 | # Forward the result to CMake 38 | include(FindPackageHandleStandardArgs) 39 | find_package_handle_standard_args( 40 | mp3lame REQUIRED_VARS "mp3lame_mp3lame_LIBRARY" 41 | "mp3lame_INCLUDE_DIR") 42 | 43 | # Create the targets 44 | if(mp3lame_FOUND AND NOT TARGET mp3lame::mp3lame) 45 | add_library(mp3lame::mp3lame UNKNOWN IMPORTED) 46 | set_target_properties( 47 | mp3lame::mp3lame 48 | PROPERTIES IMPORTED_LOCATION "${mp3lame_mp3lame_LIBRARY}" 49 | INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}") 50 | set(mp3lame_mp3lame_FOUND TRUE) 51 | endif() 52 | 53 | if(mp3lame_mpghip_LIBRARY AND NOT TARGET mp3lame::mpghip) 54 | add_library(mp3lame::mpghip UNKNOWN IMPORTED) 55 | set_target_properties( 56 | mp3lame::mpghip 57 | PROPERTIES IMPORTED_LOCATION "${mp3lame_mpghip_LIBRARY}" 58 | INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}") 59 | set(mp3lame_mpghip_FOUND) 60 | endif() 61 | 62 | mark_as_advanced(mp3lame_INCLUDE_DIR mp3lame_mp3lame_LIBRARY 63 | mp3lame_mpghip_LIBRARY) 64 | -------------------------------------------------------------------------------- /cmake_admin/Findoboe.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[.rst: 2 | Findoboe 3 | ------- 4 | 5 | Finds the oboe library. 6 | 7 | Imported Targets 8 | ^^^^^^^^^^^^^^^^ 9 | 10 | This module provides the following imported targets, if found: 11 | 12 | ``oboe::oboe`` 13 | The oboe library 14 | 15 | Result Variables 16 | ^^^^^^^^^^^^^^^^ 17 | 18 | This will define the following variables: 19 | 20 | ``oboe_FOUND`` 21 | True if the system has the oboe library. 22 | 23 | For compatibility with upstream, the following variables are also set: 24 | 25 | ``oboe_INCLUDE_DIR`` 26 | ``oboe_INCLUDE_DIRS`` 27 | ``oboe_LIBRARY`` 28 | ``oboe_LIBRARIES`` 29 | ``OBOE_INCLUDE_DIR`` 30 | ``OBOE_INCLUDE_DIRS`` 31 | ``OBOE_LIBRARY`` 32 | ``OBOE_LIBRARIES`` 33 | ``OBOE_FOUND`` 34 | 35 | #]=======================================================================] 36 | 37 | # Use pkg-config if available 38 | find_package(PkgConfig QUIET) 39 | pkg_check_modules(PC_OBOE QUIET oboe-1.0) 40 | 41 | # Find the headers and library 42 | find_path( 43 | oboe_INCLUDE_DIR 44 | NAMES "oboe/Oboe.h" 45 | HINTS "${PC_OBOE_INCLUDEDIR}") 46 | 47 | find_library( 48 | _oboe_library 49 | NAMES "oboe" 50 | HINTS "${PC_OBOE_LIBDIR}") 51 | 52 | # Extract additional flags if pkg-config is available 53 | if(PC_OBOE_FOUND) 54 | get_target_properties_from_pkg_config("${_oboe_library}" "PC_OBOE" "_oboe") 55 | endif() 56 | 57 | # Forward the result to CMake 58 | include(FindPackageHandleStandardArgs) 59 | find_package_handle_standard_args(oboe REQUIRED_VARS "_oboe_library" 60 | "oboe_INCLUDE_DIR") 61 | 62 | # Create the target 63 | if(oboe_FOUND AND NOT TARGET oboe::oboe) 64 | add_library(oboe::oboe UNKNOWN IMPORTED) 65 | set_target_properties( 66 | oboe::oboe 67 | PROPERTIES IMPORTED_LOCATION "${_oboe_library}" 68 | INTERFACE_COMPILE_OPTIONS "${_oboe_compile_options}" 69 | INTERFACE_INCLUDE_DIRECTORIES "${oboe_INCLUDE_DIR}" 70 | INTERFACE_LINK_LIBRARIES "${_oboe_link_libraries}" 71 | INTERFACE_LINK_DIRECTORIES "${_oboe_link_directories}") 72 | 73 | # Set additional variables for compatibility with upstream config 74 | set(oboe_INCLUDE_DIRS "${oboe_INCLUDE_DIR}") 75 | set(oboe_LIBRARY oboe::oboe) 76 | set(oboe_LIBRARIES oboe::oboe) 77 | set(OBOE_INCLUDE_DIR "${${oboe_INCLUDE_DIR}}") 78 | set(OBOE_INCLUDE_DIRS "${${oboe_INCLUDE_DIR}}") 79 | set(OBOE_LIBRARY oboe::oboe) 80 | set(OBOE_LIBRARIES oboe::oboe) 81 | set(OBOE_FOUND TRUE) 82 | endif() 83 | 84 | mark_as_advanced(_oboe_library) 85 | -------------------------------------------------------------------------------- /cmake_admin/GetSDL2VersionFromHeaders.cmake: -------------------------------------------------------------------------------- 1 | # Get the version of SDL2 through headers 2 | # This is needed for autotools builds before 2.0.12 3 | function(get_sdl2_version_from_headers INCLUDE_DIR OUT_VAR) 4 | file(READ "${INCLUDE_DIR}/SDL_version.h" SDL_VERSION_H) 5 | string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" 6 | SDL2_MAJOR_RE "${SDL_VERSION_H}") 7 | set(SDL2_MAJOR "${CMAKE_MATCH_1}") 8 | string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" 9 | SDL2_MINOR_RE "${SDL_VERSION_H}") 10 | set(SDL2_MINOR "${CMAKE_MATCH_1}") 11 | string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" SDL2_PATCH_RE 12 | "${SDL_VERSION_H}") 13 | set(SDL2_PATCH "${CMAKE_MATCH_1}") 14 | if(SDL2_MAJOR_RE 15 | AND SDL2_MINOR_RE 16 | AND SDL2_PATCH_RE) 17 | set(${OUT_VAR} 18 | "${SDL2_MAJOR}.${SDL2_MINOR}.${SDL2_PATCH}" 19 | PARENT_SCOPE) 20 | endif() 21 | endfunction() 22 | -------------------------------------------------------------------------------- /cmake_admin/README.md: -------------------------------------------------------------------------------- 1 | This directory contains CMake helpers and Find modules. 2 | 3 | The latter are used to search for dependencies **without requiring pkg-config**. 4 | If you want to use the config file install by a package instead of its find 5 | module, set `CMAKE_FIND_PACKAGE_PREFER_CONFIG` to `ON` 6 | 7 | Refer to [this file](../README.cmake.md) for more details about the Find modules. 8 | -------------------------------------------------------------------------------- /cmake_admin/RunOutputTest.cmake: -------------------------------------------------------------------------------- 1 | if( NOT test_cmd ) 2 | message( FATAL_ERROR "test_cmd not defined" ) 3 | endif( NOT test_cmd ) 4 | 5 | if( NOT test_output ) 6 | message( FATAL_ERROR "test_output not defined" ) 7 | endif( NOT test_output ) 8 | 9 | if( NOT expected_output ) 10 | message( FATAL_ERROR "expected_output not defined" ) 11 | endif( NOT expected_output ) 12 | 13 | separate_arguments( test_args ) 14 | 15 | execute_process( 16 | COMMAND ${test_cmd} ${test_args} 17 | RESULT_VARIABLE test_not_successful 18 | ) 19 | 20 | if( test_not_successful ) 21 | message( FATAL_ERROR "${test_cmd} ${test_args} returned error ${test_not_successful}!" ) 22 | endif( test_not_successful ) 23 | 24 | execute_process( 25 | COMMAND ${CMAKE_COMMAND} -E compare_files ${expected_output} ${test_output} 26 | RESULT_VARIABLE compare_not_successful 27 | ) 28 | 29 | if( compare_not_successful ) 30 | message( SEND_ERROR "${test_output} does not match ${expected_output}!" ) 31 | endif( compare_not_successful ) 32 | -------------------------------------------------------------------------------- /cmake_admin/SCMRevision.cmake: -------------------------------------------------------------------------------- 1 | #[=======================================================================[ 2 | Copyright © 2019-2024 Pedro López-Cabanillas 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | #]=======================================================================] 27 | 28 | if (NOT DEFINED PROJECT_WC_REVISION) 29 | find_package(Git QUIET) 30 | if (Git_FOUND) 31 | execute_process( 32 | COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD 33 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" 34 | RESULT_VARIABLE _res 35 | OUTPUT_VARIABLE PROJECT_WC_REVISION 36 | ERROR_QUIET 37 | OUTPUT_STRIP_TRAILING_WHITESPACE) 38 | if (${_res} EQUAL 0) 39 | message(STATUS "Current revision (Git) is ${PROJECT_WC_REVISION}") 40 | else() 41 | unset(PROJECT_WC_REVISION) 42 | endif() 43 | endif() 44 | endif() 45 | 46 | if (DEFINED PROJECT_WC_REVISION) 47 | set(${PROJECT_NAME}_WC_REVISION ${PROJECT_WC_REVISION}) 48 | else() 49 | set(${PROJECT_NAME}_WC_REVISION "not a git working copy") 50 | endif() 51 | -------------------------------------------------------------------------------- /cmake_admin/TestInline.cmake: -------------------------------------------------------------------------------- 1 | include ( CheckCSourceCompiles ) 2 | foreach ( _keyword "inline" "__inline__" "__inline" ) 3 | if ( NOT INLINE_KEYWORD ) 4 | set ( CMAKE_REQUIRED_DEFINITIONS "-DTESTKEYWORD=${_keyword}" ) 5 | check_c_source_compiles ( 6 | "typedef int foo_t; 7 | static TESTKEYWORD foo_t static_foo(){return 0;} 8 | foo_t foo(){return 0;} 9 | int main(int argc, char *argv[]){return 0;}" 10 | _have_${_keyword} ) 11 | if ( _have_${_keyword} ) 12 | set ( INLINE_KEYWORD ${_keyword} ) 13 | endif ( _have_${_keyword} ) 14 | endif ( NOT INLINE_KEYWORD ) 15 | endforeach ( _keyword ) 16 | -------------------------------------------------------------------------------- /cmake_admin/TestVLA.cmake: -------------------------------------------------------------------------------- 1 | include ( CheckCSourceCompiles ) 2 | if ( NOT SUPPORTS_VLA ) 3 | check_c_source_compiles ( 4 | "int main(int argc, char *argv[]){int arr[argc]; return 0;}" 5 | _have_vla ) 6 | if ( _have_vla ) 7 | set ( SUPPORTS_VLA 1 ) 8 | endif ( _have_vla ) 9 | endif ( NOT SUPPORTS_VLA ) 10 | -------------------------------------------------------------------------------- /cmake_admin/VersionResource.rc.in: -------------------------------------------------------------------------------- 1 | #include "winver.h" 2 | 3 | VS_VERSION_INFO VERSIONINFO 4 | FILEVERSION @FLUIDSYNTH_VERSION_MAJOR@, @FLUIDSYNTH_VERSION_MINOR@, @FLUIDSYNTH_VERSION_MICRO@ 5 | PRODUCTVERSION @FLUIDSYNTH_VERSION_MAJOR@, @FLUIDSYNTH_VERSION_MINOR@, @FLUIDSYNTH_VERSION_MICRO@, 0 6 | #ifdef DEBUG 7 | FILEFLAGS VS_FF_DEBUG 8 | #else 9 | FILEFLAGS 0x0L 10 | #endif 11 | FILEOS VOS__WINDOWS32 12 | FILETYPE @TARGET_TYPE@ 13 | FILESUBTYPE VFT2_UNKNOWN 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "040904E4" 18 | BEGIN 19 | VALUE "CompanyName", "FluidSynth" 20 | VALUE "FileDescription", "FluidSynth - A Software Synthesizer" 21 | VALUE "FileVersion", "@FLUIDSYNTH_VERSION_MAJOR@.@FLUIDSYNTH_VERSION_MINOR@.@FLUIDSYNTH_VERSION_MICRO@" 22 | VALUE "Full Version", "@FLUIDSYNTH_VERSION_MAJOR@.@FLUIDSYNTH_VERSION_MINOR@.@FLUIDSYNTH_VERSION_MICRO@.0" 23 | VALUE "InternalName", "FluidSynth" 24 | VALUE "ProductName", "@PRODUCT_NAME@" 25 | VALUE "LegalCopyright", "Copyright (C) 2003-2025 Peter Hanappe and others. Licensed under the terms of the LGPL v2.1" 26 | VALUE "OriginalFilename", "@TARGET_FILENAME@" 27 | VALUE "ProductVersion", "@FLUIDSYNTH_VERSION_MAJOR@.@FLUIDSYNTH_VERSION_MINOR@.@FLUIDSYNTH_VERSION_MICRO@" 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x409, 1252 33 | END 34 | END 35 | 36 | -------------------------------------------------------------------------------- /cmake_admin/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | STRING(REGEX REPLACE "\n" ";" files "${files}") 7 | FOREACH(file ${files}) 8 | MESSAGE(STATUS "Uninstalling \"${file}\"") 9 | IF(EXISTS "${file}") 10 | EXEC_PROGRAM( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | IF("${rm_retval}" STREQUAL 0) 16 | ELSE("${rm_retval}" STREQUAL 0) 17 | MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") 18 | ENDIF("${rm_retval}" STREQUAL 0) 19 | ELSE(EXISTS "${file}") 20 | MESSAGE(STATUS "File \"${file}\" does not exist.") 21 | ENDIF(EXISTS "${file}") 22 | ENDFOREACH(file) 23 | -------------------------------------------------------------------------------- /contrib/baselibs.conf: -------------------------------------------------------------------------------- 1 | libfluidsynth2 2 | -------------------------------------------------------------------------------- /contrib/debian.changelog: -------------------------------------------------------------------------------- 1 | fluidsynth (1.1.8-1) unstable; urgency=low 2 | 3 | - Update to version 1.1.8: 4 | * fix build against glib < 2.30 (#202) 5 | * fix dsound audio driver on windows (#215) 6 | * fix a bug around `synth.audio-groups` setting, which caused improper multi-channel rendering (#225) 7 | * cmake 3.0.2 is now required 8 | * compilation with clang is now possible 9 | * build fixes on OS/2 (thanks to @komh) 10 | 11 | -- Tom Moebert Fri, 13 Oct 2017 15:53:00 +0000 12 | 13 | fluidsynth (1.1.7-1) unstable; urgency=low 14 | 15 | * OBS snapshot. 16 | 17 | -- Rui Nuno Capela Tue, 5 Sep 2017 20:00:00 +0000 18 | 19 | fluidsynth (1.1.6-1) unstable; urgency=low 20 | 21 | * OBS snapshot. 22 | 23 | -- Rui Nuno Capela Sun, 19 Aug 2012 23:45:01 +0000 24 | -------------------------------------------------------------------------------- /contrib/debian.compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /contrib/debian.control: -------------------------------------------------------------------------------- 1 | Source: fluidsynth 2 | Priority: optional 3 | Section: sound 4 | Maintainer: Rui Nuno Capela 5 | Build-Depends: debhelper (>= 5.0.0), cmake, pkg-config, libdb-dev, libjack-dev, libasound2-dev, 6 | libsndfile-dev, libglib2.0-dev 7 | Standards-Version: 3.7.2 8 | 9 | Package: libfluidsynth1 10 | Section: libs 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Description: FluidSynth is a real-time software synthesizer 14 | FluidSynth is a real-time software synthesizer based on 15 | the SoundFont 2 specifications. 16 | 17 | Package: libfluidsynth-dev 18 | Section: libdevel 19 | Architecture: any 20 | Depends: libfluidsynth1 (= ${source:Version}) 21 | Description: FluidSynth is a real-time software synthesizer 22 | FluidSynth is a real-time software synthesizer based on 23 | the SoundFont 2 specifications. 24 | This package contains the header file required for compiling 25 | hosts and plugins. 26 | 27 | Package: fluidsynth 28 | Section: sound 29 | Architecture: any 30 | Depends: libfluidsynth1 (= ${source:Version}) 31 | Description: FluidSynth is a real-time software synthesizer 32 | FluidSynth is a real-time software synthesizer based on 33 | the SoundFont 2 specifications. 34 | This package contains the command-line utilities. 35 | -------------------------------------------------------------------------------- /contrib/debian.copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Rui Nuno Capela on 2 | Mon, 25 Jun 2007 10:42:40 +0100. 3 | 4 | It was downloaded from http://www.fluidsynth.org 5 | 6 | Upstream Author: Rui Nuno Capela 7 | 8 | Copyright: 9 | 10 | Copyright (C) 2003-2015, rncbc aka Rui Nuno Capela. All rights reserved. 11 | 12 | License: 13 | 14 | This program is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU General Public License 16 | as published by the Free Software Foundation; either version 2 17 | of the License, or (at your option) any later version. 18 | 19 | This program is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License along 25 | with this program; if not, write to the Free Software Foundation, Inc., 26 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | The Debian packaging is (C) 2007-2013, Rui Nuno Capela and 29 | is licensed under the GPL, see `/usr/share/common-licenses/GPL'. 30 | 31 | -------------------------------------------------------------------------------- /contrib/debian.fluidsynth.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/bin/* 2 | debian/tmp/usr/share/* 3 | -------------------------------------------------------------------------------- /contrib/debian.libfluidsynth-dev.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/include/* 2 | debian/tmp/usr/lib/*/*.so 3 | debian/tmp/usr/lib/*/pkgconfig/*.pc 4 | debian/tmp/usr/lib/*/cmake/fluidsynth/*.cmake 5 | -------------------------------------------------------------------------------- /contrib/debian.libfluidsynth1.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/lib/*/lib*.so.* 2 | -------------------------------------------------------------------------------- /contrib/debian.rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # GNU copyright 1997 to 1999 by Joey Hess. 5 | 6 | # Uncomment this to turn on verbose mode. 7 | #export DH_VERBOSE=1 8 | 9 | # This is the debhelper compatibility version to use. 10 | #export DH_COMPAT=7 11 | 12 | # These are used for cross-compiling and for saving the configure script 13 | # from having to guess our platform (since we know it already) 14 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 15 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 16 | 17 | 18 | ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) 19 | CFLAGS += -g 20 | endif 21 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 22 | INSTALL_PROGRAM += -s 23 | endif 24 | 25 | config.status: CMakeLists.txt 26 | dh_testdir 27 | 28 | # Add here commands to configure the package. 29 | cmake -DCMAKE_INSTALL_PREFIX=/usr . 30 | 31 | build: build-stamp 32 | build-stamp: config.status 33 | dh_testdir 34 | 35 | # Add here commands to compile the package. 36 | $(MAKE) 37 | 38 | # the build should fail if the tests are not successful 39 | #$(MAKE) check 40 | 41 | touch build-stamp 42 | 43 | clean: 44 | dh_testdir 45 | dh_testroot 46 | rm -f build-stamp 47 | 48 | # Add here commands to clean up after the build process. 49 | #-$(MAKE) distclean 50 | 51 | dh_clean -a 52 | 53 | install: build 54 | dh_testdir 55 | dh_testroot 56 | dh_clean -k -a 57 | dh_installdirs 58 | 59 | # Add here commands to install the package into debian/tmp 60 | $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp 61 | 62 | # Build architecture-independent files here. 63 | binary-indep: build install 64 | # We have nothing to do by default. 65 | 66 | # Build architecture-dependent files here. 67 | binary-arch: build install 68 | dh_testdir 69 | dh_testroot 70 | dh_install -a --list-missing 71 | # dh_installchangelogs -a ChangeLog 72 | # dh_installdocs -a 73 | # dh_installexamples 74 | # dh_installmenu 75 | # dh_installdebconf 76 | # dh_installlogrotate 77 | # dh_installemacsen 78 | # dh_installpam 79 | # dh_installmime 80 | # dh_installinit 81 | # dh_installcron 82 | # dh_installinfo 83 | # dh_installman 84 | # dh_link 85 | dh_strip -a 86 | dh_compress -a 87 | dh_fixperms -a 88 | # dh_perl 89 | # dh_python 90 | dh_makeshlibs 91 | dh_installdeb 92 | dh_shlibdeps 93 | dh_gencontrol 94 | dh_md5sums 95 | dh_builddeb 96 | 97 | binary: binary-indep binary-arch 98 | .PHONY: build clean binary-indep binary-arch binary install 99 | -------------------------------------------------------------------------------- /contrib/debian.series: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/contrib/debian.series -------------------------------------------------------------------------------- /contrib/fluidsynth.dsc: -------------------------------------------------------------------------------- 1 | Format: 1.0 2 | Source: fluidsynth 3 | Version: 2.2.0-1 4 | Binary: fluidsynth, libfluidsynth1, libfluidsynth-dev 5 | Maintainer: Rui Nuno Capela 6 | Architecture: any 7 | Standards-Version: 3.7.2 8 | Build-Depends: debhelper (>= 5.0.0), cmake (>= 3.13.0), pkg-config, libdb-dev, libjack-dev, libasound2-dev, libsndfile-dev, libglib2.0-dev 9 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # FluidSynth - A Software Synthesize 2 | # 3 | # Copyright (C) 2003-2010 Peter Hanappe and others. 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public License 7 | # as published by the Free Software Foundation; either version 2.1 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307, USA 19 | 20 | # CMake based build system. Pedro Lopez-Cabanillas 21 | 22 | find_package ( Doxygen ) 23 | if ( DOXYGEN_FOUND ) 24 | if ( DOXYGEN_VERSION VERSION_GREATER_EQUAL "1.9.8" ) 25 | set ( DOC_API_GROUP_TYPE "topics" ) 26 | else ( DOXYGEN_VERSION VERSION_GREATER_EQUAL "1.9.8" ) 27 | set ( DOC_API_GROUP_TYPE "modules" ) 28 | endif ( DOXYGEN_VERSION VERSION_GREATER_EQUAL "1.9.8" ) 29 | 30 | if ( DOXYGEN_VERSION VERSION_GREATER_EQUAL "1.9.5" ) 31 | set ( DOC_COLORSTYLE_CONFIG "HTML_COLORSTYLE = LIGHT" ) 32 | endif ( DOXYGEN_VERSION VERSION_GREATER_EQUAL "1.9.5" ) 33 | 34 | configure_file ( Doxyfile.cmake 35 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ) 36 | configure_file ( doxygen/layout.xml.cmake 37 | ${CMAKE_CURRENT_BINARY_DIR}/layout.xml ) 38 | add_custom_target ( doxygen 39 | ${DOXYGEN} Doxyfile 40 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 41 | ) 42 | 43 | find_package ( LibXslt ) 44 | if ( LIBXSLT_XSLTPROC_EXECUTABLE ) 45 | add_custom_target ( doxygen_settings 46 | ${LIBXSLT_XSLTPROC_EXECUTABLE} 47 | --output ${CMAKE_CURRENT_BINARY_DIR}/fluidsettings.txt 48 | ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/fluidsettings.xsl 49 | ${CMAKE_CURRENT_SOURCE_DIR}/fluidsettings.xml 50 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 51 | ) 52 | add_dependencies(doxygen doxygen_settings) 53 | endif ( LIBXSLT_XSLTPROC_EXECUTABLE ) 54 | 55 | endif ( DOXYGEN_FOUND ) 56 | 57 | 58 | if ( UNIX ) 59 | install ( FILES fluidsynth.1 60 | DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) 61 | endif ( UNIX ) 62 | 63 | add_subdirectory ( examples ) 64 | -------------------------------------------------------------------------------- /doc/FluidMixer.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/FluidMixer.ppt -------------------------------------------------------------------------------- /doc/FluidProfile_0004.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/FluidProfile_0004.pdf -------------------------------------------------------------------------------- /doc/FluidSostenuto-005.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/FluidSostenuto-005.pdf -------------------------------------------------------------------------------- /doc/FluidSynth Thread safety paper for LAC 2011.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/FluidSynth Thread safety paper for LAC 2011.odt -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | To build FluidSynth API reference documentation, make sure you have Doxygen 2 | installed. 3 | 4 | If you are using the cmake build system, change to the build directory and 5 | execute the following command in this doc/ directory: 6 | 7 | $ make doxygen 8 | 9 | The latest generated API HTML docs can also be found at: 10 | https://www.fluidsynth.org/api/ 11 | 12 | Even more documentation references are provided on our wiki page: 13 | https://github.com/FluidSynth/fluidsynth/wiki/Documentation 14 | -------------------------------------------------------------------------------- /doc/android/.gitignore: -------------------------------------------------------------------------------- 1 | external 2 | 3 | -------------------------------------------------------------------------------- /doc/android/fluidsynth-assetloader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6.0) 2 | 3 | project ( fluidsynth-assetloader C ) 4 | 5 | set ( fluidsynth-assetloader_sources fluid_androidasset.c ) 6 | 7 | add_library ( fluidsynth-assetloader SHARED ${fluidsynth-assetloader_sources} ) 8 | 9 | target_compile_options ( fluidsynth-assetloader 10 | PRIVATE -v 11 | PRIVATE -Wall 12 | PRIVATE "$<$:-Werror>") # Only include -Werror when building debug config 13 | 14 | target_include_directories ( fluidsynth-assetloader PRIVATE ../../../include ) 15 | 16 | set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L../../../dist/${ANDROID_ABI} -lfluidsynth" ) 17 | 18 | target_link_libraries ( fluidsynth-assetloader PRIVATE log android ) 19 | -------------------------------------------------------------------------------- /doc/android/fluidsynth-assetloader/ext-build.sh: -------------------------------------------------------------------------------- 1 | PWD=`pwd` 2 | 3 | ABIS="x86 x86_64 armeabi-v7a arm64-v8a" 4 | 5 | HOST_OS=`uname | tr [:upper:] [:lower:]` 6 | 7 | ANDROID_NDK_PATH=~/android-sdk-$HOST_OS/ndk-bundle 8 | CMAKEFILE=$ANDROID_NDK_PATH/build/cmake/android.toolchain.cmake 9 | 10 | for A_ABI in $ABIS ; do 11 | mkdir -p build/$A_ABI && \ 12 | cd build/$A_ABI && \ 13 | cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKEFILE -DANDROID_PLATFORM=android-27 -DANDROID_ABI=$A_ABI ../.. && \ 14 | make && 15 | cd ../.. ; 16 | done 17 | -------------------------------------------------------------------------------- /doc/android/fluidsynth-assetloader/fluid_androidasset.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | 22 | #ifndef _PRIV_FLUID_ANDROIDASSET_H 23 | #define _PRIV_FLUID_ANDROIDASSET_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include 30 | #include 31 | 32 | fluid_sfloader_t* new_fluid_android_asset_sfloader(fluid_settings_t *settings, void *assetManager); 33 | void Java_fluidsynth_androidextensions_NativeHandler_setAssetManagerContext(JNIEnv *env, jobject _this, jobject assetManager); 34 | 35 | void *asset_open(const char *path); 36 | int asset_close(void *handle); 37 | fluid_long_long_t asset_tell(void *handle); 38 | int asset_seek(void *handle, fluid_long_long_t offset, int origin); 39 | int asset_read(void *buf, fluid_long_long_t count, void *handle); 40 | 41 | #ifdef __cplusplus 42 | } /* extern "C" */ 43 | #endif 44 | 45 | #endif /* _PRIV_FLUID_ANDROIDASSET_H */ 46 | -------------------------------------------------------------------------------- /doc/android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | TARGET_PLATFORM := android-27 3 | 4 | GLIB_LIB = ../dep/$(APP_ABI)/ 5 | 6 | include $(CLEAR_VARS) 7 | LOCAL_MODULE := glib-2.0 8 | LOCAL_SRC_FILES := $(GLIB_LIB)/libglib-2.0.a 9 | include $(PREBUILT_STATIC_LIBRARY) 10 | 11 | include $(CLEAR_VARS) 12 | LOCAL_MODULE := iconv 13 | LOCAL_SRC_FILES := $(GLIB_LIB)/libiconv.a 14 | include $(PREBUILT_STATIC_LIBRARY) 15 | 16 | include $(CLEAR_VARS) 17 | LOCAL_MODULE := intl 18 | LOCAL_SRC_FILES := $(GLIB_LIB)/libintl.a 19 | include $(PREBUILT_STATIC_LIBRARY) 20 | 21 | include $(CLEAR_VARS) 22 | LOCAL_MODULE := oboe 23 | LOCAL_SRC_FILES := $(GLIB_LIB)/liboboe.a 24 | include $(PREBUILT_STATIC_LIBRARY) 25 | 26 | include $(CLEAR_VARS) 27 | LOCAL_MODULE := fluidsynth_static 28 | LOCAL_SRC_FILES := ../dep/$(APP_ABI)/libfluidsynth.a 29 | include $(PREBUILT_STATIC_LIBRARY) 30 | 31 | LOCAL_MODULE := fluidsynth 32 | 33 | ifeq ($(NDK_DEBUG),1) 34 | cmd-strip := 35 | endif 36 | 37 | LOCAL_STATIC_LIBRARIES := glib-2.0 iconv intl oboe 38 | 39 | LOCAL_WHOLE_STATIC_LIBRARIES := fluidsynth_static 40 | 41 | LOCAL_LDLIBS := -lc -lOpenSLES -ldl -llog -landroid -L$(LOCAL_PATH)/../dist/$(APP_ABI) -loboe-c 42 | 43 | include $(BUILD_SHARED_LIBRARY) 44 | 45 | -------------------------------------------------------------------------------- /doc/android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-21 2 | APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a 3 | -------------------------------------------------------------------------------- /doc/android/oboe-1.0.pc: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir} 2 | exec_prefix=${prefix} 3 | libdir=${prefix} 4 | includedir=${prefix}/../../include/ 5 | 6 | Name: Oboe 7 | Description: Oboe library 8 | Version: 1.0.0 9 | Libs: -L${libdir} -loboe -landroid -llog -lstdc++ 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /doc/doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # FluidSynth - A Software Synthesize 2 | # 3 | # Copyright (C) 2003-2010 Peter Hanappe and others. 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public License 7 | # as published by the Free Software Foundation; either version 2.1 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307, USA 19 | 20 | # CMake based build system. Pedro Lopez-Cabanillas 21 | 22 | include ( FluidUnitTest ) 23 | add_custom_target ( demo ) 24 | 25 | ADD_FLUID_DEMO ( example ) 26 | ADD_FLUID_DEMO ( fluidsynth_arpeggio ) 27 | ADD_FLUID_DEMO ( fluidsynth_fx ) 28 | ADD_FLUID_DEMO ( fluidsynth_metronome ) 29 | ADD_FLUID_DEMO ( fluidsynth_simple ) 30 | ADD_FLUID_DEMO ( fluidsynth_instruments ) 31 | ADD_FLUID_DEMO ( fluidsynth_enumsettings CXX ) 32 | -------------------------------------------------------------------------------- /doc/examples/fluidsynth_instruments.c: -------------------------------------------------------------------------------- 1 | /* FluidSynth Instruments - An example of using fluidsynth >= 2.x 2 | * 3 | * This code is in the public domain. 4 | * 5 | * To compile: 6 | * gcc -o fluidsynth_instruments fluidsynth_instruments.c -lfluidsynth 7 | * 8 | * To run: 9 | * fluidsynth_instruments soundfont 10 | * 11 | * [Pedro López-Cabanillas ] 12 | */ 13 | 14 | #include 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | fluid_settings_t* settings = NULL; 20 | fluid_synth_t* synth = NULL; 21 | fluid_sfont_t* sfont = NULL; 22 | int err = 0, sfid = -1; 23 | 24 | if (argc != 2) { 25 | fprintf(stderr, "Usage: fluidsynth_instr [soundfont]\n"); 26 | return 1; 27 | } 28 | 29 | /* Create the settings object. This example uses the default 30 | * values for the settings. */ 31 | settings = new_fluid_settings(); 32 | if (settings == NULL) { 33 | fprintf(stderr, "Failed to create the settings\n"); 34 | err = 2; 35 | goto cleanup; 36 | } 37 | 38 | /* Create the synthesizer */ 39 | synth = new_fluid_synth(settings); 40 | if (synth == NULL) { 41 | fprintf(stderr, "Failed to create the synthesizer\n"); 42 | err = 3; 43 | goto cleanup; 44 | } 45 | 46 | /* Load the soundfont */ 47 | sfid = fluid_synth_sfload(synth, argv[1], 1); 48 | if (sfid == -1) { 49 | fprintf(stderr, "Failed to load the SoundFont\n"); 50 | err = 4; 51 | goto cleanup; 52 | } 53 | 54 | /* Enumeration of banks and programs */ 55 | sfont = fluid_synth_get_sfont_by_id(synth, sfid); 56 | if (sfont != NULL) { 57 | fluid_preset_t *preset; 58 | fluid_sfont_iteration_start(sfont); 59 | while ((preset = fluid_sfont_iteration_next(sfont)) != NULL) { 60 | int bank = fluid_preset_get_banknum(preset); 61 | int prog = fluid_preset_get_num(preset); 62 | const char* name = fluid_preset_get_name(preset); 63 | printf("bank: %d prog: %d name: %s\n", bank, prog, name); 64 | } 65 | } 66 | 67 | printf("done\n"); 68 | 69 | cleanup: 70 | if (synth) { 71 | delete_fluid_synth(synth); 72 | } 73 | if (settings) { 74 | delete_fluid_settings(settings); 75 | } 76 | return err; 77 | } 78 | -------------------------------------------------------------------------------- /doc/examples/fluidsynth_sfload_mem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a C99 program that demonstrates how to load a soundfont from memory. 3 | * 4 | * It only gives a brief overview on how to achieve this with fluidsynth's API. 5 | * Although it should compile, it's highly incomplete, as the details of it's 6 | * implementation depend on the users needs. 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void *my_open(const char *filename) 14 | { 15 | void *p; 16 | 17 | if(filename[0] != '&') 18 | { 19 | return NULL; 20 | } 21 | 22 | sscanf(filename, "&%p", &p); 23 | return p; 24 | } 25 | 26 | int my_read(void *buf, int count, void *handle) 27 | { 28 | // NYI 29 | return FLUID_OK; 30 | } 31 | 32 | int my_seek(void *handle, long offset, int origin) 33 | { 34 | // NYI 35 | return FLUID_OK; 36 | } 37 | 38 | int my_close(void *handle) 39 | { 40 | // NYI 41 | return FLUID_OK; 42 | } 43 | 44 | long my_tell(void *handle) 45 | { 46 | // NYI 47 | return 0; 48 | } 49 | 50 | int main() 51 | { 52 | int err = 0; 53 | 54 | fluid_settings_t *settings = new_fluid_settings(); 55 | fluid_synth_t *synth = new_fluid_synth(settings); 56 | 57 | fluid_sfloader_t *my_sfloader = new_fluid_defsfloader(settings); 58 | fluid_sfloader_set_callbacks(my_sfloader, 59 | my_open, 60 | my_read, 61 | my_seek, 62 | my_tell, 63 | my_close); 64 | fluid_synth_add_sfloader(synth, my_sfloader); 65 | 66 | 67 | char abused_filename[64]; 68 | const void *pointer_to_sf2_in_mem = 0x1234Beef; // some pointer to where the soundfont shall be loaded from 69 | sprintf(abused_filename, "&%p", pointer_to_sf2_in_mem); 70 | 71 | int id = fluid_synth_sfload(synth, abused_filename, 0); 72 | /* now my_open() will be called with abused_filename and should have opened the memory region */ 73 | 74 | if(id == FLUID_FAILED) 75 | { 76 | puts("oops"); 77 | err = -1; 78 | goto cleanup; 79 | } 80 | 81 | /* 82 | * ~~~ Do your daily business here ~~~ 83 | */ 84 | 85 | cleanup: 86 | /* deleting the synth also deletes my_sfloader */ 87 | delete_fluid_synth(synth); 88 | 89 | delete_fluid_settings(settings); 90 | 91 | return err; 92 | } 93 | -------------------------------------------------------------------------------- /doc/examples/fluidsynth_simple.c: -------------------------------------------------------------------------------- 1 | /* FluidSynth Simple - An example of using fluidsynth 2 | * 3 | * This code is in the public domain. 4 | * 5 | * To compile: 6 | * gcc -g -O -o fluidsynth_simple fluidsynth_simple.c -lfluidsynth 7 | * 8 | * To run 9 | * fluidsynth_simple soundfont 10 | * 11 | * [Peter Hanappe] 12 | */ 13 | 14 | 15 | #include 16 | #include 17 | 18 | int main(int argc, char **argv) 19 | { 20 | fluid_settings_t *settings; 21 | fluid_synth_t *synth = NULL; 22 | fluid_audio_driver_t *adriver = NULL; 23 | int err = 0; 24 | 25 | if(argc != 2) 26 | { 27 | fprintf(stderr, "Usage: fluidsynth_simple [soundfont]\n"); 28 | return 1; 29 | } 30 | 31 | /* Create the settings object. This example uses the default 32 | * values for the settings. */ 33 | settings = new_fluid_settings(); 34 | 35 | if(settings == NULL) 36 | { 37 | fprintf(stderr, "Failed to create the settings\n"); 38 | err = 2; 39 | goto cleanup; 40 | } 41 | 42 | /* Create the synthesizer */ 43 | synth = new_fluid_synth(settings); 44 | 45 | if(synth == NULL) 46 | { 47 | fprintf(stderr, "Failed to create the synthesizer\n"); 48 | err = 3; 49 | goto cleanup; 50 | } 51 | 52 | /* Load the soundfont */ 53 | if(fluid_synth_sfload(synth, argv[1], 1) == -1) 54 | { 55 | fprintf(stderr, "Failed to load the SoundFont\n"); 56 | err = 4; 57 | goto cleanup; 58 | } 59 | 60 | /* Create the audio driver. As soon as the audio driver is 61 | * created, the synthesizer can be played. */ 62 | adriver = new_fluid_audio_driver(settings, synth); 63 | 64 | if(adriver == NULL) 65 | { 66 | fprintf(stderr, "Failed to create the audio driver\n"); 67 | err = 5; 68 | goto cleanup; 69 | } 70 | 71 | /* Play a note */ 72 | fluid_synth_noteon(synth, 0, 60, 100); 73 | 74 | printf("Press \"Enter\" to stop: "); 75 | fgetc(stdin); 76 | printf("done\n"); 77 | 78 | 79 | cleanup: 80 | 81 | if(adriver) 82 | { 83 | delete_fluid_audio_driver(adriver); 84 | } 85 | 86 | if(synth) 87 | { 88 | delete_fluid_synth(synth); 89 | } 90 | 91 | if(settings) 92 | { 93 | delete_fluid_settings(settings); 94 | } 95 | 96 | return err; 97 | } 98 | -------------------------------------------------------------------------------- /doc/polymono/FluidPolyMono-0004.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/polymono/FluidPolyMono-0004.pdf -------------------------------------------------------------------------------- /doc/polymono/poly_mono_0.txt: -------------------------------------------------------------------------------- 1 | # What are default 'basic channels' in FluidSynth ? 2 | #-------------------------------------------------- 3 | # At initialization the default basic channel is poly omnion (see pdf 2.2). 4 | 5 | # type the command basicchannels to display actual basic channels. 6 | basicchannels 7 | 8 | # end 9 | -------------------------------------------------------------------------------- /doc/polymono/poly_mono_1.txt: -------------------------------------------------------------------------------- 1 | # How to change the whole set of actual basic channels ? 2 | # ------------------------------------------------------------- 3 | # Assuming you want to set 2 groups of channels: 4 | # Group 1: first channel 5 in poly mode, only one channel 5 | # Group 2: first channel 10 in mono mode , only one channel 6 | 7 | # Group 1 should have following settings: 8 | # basic channel 5, mode poly, omni off, (mode 2). 9 | 10 | # Group 2 should have the following settings: 11 | # basic channel 10, mode mono, omni off, (mode 3), composed of one channel. 12 | 13 | # First use the command resetbasicchannels to reset all basic channels 14 | resetbasicchannels 15 | 16 | # Then use command setbasicchannels using numbered mode 2 and 3: 17 | setbasicchannels 5 2 0 10 3 1 18 | # or using named mode: 19 | # setbasicchannels 5 poly_omnioff 0 10 mono_omnioff 1 20 | 21 | # Use basicchannels command to verify your settings 22 | basicchannels 23 | 24 | 25 | # end 26 | -------------------------------------------------------------------------------- /doc/polymono/poly_mono_2.txt: -------------------------------------------------------------------------------- 1 | # How to add a new basic channel among others actual basic channels ? 2 | # ------------------------------------------------------------------- 3 | # Perhaps you have already set several groups of basics channels and 4 | # you want add a new one without modifying actual groups. 5 | # Assuming following actual groups: 6 | 7 | # Basic channel: 5, poly omni off(mode 2), nbr: 1 8 | # Basic channel: 10, mono omni off(mode 3), nbr: 1 9 | 10 | # Now we want to add a new group 3: 11 | # Group 3 should have the following settings: 12 | # basic channel 13, mode mono, omni off, (mode 3) composed of 2 channels. 13 | 14 | # Use command setbasicchannels using numbered mode 3: 15 | setbasicchannels 13 3 2 16 | # or using named mode: 17 | # setbasicchannels 13 mono_omnioff 2 18 | 19 | Use basicchannels command to verify your settings 20 | basicchannels 21 | 22 | # end 23 | -------------------------------------------------------------------------------- /doc/polymono/poly_mono_3.txt: -------------------------------------------------------------------------------- 1 | # How to change an actual basic channel ? 2 | # --------------------------------------- 3 | # Perhaps you have already set several groups of basics channels 4 | # and you want change the settings of one. 5 | 6 | # Assuming following actual groups: 7 | # -Group 1:Basic channel: 5, poly omni off(mode 2), nbr: 1 8 | # -Group 2:Basic channel: 10, mono omni off(mode 3), nbr: 1 9 | # -Group 3:Basic channel: 13, mono omni off(mode 3), nbr: 2 10 | 11 | # Now we want to change group 1: 12 | # Group 1 should have the following settings: 13 | # -basic channel 5, mode poly, omni on, (mode 0) composed of 4 channels in this group. 14 | 15 | #First use the command resetbasicchannels to clear the group intended to be changed. 16 | resetbasicchannels 5 17 | 18 | # Then use command setbasicchannels using numbered mode 0: 19 | setbasicchannels 5 0 4 20 | # or Using named mode: 21 | # setbasicchannels 5 poly_omnion 4 22 | 23 | # Use basicchannels command to verify your settings 24 | basicchannels 25 | 26 | # end 27 | -------------------------------------------------------------------------------- /doc/polymono/poly_mono_4.txt: -------------------------------------------------------------------------------- 1 | # How to change an actual basic channel and add a new one ? 2 | # --------------------------------------------------------- 3 | # Note that command setbasicchannels allows to add or change 4 | # groups of basics channels. 5 | # 6 | # Note also that the commands allows this for more than one 7 | # groups executing only one command: 8 | 9 | # The following command restores Group 1 to the state: 10 | # -Group 1:Basic channel: 5, poly omni off(mode 2), nbr: 1 11 | # Then adds a new group: 12 | # -Group 0:Basic channel: 2, mono omni on(mode 1), composed of 3 possible channels in this group 13 | 14 | #First use the command resetbasicchannels to clear the group intended to be changed. 15 | resetbasicchannels 5 16 | 17 | # Use command setbasicchannels to change a group and add a new one, using numbered mode 2 and 1: 18 | setbasicchannels 5 2 0 2 1 3 19 | # or using named mode: 20 | # setbasicchannels 5 poly_omnioff 0 2 mono_omnion 3 21 | 22 | # Use basicchannels command to verify your settings 23 | basicchannels 24 | 25 | # end 26 | -------------------------------------------------------------------------------- /doc/polymono/poly_mono_5.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/doc/polymono/poly_mono_5.txt -------------------------------------------------------------------------------- /doc/polymono/readme.txt: -------------------------------------------------------------------------------- 1 | /fluidSynth/doc/polymono directory contains: 2 | 3 | 1) FluidPolyMono-0004.pdf, the documentation of poly/mono functionalities. 4 | 2) tutorials examples files: 5 | 2.1) tutorials chapter 2.1 6 | poly_mono_0.txt 7 | poly_mono_1.txt 8 | poly_mono_2.txt 9 | poly_mono_3.txt 10 | poly_mono_4.txt 11 | poly_mono_5.txt 12 | 13 | 2.2) tutorials chapter 3.1 14 | leg_00.txt 15 | leg_01.txt 16 | leg_por_00.txt 17 | leg_por_01.txt 18 | 19 | These tutorials files are usable directly on the FluidSynth console application. 20 | See the pdf file (chapters 2.1 and 3.1). 21 | 22 | jean-jacques ceresa 23 | -------------------------------------------------------------------------------- /doc/usage/_overview.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page UsageGuide Usage Guide 4 | - \subpage CreatingSettings 5 | - \subpage CreatingSynth 6 | - \subpage LoadingSoundfonts 7 | - \subpage CreatingAudioDriver 8 | - \subpage UsingSynth 9 | - \subpage SendingMIDI 10 | - \subpage RealtimeMIDI 11 | - \subpage MIDIPlayer 12 | - \subpage FileRenderer 13 | - \subpage MIDIPlayerMem 14 | - \subpage MIDIRouter 15 | - \subpage Sequencer 16 | - \subpage Shell 17 | - \subpage Multi-channel 18 | - \subpage synth-context 19 | - \subpage Advanced 20 | 21 | */ 22 | -------------------------------------------------------------------------------- /doc/usage/advanced.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page Advanced Advanced features 4 | 5 | The following features are not yet fully documented. Some information can be 6 | found in the API reference and in the GitHub Wiki. 7 | 8 | - Accessing low-level voice parameters 9 | - Reverb settings 10 | - Chorus settings 11 | - Interpolation settings (set_gen, get_gen, NRPN) 12 | - Voice overflow settings 13 | - LADSPA effects unit 14 | - MIDI tunings 15 | 16 | */ 17 | -------------------------------------------------------------------------------- /doc/usage/creating_settings.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page CreatingSettings Creating and changing the settings 4 | 5 | Before you can use the synthesizer, you have to create a settings object. The 6 | settings objects is used by many components of the FluidSynth library. It gives 7 | a unified API to set the parameters of the audio drivers, the midi drivers, the 8 | synthesizer, and so forth. A number of default settings are defined by the 9 | current implementation. 10 | 11 | All settings have a name that follows the "dotted-name" notation. For example, 12 | \setting{synth_polyphony} refers to the number of voices (polyphony) allocated 13 | by the synthesizer. The settings also have a type. There are currently three 14 | types: strings, numbers (double floats), and integers. You can change the 15 | values of a setting using the fluid_settings_setstr(), fluid_settings_setnum(), 16 | and fluid_settings_setint() functions. For example: 17 | 18 | \code 19 | #include 20 | 21 | int main(int argc, char** argv) 22 | { 23 | fluid_settings_t* settings = new_fluid_settings(); 24 | fluid_settings_setint(settings, "synth.polyphony", 128); 25 | /* ... */ 26 | delete_fluid_settings(settings); 27 | return 0; 28 | } 29 | \endcode 30 | 31 | The API contains the functions to query the type, the current value, the 32 | default value, the range and the "hints" of a setting. The range is the minimum 33 | and maximum value of the setting. The hints gives additional information about 34 | a setting. For example, whether a string represents a filename. Or whether a 35 | number should be interpreted on a logarithmic scale. Check the settings.h 36 | API documentation for a description of all functions. 37 | 38 | */ 39 | -------------------------------------------------------------------------------- /doc/usage/creating_synth.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page CreatingSynth Creating the synthesizer 4 | 5 | To create the synthesizer, you pass it the settings object, as in the 6 | following example: 7 | 8 | \code 9 | #include 10 | 11 | int main(int argc, char** argv) 12 | { 13 | fluid_settings_t* settings; 14 | fluid_synth_t* synth; 15 | settings = new_fluid_settings(); 16 | synth = new_fluid_synth(settings); 17 | 18 | /* Do useful things here */ 19 | 20 | delete_fluid_synth(synth); 21 | delete_fluid_settings(settings); 22 | return 0; 23 | } 24 | \endcode 25 | 26 | For a full list of available synthesizer settings, please 27 | refer to the \setting{synth} documentation. 28 | 29 | */ 30 | -------------------------------------------------------------------------------- /doc/usage/file_renderer.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page FileRenderer Fast file renderer for non-realtime MIDI file rendering 4 | 5 | Instead of creating an audio driver as described in section \ref MIDIPlayer 6 | one may chose to use the file renderer, which is the fastest way to 7 | synthesize MIDI files. 8 | 9 | \code 10 | fluid_settings_t* settings; 11 | fluid_synth_t* synth; 12 | fluid_player_t* player; 13 | fluid_file_renderer_t* renderer; 14 | 15 | settings = new_fluid_settings(); 16 | 17 | // specify the file to store the audio to 18 | // make sure you compiled fluidsynth with libsndfile to get a real wave file 19 | // otherwise this file will only contain raw s16 stereo PCM 20 | fluid_settings_setstr(settings, "audio.file.name", "/path/to/output.wav"); 21 | 22 | // use number of samples processed as timing source, rather than the system timer 23 | fluid_settings_setstr(settings, "player.timing-source", "sample"); 24 | 25 | // since this is a non-realtime scenario, there is no need to pin the sample data 26 | fluid_settings_setint(settings, "synth.lock-memory", 0); 27 | 28 | synth = new_fluid_synth(settings); 29 | 30 | // *** loading of a soundfont omitted *** 31 | 32 | player = new_fluid_player(synth); 33 | fluid_player_add(player, "/path/to/midifile.mid"); 34 | fluid_player_play(player); 35 | 36 | renderer = new_fluid_file_renderer (synth); 37 | 38 | while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING) 39 | { 40 | if (fluid_file_renderer_process_block(renderer) != FLUID_OK) 41 | { 42 | break; 43 | } 44 | } 45 | 46 | // just for sure: stop the playback explicitly and wait until finished 47 | fluid_player_stop(player); 48 | fluid_player_join(player); 49 | 50 | delete_fluid_file_renderer(renderer); 51 | delete_fluid_player(player); 52 | delete_fluid_synth(synth); 53 | delete_fluid_settings(settings); 54 | \endcode 55 | 56 | Various output files types are supported, if compiled with libsndfile. Those 57 | can be specified via the \c settings object as well. Refer to the 58 | \setting{audio} documentation for more \c audio.file\.\* options. 59 | 60 | */ 61 | -------------------------------------------------------------------------------- /doc/usage/loading_soundfonts.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page LoadingSoundfonts Loading and managing SoundFonts 4 | 5 | Before any sound can be produced, the synthesizer needs a SoundFont. 6 | 7 | SoundFonts are loaded with the fluid_synth_sfload() function. The function 8 | takes the path to a SoundFont file and a boolean to indicate whether the 9 | presets of the MIDI channels should be updated after the SoundFont is loaded. 10 | When the boolean value is TRUE, all MIDI channel bank and program numbers 11 | will be refreshed, which may cause new instruments to be selected from the 12 | newly loaded SoundFont. 13 | 14 | The synthesizer can load any number of SoundFonts. The loaded SoundFonts are 15 | treated as a stack, where each new loaded SoundFont is placed at the top of 16 | the stack. When selecting presets by bank and program numbers, SoundFonts are 17 | searched beginning at the top of the stack. In the case where there are 18 | presets in different SoundFonts with identical bank and program numbers, the 19 | preset from the most recently loaded SoundFont is used. The 20 | fluid_synth_program_select() can be used for unambiguously selecting a preset 21 | or bank offsets could be applied to each SoundFont with 22 | fluid_synth_set_bank_offset(), to try and ensure that each preset has unique 23 | bank and program numbers. 24 | 25 | The fluid_synth_sfload() function returns the unique identifier of the loaded 26 | SoundFont, or -1 in case of an error. This identifier is used in subsequent 27 | management functions: fluid_synth_sfunload() removes the SoundFont, 28 | fluid_synth_sfreload() reloads the SoundFont. When a SoundFont is reloaded, 29 | it retains it's ID and position on the SoundFont stack. 30 | 31 | Additional API functions are provided to get the number of loaded SoundFonts 32 | and to get a pointer to the SoundFont. 33 | 34 | */ 35 | -------------------------------------------------------------------------------- /doc/usage/manual_rendering.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page UsingSynth Using the synthesizer without an audio driver 4 | 5 | It is possible to use the synthesizer object without creating an audio 6 | driver. This is desirable if the application using FluidSynth manages the 7 | audio output itself. The synthesizer has several API functions that can be 8 | used to obtain the audio output: 9 | 10 | fluid_synth_write_s16() fills two buffers (left and right channel) with 11 | samples coded as signed 16 bits (the endian-ness is machine dependent). 12 | fluid_synth_write_float() fills a left and right audio buffer with 32 bits 13 | floating point samples. The function fluid_synth_process() is the generic 14 | interface for synthesizing audio, which is also capable of multi channel 15 | audio output. 16 | 17 | */ 18 | -------------------------------------------------------------------------------- /doc/usage/midi_player.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page MIDIPlayer Loading and playing a MIDI file 4 | 5 | FluidSynth can be used to play MIDI files, using the MIDI File Player 6 | interface. It follows a high level implementation, though its implementation 7 | is currently incomplete. After initializing the synthesizer, create the 8 | player passing the synth instance to new_fluid_player(). Then, you can add 9 | some SMF file names to the player using fluid_player_add(), and finally call 10 | fluid_player_play() to start the playback. You can check if the player has 11 | finished by calling fluid_player_get_status(), or wait for the player to 12 | terminate using fluid_player_join(). 13 | 14 | \code 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | int i; 20 | fluid_settings_t* settings; 21 | fluid_synth_t* synth; 22 | fluid_player_t* player; 23 | fluid_audio_driver_t* adriver; 24 | settings = new_fluid_settings(); 25 | synth = new_fluid_synth(settings); 26 | player = new_fluid_player(synth); 27 | /* process command line arguments */ 28 | for (i = 1; i < argc; i++) { 29 | if (fluid_is_soundfont(argv[i])) { 30 | fluid_synth_sfload(synth, argv[1], 1); 31 | } 32 | if (fluid_is_midifile(argv[i])) { 33 | fluid_player_add(player, argv[i]); 34 | } 35 | } 36 | /* start the synthesizer thread */ 37 | adriver = new_fluid_audio_driver(settings, synth); 38 | /* play the midi files, if any */ 39 | fluid_player_play(player); 40 | /* wait for playback termination */ 41 | fluid_player_join(player); 42 | /* cleanup */ 43 | delete_fluid_audio_driver(adriver); 44 | delete_fluid_player(player); 45 | delete_fluid_synth(synth); 46 | delete_fluid_settings(settings); 47 | return 0; 48 | } 49 | \endcode 50 | 51 | 52 | A list of available MIDI player settings can be found in the 53 | \setting{player} documentation. 54 | 55 | */ 56 | -------------------------------------------------------------------------------- /doc/usage/midi_player_mem.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page MIDIPlayerMem Playing a MIDI file from memory 4 | 5 | FluidSynth can be also play MIDI files directly from a buffer in memory. If 6 | you need to play a file from a stream (such as stdin, a network, or a 7 | high-level file interface), you can load the entire file into a buffer first, 8 | and then use this approach. Use the same technique as above, but rather than 9 | calling fluid_player_add(), load it into memory and call 10 | fluid_player_add_mem() instead. Once you have passed a buffer to 11 | fluid_player_add_mem(), it is copied, so you may use it again or free it 12 | immediately (it is your responsibility to free it if you allocated it). 13 | 14 | \code 15 | #include 16 | #include 17 | #include 18 | 19 | /* An example midi file */ 20 | const char MIDIFILE[] = { 21 | 0x4d, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 22 | 0x00, 0x01, 0x00, 0x01, 0x01, 0xe0, 0x4d, 0x54, 23 | 0x72, 0x6b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x90, 24 | 0x3c, 0x64, 0x87, 0x40, 0x80, 0x3c, 0x7f, 0x00, 25 | 0x90, 0x43, 0x64, 0x87, 0x40, 0x80, 0x43, 0x7f, 26 | 0x00, 0x90, 0x48, 0x64, 0x87, 0x40, 0x80, 0x48, 27 | 0x7f, 0x83, 0x60, 0xff, 0x2f, 0x00 28 | }; 29 | 30 | int main(int argc, char** argv) 31 | { 32 | int i; 33 | void* buffer; 34 | size_t buffer_len; 35 | fluid_settings_t* settings; 36 | fluid_synth_t* synth; 37 | fluid_player_t* player; 38 | fluid_audio_driver_t* adriver; 39 | settings = new_fluid_settings(); 40 | synth = new_fluid_synth(settings); 41 | player = new_fluid_player(synth); 42 | adriver = new_fluid_audio_driver(settings, synth); 43 | /* process command line arguments */ 44 | for (i = 1; i < argc; i++) { 45 | if (fluid_is_soundfont(argv[i])) { 46 | fluid_synth_sfload(synth, argv[1], 1); 47 | } 48 | } 49 | /* queue up the in-memory midi file */ 50 | fluid_player_add_mem(player, MIDIFILE, sizeof(MIDIFILE)); 51 | /* play the midi file */ 52 | fluid_player_play(player); 53 | /* wait for playback termination */ 54 | fluid_player_join(player); 55 | /* cleanup */ 56 | delete_fluid_audio_driver(adriver); 57 | delete_fluid_player(player); 58 | delete_fluid_synth(synth); 59 | delete_fluid_settings(settings); 60 | return 0; 61 | } 62 | \endcode 63 | 64 | */ 65 | -------------------------------------------------------------------------------- /doc/usage/multi_channel.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page Multi-channel Multi-channel audio rendering 4 | 5 | FluidSynth is capable of rendering all audio and all effects from all MIDI 6 | channels to separate stereo buffers. Refer to the documentation of 7 | fluid_synth_process() and review the different use-cases in the example file 8 | for information on how to do that: \ref fluidsynth_process.c 9 | 10 | The following chart illustrates how the voices (produced by MIDI NoteOns) are 11 | dispatched or mapped to their dry/effects audio buffers. 12 | 13 | \image html fluid_mixer.svg "FluidSynth Mixer Chart" 14 | 15 | */ 16 | -------------------------------------------------------------------------------- /doc/usage/realtime_midi.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page RealtimeMIDI Creating a real-time MIDI driver 4 | 5 | FluidSynth can process real-time MIDI events received from hardware MIDI 6 | ports or other applications. To do so, the client must create a MIDI input 7 | driver. It is a very similar process to the creation of the audio driver: you 8 | initialize some properties in a settings instance and call the 9 | new_fluid_midi_driver() function providing a callback function that will be 10 | invoked when a MIDI event is received. The following MIDI drivers are 11 | currently supported: 12 | 13 | - jack: JACK Audio Connection Kit MIDI driver (Linux, Mac OS X) 14 | - oss: Open Sound System raw MIDI (Linux, Unix) 15 | - alsa_raw: ALSA raw MIDI interface (Linux) 16 | - alsa_seq: ALSA sequencer MIDI interface (Linux) 17 | - winmidi: Microsoft Windows MM System (Windows) 18 | - midishare: MIDI Share (Linux, Mac OS X) 19 | - coremidi: Apple CoreMIDI (Mac OS X) 20 | 21 | \code 22 | #include 23 | 24 | int handle_midi_event(void* data, fluid_midi_event_t* event) 25 | { 26 | printf("event type: %d\n", fluid_midi_event_get_type(event)); 27 | } 28 | 29 | int main(int argc, char** argv) 30 | { 31 | fluid_settings_t* settings; 32 | fluid_midi_driver_t* mdriver; 33 | settings = new_fluid_settings(); 34 | mdriver = new_fluid_midi_driver(settings, handle_midi_event, NULL); 35 | /* ... */ 36 | delete_fluid_midi_driver(mdriver); 37 | return 0; 38 | } 39 | \endcode 40 | 41 | There are a number of general MIDI driver settings. The \setting{midi_driver} setting 42 | defines the MIDI subsystem that will be used. There are additional settings 43 | for the MIDI subsystems used. For a full list of available 44 | midi driver settings, please refer to the \setting{midi} documentation. 45 | 46 | */ 47 | -------------------------------------------------------------------------------- /doc/usage/sending_midi.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page SendingMIDI Sending MIDI events 4 | 5 | Once the synthesizer is up and running and a SoundFont is loaded, most people 6 | will want to do something useful with it. Make noise, for example. MIDI 7 | messages can be sent using the fluid_synth_noteon(), fluid_synth_noteoff(), 8 | fluid_synth_cc(), fluid_synth_pitch_bend(), fluid_synth_pitch_wheel_sens(), 9 | and fluid_synth_program_change() functions. For convenience, there's also a 10 | fluid_synth_bank_select() function (the bank select message is normally sent 11 | using a control change message). 12 | 13 | The following example show a generic graphical button that plays a note when 14 | clicked: 15 | 16 | \code 17 | class SoundButton : public SomeButton 18 | { 19 | public: 20 | 21 | SoundButton() : SomeButton() { 22 | if (!_synth) { 23 | initSynth(); 24 | } 25 | } 26 | 27 | static void initSynth() { 28 | _settings = new_fluid_settings(); 29 | _synth = new_fluid_synth(_settings); 30 | _adriver = new_fluid_audio_driver(_settings, _synth); 31 | } 32 | 33 | /* ... */ 34 | 35 | virtual int handleMouseDown(int x, int y) { 36 | /* Play a note on key 60 with velocity 100 on MIDI channel 0 */ 37 | fluid_synth_noteon(_synth, 0, 60, 100); 38 | } 39 | 40 | virtual int handleMouseUp(int x, int y) { 41 | /* Release the note on key 60 */ 42 | fluid_synth_noteoff(_synth, 0, 60); 43 | } 44 | 45 | protected: 46 | 47 | static fluid_settings_t* _settings; 48 | static fluid_synth_t* _synth; 49 | static fluid_audio_driver_t* _adriver; 50 | }; 51 | \endcode 52 | 53 | */ 54 | -------------------------------------------------------------------------------- /doc/usage/shell.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page Shell Shell interface 4 | 5 | The shell interface allows you to send simple textual commands to the 6 | synthesizer, to parse a command file, or to read commands from the stdin or 7 | other input streams. To find the list of currently supported commands, type 8 | @c help in the fluidsynth command line shell. For a full list of available 9 | command line settings, please refer to the \ref 10 | settings_shell documentation. 11 | 12 | */ 13 | -------------------------------------------------------------------------------- /doc/usage/synth_context.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page synth-context Understanding the "synthesis context" 4 | 5 | When reading through the functions exposed via our API, you will often read the 6 | note: "May or may not be called from synthesis context." 7 | 8 | The reason for this is that some functions are intentionally not thread-safe. 9 | Or they require to be called from this context to behave correctly. 10 | 11 | FluidSynth's rendering engine is implemented by using the "Dispatcher Thread 12 | Pattern". This means that a certain thread @c A which calls one of FluidSynth's 13 | rendering functions, namely 14 | 15 | - fluid_synth_process() 16 | - fluid_synth_nwrite_float() 17 | - fluid_synth_write_float() 18 | - fluid_synth_write_s16() 19 | 20 | automatically becomes the "synthesis thread". The terms "synthesis context" and 21 | "synthesis thread" are equivalent. A few locations in our API provide hooks 22 | that allow you to interfere this "synthesis context". At those locations you 23 | can register your own custom functions that will always be called by thread 24 | @c A. For this use-case, the following functions are of interest: 25 | 26 | - new_fluid_audio_driver2() 27 | - fluid_player_set_playback_callback() 28 | - fluid_sequencer_register_client() 29 | 30 | */ 31 | -------------------------------------------------------------------------------- /fluidsynth.conf.in: -------------------------------------------------------------------------------- 1 | # Mandatory parameters (uncomment and edit) 2 | #SOUND_FONT=@DEFAULT_SOUNDFONT@ 3 | 4 | # Additional optional parameters (may be useful, see 'man fluidsynth' for further info) 5 | #OTHER_OPTS='-a alsa -m alsa_seq -p FluidSynth\ GM -r 48000' 6 | -------------------------------------------------------------------------------- /fluidsynth.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: FluidSynth 7 | Description: Software SoundFont synth 8 | Version: @VERSION@ 9 | Requires.private: @PC_REQUIRES_PRIV_JOINED@ 10 | Libs: -L${libdir} -l@implibname@ 11 | Libs.private: @LIBS_PRIVATE_JOINED@ @LIBS_PRIVATE_WITH_PATH_JOINED@ 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /fluidsynth.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=FluidSynth Daemon 3 | Documentation=man:fluidsynth(1) 4 | After=sound.target 5 | After=pipewire.service pulseaudio.service 6 | Wants=pipewire.service pulseaudio.service 7 | # If you need more than one instance, use `systemctl edit` to override this: 8 | ConditionPathExists=!/run/lock/fluidsynth/fluidsynth.lock 9 | ConditionUser=!@system 10 | 11 | [Service] 12 | # added automatically, for details please see 13 | # https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort 14 | ProtectSystem=full 15 | ProtectHome=read-only 16 | ProtectHostname=true 17 | ProtectKernelTunables=true 18 | ProtectKernelModules=true 19 | ProtectKernelLogs=true 20 | ProtectControlGroups=true 21 | # end of automatic additions 22 | # required in order for the above sandboxing options to work on a user unit 23 | PrivateUsers=yes 24 | Type=notify 25 | NotifyAccess=main 26 | Environment=OTHER_OPTS= SOUND_FONT= 27 | EnvironmentFile=@FLUID_DAEMON_ENV_FILE@ 28 | EnvironmentFile=-%h/.config/fluidsynth 29 | ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/fluidsynth -is $OTHER_OPTS $SOUND_FONT 30 | ExecStartPre=touch /run/lock/fluidsynth/fluidsynth.lock 31 | ExecStopPost=rm -f /run/lock/fluidsynth/fluidsynth.lock 32 | 33 | [Install] 34 | WantedBy=default.target 35 | 36 | -------------------------------------------------------------------------------- /fluidsynth.tmpfiles.in: -------------------------------------------------------------------------------- 1 | d /run/lock/fluidsynth 0777 root root 2 | -------------------------------------------------------------------------------- /include/fluidsynth/misc.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUIDSYNTH_MISC_H 22 | #define _FLUIDSYNTH_MISC_H 23 | 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | 30 | /** 31 | * @defgroup misc Miscellaneous 32 | * 33 | * Miscellaneous utility functions and defines 34 | * 35 | * @{ 36 | */ 37 | 38 | /** 39 | * Value that indicates success, used by most libfluidsynth functions. 40 | * 41 | * @note This was not publicly defined prior to libfluidsynth 1.1.0. When 42 | * writing code which should also be compatible with older versions, something 43 | * like the following can be used: 44 | * 45 | * @code 46 | * #include 47 | * 48 | * #ifndef FLUID_OK 49 | * #define FLUID_OK (0) 50 | * #define FLUID_FAILED (-1) 51 | * #endif 52 | * @endcode 53 | * 54 | * @since 1.1.0 55 | */ 56 | #define FLUID_OK (0) 57 | 58 | /** 59 | * Value that indicates failure, used by most libfluidsynth functions. 60 | * 61 | * @note See #FLUID_OK for more details. 62 | * 63 | * @since 1.1.0 64 | */ 65 | #define FLUID_FAILED (-1) 66 | 67 | 68 | FLUIDSYNTH_API int fluid_is_soundfont(const char *filename); 69 | FLUIDSYNTH_API int fluid_is_midifile(const char *filename); 70 | FLUIDSYNTH_API void fluid_free(void* ptr); 71 | /** @} */ 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* _FLUIDSYNTH_MISC_H */ 78 | -------------------------------------------------------------------------------- /include/fluidsynth/seqbind.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUIDSYNTH_SEQBIND_H 22 | #define _FLUIDSYNTH_SEQBIND_H 23 | 24 | #include "seq.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * @addtogroup sequencer 32 | * 33 | * @{ 34 | */ 35 | FLUIDSYNTH_API 36 | fluid_seq_id_t fluid_sequencer_register_fluidsynth(fluid_sequencer_t *seq, fluid_synth_t *synth); 37 | FLUIDSYNTH_API 38 | int fluid_sequencer_add_midi_event_to_buffer(void *data, fluid_midi_event_t *event); 39 | /** @} */ 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif /* _FLUIDSYNTH_SEQBIND_H */ 45 | 46 | -------------------------------------------------------------------------------- /include/fluidsynth/version.h.in: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUIDSYNTH_VERSION_H 22 | #define _FLUIDSYNTH_VERSION_H 23 | 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * @addtogroup misc 31 | * 32 | * @{ 33 | */ 34 | #define FLUIDSYNTH_VERSION "@FLUIDSYNTH_VERSION@" /**< String constant of libfluidsynth version. */ 35 | #define FLUIDSYNTH_VERSION_MAJOR @FLUIDSYNTH_VERSION_MAJOR@ /**< libfluidsynth major version integer constant. */ 36 | #define FLUIDSYNTH_VERSION_MINOR @FLUIDSYNTH_VERSION_MINOR@ /**< libfluidsynth minor version integer constant. */ 37 | #define FLUIDSYNTH_VERSION_MICRO @FLUIDSYNTH_VERSION_MICRO@ /**< libfluidsynth micro version integer constant. */ 38 | 39 | FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro); 40 | FLUIDSYNTH_API char* fluid_version_str(void); 41 | /** @} */ 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* _FLUIDSYNTH_VERSION_H */ 48 | -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | net.volcanomobile.fluidsynth-android 8 | fluidsynth-android 9 | VERSION 10 | aar 11 | 12 | fluidsynth-android 13 | The AAR for FluidSynth Android. 14 | https://github.com/VolcanoMobile/fluidsynth-android 15 | 16 | 17 | 18 | The FluidSynth License 19 | https://github.com/VolcanoMobile/fluidsynth-android/blob/master/LICENSE 20 | repo 21 | 22 | 23 | 24 | 25 | 26 | Philippe Simons 27 | philippe.simons@volcanomobile.net 28 | Volcano Mobile 29 | https://volcanomobile.net/ 30 | 31 | 32 | 33 | 34 | scm:git:git://github.com/VolcanoMobile/fluidsynth-android.git 35 | scm:git:ssh://github.com:VolcanoMobile/fluidsynth-android.git 36 | https://github.com/VolcanoMobile/fluidsynth-android/tree/master 37 | 38 | -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/modules/fluidsynth/libs/android.arm64-v8a/abi.json: -------------------------------------------------------------------------------- 1 | {"abi":"arm64-v8a","api":21,"ndk":21,"stl":"c++_shared"} -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/modules/fluidsynth/libs/android.armeabi-v7a/abi.json: -------------------------------------------------------------------------------- 1 | {"abi":"armeabi-v7a","api":16,"ndk":21,"stl":"c++_shared"} -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/modules/fluidsynth/libs/android.x86/abi.json: -------------------------------------------------------------------------------- 1 | {"abi":"x86","api":16,"ndk":21,"stl":"c++_shared"} -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/modules/fluidsynth/libs/android.x86_64/abi.json: -------------------------------------------------------------------------------- 1 | {"abi":"x86_64","api":21,"ndk":21,"stl":"c++_shared"} -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/modules/fluidsynth/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "export_libraries": [], 3 | "library_name": null, 4 | "android": { 5 | "export_libraries": [], 6 | "library_name": null 7 | } 8 | } -------------------------------------------------------------------------------- /prefab/fluidsynth-android-VERSION/prefab/prefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema_version": 1, 3 | "name": "fluidsynth-android", 4 | "version": "VERSION", 5 | "dependencies": [] 6 | } -------------------------------------------------------------------------------- /sf2/COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Vintage Dreams Waves v 2.0. for Creative Labs' AWE Soundcards 2 | (EMU Soundfont 2 Format) 3 | 4 | Copyright (c) Ian Wilson, 1996 (Updated January 1998) 5 | 6 | This soundfont is freeware. You may freely use and/or redistribute it subject 7 | to the following terms: 8 | 1. It is not altered, edited, modified, ripped, or converted to other formats, 9 | except for private use only. 10 | 2. It is distributed with this copyright notice. 11 | 12 | This soundfont is distributed WITHOUT WARRANTY, and without the implied 13 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. No liability 14 | or damages can be inferred upon the said copyright owner, Ian Wilson. 15 | 16 | Any feedback, contact Ian Wilson. 17 | vintagedreamworks@hotmail.com 18 | http://www.geocities.com/SiliconValley/Campus/8645/index.html 19 | http://members.nbci.com/silicon39/ 20 | http://www.mp3.com/silicon39 21 | https://analoguesque.x10host.com/ 22 | 23 | 24 | Update 2020-10-31: 25 | 26 | Ian Wilson has granted FluidSynth explicit permission to convert 27 | Vintage Dreams Waves to SF3: 28 | 29 | On Sat, Oct 31, 2020 Tom M. wrote: 30 | 31 | Hello Ian, 32 | 33 | I'm the current maintainer of the open-source SoundFont synthesizer 34 | FluidSynth. We are currently using your VintageDreamsWaves-v2.sf2 for 35 | unit testing, as we found it small and useful. 36 | 37 | We would like to convert this SoundFont to SoundFont3 (an unofficial 38 | extension to SF2 which stores the individual samples as OGG/Vorbis 39 | compressed stream, rather than PCM). 40 | 41 | However, your copyright notice doesn't allow your SoundFont to be 42 | converted to other formats: 43 | 44 | https://github.com/FluidSynth/fluidsynth/blob/master/sf2/COPYRIGHT.txt 45 | 46 | May I ask for your explicit permission to convert your font to SF3 and 47 | place it into our public Git repository? Apart from the lossy Vorbis 48 | compression, your SoundFont would not be modified further. 49 | 50 | No matter how you decide, thanks for your work! 51 | 52 | Regards 53 | Tom 54 | 55 | https://www.fluidsynth.org/ 56 | 57 | 58 | On Sat, Oct 31, 2020 Ian Wilson replied: 59 | 60 | Hi Tom, 61 | 62 | Great to hear from you, and thanks for reaching out regarding the SoundFont license. 63 | 64 | Your unofficial SoundFont 3 project sounds very interesting, and glad you could get use out of the Vintage Dreams Waves. 65 | 66 | You are welcome to convert it to the SoundFont 3 format. 67 | 68 | Please let me know how it all works out. 69 | 70 | Regards 71 | Ian 72 | -------------------------------------------------------------------------------- /sf2/VintageDreamsWaves-v2.sf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/sf2/VintageDreamsWaves-v2.sf2 -------------------------------------------------------------------------------- /sf2/VintageDreamsWaves-v2.sf3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/sf2/VintageDreamsWaves-v2.sf3 -------------------------------------------------------------------------------- /sf2/VìntàgèDrèàmsWàvès-v2.sf2: -------------------------------------------------------------------------------- 1 | VintageDreamsWaves-v2.sf2 -------------------------------------------------------------------------------- /sf2/■VintageDreamsWaves-v2■.sf2: -------------------------------------------------------------------------------- 1 | VintageDreamsWaves-v2.sf2 -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=FluidSynth_fluidsynth 2 | sonar.organization=fluidsynth 3 | 4 | sonar.cfamily.threads=2 5 | 6 | 7 | # This is the name and version displayed in the SonarCloud UI. 8 | #sonar.projectName=fluidsynth 9 | #sonar.projectVersion=1.0 10 | 11 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. 12 | #sonar.sources=. 13 | 14 | # Encoding of the source code. Default is default system encoding 15 | #sonar.sourceEncoding=UTF-8 16 | -------------------------------------------------------------------------------- /src/bindings/fluid_ladspa.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_LADSPA_H 22 | #define _FLUID_LADSPA_H 23 | 24 | #include "fluid_sys.h" 25 | 26 | fluid_ladspa_fx_t *new_fluid_ladspa_fx(fluid_real_t sample_rate, int buffer_size); 27 | void delete_fluid_ladspa_fx(fluid_ladspa_fx_t *fx); 28 | 29 | int fluid_ladspa_set_sample_rate(fluid_ladspa_fx_t *fx, fluid_real_t sample_rate); 30 | 31 | void fluid_ladspa_run(fluid_ladspa_fx_t *fx, int block_count, int block_size); 32 | 33 | int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix, 34 | int num_buffers, fluid_real_t buffers[], int buf_stride); 35 | 36 | #endif /* _FLUID_LADSPA_H */ 37 | -------------------------------------------------------------------------------- /src/bindings/fluid_rtkit.h: -------------------------------------------------------------------------------- 1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ 2 | 3 | #ifndef foortkithfoo 4 | #define foortkithfoo 5 | 6 | /*** 7 | Copyright 2009 Lennart Poettering 8 | Copyright 2010 David Henningsson 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation files 12 | (the "Software"), to deal in the Software without restriction, 13 | including without limitation the rights to use, copy, modify, merge, 14 | publish, distribute, sublicense, and/or sell copies of the Software, 15 | and to permit persons to whom the Software is furnished to do so, 16 | subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 25 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 26 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 27 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28 | SOFTWARE. 29 | ***/ 30 | 31 | #ifdef DBUS_SUPPORT 32 | 33 | #include 34 | #include 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /* This is the reference implementation for a client for 41 | * RealtimeKit. You don't have to use this, but if do, just copy these 42 | * sources into your repository */ 43 | 44 | #define RTKIT_SERVICE_NAME "org.freedesktop.RealtimeKit1" 45 | #define RTKIT_OBJECT_PATH "/org/freedesktop/RealtimeKit1" 46 | 47 | /* This is mostly equivalent to sched_setparam(thread, SCHED_RR, { 48 | * .sched_priority = priority }). 'thread' needs to be a kernel thread 49 | * id as returned by gettid(), not a pthread_t! If 'thread' is 0 the 50 | * current thread is used. The returned value is a negative errno 51 | * style error code, or 0 on success. */ 52 | int fluid_rtkit_make_realtime(pid_t thread, int priority); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/gentables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | # Set the CC, CFLAGS and LDFLAGS variables to the corresponding *_FOR_BUILD environment variables. 4 | # If the CC_FOR_BUILD environment variable is unset or empty, this will unset the CC CMake variable 5 | # and by that force CMake to look for a (working) C compiler, which hopefully will be the host compiler. 6 | set(ENV{CC} "$ENV{CC_FOR_BUILD}") 7 | 8 | # CMake is notorious for ignoring the CPPFLAGS variable, so explicitly append it to the CFLAGS variable here. 9 | set(ENV{CFLAGS} "$ENV{CFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD}") 10 | 11 | set(ENV{LDFLAGS} "$ENV{LDFLAGS_FOR_BUILD}") 12 | 13 | project (gentables C) 14 | 15 | set ( CMAKE_BUILD_TYPE Debug ) 16 | 17 | # hardcode ".exe" as suffix to the binary, else in case of cross-platform cross-compiling the calling cmake will not know the suffix used here and fail to find the binary 18 | set ( CMAKE_EXECUTABLE_SUFFIX ".exe" ) 19 | 20 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 21 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) 22 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) 23 | 24 | # Add the executable that generates the table 25 | add_executable( make_tables 26 | make_tables.c 27 | gen_conv.c 28 | gen_rvoice_dsp.c) 29 | 30 | target_include_directories( make_tables PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../ ) 31 | 32 | if ( WIN32 ) 33 | add_definitions ( -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS ) 34 | else ( WIN32 ) 35 | target_link_libraries (make_tables "m") 36 | endif () 37 | -------------------------------------------------------------------------------- /src/gentables/make_tables.c: -------------------------------------------------------------------------------- 1 | 2 | #include "make_tables.h" 3 | 4 | static void write_value(FILE *fp, double val, int i) 5 | { 6 | fprintf(fp, " %.15e%c /* %d */\n", 7 | val, 8 | ',', 9 | i 10 | ); 11 | } 12 | 13 | /* Emit an array of real numbers */ 14 | void emit_array(FILE *fp, const char *tblname, const double *tbl, int size) 15 | { 16 | int i; 17 | 18 | fprintf(fp, "static const fluid_real_t %s[%d] = {\n", tblname, size); 19 | 20 | for (i = 0; i < size; i++) 21 | { 22 | write_value(fp, tbl[i], i); 23 | } 24 | fprintf(fp, "};\n\n"); 25 | } 26 | 27 | /* Emit a matrix of real numbers */ 28 | void emit_matrix(FILE *fp, const char *tblname, emit_matrix_cb tbl_cb, int sizeh, int sizel) 29 | { 30 | int i, j; 31 | 32 | fprintf(fp, "static const fluid_real_t %s[%d][%d] = {\n {\n", tblname, sizeh, sizel); 33 | 34 | for (i = 0; i < sizeh; i++) 35 | { 36 | for (j = 0; j < sizel; j++) 37 | { 38 | write_value(fp, tbl_cb(i, j), i*sizel+j); 39 | } 40 | 41 | 42 | if (i < (sizeh-1)) 43 | fprintf(fp, " }, {\n"); 44 | else 45 | fprintf(fp, " }\n};\n\n"); 46 | } 47 | } 48 | 49 | static void open_table(FILE**fp, const char* dir, const char* file) 50 | { 51 | char buf[2048] = {0}; 52 | 53 | strcat(buf, dir); 54 | strcat(buf, file); 55 | 56 | /* open the output file */ 57 | *fp = fopen(buf, "w"); 58 | if (*fp == NULL) 59 | { 60 | exit(-2); 61 | } 62 | 63 | /* Emit warning header */ 64 | fprintf(*fp, 65 | "/* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. */\n\n" 66 | "#ifdef __cplusplus\n" 67 | "extern \"C\" {\n" 68 | "#endif\n\n" 69 | ); 70 | } 71 | 72 | static void close_table(FILE**fp) 73 | { 74 | fprintf(*fp, 75 | "#ifdef __cplusplus\n" 76 | "}\n" 77 | "#endif\n" 78 | ); 79 | fclose(*fp); 80 | } 81 | 82 | int main (int argc, char *argv[]) 83 | { 84 | FILE *fp; 85 | 86 | // make sure we have enough arguments 87 | if (argc < 2) 88 | return -1; 89 | 90 | open_table(&fp, argv[1], "fluid_conv_tables.inc.h"); 91 | gen_conv_table(fp); 92 | close_table(&fp); 93 | 94 | open_table(&fp, argv[1], "fluid_rvoice_dsp_tables.inc.h"); 95 | gen_rvoice_table_dsp(fp); 96 | close_table(&fp); 97 | 98 | return 0; 99 | } 100 | -------------------------------------------------------------------------------- /src/gentables/make_tables.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLUID_MAKE_TABLES_H 3 | #define _FLUID_MAKE_TABLES_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | #define EMIT_ARRAY(__fp__, __arr__) emit_array(__fp__, #__arr__, __arr__, sizeof(__arr__)/sizeof(*__arr__)) 12 | 13 | /* callback for general access to matrices */ 14 | typedef double (*emit_matrix_cb)(int y, int x); 15 | 16 | /* Generators */ 17 | void gen_rvoice_table_dsp(FILE *fp); 18 | void gen_conv_table(FILE *fp); 19 | 20 | /* Emit an array of real numbers */ 21 | void emit_array(FILE *fp, const char *tblname, const double *tbl, int size); 22 | 23 | /* Emit a matrix of real numbers */ 24 | void emit_matrix(FILE *fp, const char *tblname, emit_matrix_cb tbl_cb, int sizeh, int sizel); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/midi/fluid_midi_router.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | /* Author: Markus Nentwig, nentwig@users.sourceforge.net 22 | */ 23 | 24 | #ifndef _FLUID_MIDIROUTER_H 25 | #define _FLUID_MIDIROUTER_H 26 | 27 | #include "fluidsynth_priv.h" 28 | #include "fluid_midi.h" 29 | #include "fluid_sys.h" 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/midi/fluid_seq_queue.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_SEQ_QUE_H 22 | #define _FLUID_SEQ_QUE_H 23 | 24 | #include "fluidsynth.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #include "fluid_event.h" 31 | #include "fluid_seqbind_notes.h" 32 | 33 | void* new_fluid_seq_queue(int nbEvents); 34 | void delete_fluid_seq_queue(void *queue); 35 | int fluid_seq_queue_push(void *queue, const fluid_event_t *evt); 36 | void fluid_seq_queue_remove(void *queue, fluid_seq_id_t src, fluid_seq_id_t dest, int type); 37 | void fluid_seq_queue_process(void *que, fluid_sequencer_t *seq, unsigned int cur_ticks); 38 | void fluid_seq_queue_invalidate_note_private(void *que, fluid_seq_id_t dest, fluid_note_id_t id); 39 | 40 | int event_compare_for_test(const fluid_event_t* left, const fluid_event_t* right); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _FLUID_SEQ_QUE_H */ 47 | -------------------------------------------------------------------------------- /src/midi/fluid_seqbind_notes.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_SEQBIND_NOTE_H 22 | #define _FLUID_SEQBIND_NOTE_H 23 | 24 | #include "fluidsynth.h" 25 | #include "fluid_event.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | fluid_note_id_t fluid_note_compute_id(int chan, short key); 32 | void* new_fluid_note_container(void); 33 | void delete_fluid_note_container(void *cont); 34 | int fluid_note_container_insert(void* cont, fluid_note_id_t id); 35 | void fluid_note_container_remove(void* cont, fluid_note_id_t id); 36 | void fluid_note_container_clear(void* cont); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _FLUID_SEQBIND_NOTE_H */ 43 | -------------------------------------------------------------------------------- /src/rvoice/fluid_adsr_env.c: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #include "fluid_adsr_env.h" 22 | 23 | DECLARE_FLUID_RVOICE_FUNCTION(fluid_adsr_env_set_data) 24 | { 25 | fluid_adsr_env_t *env = obj; 26 | fluid_adsr_env_section_t section = param[0].i; 27 | unsigned int count = param[1].i; 28 | fluid_real_t coeff = param[2].real; 29 | fluid_real_t increment = param[3].real; 30 | fluid_real_t min = param[4].real; 31 | fluid_real_t max = param[5].real; 32 | 33 | env->data[section].count = count; 34 | env->data[section].coeff = coeff; 35 | env->data[section].increment = increment; 36 | env->data[section].min = min; 37 | env->data[section].max = max; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/rvoice/fluid_lfo.c: -------------------------------------------------------------------------------- 1 | #include "fluid_lfo.h" 2 | 3 | DECLARE_FLUID_RVOICE_FUNCTION(fluid_lfo_set_incr) 4 | { 5 | fluid_lfo_t *lfo = obj; 6 | fluid_real_t increment = param[0].real; 7 | 8 | lfo->increment = increment; 9 | } 10 | 11 | DECLARE_FLUID_RVOICE_FUNCTION(fluid_lfo_set_delay) 12 | { 13 | fluid_lfo_t *lfo = obj; 14 | unsigned int delay = param[0].i; 15 | 16 | lfo->delay = delay; 17 | } 18 | -------------------------------------------------------------------------------- /src/rvoice/fluid_lfo.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_LFO_H 22 | #define _FLUID_LFO_H 23 | 24 | #include "fluid_sys.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | typedef struct _fluid_lfo_t fluid_lfo_t; 30 | 31 | struct _fluid_lfo_t 32 | { 33 | fluid_real_t val; /* the current value of the LFO */ 34 | unsigned int delay; /* the delay of the lfo in samples */ 35 | fluid_real_t increment; /* the lfo frequency is converted to a per-buffer increment */ 36 | }; 37 | 38 | static FLUID_INLINE void 39 | fluid_lfo_reset(fluid_lfo_t *lfo) 40 | { 41 | lfo->val = 0.0f; 42 | } 43 | 44 | // These two cannot be inlined since they're used by event_dispatch 45 | DECLARE_FLUID_RVOICE_FUNCTION(fluid_lfo_set_incr); 46 | DECLARE_FLUID_RVOICE_FUNCTION(fluid_lfo_set_delay); 47 | 48 | static FLUID_INLINE fluid_real_t 49 | fluid_lfo_get_val(fluid_lfo_t *lfo) 50 | { 51 | return lfo->val; 52 | } 53 | 54 | static FLUID_INLINE void 55 | fluid_lfo_calc(fluid_lfo_t *lfo, unsigned int cur_delay) 56 | { 57 | if(cur_delay < lfo->delay) 58 | { 59 | return; 60 | } 61 | 62 | lfo->val += lfo->increment; 63 | 64 | if(lfo->val > (fluid_real_t) 1.0) 65 | { 66 | lfo->increment = -lfo->increment; 67 | lfo->val = (fluid_real_t) 2.0 - lfo->val; 68 | } 69 | else if(lfo->val < (fluid_real_t) -1.0) 70 | { 71 | lfo->increment = -lfo->increment; 72 | lfo->val = (fluid_real_t) -2.0 - lfo->val; 73 | } 74 | 75 | } 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/rvoice/fluid_rvoice_dsp_tables.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLUID_RVOICE_DSP_TABLES_H 3 | #define _FLUID_RVOICE_DSP_TABLES_H 4 | 5 | #define FLUID_INTERP_MAX 256 6 | #define SINC_INTERP_ORDER 7 /* 7th order constant */ 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/sfloader/fluid_instpatch.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLUID_INSTPATCH_H 3 | #define _FLUID_INSTPATCH_H 4 | 5 | #include "fluid_sfont.h" 6 | #include "fluid_settings.h" 7 | 8 | void fluid_instpatch_init(void); 9 | void fluid_instpatch_deinit(void); 10 | fluid_sfloader_t *new_fluid_instpatch_loader(fluid_settings_t *settings); 11 | 12 | int fluid_instpatch_supports_multi_init(void); 13 | 14 | #endif // _FLUID_INSTPATCH_H 15 | -------------------------------------------------------------------------------- /src/sfloader/fluid_samplecache.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | 22 | #ifndef _FLUID_SAMPLECACHE_H 23 | #define _FLUID_SAMPLECACHE_H 24 | 25 | #include "fluid_sfont.h" 26 | #include "fluid_sffile.h" 27 | 28 | int fluid_samplecache_load(SFData *sf, 29 | unsigned int sample_start, unsigned int sample_end, int sample_type, 30 | int try_mlock, short **data, char **data24); 31 | 32 | int fluid_samplecache_unload(const short *sample_data); 33 | 34 | /* Only used for tests */ 35 | int fluid_samplecache_count_entries(void); 36 | 37 | #endif /* _FLUID_SAMPLECACHE_H */ 38 | -------------------------------------------------------------------------------- /src/synth/fluid_event.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | 22 | #ifndef _FLUID_EVENT_PRIV_H 23 | #define _FLUID_EVENT_PRIV_H 24 | 25 | #include "fluidsynth.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef int fluid_note_id_t; 32 | 33 | /* Private data for event */ 34 | /* ?? should be optimized in size, using unions */ 35 | struct _fluid_event_t 36 | { 37 | unsigned int time; 38 | int type; 39 | fluid_seq_id_t src; 40 | fluid_seq_id_t dest; 41 | int channel; 42 | short key; 43 | short vel; 44 | short control; 45 | int value; 46 | fluid_note_id_t id; 47 | int pitch; 48 | unsigned int duration; 49 | double scale; 50 | void *data; 51 | }; 52 | 53 | unsigned int fluid_event_get_time(fluid_event_t *evt); 54 | void fluid_event_set_time(fluid_event_t *evt, unsigned int time); 55 | 56 | fluid_note_id_t fluid_event_get_id(fluid_event_t *evt); 57 | void fluid_event_set_id(fluid_event_t *evt, fluid_note_id_t id); 58 | 59 | void fluid_event_clear(fluid_event_t *evt); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* _FLUID_EVENT_PRIV_H */ 66 | -------------------------------------------------------------------------------- /src/synth/fluid_gen.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | 22 | #ifndef _FLUID_GEN_H 23 | #define _FLUID_GEN_H 24 | 25 | #include "fluidsynth_priv.h" 26 | 27 | typedef struct _fluid_gen_info_t 28 | { 29 | char num; /* Generator number */ 30 | char *name; 31 | char init; /* Does the generator need to be initialized (not used) */ 32 | char nrpn_scale; /* The scale to convert from NRPN (cfr. fluid_gen_map_nrpn()) */ 33 | float min; /* The minimum value */ 34 | float max; /* The maximum value */ 35 | float def; /* The default value (cfr. fluid_gen_init()) */ 36 | } fluid_gen_info_t; 37 | 38 | /* 39 | * SoundFont generator structure. 40 | */ 41 | typedef struct _fluid_gen_t 42 | { 43 | unsigned char flags; /**< Is the generator set or not (#fluid_gen_flags) */ 44 | double val; /**< The nominal value */ 45 | double mod; /**< Change by modulators */ 46 | double nrpn; /**< Change by NRPN messages */ 47 | } fluid_gen_t; 48 | 49 | /* 50 | * Enum value for 'flags' field of #fluid_gen_t (not really flags). 51 | */ 52 | enum fluid_gen_flags 53 | { 54 | GEN_UNUSED, /**< Generator value is not set */ 55 | GEN_SET, /**< Generator value is set */ 56 | }; 57 | 58 | #define fluid_gen_set_mod(_gen, _val) { (_gen)->mod = (double) (_val); } 59 | #define fluid_gen_set_nrpn(_gen, _val) { (_gen)->nrpn = (double) (_val); } 60 | 61 | fluid_real_t fluid_gen_scale(int gen, float value); 62 | fluid_real_t fluid_gen_scale_nrpn(int gen, int nrpn); 63 | void fluid_gen_init(fluid_gen_t *gen, fluid_channel_t *channel); 64 | const char *fluid_gen_name(int gen); 65 | 66 | 67 | #endif /* _FLUID_GEN_H */ 68 | -------------------------------------------------------------------------------- /src/synth/fluid_mod.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_MOD_H 22 | #define _FLUID_MOD_H 23 | 24 | #include "fluidsynth_priv.h" 25 | #include "fluid_conv.h" 26 | 27 | /* 28 | * Modulator structure. See SoundFont 2.04 PDF section 8.2. 29 | */ 30 | struct _fluid_mod_t 31 | { 32 | unsigned char dest; /**< Destination generator to control */ 33 | unsigned char src1; /**< Source controller 1 */ 34 | unsigned char flags1; /**< Source controller 1 flags */ 35 | unsigned char src2; /**< Source controller 2 */ 36 | unsigned char flags2; /**< Source controller 2 flags */ 37 | unsigned char trans; /**< Output transform flag */ 38 | double amount; /**< Multiplier amount */ 39 | /* The 'next' field allows to link modulators into a list. It is 40 | * not used in fluid_voice.c, there each voice allocates memory for a 41 | * fixed number of modulators. Since there may be a huge number of 42 | * different zones, this is more efficient. 43 | */ 44 | fluid_mod_t *next; 45 | }; 46 | 47 | fluid_real_t fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice); 48 | int fluid_mod_check_sources(const fluid_mod_t *mod, char *name); 49 | fluid_real_t fluid_mod_transform_source_value(fluid_real_t val, unsigned char mod_flags, const fluid_real_t range); 50 | 51 | 52 | #ifdef DEBUG 53 | void fluid_dump_modulator(fluid_mod_t *mod); 54 | #endif 55 | 56 | 57 | #endif /* _FLUID_MOD_H */ 58 | -------------------------------------------------------------------------------- /src/synth/fluid_tuning.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | 22 | /* 23 | 24 | More information about micro tuning can be found at: 25 | 26 | https://www.midi.org/about-midi/tuning.htm 27 | https://www.midi.org/about-midi/tuning-scale.htm 28 | https://www.midi.org/about-midi/tuning_extens.htm 29 | 30 | */ 31 | 32 | #ifndef _FLUID_TUNING_H 33 | #define _FLUID_TUNING_H 34 | 35 | #include "fluidsynth_priv.h" 36 | 37 | struct _fluid_tuning_t 38 | { 39 | char *name; 40 | int bank; 41 | int prog; 42 | double pitch[128]; /* the pitch of every key, in cents */ 43 | fluid_atomic_int_t refcount; /* Tuning reference count */ 44 | }; 45 | 46 | fluid_tuning_t *new_fluid_tuning(const char *name, int bank, int prog); 47 | void delete_fluid_tuning(fluid_tuning_t *tuning); 48 | fluid_tuning_t *fluid_tuning_duplicate(fluid_tuning_t *tuning); 49 | void fluid_tuning_ref(fluid_tuning_t *tuning); 50 | int fluid_tuning_unref(fluid_tuning_t *tuning, int count); 51 | 52 | int fluid_tuning_set_name(fluid_tuning_t *tuning, const char *name); 53 | char *fluid_tuning_get_name(fluid_tuning_t *tuning); 54 | 55 | #define fluid_tuning_get_bank(_t) ((_t)->bank) 56 | #define fluid_tuning_get_prog(_t) ((_t)->prog) 57 | 58 | void fluid_tuning_set_pitch(fluid_tuning_t *tuning, int key, double pitch); 59 | #define fluid_tuning_get_pitch(_t, _key) ((_t)->pitch[_key]) 60 | 61 | void fluid_tuning_set_octave(fluid_tuning_t *tuning, const double *pitch_deriv); 62 | 63 | void fluid_tuning_set_all(fluid_tuning_t *tuning, const double *pitch); 64 | #define fluid_tuning_get_all(_t) (&(_t)->pitch[0]) 65 | 66 | 67 | 68 | 69 | #endif /* _FLUID_TUNING_H */ 70 | -------------------------------------------------------------------------------- /src/utils/fluid_conv.h: -------------------------------------------------------------------------------- 1 | /* FluidSynth - A Software Synthesizer 2 | * 3 | * Copyright (C) 2003 Peter Hanappe and others. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free 17 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA 19 | */ 20 | 21 | #ifndef _FLUID_CONV_H 22 | #define _FLUID_CONV_H 23 | 24 | #include "fluidsynth_priv.h" 25 | #include "utils/fluid_conv_tables.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | fluid_real_t fluid_ct2hz_real(fluid_real_t cents); 31 | fluid_real_t fluid_ct2hz(fluid_real_t cents); 32 | fluid_real_t fluid_cb2amp(fluid_real_t cb); 33 | fluid_real_t fluid_sec2tc(fluid_real_t sec); 34 | fluid_real_t fluid_tc2sec(fluid_real_t tc); 35 | fluid_real_t fluid_tc2sec_delay(fluid_real_t tc); 36 | fluid_real_t fluid_tc2sec_attack(fluid_real_t tc); 37 | fluid_real_t fluid_tc2sec_release(fluid_real_t tc); 38 | fluid_real_t fluid_hz2ct(fluid_real_t f); 39 | double fluid_act2hz(double c); 40 | fluid_real_t fluid_pan(fluid_real_t c, int left); 41 | fluid_real_t fluid_balance(fluid_real_t balance, int left); 42 | fluid_real_t fluid_concave(fluid_real_t val); 43 | fluid_real_t fluid_convex(fluid_real_t val); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif /* _FLUID_CONV_H */ 49 | -------------------------------------------------------------------------------- /src/utils/fluid_conv_tables.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLUID_CONV_TABLES_H 3 | #define _FLUID_CONV_TABLES_H 4 | 5 | /* 6 | Attenuation range in centibels. 7 | Attenuation range is the dynamic range of the volume envelope generator 8 | from 0 to the end of attack segment. 9 | fluidsynth is a 24 bit synth, it could (should??) be 144 dB of attenuation. 10 | However the spec makes no distinction between 16 or 24 bit synths, so use 11 | 96 dB here. 12 | 13 | Note about usefulness of 24 bits: 14 | 1)Even fluidsynth is a 24 bit synth, this format is only relevant if 15 | the sample format coming from the soundfont is 24 bits and the audio sample format 16 | chosen by the application (audio.sample.format) is not 16 bits. 17 | 18 | 2)When the sample soundfont is 16 bits, the internal 24 bits number have 19 | 16 bits msb and lsb to 0. Consequently, at the DAC output, the dynamic range of 20 | this 24 bit sample is reduced to the the dynamic of a 16 bits sample (ie 90 db) 21 | even if this sample is produced by the audio driver using an audio sample format 22 | compatible for a 24 bit DAC. 23 | 24 | 3)When the audio sample format settings is 16 bits (audio.sample.format), the 25 | audio driver will make use of a 16 bit DAC, and the dynamic will be reduced to 96 dB 26 | even if the initial sample comes from a 24 bits soundfont. 27 | 28 | In both cases (2) or (3), the real dynamic range is only 96 dB. 29 | 30 | Other consideration for FLUID_NOISE_FLOOR related to case (1),(2,3): 31 | - for case (1), FLUID_NOISE_FLOOR should be the noise floor for 24 bits (i.e -138 dB). 32 | - for case (2) or (3), FLUID_NOISE_FLOOR should be the noise floor for 16 bits (i.e -90 dB). 33 | */ 34 | #define FLUID_PEAK_ATTENUATION 960.0f 35 | 36 | #define FLUID_CENTS_HZ_SIZE 1200 37 | #define FLUID_VEL_CB_SIZE 128 38 | #define FLUID_CB_AMP_SIZE 1441 39 | #define FLUID_PAN_SIZE 1002 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/utils/fluid_list.h: -------------------------------------------------------------------------------- 1 | /* GLIB - Library of useful routines for C programming 2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef _FLUID_LIST_H 21 | #define _FLUID_LIST_H 22 | 23 | #include "fluidsynth_priv.h" 24 | 25 | /* 26 | * 27 | * Lists 28 | * 29 | * A sound font loader has to pack the data from the .SF2 file into 30 | * list structures of this type. 31 | * 32 | */ 33 | 34 | typedef struct _fluid_list_t fluid_list_t; 35 | 36 | typedef int (*fluid_compare_func_t)(const void *a, const void *b); 37 | 38 | struct _fluid_list_t 39 | { 40 | void *data; 41 | fluid_list_t *next; 42 | }; 43 | 44 | fluid_list_t *new_fluid_list(void); 45 | void delete_fluid_list(fluid_list_t *list); 46 | void delete1_fluid_list(fluid_list_t *list); 47 | fluid_list_t *fluid_list_sort(fluid_list_t *list, fluid_compare_func_t compare_func); 48 | fluid_list_t *fluid_list_append(fluid_list_t *list, void *data); 49 | fluid_list_t *fluid_list_prepend(fluid_list_t *list, void *data); 50 | fluid_list_t *fluid_list_remove(fluid_list_t *list, void *data); 51 | fluid_list_t *fluid_list_remove_link(fluid_list_t *list, fluid_list_t *llink); 52 | fluid_list_t *fluid_list_nth(fluid_list_t *list, int n); 53 | fluid_list_t *fluid_list_last(fluid_list_t *list); 54 | fluid_list_t *fluid_list_insert_at(fluid_list_t *list, int n, void *data); 55 | int fluid_list_idx(fluid_list_t *list, void *data); 56 | int fluid_list_size(fluid_list_t *list); 57 | 58 | #define fluid_list_next(slist) ((slist) ? (((fluid_list_t *)(slist))->next) : NULL) 59 | #define fluid_list_get(slist) ((slist) ? ((slist)->data) : NULL) 60 | 61 | int fluid_list_str_compare_func(const void *a, const void *b); 62 | 63 | #endif /* _FLUID_LIST_H */ 64 | -------------------------------------------------------------------------------- /test-android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | .idea 17 | 18 | app/src/main/cpp/include/ 19 | app/src/main/cpp/tests/ 20 | app/src/main/jniLibs/ 21 | test-names.txt 22 | -------------------------------------------------------------------------------- /test-android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /test-android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | applicationId "org.fluidsynth.fluidsynth_tests" 12 | minSdkVersion 24 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | externalNativeBuild { 19 | cmake { 20 | cppFlags '' 21 | arguments '-DANDROID_STL=c++_shared' 22 | } 23 | 24 | if (project.hasProperty('customAbiFilters')) 25 | ndk.abiFilters "$customAbiFilters" 26 | } 27 | } 28 | 29 | buildTypes { 30 | release { 31 | minifyEnabled false 32 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 33 | } 34 | } 35 | compileOptions { 36 | sourceCompatibility JavaVersion.VERSION_1_8 37 | targetCompatibility JavaVersion.VERSION_1_8 38 | } 39 | kotlinOptions { 40 | jvmTarget = '1.8' 41 | } 42 | externalNativeBuild { 43 | cmake { 44 | path file('src/main/cpp/CMakeLists.txt') 45 | version '3.16.0+' 46 | } 47 | } 48 | buildFeatures { 49 | viewBinding true 50 | } 51 | } 52 | 53 | dependencies { 54 | 55 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 56 | implementation 'androidx.core:core-ktx:1.5.0' 57 | implementation 'androidx.appcompat:appcompat:1.3.0' 58 | implementation 'com.google.android.material:material:1.3.0' 59 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 60 | testImplementation 'junit:junit:4.13.2' 61 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 62 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 63 | } 64 | -------------------------------------------------------------------------------- /test-android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /test-android/app/src/androidTest/java/org/fluidsynth/fluidsynth_tests/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package org.fluidsynth.fluidsynth_tests 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | import org.fluidsynth.fluidsynthtests.TestRunner 6 | 7 | import org.junit.Test 8 | import org.junit.runner.RunWith 9 | 10 | import org.junit.Assert.* 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * See [testing documentation](http://d.android.com/tools/testing). 16 | */ 17 | @RunWith(AndroidJUnit4::class) 18 | class ExampleInstrumentedTest { 19 | @Test 20 | fun useAppContext() { 21 | // Context of the app under test. 22 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 23 | assertEquals("org.fluidsynth.fluidsynth_tests", appContext.packageName) 24 | 25 | TestRunner.runTests() 26 | } 27 | } -------------------------------------------------------------------------------- /test-android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test-android/app/src/main/cpp/native-lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" int run_all_fluidsynth_tests(); 6 | 7 | extern "C" JNIEXPORT void JNICALL Java_org_fluidsynth_fluidsynthtests_TestRunner_00024Companion_runTests(JNIEnv* env, jobject thiz) { 8 | run_all_fluidsynth_tests(); 9 | } 10 | -------------------------------------------------------------------------------- /test-android/app/src/main/java/org/fluidsynth/fluidsynthtests/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package org.fluidsynth.fluidsynthtests 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import org.fluidsynth.fluidsynthtests.databinding.ActivityMainBinding 6 | 7 | class MainActivity : AppCompatActivity() { 8 | 9 | private lateinit var binding: ActivityMainBinding 10 | 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | 14 | binding = ActivityMainBinding.inflate(layoutInflater) 15 | setContentView(binding.root) 16 | 17 | TestRunner.runTests() 18 | 19 | // Example of a call to a native method 20 | binding.sampleText.text = "If this shows up then there was no reported test failure!" 21 | } 22 | } -------------------------------------------------------------------------------- /test-android/app/src/main/java/org/fluidsynth/fluidsynthtests/TestRunner.kt: -------------------------------------------------------------------------------- 1 | package org.fluidsynth.fluidsynthtests 2 | 3 | class TestRunner { 4 | companion object { 5 | external fun runTests() 6 | init { 7 | System.loadLibrary("native-lib") 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /test-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /test-android/app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | fluidsynth-tests 3 | -------------------------------------------------------------------------------- /test-android/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /test-android/app/src/test/java/org/fluidsynth/fluidsynth_tests/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package org.fluidsynth.fluidsynth_tests 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /test-android/build-scripts/.gitignore: -------------------------------------------------------------------------------- 1 | android-build-root/ 2 | archives/ 3 | build-artifacts/ 4 | wget-log 5 | 6 | -------------------------------------------------------------------------------- /test-android/build-scripts/build-all-archs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ./build-env.sh 4 | 5 | mkdir -p $DEV 6 | 7 | # build 8 | 9 | ANDROID_ABI_CMAKE=armeabi-v7a ./extract.sh || exit 1 10 | ARCH='arm' ANDROID_ARCH='armv7a' ANDROID_ABI_CMAKE='armeabi-v7a' ANDROID_TARGET_ABI='eabi' AUTOTOOLS_TARGET="$ARCH-none-linux-android$ANDROID_TARGET_ABI" ./build.sh || exit 1 11 | 12 | ANDROID_ABI_CMAKE=arm64-v8a ./extract.sh || exit 1 13 | ARCH='aarch64' ANDROID_ARCH='aarch64' ANDROID_ABI_CMAKE='arm64-v8a' ANDROID_TARGET_ABI='' AUTOTOOLS_TARGET="$ARCH-none-linux-android" ./build.sh || exit 1 14 | 15 | ANDROID_ABI_CMAKE=x86 ./extract.sh || exit 1 16 | ARCH='i686' ANDROID_ARCH='i686' ANDROID_ABI_CMAKE='x86' ANDROID_TARGET_ABI='' AUTOTOOLS_TARGET="$ARCH-pc-linux-android" ./build.sh || exit 1 17 | 18 | ANDROID_ABI_CMAKE=x86_64 ./extract.sh || exit 1 19 | ARCH='x86_64' ANDROID_ARCH='x86_64' ANDROID_ABI_CMAKE='x86_64' ANDROID_TARGET_ABI='' AUTOTOOLS_TARGET="$ARCH-pc-linux-android" ./build.sh || exit 1 20 | -------------------------------------------------------------------------------- /test-android/build-scripts/build-call-cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ./build-env.sh 4 | 5 | if [ -z "$parameters_installCommand" ] ; then 6 | parameters_installCommand="make install" 7 | fi 8 | 9 | if [ -z "$parameters_workDir" ] ; then 10 | parameters_workDir=$DEV 11 | fi 12 | 13 | source ./build-env.sh 14 | 15 | #set -ex 16 | pushd $parameters_sourceDir 17 | mkdir -p build_$ANDROID_ABI_CMAKE 18 | pushd build_$ANDROID_ABI_CMAKE 19 | 20 | # Invoke cmake in the most correctest way I've could find while try and erroring: 21 | # 22 | # The biggest pain point is that CMake does not seem to respect our existing cross compilation CFLAGS and LDFLAGS. 23 | # Hence we are passing them manually, once via Android flags and once for "Required" flags. The latter is necessary 24 | # to let cmake correctly probe for any existing header, function, library, etc. 25 | # Watch out: Sometimes the flags are passed as ;-limited list! 26 | 27 | 28 | cmake -G "Unix Makefiles" \ 29 | -DCMAKE_MAKE_PROGRAM=make \ 30 | -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \ 31 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ 32 | -DANDROID_NATIVE_API_LEVEL=$ANDROID_API \ 33 | -DANDROID_ABI=$ANDROID_ABI_CMAKE \ 34 | -DANDROID_TOOLCHAIN=$CC \ 35 | -DANDROID_NDK=$NDK \ 36 | -DANDROID_COMPILER_FLAGS="${CFLAGS// /;}" \ 37 | -DANDROID_LINKER_FLAGS="${LDFLAGS// /;}" \ 38 | -DANDROID_STL="c++_shared" \ 39 | -DCMAKE_REQUIRED_FLAGS="${CFLAGS}" \ 40 | -DCMAKE_REQUIRED_LINK_OPTIONS="${LDFLAGS// /;}" \ 41 | -DCMAKE_INSTALL_PREFIX=${PREFIX} \ 42 | -DCMAKE_STAGING_PREFIX=${PREFIX} \ 43 | -DBUILD_SHARED_LIBS=1 \ 44 | $parameters_cmakeArgs .. 45 | #-DCMAKE_VERBOSE_MAKEFILE=1 \ 46 | make -j$((`nproc`+1)) || (popd && popd && exit 1) 47 | $parameters_installCommand 48 | popd 49 | popd 50 | 51 | -------------------------------------------------------------------------------- /test-android/build-scripts/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ./build-env.sh 4 | 5 | mkdir -p archives 6 | wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz 7 | wget -O libffi-${FFI_VERSION}.tar.gz https://github.com/libffi/libffi/archive/${FFI_VERSION}.tar.gz 8 | wget http://ftp.gnu.org/pub/gnu/gettext/gettext-${GETTEXT_VERSION}.tar.gz 9 | wget http://ftp.gnome.org/pub/gnome/sources/glib/${GLIB_VERSION}/glib-${GLIB_VERSION}.${GLIB_EXTRAVERSION}.tar.xz 10 | wget -O oboe-${OBOE_VERSION}.tar.gz https://github.com/google/oboe/archive/${OBOE_VERSION}.tar.gz 11 | wget https://github.com/libsndfile/libsndfile/releases/download/${SNDFILE_VERSION}/libsndfile-${SNDFILE_VERSION}.tar.bz2 12 | wget -O libinstpatch-${INSTPATCH_VERSION}.tar.gz https://github.com/swami/libinstpatch/archive/refs/tags/v${INSTPATCH_VERSION}.tar.gz 13 | wget https://github.com/xiph/vorbis/releases/download/v${VORBIS_VERSION}/libvorbis-${VORBIS_VERSION}.tar.gz 14 | wget https://github.com/xiph/ogg/releases/download/v${OGG_VERSION}/libogg-${OGG_VERSION}.tar.gz 15 | wget -O flac-${FLAC_VERSION}.tar.gz https://github.com/xiph/flac/archive/${FLAC_VERSION}.tar.gz 16 | wget -O opus-${OPUS_VERSION}.tar.gz https://github.com/xiph/opus/archive/refs/tags/v${OPUS_VERSION}.tar.gz 17 | mv *.tar.gz *.tar.xz *.tar.bz2 $ARCHIVE_DIR 18 | -------------------------------------------------------------------------------- /test-android/build-scripts/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ./build-env.sh 4 | 5 | mkdir -p $DEV 6 | 7 | pushd $DEV 8 | 9 | tar zxf $ARCHIVE_DIR/libiconv-${ICONV_VERSION}.tar.gz 10 | tar zxf $ARCHIVE_DIR/libffi-${FFI_VERSION}.tar.gz 11 | tar zxf $ARCHIVE_DIR/gettext-${GETTEXT_VERSION}.tar.gz 12 | tar xf $ARCHIVE_DIR/glib-${GLIB_VERSION}.${GLIB_EXTRAVERSION}.tar.xz 13 | tar zxf $ARCHIVE_DIR/oboe-${OBOE_VERSION}.tar.gz 14 | tar jxf $ARCHIVE_DIR/libsndfile-${SNDFILE_VERSION}.tar.bz2 15 | tar zxf $ARCHIVE_DIR/libinstpatch-${INSTPATCH_VERSION}.tar.gz 16 | tar zxf $ARCHIVE_DIR/libvorbis-${VORBIS_VERSION}.tar.gz 17 | tar zxf $ARCHIVE_DIR/libogg-${OGG_VERSION}.tar.gz 18 | tar xf $ARCHIVE_DIR/flac-${FLAC_VERSION}.tar.gz 19 | tar xf $ARCHIVE_DIR/opus-${OPUS_VERSION}.tar.gz 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /test-android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.10" 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.2.1" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } -------------------------------------------------------------------------------- /test-android/convert-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DISABLED_TESTS=(\ 4 | preset_pinning \ 5 | utf8_open \ 6 | sf3_sfont_loading \ 7 | sample_cache \ 8 | sfont_loading \ 9 | preset_sample_loading \ 10 | sfont_unloading \ 11 | sample_rate_change \ 12 | bug_635 \ 13 | ) 14 | 15 | rm -f test-names.txt 16 | mkdir -p app/src/main/cpp/tests/ 17 | 18 | for f in `grep -lR "int main(void)" ../test/ | sort` ; do 19 | export TESTMAINNAME=`echo $f | sed -e "s/\.\.\/test\/test_\(.*\).c$/\1/"` 20 | echo $TESTMAINNAME >> test-names.txt 21 | export OUTPUTFILE=app/src/main/cpp/tests/test_${TESTMAINNAME}.c 22 | sed -e "s/int main(void)/int "$TESTMAINNAME"_main(void)/" $f > $OUTPUTFILE ; 23 | done 24 | 25 | RUN_ALL_TESTS=app/src/main/cpp/run_all_tests.c 26 | 27 | rm -f $RUN_ALL_TESTS 28 | 29 | while IFS= read -r line; do 30 | echo "int "$line"_main();" >> $RUN_ALL_TESTS ; 31 | done < test-names.txt 32 | 33 | echo "int run_all_fluidsynth_tests() {" >> $RUN_ALL_TESTS 34 | echo " int ret = 0; " >> $RUN_ALL_TESTS 35 | 36 | while IFS= read -r line; do 37 | if [[ " ${DISABLED_TESTS[@]} " =~ " ${line} " ]]; then 38 | echo " //ret += "$line"_main();" >> $RUN_ALL_TESTS ; 39 | else 40 | echo " ret += "$line"_main();" >> $RUN_ALL_TESTS ; 41 | fi 42 | done < test-names.txt 43 | 44 | echo " return ret;" >> $RUN_ALL_TESTS 45 | echo "}" >> $RUN_ALL_TESTS 46 | -------------------------------------------------------------------------------- /test-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /test-android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test-android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 27 19:17:18 JST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /test-android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /test-android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "fluidsynth-tests" 2 | include ':app' 3 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | 2 | This directory contains small executables to verify fluidsynths correct behaviour, i.e. unit tests. 3 | 4 | #### Do *not* blindly use the tests as template for your application! 5 | 6 | Although some tests might serve as educational demonstration of how to use certain parts of fluidsynth, 7 | they are **not** intended to do so! It is most likely that those tests will consist of many hacky parts 8 | that are necessary to test fluidsynth (e.g. including fluidsynth's private headers to access internal 9 | data types and functions). For user applications this programming style is strongly discouraged! 10 | Keep referring to the documentation and code examples listed in the [API documentation](https://www.fluidsynth.org/api/). 11 | 12 | #### Developers 13 | 14 | To add a unit test just duplicate an existing one, give it a unique name and update the CMakeLists.txt by 15 | 16 | * adding a call to `ADD_FLUID_TEST()` and 17 | * a dependency to the custom `check` target. 18 | 19 | Execute the tests via `make check`. Unit tests should use the `VintageDreamsWaves-v2.sf2` as test soundfont. 20 | Use the `TEST_SOUNDFONT` macro to access it. 21 | -------------------------------------------------------------------------------- /test/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | project(consuming_test LANGUAGES C) 3 | 4 | find_package(FluidSynth CONFIG REQUIRED) 5 | 6 | add_executable(main main.c) 7 | 8 | target_link_libraries(main PRIVATE FluidSynth::libfluidsynth) 9 | -------------------------------------------------------------------------------- /test/cmake/README.md: -------------------------------------------------------------------------------- 1 | This CMake project checks that Fluidsynth can be imported through `find_package` and link properly. 2 | -------------------------------------------------------------------------------- /test/cmake/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char* argv[]) { 5 | /* We use any function from the API to ensure the linker does not skip the library */ 6 | fluid_settings_t *settings = new_fluid_settings(); 7 | delete_fluid_settings(settings); 8 | return EXIT_SUCCESS; 9 | } 10 | -------------------------------------------------------------------------------- /test/test.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "config.h" 5 | #include 6 | #include 7 | 8 | /* 9 | * We call abort() because on Linux this sends a signal to the process and causes the debugger to break. 10 | * 11 | * MSVC++ runtime opens a dialog when abort() is called, saying that abort() has been called and you can 12 | * click "Retry" to make the debugger break. 13 | * When executed by CI build however, the dialog causes the unit tests to be stuck forever. 14 | * Thus suppress the dialog on windows. 15 | * MinGW however requires explicit linking against MSVCRT >= 8.0 for _set_abort_behavior(). 16 | * It's not worth the hassle to implement this with cmake... 17 | */ 18 | #if defined(NO_GUI) && defined(MINGW32) 19 | #define TEST_ABORT exit(EXIT_FAILURE); 20 | #elif defined(NO_GUI) && defined(_WIN32) 21 | #define TEST_ABORT _set_abort_behavior(0, _WRITE_ABORT_MSG); abort() 22 | #else 23 | #define TEST_ABORT abort() 24 | #endif 25 | 26 | #define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d assertion (%s) failed\n", __LINE__, #COND); TEST_ABORT; } } while (0) 27 | 28 | /* macro to test whether a fluidsynth function succeeded or not */ 29 | #define TEST_SUCCESS(FLUID_FUNCT) TEST_ASSERT((FLUID_FUNCT) != FLUID_FAILED) 30 | -------------------------------------------------------------------------------- /test/test_bug_635.c: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "fluidsynth.h" 3 | #include "sfloader/fluid_sfont.h" 4 | #include "sfloader/fluid_defsfont.h" 5 | #include "utils/fluid_sys.h" 6 | #include "utils/fluid_list.h" 7 | 8 | // load our sf2 and sf3 test soundfonts, with and without dynamic sample loading 9 | int main(void) 10 | { 11 | int id[2], sfcount, i; 12 | 13 | fluid_synth_t *synth; 14 | fluid_settings_t *settings = new_fluid_settings(); 15 | 16 | fluid_settings_setint(settings, "synth.dynamic-sample-loading", 1); 17 | synth = new_fluid_synth(settings); 18 | id[0] = fluid_synth_sfload(synth, TEST_SOUNDFONT, 0); 19 | sfcount = fluid_synth_sfcount(synth); 20 | 21 | TEST_ASSERT(id[0] != FLUID_FAILED); 22 | TEST_ASSERT(sfcount == 1); 23 | 24 | for(i = 0; i < sfcount; i++) 25 | { 26 | fluid_preset_t *preset; 27 | fluid_list_t *list; 28 | 29 | fluid_sfont_t *sfont = fluid_synth_get_sfont_by_id(synth, id[i]); 30 | fluid_defsfont_t *defsfont = fluid_sfont_get_data(sfont); 31 | 32 | /* Make sure we have the right number of presets */ 33 | fluid_sfont_iteration_start(sfont); 34 | 35 | while((preset = fluid_sfont_iteration_next(sfont)) != NULL) 36 | { 37 | // Try to start a voice with a preset that has not been selected on any channel (bug #635) 38 | 39 | // ignore return value check on fluid_synth_start 40 | fluid_synth_start(synth, 0, preset, 0, 1, 60, 127); 41 | 42 | // fluidsynth < 2.1.3 would crash here 43 | TEST_SUCCESS(fluid_synth_process(synth, 1024, 0, NULL, 0, NULL)); 44 | 45 | fluid_synth_stop(synth, 0); 46 | } 47 | 48 | for(list = defsfont->sample; list; list = fluid_list_next(list)) 49 | { 50 | fluid_sample_t *sample = fluid_list_get(list); 51 | fluid_voice_t *v; 52 | 53 | v = fluid_synth_alloc_voice(synth, sample, 0, 60, 127); 54 | 55 | fluid_synth_start_voice(synth, v); 56 | 57 | // fluidsynth < 2.1.3 would crash here 58 | TEST_SUCCESS(fluid_synth_process(synth, 1024, 0, NULL, 0, NULL)); 59 | 60 | // make sure the voice was NULL, no need for fluid_synth_stop() here 61 | TEST_ASSERT(v == NULL); 62 | } 63 | } 64 | 65 | /* teardown */ 66 | delete_fluid_synth(synth); 67 | delete_fluid_settings(settings); 68 | 69 | return EXIT_SUCCESS; 70 | } 71 | -------------------------------------------------------------------------------- /test/test_ct2hz.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "utils/fluid_conv.h" 4 | #include "utils/fluid_conv_tables.h" 5 | #include "utils/fluid_sys.h" 6 | 7 | // this test makes sure FLUID_SNPRINTF uses a proper C99 compliant implementation 8 | 9 | int float_eq(double x, double y) 10 | { 11 | static const double EPS = 1e-3; 12 | double diff = (x - y) / fmax(y,x); 13 | int ok = fabs(diff) < EPS; 14 | if(!ok) 15 | { 16 | FLUID_LOG(FLUID_INFO, "Comparing %.9f and %.9f failed, diff is %.9f", x, y, diff); 17 | } 18 | return ok; 19 | } 20 | 21 | int main(void) 22 | { 23 | int i; 24 | // 440 * 2^((x-6900)/1200) where x is the cent value given to ct2hz() 25 | 26 | TEST_ASSERT(float_eq(fluid_ct2hz_real(13500), 19912.12695821317828712777723687254894626098)); 27 | 28 | TEST_ASSERT(float_eq(fluid_ct2hz_real(12900), 14080)); 29 | TEST_ASSERT(float_eq(fluid_ct2hz_real(12899), 14071.86942151064095341800489737387241797607)); 30 | 31 | TEST_ASSERT(float_eq(fluid_ct2hz_real(12700), 12543.85395141597741074238497471441611245995)); 32 | TEST_ASSERT(float_eq(fluid_ct2hz_real(6900), 440)); 33 | TEST_ASSERT(float_eq(fluid_ct2hz_real(5700), 220)); 34 | TEST_ASSERT(float_eq(fluid_ct2hz_real(4500), 110)); 35 | 36 | TEST_ASSERT(float_eq(fluid_ct2hz_real(901), 13.7579446057151293153308979171569743434390204)); 37 | TEST_ASSERT(float_eq(fluid_ct2hz_real(900), 13.75)); 38 | TEST_ASSERT(float_eq(fluid_ct2hz_real(899), 13.7420599819439853060722704075916722831797578)); 39 | 40 | TEST_ASSERT(float_eq(fluid_ct2hz_real(1), 8.1805228064648688650522010380302841769481091116)); 41 | TEST_ASSERT(float_eq(fluid_ct2hz_real(0), 8.1757989156437073336828122976032719176391831357)); // often referred to as Absolute zero in the SF2 spec 42 | 43 | TEST_ASSERT(float_eq(fluid_ct2hz_real(-725), fluid_act2hz(-725))); 44 | TEST_ASSERT(float_eq(fluid_ct2hz_real(-14700), fluid_act2hz(-14700))); 45 | TEST_ASSERT(float_eq(fluid_ct2hz_real(-15900), fluid_act2hz(-15900))); 46 | 47 | // Test the entire possible range: from lowest permitted value of MODLFOFREQ up to filter fc limit 48 | for(i = -16000*1000; i < 13500*1000; i++) 49 | { 50 | TEST_ASSERT(float_eq(fluid_ct2hz_real(i/1000.0), fluid_act2hz(i/1000.0))); 51 | } 52 | return EXIT_SUCCESS; 53 | } 54 | -------------------------------------------------------------------------------- /test/test_fast_render.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" 4 | #include "utils/fluid_sys.h" 5 | 6 | 7 | // this tests fast file rendering and libsndfile output 8 | int main(void) 9 | { 10 | int id; 11 | fluid_settings_t *settings; 12 | fluid_synth_t *synth; 13 | fluid_player_t *player; 14 | fluid_file_renderer_t *renderer; 15 | 16 | settings = new_fluid_settings(); 17 | synth = new_fluid_synth(settings); 18 | 19 | TEST_ASSERT(settings != NULL); 20 | TEST_ASSERT(synth != NULL); 21 | 22 | // no sfont loaded 23 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 24 | 25 | TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_1) == TRUE); 26 | TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_1, 1)); 27 | 28 | fluid_settings_setstr(settings, "audio.file.name", TEST_WAV_UTF8); 29 | 30 | player = new_fluid_player(synth); 31 | TEST_ASSERT(player != NULL); 32 | 33 | TEST_ASSERT(fluid_is_midifile(TEST_MIDI_UTF8) == TRUE); 34 | TEST_SUCCESS(fluid_player_add(player, TEST_MIDI_UTF8)); 35 | 36 | renderer = new_fluid_file_renderer(synth); 37 | TEST_ASSERT(renderer != NULL); 38 | 39 | TEST_SUCCESS(fluid_player_play(player)); 40 | 41 | while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING) 42 | { 43 | if (fluid_file_renderer_process_block(renderer) != FLUID_OK) 44 | { 45 | break; 46 | } 47 | } 48 | 49 | delete_fluid_file_renderer(renderer); 50 | delete_fluid_player(player); 51 | delete_fluid_synth(synth); 52 | delete_fluid_settings(settings); 53 | 54 | FILE *file; 55 | file = FLUID_FOPEN(TEST_WAV_UTF8, "rb"); 56 | TEST_ASSERT(file != NULL); 57 | TEST_ASSERT(FLUID_FCLOSE(file) == 0); 58 | 59 | return EXIT_SUCCESS; 60 | } 61 | -------------------------------------------------------------------------------- /test/test_jack_obtaining_synth.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" 4 | #include "fluid_adriver.h" 5 | 6 | // The jack driver may need the synth instance to adjust the sample-rate in case it mismatches with 7 | // the sample-rate of the jack driver. However, new_fluid_audio_driver2() does not receive a synth pointer. 8 | // Thus looking up the synth instance must be done via the settings object. 9 | int main(void) 10 | { 11 | #if JACK_SUPPORT 12 | fluid_synth_t *obtained_synth; 13 | fluid_synth_t *expected_synth; 14 | fluid_settings_t *settings = new_fluid_settings(); 15 | TEST_ASSERT(settings != NULL); 16 | 17 | expected_synth = new_fluid_synth(settings); 18 | TEST_ASSERT(expected_synth != NULL); 19 | 20 | TEST_SUCCESS(fluid_jack_obtain_synth(settings, &obtained_synth)); 21 | TEST_ASSERT(obtained_synth == expected_synth); 22 | 23 | delete_fluid_synth(obtained_synth); 24 | delete_fluid_settings(settings); 25 | 26 | obtained_synth = expected_synth = NULL; 27 | 28 | settings = new_fluid_settings(); 29 | TEST_ASSERT(settings != NULL); 30 | TEST_ASSERT(fluid_jack_obtain_synth(settings, &obtained_synth) == FLUID_FAILED); 31 | delete_fluid_settings(settings); 32 | #endif 33 | return EXIT_SUCCESS; 34 | } 35 | -------------------------------------------------------------------------------- /test/test_pointer_alignment.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "utils/fluid_sys.h" 4 | 5 | 6 | // test for fluid_align_ptr() 7 | int main(void) 8 | { 9 | unsigned int align; 10 | uintptr_t ptr, aligned_ptr; 11 | 12 | for(align = 32; align <= 4 * 1024u; align <<= 1) 13 | { 14 | for(ptr = 0; ptr <= (align << 10); ptr++) 15 | { 16 | char *tmp = fluid_align_ptr((char *)ptr, align); 17 | aligned_ptr = (uintptr_t)tmp; 18 | 19 | // pointer must be aligned properly 20 | TEST_ASSERT(aligned_ptr % align == 0); 21 | 22 | // aligned pointer must not be smaller than ptr 23 | TEST_ASSERT(aligned_ptr >= ptr); 24 | 25 | // aligned pointer must not be bigger than alignment 26 | TEST_ASSERT(aligned_ptr < ptr + align); 27 | } 28 | } 29 | 30 | return EXIT_SUCCESS; 31 | } 32 | -------------------------------------------------------------------------------- /test/test_sample_cache.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" // use local fluidsynth header 4 | #include "utils/fluid_sys.h" 5 | 6 | 7 | // this test aims to make sure that sample data used by multiple synths is not freed 8 | // once unloaded by its parent synth 9 | int main(void) 10 | { 11 | enum { FRAMES = 1024 }; 12 | float buf[FRAMES * 2]; 13 | 14 | fluid_settings_t *settings = new_fluid_settings(); 15 | fluid_synth_t *synth1 = new_fluid_synth(settings), 16 | *synth2 = new_fluid_synth(settings); 17 | 18 | TEST_ASSERT(settings != NULL); 19 | TEST_ASSERT(synth1 != NULL); 20 | TEST_ASSERT(synth2 != NULL); 21 | 22 | // load a sfont to synth1 23 | TEST_SUCCESS(fluid_synth_sfload(synth1, TEST_SOUNDFONT, 1)); 24 | 25 | // load the same font to synth2 and start a note 26 | TEST_SUCCESS(fluid_synth_sfload(synth2, TEST_SOUNDFONT, 1)); 27 | TEST_SUCCESS(fluid_synth_noteon(synth2, 0, 60, 127)); 28 | 29 | // render some audio 30 | TEST_SUCCESS(fluid_synth_write_float(synth2, FRAMES, buf, 0, 2, buf, 1, 2)); 31 | 32 | // delete the synth that owns the soundfont 33 | delete_fluid_synth(synth1); 34 | 35 | // render again with the unloaded sfont and hope no segfault happens 36 | TEST_SUCCESS(fluid_synth_write_float(synth2, FRAMES, buf, 0, 2, buf, 1, 2)); 37 | 38 | delete_fluid_synth(synth2); 39 | delete_fluid_settings(settings); 40 | 41 | return EXIT_SUCCESS; 42 | } 43 | -------------------------------------------------------------------------------- /test/test_sample_rate_change.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" 4 | #include "synth/fluid_synth.h" 5 | #include "synth/fluid_voice.h" 6 | #include "rvoice/fluid_rvoice.h" 7 | #include "utils/fluid_sys.h" 8 | 9 | static void verify_sample_rate(fluid_synth_t *synth, int expected_srate) 10 | { 11 | int i; 12 | 13 | TEST_ASSERT(synth->sample_rate == expected_srate); 14 | 15 | for(i = 0; i < synth->polyphony; i++) 16 | { 17 | TEST_ASSERT(synth->voice[i]->output_rate == expected_srate); 18 | TEST_ASSERT(synth->voice[i]->rvoice->dsp.output_rate == expected_srate); 19 | TEST_ASSERT(synth->voice[i]->overflow_rvoice->dsp.output_rate == expected_srate); 20 | } 21 | 22 | // TODO check fx, rvoice_mixer et. al.? 23 | } 24 | 25 | // this test should make sure that sample rate changed are handled correctly 26 | int main(void) 27 | { 28 | int polyphony; 29 | double sample_rate; 30 | 31 | fluid_settings_t *settings = new_fluid_settings(); 32 | fluid_synth_t *synth = new_fluid_synth(settings); 33 | 34 | TEST_ASSERT(settings != NULL); 35 | TEST_ASSERT(synth != NULL); 36 | 37 | TEST_SUCCESS(fluid_settings_getint(settings, "synth.polyphony", &polyphony)); 38 | TEST_ASSERT(polyphony == synth->polyphony); 39 | 40 | TEST_SUCCESS(fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate)); 41 | 42 | verify_sample_rate(synth, sample_rate); 43 | 44 | 45 | TEST_SUCCESS(fluid_synth_sfload(synth, TEST_SOUNDFONT, 1)); 46 | // play some notes to start some voices 47 | TEST_SUCCESS(fluid_synth_noteon(synth, 0, 60, 127)); 48 | TEST_SUCCESS(fluid_synth_noteon(synth, 2, 71, 127)); 49 | TEST_SUCCESS(fluid_synth_noteon(synth, 3, 82, 127)); 50 | 51 | verify_sample_rate(synth, sample_rate); 52 | 53 | // set srate to minimum allowed 54 | sample_rate = 8000; 55 | fluid_synth_set_sample_rate(synth, sample_rate); 56 | 57 | // manually dispatch rvoice events to get samples rates updated (this simulates the render thread) 58 | fluid_synth_process_event_queue(synth); 59 | 60 | verify_sample_rate(synth, sample_rate); 61 | 62 | delete_fluid_synth(synth); 63 | delete_fluid_settings(settings); 64 | 65 | return EXIT_SUCCESS; 66 | } 67 | -------------------------------------------------------------------------------- /test/test_seq_evt_order.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" // use local fluidsynth header 4 | #include "fluid_seq_queue.h" 5 | 6 | // simple test to ensure that manually unregistering and deleting the internal fluid_seqbind_t works without crashing 7 | int main(void) 8 | { 9 | fluid_event_t* evt1 = new_fluid_event(); 10 | fluid_event_t* evt2 = new_fluid_event(); 11 | 12 | fluid_event_set_time(evt1, 1); 13 | fluid_event_set_time(evt2, 1); 14 | 15 | // Note that event_compare() returns !leftIsBeforeRight 16 | 17 | TEST_ASSERT( !event_compare_for_test(evt1, evt1)); 18 | TEST_ASSERT( !event_compare_for_test(evt2, evt2)); 19 | 20 | fluid_event_bank_select(evt1, 0, 0); 21 | fluid_event_program_change(evt2, 0, 0); 22 | 23 | TEST_ASSERT( !event_compare_for_test(evt1, evt2)); 24 | TEST_ASSERT(!!event_compare_for_test(evt2, evt1)); 25 | 26 | fluid_event_note(evt1, 0, 0, 0, 1); 27 | 28 | TEST_ASSERT(!!event_compare_for_test(evt1, evt2)); 29 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 30 | 31 | fluid_event_noteon(evt1, 0, 0, 60); 32 | fluid_event_noteoff(evt2, 0, 0); 33 | 34 | TEST_ASSERT(!!event_compare_for_test(evt1, evt2)); 35 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 36 | 37 | // make sure noteons with vel=0 are handled like noteoffs 38 | fluid_event_noteon(evt1, 0, 0, 60); 39 | fluid_event_noteon(evt2, 0, 0, 0); 40 | 41 | TEST_ASSERT(!!event_compare_for_test(evt1, evt2)); 42 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 43 | 44 | // two noteoffs 45 | fluid_event_noteon(evt1, 0, 0, 0); 46 | fluid_event_noteoff(evt2, 0, 0); 47 | 48 | TEST_ASSERT( !event_compare_for_test(evt1, evt2)); 49 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 50 | 51 | fluid_event_unregistering(evt1); 52 | fluid_event_system_reset(evt2); 53 | 54 | TEST_ASSERT(!!event_compare_for_test(evt1, evt2)); 55 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 56 | 57 | fluid_event_unregistering(evt1); 58 | fluid_event_pan(evt2, 0, 0); 59 | 60 | TEST_ASSERT( !event_compare_for_test(evt1, evt2)); 61 | TEST_ASSERT(!!event_compare_for_test(evt2, evt1)); 62 | 63 | fluid_event_modulation(evt1, 0, 0); 64 | fluid_event_pan(evt2, 0, 0); 65 | 66 | TEST_ASSERT( !event_compare_for_test(evt1, evt2)); 67 | TEST_ASSERT( !event_compare_for_test(evt2, evt1)); 68 | 69 | delete_fluid_event(evt1); 70 | delete_fluid_event(evt2); 71 | 72 | return EXIT_SUCCESS; 73 | } 74 | -------------------------------------------------------------------------------- /test/test_seqbind_unregister.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" // use local fluidsynth header 4 | 5 | static void test_unregister_with_event(fluid_synth_t *synth) 6 | { 7 | fluid_sequencer_t *seq = new_fluid_sequencer2(0 /*i.e. use sample timer*/); 8 | 9 | // silently creates a fluid_seqbind_t 10 | int seqid = fluid_sequencer_register_fluidsynth(seq, synth); 11 | 12 | fluid_event_t *evt = new_fluid_event(); 13 | fluid_event_set_source(evt, -1); 14 | fluid_event_set_dest(evt, seqid); 15 | 16 | // manually free the fluid_seqbind_t 17 | fluid_event_unregistering(evt); 18 | fluid_sequencer_send_now(seq, evt); 19 | 20 | // client should be removed, deleting the seq should not free the struct again 21 | delete_fluid_event(evt); 22 | delete_fluid_sequencer(seq); 23 | } 24 | 25 | static void test_unregister_with_client_unregister(fluid_synth_t *synth) 26 | { 27 | fluid_sequencer_t *seq = new_fluid_sequencer2(0 /*i.e. use sample timer*/); 28 | 29 | // silently creates a fluid_seqbind_t 30 | int seqid = fluid_sequencer_register_fluidsynth(seq, synth); 31 | fluid_sequencer_unregister_client(seq, seqid); 32 | 33 | // client should be removed, deleting the seq should not free the struct again 34 | delete_fluid_sequencer(seq); 35 | } 36 | 37 | static void test_unregister_without_unregister(fluid_synth_t *synth) 38 | { 39 | fluid_sequencer_t *seq = new_fluid_sequencer2(0 /*i.e. use sample timer*/); 40 | 41 | // silently creates a fluid_seqbind_t 42 | fluid_sequencer_register_fluidsynth(seq, synth); 43 | 44 | // client should be removed 45 | delete_fluid_sequencer(seq); 46 | } 47 | 48 | // test to ensure that unregistering and deleting the internal fluid_seqbind_t works without double-free 49 | // 50 | // valgrind should be used to ensure that there are no memory leaks 51 | int main(void) 52 | { 53 | fluid_settings_t *settings = new_fluid_settings(); 54 | fluid_synth_t *synth = new_fluid_synth(settings); 55 | 56 | test_unregister_with_event(synth); 57 | test_unregister_with_client_unregister(synth); 58 | test_unregister_without_unregister(synth); 59 | 60 | delete_fluid_synth(synth); 61 | delete_fluid_settings(settings); 62 | 63 | return EXIT_SUCCESS; 64 | } 65 | -------------------------------------------------------------------------------- /test/test_sf3_sfont_loading.c: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "fluidsynth.h" 3 | #include "sfloader/fluid_sfont.h" 4 | #include "utils/fluid_sys.h" 5 | 6 | 7 | int main(void) 8 | { 9 | int id; 10 | fluid_sfont_t *sfont; 11 | 12 | fluid_settings_t *settings = new_fluid_settings(); 13 | fluid_synth_t *synth = new_fluid_synth(settings); 14 | 15 | TEST_ASSERT(settings != NULL); 16 | TEST_ASSERT(synth != NULL); 17 | 18 | // no sfont loaded 19 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 20 | 21 | FLUID_LOG(FLUID_INFO, "Attempt to open %s", TEST_SOUNDFONT_SF3); 22 | 23 | // load a sfont to synth 24 | TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_SF3, 1)); 25 | 26 | // one sfont loaded 27 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 28 | 29 | sfont = fluid_synth_get_sfont_by_id(synth, id); 30 | TEST_ASSERT(sfont != NULL); 31 | 32 | // this is still the same filename as we've put in 33 | TEST_ASSERT(FLUID_STRCMP(TEST_SOUNDFONT_SF3, fluid_sfont_get_name(sfont)) == 0); 34 | TEST_ASSERT(fluid_sfont_get_id(sfont) == id); 35 | 36 | // still the same id? 37 | TEST_ASSERT(fluid_synth_sfreload(synth, id) == id); 38 | // one sfont loaded 39 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 40 | 41 | sfont = fluid_synth_get_sfont_by_id(synth, id); 42 | TEST_ASSERT(sfont != NULL); 43 | 44 | // still the same filename? 45 | TEST_ASSERT(FLUID_STRCMP(TEST_SOUNDFONT_SF3, fluid_sfont_get_name(sfont)) == 0); 46 | // correct id stored? 47 | TEST_ASSERT(fluid_sfont_get_id(sfont) == id); 48 | 49 | // remove the sfont without deleting 50 | TEST_SUCCESS(fluid_synth_remove_sfont(synth, sfont)); 51 | 52 | // no sfont loaded 53 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 54 | 55 | // re-add the sfont without deleting 56 | TEST_SUCCESS(id = fluid_synth_add_sfont(synth, sfont)); 57 | 58 | // one sfont loaded 59 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 60 | 61 | // destroy the sfont 62 | TEST_SUCCESS(fluid_synth_sfunload(synth, id, 0)); 63 | // no sfont loaded 64 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 65 | 66 | delete_fluid_synth(synth); 67 | delete_fluid_settings(settings); 68 | 69 | return EXIT_SUCCESS; 70 | } 71 | -------------------------------------------------------------------------------- /test/test_sfont_loading.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" 4 | #include "sfloader/fluid_sfont.h" 5 | #include "sfloader/fluid_defsfont.h" 6 | #include "utils/fluid_sys.h" 7 | 8 | 9 | // this tests the soundfont loading API of the synth. 10 | // might be expanded to test the soundfont loader as well... 11 | int main(void) 12 | { 13 | int id; 14 | fluid_sfont_t *sfont; 15 | fluid_defsfont_t *defsfont; 16 | 17 | fluid_settings_t *settings = new_fluid_settings(); 18 | fluid_synth_t *synth = new_fluid_synth(settings); 19 | 20 | TEST_ASSERT(settings != NULL); 21 | TEST_ASSERT(synth != NULL); 22 | 23 | // no sfont loaded 24 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 25 | 26 | TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT) == TRUE); 27 | 28 | // load a sfont to synth 29 | TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT, 1)); 30 | // one sfont loaded 31 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 32 | TEST_ASSERT((sfont = fluid_synth_get_sfont_by_id(synth, id)) != NULL); 33 | 34 | // this is still the same filename as we've put in 35 | TEST_ASSERT(FLUID_STRCMP(TEST_SOUNDFONT, fluid_sfont_get_name(sfont)) == 0); 36 | TEST_ASSERT(fluid_sfont_get_id(sfont) == id); 37 | 38 | // still the same id? 39 | TEST_ASSERT(fluid_synth_sfreload(synth, id) == id); 40 | // one sfont loaded 41 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 42 | TEST_ASSERT((sfont = fluid_synth_get_sfont_by_id(synth, id)) != NULL); 43 | 44 | // still the same filename? 45 | TEST_ASSERT(FLUID_STRCMP(TEST_SOUNDFONT, fluid_sfont_get_name(sfont)) == 0); 46 | // correct id stored? 47 | TEST_ASSERT(fluid_sfont_get_id(sfont) == id); 48 | 49 | // remove the sfont without deleting 50 | TEST_SUCCESS(fluid_synth_remove_sfont(synth, sfont)); 51 | // no sfont loaded 52 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 53 | 54 | // re-add the sfont without deleting 55 | TEST_SUCCESS(id = fluid_synth_add_sfont(synth, sfont)); 56 | // one sfont loaded 57 | TEST_ASSERT(fluid_synth_sfcount(synth) == 1); 58 | 59 | // count the number of presets, instruments, samples 60 | defsfont = fluid_sfont_get_data(sfont); 61 | TEST_ASSERT(fluid_list_size(defsfont->preset) == 136); 62 | TEST_ASSERT(fluid_list_size(defsfont->sample) == 124-1); // SineWave ROM sample ignored 63 | TEST_ASSERT(fluid_list_size(defsfont->inst) == 238); 64 | 65 | // destroy the sfont 66 | TEST_SUCCESS(fluid_synth_sfunload(synth, id, 0)); 67 | // no sfont loaded 68 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 69 | 70 | delete_fluid_synth(synth); 71 | delete_fluid_settings(settings); 72 | 73 | return EXIT_SUCCESS; 74 | } 75 | -------------------------------------------------------------------------------- /test/test_snprintf.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "utils/fluid_sys.h" 4 | 5 | // this test makes sure FLUID_SNPRINTF uses a proper C99 compliant implementation 6 | 7 | int main(void) 8 | { 9 | char buf[2 + 1]; 10 | 11 | int ret = FLUID_SNPRINTF(buf, sizeof(buf), "99"); 12 | TEST_ASSERT(ret == 2); 13 | 14 | TEST_ASSERT(buf[2] == '\0'); 15 | 16 | ret = FLUID_SNPRINTF(buf, sizeof(buf), "999"); 17 | TEST_ASSERT(ret == 3); 18 | 19 | // output truncated, buffer must be NULL terminated! 20 | TEST_ASSERT(buf[2] == '\0'); 21 | 22 | return EXIT_SUCCESS; 23 | } 24 | -------------------------------------------------------------------------------- /test/test_utf8_open.c: -------------------------------------------------------------------------------- 1 | 2 | #include "test.h" 3 | #include "fluidsynth.h" 4 | #include "utils/fluid_sys.h" 5 | 6 | 7 | // this tests utf-8 file handling by loading the test .sf2 file 8 | // manually and through the soundfont-related APIs 9 | int main(void) 10 | { 11 | int id; 12 | fluid_settings_t *settings; 13 | fluid_synth_t *synth; 14 | fluid_player_t *player; 15 | 16 | FILE *file; 17 | file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_1, "rb"); 18 | TEST_ASSERT(file != NULL); 19 | TEST_ASSERT(FLUID_FCLOSE(file) == 0); 20 | 21 | file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_2, "rb"); 22 | TEST_ASSERT(file != NULL); 23 | TEST_ASSERT(FLUID_FCLOSE(file) == 0); 24 | 25 | file = FLUID_FOPEN(TEST_MIDI_UTF8, "rb"); 26 | TEST_ASSERT(file != NULL); 27 | TEST_ASSERT(FLUID_FCLOSE(file) == 0); 28 | 29 | settings = new_fluid_settings(); 30 | synth = new_fluid_synth(settings); 31 | 32 | TEST_ASSERT(settings != NULL); 33 | TEST_ASSERT(synth != NULL); 34 | 35 | // no sfont loaded 36 | TEST_ASSERT(fluid_synth_sfcount(synth) == 0); 37 | 38 | TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_1) == TRUE); 39 | TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_1, 1)); 40 | 41 | TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_2) == TRUE); 42 | TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_2, 1)); 43 | 44 | player = new_fluid_player(synth); 45 | TEST_ASSERT(player != NULL); 46 | 47 | TEST_ASSERT(fluid_is_midifile(TEST_MIDI_UTF8) == TRUE); 48 | TEST_SUCCESS(fluid_player_add(player, TEST_MIDI_UTF8)); 49 | 50 | delete_fluid_player(player); 51 | delete_fluid_synth(synth); 52 | delete_fluid_settings(settings); 53 | 54 | return EXIT_SUCCESS; 55 | } 56 | -------------------------------------------------------------------------------- /test/èmpty.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test/èmpty.mid -------------------------------------------------------------------------------- /test/ⓉⒺⓈⓉ.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolcanoMobile/fluidsynth-android/317b1d275a5a2a80d21934140e7b06a89320d161/test/ⓉⒺⓈⓉ.mid --------------------------------------------------------------------------------