Commit graph

154 commits

Author SHA1 Message Date
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
derselbst
2a6b22e9bb Bump to 2.1.2 2020-04-05 18:44:06 +02:00
derselbst
ab15b32656 Bump to 2.1.1 2020-02-16 15:59:11 +01:00
derselbst
8a0761a129 Fix cmake warning 2020-02-02 15:25:39 +01:00
Nikos Chantziaras
545959ca17
Fix linking against libinstpatch (#617)
This fixes the case where linking fails if libinstpatch is not installed in a system/default location but instead needs to be found through `PKG_CONFIG_PATH`.
2020-02-01 08:54:21 +01:00
Atsushi Eno
69ba49348a
CMakeLists.txt: make positional code (-fPIC) customizible. (#616)
For some use cases it is necessary to specify -fPIC even if we build
static library e.g. building vst plugins (*.so) which may not load
shared libraries from outside the system paths (depends on DAWs).
For such environment we would like to build the final shared library
without depending on `libfluidsynth.so(.*)` but if we build libfluidsynth.a
it always comes without -fPIC. This change makes it adjustable.
2020-01-31 15:45:18 +01:00
derselbst
6163577a61 Remove unused clang-format cmake target 2020-01-11 09:45:05 +01:00
derselbst
850e8a2ec8 Fix building without pkg-config 2020-01-11 09:43:46 +01:00
Fabrice Fontaine
c538c9fa7e CMakeLists.txt: use pkg-config to find readline
Use pkg_check_modules to find readline dependencies such as ncurses and
fallback on current mechanism.

This will fix the following build failure when building statically:

/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libreadline.a(display.o): in function `cr':
display.c:(.text+0x1a0): undefined reference to `tputs'

Fixes:
 - http://autobuild.buildroot.org/results/88609eefe55af2ca50d43e17d3424b923528b07a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-01-10 08:57:57 +01:00
derselbst
b4bef26482 Apply compilation flags to AppleClang 2019-11-13 22:15:01 +02:00
Tom M
4c980c5860
Remove unused macros from config.h (#588) 2019-11-04 16:44:32 +01:00
derselbst
99a0ccbaad Adjust SOVERSION for 2.1.0RC1 2019-10-27 17:00:53 +01:00
derselbst
585396d36e Bump version to 2.1.0 RC1 2019-10-23 21:00:38 +02:00
derselbst
18ad9df21b Bump required libinstpatch version to 1.1.0 2019-10-23 17:28:55 +02:00
derselbst
606c4d47b6 Turn implicit function declarations into errors 2019-10-21 13:01:50 +02:00
derselbst
587fbf2e67 Fix broken previous merge.
Fixes build and closes #567.
2019-10-05 14:24:22 +02:00
derselbst
9ab3e3ab51 Merge branch '2.0.x' into master 2019-09-28 07:38:54 +02:00
derselbst
ca7f7047ad Correctly define DEBUG macro 2019-09-27 14:05:13 +02:00
derselbst
9793c0def3 bump to 2.0.7 2019-09-24 16:23:55 +02:00
derselbst
1e7a5f594d Merge branch '2.0.x' into master 2019-08-19 16:39:36 +02:00
derselbst
dec5e98f23 Bump version to 2.0.6 2019-08-17 18:00:29 +02:00
derselbst
90c5eb05c1 Let clang only report successfully vectorized loops
too spamy otherwise, flag kept as comment for manual profiling though
2019-08-08 21:54:12 +02:00
derselbst
03511aef3a Merge branch '2.0.x' into master 2019-08-08 19:51:44 +02:00
derselbst
b87d8b96ef Print out version of clang-tidy 2019-08-08 19:50:41 +02:00
derselbst
d8bbd56fea Restore original libinstpatch pkgconfig module name 2019-08-02 14:06:54 +02:00
derselbst
6a6015f047 Fix build if -Denable-fpe-check=1 on windows 2019-08-02 13:53:14 +02:00
derselbst
e1dc5d8f68 Correctly define DEBUG macro 2019-08-02 13:21:21 +02:00
derselbst
eb40b5a550 Compile with address sanitizer on request 2019-07-10 17:01:12 +02:00
Carlo Bramini
a02f1379d8 Add support for C99 math functions, if available (#545) 2019-07-07 11:02:31 +02:00
Tom M
b6df34cc27
Restructure cmake build summary (#542) 2019-06-28 16:28:41 +02:00
Tom M
ef2c256e9e
fix build with recent libinstpatch 2019-06-22 18:57:13 +02:00