Commit graph

184 commits

Author SHA1 Message Date
Pedro López-Cabanillas
66b77bfb6f
cmake modernization, tasks 1 & 2 (#970)
* raised cmake_minimum_required ( VERSION 3.13 )
* removed other CMAKE_VERSION checks
* fixed overlinking of library, cmdline client, and unit tests
2021-09-03 12:21:05 +02:00
Pedro López-Cabanillas
ebed81099d Clarifications 2021-09-01 21:03:10 +02:00
Pedro López-Cabanillas
7ca3407d30 fixes and simplifications
* FluidSynthConfigVersion.cmake is created with ${VERSION} instead of
${LIB_VERSION_INFO}
* FluidSynthConfig.cmake.in simplified: it doesn't need to include the
version file.
* Simplified BUILD_INTERFACE generator expression as suggested
2021-09-01 21:00:30 +02:00
Pedro López-Cabanillas
ad4f1b9191 cmake: export targets
The build system creates two exported targets:
- The executable FluidSynth::fluidsynth
- The library FluidSynth::libfluidsynth

A downstream project using CMake can find and link the library target
directly with cmake (without needing pkg-config) this way:

~~~
project(sample LANGUAGES C)
find_package ( FluidSynth )
if (FluidSynth_FOUND)
  add_executable( sample sample.c )
  target_link_libraries ( sample PRIVATE FluidSynth::libfluidsynth )
endif ()
~~~

After installing fluidsynth in a prefix like "$HOME/Fluidsynth3":
cmake -DCNAKE_PREFIX_PATH="$HOME/Fluidsynth3/;..."

Instead installing, the build directory can be used directly, for
instance:

cmake -DFluidSynth_DIR="$HOME/fluidsynth-2.2.2/build/" ...
2021-09-01 21:00:18 +02:00
derselbst
e6ce0f4845 Remove fluidsynth.spec.in in favor of contrib/fluidsynth.spec 2021-09-01 19:53:58 +02:00
Tom M
fab1ca1ca9
Revert "cmake: export targets" 2021-08-30 16:07:53 +02:00
derselbst
fefd22a9d6 Remove fluidsynth.spec.in in favor of contrib/fluidsynth.spec 2021-08-28 23:23:34 +02:00
Pedro López-Cabanillas
f023d7e014 Reverted PRIVATE in target_link_libraries() and clarifications 2021-08-02 11:31:43 +02:00
Pedro López-Cabanillas
64a7787e90 fixes and simplifications
* FluidSynthConfigVersion.cmake is created with ${VERSION} instead of
${LIB_VERSION_INFO}
* FluidSynthConfig.cmake.in simplified: it doesn't need to include the
version file.
* Simplified BUILD_INTERFACE generator expression as suggested
2021-08-02 11:31:43 +02:00
Pedro López-Cabanillas
cf5fbac9af cmake: export targets
The build system creates two exported targets:
- The executable FluidSynth::fluidsynth
- The library FluidSynth::libfluidsynth

A downstream project using CMake can find and link the library target
directly with cmake (without needing pkg-config) this way:

~~~
project(sample LANGUAGES C)
find_package ( FluidSynth )
if (FluidSynth_FOUND)
  add_executable( sample sample.c )
  target_link_libraries ( sample PRIVATE FluidSynth::libfluidsynth )
endif ()
~~~

After installing fluidsynth in a prefix like "$HOME/Fluidsynth3":
cmake -DCNAKE_PREFIX_PATH="$HOME/Fluidsynth3/;..."

Instead installing, the build directory can be used directly, for
instance:

cmake -DFluidSynth_DIR="$HOME/fluidsynth-2.2.2/build/" ...
2021-08-02 11:31:43 +02:00
Tom M
8e56188316
Define socklen_t in according to a feature test (#949)
Co-authored-by: KO Myung-Hun <komh@chollian.net>
2021-07-28 11:00:27 +02:00
Tom M
ec6d563c39
Fix VERSION_GREATER_EQUAL for CMAKE < v3.7 (#950)
VERSION_GREATER_EQUAL was introduced in CMAKE v3.7.

Co-authored-by: KO Myung-Hun <komh@chollian.net>
2021-07-28 10:49:57 +02:00
Ghabry
0e3411cba4 Emscripten: --as-needed is not supported 2021-07-19 00:36:31 +02:00
Ghabry
475f902584 Fix emscripten: Append CMAKE_MODULE_PATH instead of overwriting it
Emscripten adds a custom CMAKE_MODULE_PATH in the toolchain file.
Without these modules TestBigEndian fails.
2021-07-19 00:27:34 +02:00
Tom M
fc21d284dc
Fix Fluidsynth.pc doesn't include static libraries (#933) 2021-07-11 17:37:54 +02:00
luz paz
e4c8ef080c Fix source comment typos
Found via `codespell -q 3 -S ChangeLog -L bloc,blocs,capela,parms,readd,seh`
2021-07-10 08:44:35 -04:00
derselbst
aa2561d091 Bump to 2.2.2 2021-07-09 21:56:04 +02:00
Tom M
95e3693779
Fix linkage of openMP for XCode 12.5 (#919) 2021-06-22 09:23:19 +02:00
Tom M
148cec6c03
Do not stringify cmake variable in if clause (#895) 2021-05-26 14:19:25 +02:00
Tom M
a28a5e6d20
Improve OGG/Vorbis detection (#888)
Previously, cmake only tested for a specific version of libsndfile and then assumed, it has OGG/Vorbis support. However, libsndfile may still be compiled without OGG/Vorbis support. If this is the case, fluidsynth should refuse to load SF3 files. Otherwise the attempt to load SF3 files would fail with a bunch of error messages.

The solution of this PR proposes to lookup the private libs listed in sndfile.pc and see whether it includes "vorbis".
2021-05-12 21:09:33 +02:00
Tom M
8446023255
Add more test cases for UTF8 filenames (#889) 2021-05-12 17:41:55 +02:00
derselbst
532c3e066f Bump to 2.2.1 2021-05-08 18:30:07 +02:00
Tom M
4231645fb8
Define _WIN32_WINNT during compilation (#871) 2021-05-07 09:45:17 +02:00
Carlo Bramini
10510e486b
[WINDOWS] Fix declaration of GUIDs (try 2). (#868)
Supersedes and closes #867.
2021-04-29 21:03:19 +02:00
Tom M
c8c3966586
Use CHECK_SYMBOL_EXISTS when probing for functions (#859) 2021-04-25 14:49:03 +02:00
derselbst
b990f765c2 Remove statically linked CRT workaround
Leave it to the user to override CMAKE_MSVC_RUNTIME_LIBRARY.
2021-04-13 21:12:25 +02:00
Tom M
ddb13e36c5
Collect coverage during test execution (#825) 2021-04-03 17:34:48 +02:00
derselbst
3f5394a15d Bump version to 2.2.0 2021-03-27 17:46:01 +01:00
derselbst
14ab1ec6ab Merge branch '2.1.x' into master 2021-03-13 18:32:41 +01:00
derselbst
2c1561ea18 Bump to 2.1.8 2021-03-13 18:24:28 +01:00
Tom M
8745f542c2
Merge pull request #747 from FluidSynth/oboe-phil
Update Oboe driver
2021-02-06 10:43:07 +01:00
Chris Xiong
712707fe87
Add WASAPI driver. (#754)
This driver is currently tested and verified to work on:
 - Windows Vista x64 VM
 - Windows 7 x64 VM
 - Windows 10 1909 x64 (VM and Laptop)
 - Windows 10 21296 x64 on a ThinkPad X1 Yoga 1st Gen with 3 different sound cards (Conexant CX20753/4, Scarlett Solo Gen 2, Aureon 7.1 USB)

This driver is capable of reaching very low latency in exclusive mode (~6ms on Scarlett Solo with 48kHz).
2021-01-29 18:11:17 +01:00
derselbst
b84e8b83e0 Merge branch '2.1.x' into master 2021-01-29 14:42:04 +01:00
derselbst
e2d67ea772 Bump to 2.1.7 2021-01-29 14:37:27 +01:00
derselbst
2cfd56bb10 Modernize Oboe driver 2021-01-19 18:48:52 +01:00
derselbst
e04cd572cb Merge branch '2.1.x' into master 2021-01-03 21:37:32 +01:00
derselbst
26710f1076 Bump to 2.1.6 2021-01-01 21:26:12 +01:00
getraid-gg
1cdeebef37 Enable the use of UTF-8 filenames under Windows (#718)
While `fopen` (used through the macro `FLUID_FOPEN`) uses UTF-8 on *nix, it's restricted to ANSI on Windows. A change to enable using paths containing non-ANSI characters was suggested before in issue #128 but was rejected due to requiring large parts of both the public API and private implementation to be modified to accommodate Windows.

This PR instead changes the macro definition for `FLUID_FOPEN` from `fopen` to a new wrapper, `fluid_fopen`. This wrapper is defined in `fluidsynth_priv.h` and defined in `fluid_sys.c` (following the pattern of `fluid_alloc`). Under Windows, it converts the `const char*` UTF-8 parameters to Unicode `wchar_t*` strings using the Windows API function `MultiByteToWideChar` and opens the file using the Windows API-specific `_wfopen`. On all other platforms, it simply calls `fopen`.

The public API is unchanged. This solution will require Windows users of the API to convert UTF-16 strings to UTF-8 (which then get converted back into UTF-16 anyway), but that's still an improvement over only being able to use ANSI paths.

This PR also adds a new test, `test_utf8_open`, which tests `FLUID_FOPEN` directly and through `fluid_is_soundfont` and `fluid_synth_sfload` using a new soundfont file, `sf2/■VintageDreamsWaves-v2■.sf2`, which is just a copy of `VintageDreamsWaves-v2.sf2` with Unicode characters in the filename.
2020-12-22 11:30:14 +01:00
derselbst
23b270c08b Merge branch '2.1.x' into master 2020-09-06 14:54:26 +02:00
derselbst
ff7c72c80f Bump to 2.1.5 2020-09-06 11:52:39 +02:00
derselbst
0acfd81e28 Merge branch '2.1.x' into master 2020-08-17 18:24:45 +02:00
Fabrice Fontaine
0cccf83a38 CMakeLists.txt: fix build with gcc 4.8 (#661)
-Werror=incompatible-pointer-types is unconditionally used since version
2.1.4 and 137a14e106. This will raise a
build failure when checking for threads on gcc 4.8:

/home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-none-linux-gnueabi-gcc --sysroot=/home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-gnueabi/sysroot -DTESTKEYWORD=inline  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wall -W -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Wbad-function-cast -Wcast-align   -DNDEBUG -fPIE   -o CMakeFiles/cmTC_98946.dir/CheckIncludeFile.c.o   -c /home/buildroot/autobuild/run/instance-3/output-1/build/fluidsynth-2.1.4/CMakeFiles/CMakeTmp/CheckIncludeFile.c
cc1: error: -Werror=incompatible-pointer-types: no option -Wincompatible-pointer-types

Fixes:
 - http://autobuild.buildroot.org/results/13cbba871db56ef8657a3d13c6ac8e1b4da0d244

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-08-17 18:01:39 +02:00
derselbst
62b715483f Merge branch '2.1.x' into master 2020-07-09 19:39:21 +02:00
derselbst
137a14e106 Turn incompatible-pointer-types warning into error 2020-07-08 19:10:53 +02:00
derselbst
d73135fc48 Merge branch '2.1.x' into master 2020-07-05 16:32:47 +02:00
derselbst
459949a62b Bump to 2.1.4 2020-07-05 16:19:33 +02:00
Tom M
0d98c47545
Revise the sequencer's event queue (#604)
Proposing a new event queue for the sequencer, based on prior discussion:
https://lists.nongnu.org/archive/html/fluid-dev/2019-12/msg00001.html

With this change fluidsynth will require a C++98 compliant compiler.

Consider this as RFC, feedback is welcome.

The "pain-points" from the discussion:

#### 1. It is slow.

Done (thanks to heap sort), see runtime of `test_seq_event_queue_sort`.

#### 2. A meaningful ordering for events with the same tick has not been considered.

Done, see comments in `fluid_seq_queue.cpp`.

#### 3. Complicated implementation

Now uses one single event queue, which requires C++98. Implemented similarly to std::priority_queue by using heap sort.

The "queue" I use currently is of type `std::deque`. `deque` does not provide preallocation. `std::vector` does provide it. However, `std::deque` has the huge advantage that appending additional elements is cheap. For `std::vector` appending new elements would require to reallocate all the memory and copy it to the new array. So,

* either use `std::deque` with the risk that memory allocation may occur during `fluid_sequencer_send_at()`, or
* use `std::vector` with a preallocated pool of events and make `fluid_sequencer_send_at()` when the `vector` runs out of capacity.

Comments?

#### 4. Events that have been processed are deleted and gone.

After having thought about this more, this is the correct behavior. After events have been dispatched, they must be released to free underlying memory, see point 3. For the very rare case that a client (e.g. fluid_player) may require those events in the future, the client should be responsible for storing the events somewhere.

#### 5. The sequencer supports the system timer as alternative time source.

The conclusion from the mailing list was that the system timer can be removed. This has been done.

#### 6. Time Scaling

Time scaling can now be used for arbitrary tempo changes. The previous implementation was capable of that as well, however, the time-scale was limited to 1000. The only limitation for the scale is now >0, see `test_seq_scale`.

### Other Points

* `fluid_sequencer_remove_events()` turned out to be broken before, as it did not remove all events from the queue. This has been fixed, see `test_seq_event_queue_remove`.

* Consider the following code executed by `threadA`:

```c
fluid_sequencer_send_at(event0);
fluid_sequencer_set_time_scale(); // new scale
fluid_sequencer_send_at(event1);
```

The new scale will be definitely applied to `event1`. However, if another concurrently running `threadB` executes `fluid_sequencer_process()`, it was previously not clear, whether the new scale was also applied to event0. This depends on whether `event0` was still in the `preQueue`, and this depends on `event0.time` and the tick count that `fluid_sequencer_process()` is being called with. This has been changed. As of now, events are queued with their timestamp AS-IS. And only the latest call to `fluid_sequencer_set_time_scale()` is being considered during `fluid_sequencer_process()`. This makes the implementation very simple, i.e. no events need to be changed and the sequencer doesn't have to be locked down. On the other hand, it means that `fluid_sequencer_set_time_scale()` can only be used for tempo changes when called from the sequencer callback. In other words, if `threadA` executes the code above followed by `fluid_sequencer_process()`, `event0` and `event1` will be executed with the same tempo, which is the latest scale provided to the seq. Is this acceptable? The old implementation had the same limitation. And when looking through the internet, I only find users who call `fluid_sequencer_set_time_scale()` from the sequencer callback. Still, this is a point I'm raising for discussion.
2020-05-26 17:16:22 +02:00
Tom M
9995fd88b2
Support loading SoundFonts >2GiB on Windows (#629)
Since sizeof(long) == 4 even on 64 bit Windose, big files cannot be
loaded natively via the ANSI C file API. This change makes fluidsynth's
file callback API use long long, which is guaranteed to be at least 64
bit wide.
2020-05-26 16:53:59 +02:00
derselbst
5af89f8c92 Bump to 2.1.3 2020-05-23 14:29:17 +02:00
derselbst
d9ad6a0725 Fix warning in cmake >= 3.17 2020-04-06 10:40:37 +02:00