Commit graph

61 commits

Author SHA1 Message Date
derselbst
b28c0ed044 Revert "remove VintageDreamsWaves-v2.sf3"
This reverts commit a36c06cff2. We've got
explicit permission from Ian Wilson to convert it to SF3.

Addresses #701.
2020-10-31 15:42:33 +01:00
Marcus Weseloh
109c41c355
Add public API to pin and unpin presets to the sample cache (#698)
Following the discussion about an API to pin and unpin preset samples in the sample cache here:
https://lists.nongnu.org/archive/html/fluid-dev/2020-10/msg00016.html

Short explanation of the change:

Only the default loader currently supports dynamic sample loading, so I thought it might be a good idea to keep the changes for this feature mostly contained in the default loader as well. I've added two new preset notify flags (FLUID_PRESET_PIN and FLUID_PRESET_UNPIN) that are handled by the preset->notify callback and trigger the loading and possibly unloading of the samples.
2020-10-31 13:23:15 +01:00
Tom M
4c1292d8ab
Remove fluid_event_any_control_change() from public API (#674)
Originally, I have only marked it deprecated. But since we have an SOVERSION bump next release and because this function was only meant for internal usage, I think it's safe to remove it right now.
2020-09-12 10:40:57 +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
derselbst
27ad0684c6 Add regression test for #635 2020-05-23 15:30:27 +02:00
derselbst
28cde7e867 Reactivate test_preset_sample_loading 2020-05-23 14:40:41 +02:00
Tom M
2bbe9272bb
Merge pull request #614 from FluidSynth/sfsampletype
Hardening fluid_sample_validate() against invalid flag combinations
2020-02-13 17:07:57 +01:00
Tom M
af2342ac43
Solve the sequencer client unregistering problem (#610)
Responsibility for calling fluid_sequencer_unregister_client() in case of FLUID_SEQ_UNREGISTERING events has been moved to fluid_sequencer_send_now(). In other words, a FLUID_SEQ_UNREGISTERING event now really unregisters the client, no matter how the client's callback function looks like.

Avoids leaking the sequencer clients if implementations do not unregister them explicitly.

Also fixes another memory leak if fluid_sequencer_register_fluidsynth() clients were unregistered with fluid_sequencer_unregister_client() rather than by sending an unregistering event.
2020-02-01 14:32:35 +01:00
derselbst
76f4bc3db3 Add a unit test for fluid_sample_validate() 2020-01-24 15:57:08 +01:00
derselbst
a250ac2a97 Slightly extend test_sfont_loading.c 2020-01-24 13:33:41 +01:00
Tom M
3610372ae5
Workaround for jack sample rate mismatch (#607)
During the creation of a jack audio driver, it is checked whether the sample-rate of the settings object matches jack's rate. If not, it was adjusted previously via fluid_synth_set_sample_rate(). Due to the deprecation of that function and removal of real-time capability of the synth.sample-rate setting, a regression was introduced in 5fbddcecc3 causing the synth's sample-rate to be not updated.

This workaround obtains the synth via the settings instance and for now calls the deprecated sample-rate set function.
2020-01-19 15:36:15 +01:00
derselbst
ba71d6ad9e Update unregistering unit test 2020-01-18 09:51:19 +01:00
derselbst
f979c58e3c Add a unit test for fluid_sequencer_set_time_scale() 2020-01-03 20:30:09 +01:00
derselbst
7898c4f4ab Add a unit test for fluid_sequencer_send_at() 2019-12-27 10:49:25 +01:00
derselbst
dfcf5c019f Add a unit test for fluid_synth_write_float 2019-10-22 16:08:41 +02:00
Tom M
fa7354a336
More efficient implementation of fluid_ct2hz() (#569)
This provides a less branchy and therefore more instruction-cache-friendly version of fluid_ct2hz(), which also significantly reduces the number of floating-point comparisons.
2019-10-22 13:09:42 +02:00
derselbst
aafc59bde6 Fix Windows Azure Release Build 2019-10-19 18:20:09 +02:00
derselbst
3c4861c752 Add a unit test for fluid_ct2hz_real() 2019-10-18 21:03:00 +02:00
Tom M
5c795791c1
Suppress abort() dialog on windows (#549) 2019-08-06 17:29:49 +02:00
derselbst
e5dbe76d1b Fix memory leak in test_seqbind_unregister 2019-07-10 17:01:01 +02:00
derselbst
8b448ffd4b fix build with MSVC 2019-04-17 19:20:36 +02:00
derselbst
68db8f4a80 add a unit test for fluid_synth_process()
addresses #527
2019-04-14 17:22:39 +02:00
derselbst
a36c06cff2 remove VintageDreamsWaves-v2.sf3
Converting this soundfont to other formats is forbidden. Suspend
depending unit tests.
2019-03-24 17:25:57 +01:00
derselbst
9ef169cb00 fix building CoreAudio on OSX 10.4
by cleaning up fluidsynth's private includes
2019-02-15 17:55:02 +01:00
derselbst
dde52c35dd update test_sfont_loading to call fluid_is_soundfont() 2018-12-09 10:35:21 +01:00
derselbst
7b9e8de262 stop cmake from querying for a C++ compiler 2018-08-14 17:14:59 +02:00
derselbst
521e5451fc remove cmake option enable-tests
Always build unit tests instead and use cmakes OBJECT library to bypass visibility control and the value of BUILD_SHARED_LIBS.
2018-08-05 20:50:41 +02:00
derselbst
9382edabd5 enforce coding style guide
using astyle
2018-06-24 13:13:18 +02:00
derselbst
8f6a602495 fix no-prototype warning in test_seqbind_unregister.c 2018-05-19 09:29:39 +02:00
Tom M
fcc69471d6
Merge pull request #385 from FluidSynth/issue49
Add reverb and chorus settings
2018-05-18 10:15:11 +02:00
Tom M
7aea42c96f
Merge pull request #374 from FluidSynth/rvoice-align
Enable / Improve vectorizion in rvoice_mixer
2018-05-18 10:14:14 +02:00
Tom M
51252b72b4
Merge branch 'master' into issue49 2018-05-17 22:13:36 +02:00
derselbst
0188cd9d93 rename reverb roomsize setting to match naming conventions 2018-05-17 21:44:03 +02:00
derselbst
dac1fe48cc check that realtime reverb and chorus settings work 2018-05-17 21:38:04 +02:00
derselbst
04a5224eb9 add a unit test for C99 compliant FLUID_SNPRINTF 2018-05-17 14:56:55 +02:00
Tom M
f1384f03d9
Merge branch 'master' into rvoice-align 2018-05-11 16:53:42 +02:00
derselbst
cb58583050 add a unit test for reverb and chorus settings 2018-05-09 22:09:23 +02:00
derselbst
34912586f0 add a unit test for manually unregistering via fluid_event_unregistering()
currently results in a double free
2018-05-08 22:19:59 +02:00
derselbst
cdbd508007 add fluid_align_ptr() for aligning pointers 2018-04-26 16:07:19 +02:00
derselbst
291075c31f fix build for gcc 2018-04-25 12:33:47 +02:00
derselbst
044c5e3238 fuse preset iteration tests to preset+sample loading tests 2018-04-24 21:32:49 +02:00
Marcus Weseloh
7240461e5b Merge branch 'master' into dynamic-sample-loading 2018-04-21 23:34:20 +02:00
derselbst
c433fc887c simplify dependency handling of unit tests 2018-04-21 23:22:45 +02:00
derselbst
a051d57ab3 avoid preprocessor stringification to expand to special '%' character
in fprintf() call
2018-04-21 10:37:04 +02:00
Marcus Weseloh
7987446fdf Fix tests without libsndfile. Not pretty, welcome a better solution! 2018-04-18 09:14:55 +02:00
Marcus Weseloh
f52bbf53a4 Add VintageDreamsWaves-v2 in SF3 format and some tests for sf3 loading 2018-04-18 09:14:55 +02:00
derselbst
88606f1538 test_sfont_loading: update unit test purpose 2018-04-11 11:12:01 +02:00
derselbst
36881f4ba8 add test for sample rate changes 2018-04-11 11:12:01 +02:00
derselbst
cb35fac1c6 make VintageDreams sf2 an explicit requirement for unit tests 2018-04-11 11:03:12 +02:00
derselbst
713a4b680d remove redundant TEST_ASSERT_[N]EQ macros 2018-04-11 10:23:17 +02:00