Commit Graph

1401 Commits

Author SHA1 Message Date
Marcus Weseloh 84704ea440 Remove Gen_MaxValid macro
Not really necessary, checking against Gen_Last is just as
understandable and removes a macro.
2021-03-27 22:42:57 +01:00
Marcus Weseloh 359af770a3 Rename Gen_Dummy to Gen_last to clarify the purpose 2021-03-27 22:42:57 +01:00
Marcus Weseloh b61abdd907 Remove unused structs in sffile code 2021-03-27 22:42:57 +01:00
Marcus Weseloh 16d2f43509 Remove unused library, genre and morphology fields
Those fields are not used anywhere, so let's simply remove them.
2021-03-27 22:42:57 +01:00
Tom M 8413c35aca
Fix a regression in fluid_player_stop() (#822)
fluid_player_stop() should not set the STOPPING state, when the player has already finished. Introduced in 676923757c.
2021-03-27 18:35:00 +01:00
Marcus Weseloh 9a4b95a742 Reset the synth after the end, not before the start of a song
This change prevents an unnecessary synth reset before the first
MIDI song is played. It allows changing synth parameters via a
config file without having to unset the player.reset-synth setting.
2021-03-24 20:41:18 +01:00
Tom M c32faa7b17
Parallelize SF2 loading (#812)
The loading of SF2 samples can be parallelized as well, at least for bigger soundfonts like the Stgiga 4GB monster.

The following test is performed with hot-caches:

`time src/fluidsynth -i -a alsa Stgiga\'s\ HiDef\ Soundfont\ \(2019-05-25\).sf2`

Serial version:
```
real    0m15,460s
user    0m14,163s
sys     0m1,192s
```

Parallelized version proposed by this PR:
```
real    0m5,851s
user    0m14,089s
sys     0m1,194s
```
2021-03-17 19:41:33 +01:00
Tom M 5ae72f8c74
Merge branch 'master' into fluid-sffile-variable-renaming 2021-03-15 21:40:16 +01:00
derselbst 9ea6c75724 Merge branch '2.1.x' into master 2021-03-15 21:27:42 +01:00
Tom M 005719628a
Invalid generators were not removed from zone list (#810)
fluid_list_remove() should receive the beginning of a list, so it can adjust the predecessor of the element to be removed. Otherwise the element would remain in the list, which in this case led to a use-after-free afterwards.
2021-03-15 20:12:51 +01:00
Marcus Weseloh e3d95cb854 Rename p in load_igen to inst_list 2021-03-14 21:33:46 +01:00
Marcus Weseloh 552b1c4aa6 Rename p in load_imod to inst_list 2021-03-14 21:32:08 +01:00
Marcus Weseloh dd037c725e Rename p in load_ibag to inst_list 2021-03-14 21:31:27 +01:00
Marcus Weseloh 93a74ff3bd Rename pr in load_ihdr to prev_inst 2021-03-14 21:29:28 +01:00
Marcus Weseloh c545766ea6 Rename p in load_ihdr to inst 2021-03-14 21:27:40 +01:00
Marcus Weseloh 8df5abf903 Rename p in load_pgen to preset_list 2021-03-14 21:24:25 +01:00
Marcus Weseloh 9e7c108f4c Rename p in load_pmod to preset_list 2021-03-14 21:12:04 +01:00
Marcus Weseloh f1baa556a6 Rename p in load_pbag to preset_list 2021-03-14 21:11:07 +01:00
Marcus Weseloh edc99ebc24 Rename p2 in fixup_igen to zone_list 2021-03-14 21:03:10 +01:00
Marcus Weseloh 06145d2139 Rename p2 in fixup_pgen to zone_list 2021-03-14 21:02:29 +01:00
Marcus Weseloh e254c56373 Rename p2 in load_igen to zone_list 2021-03-14 21:00:15 +01:00
Marcus Weseloh 0c363cc574 Rename p2 in load_imod to zone_list 2021-03-14 20:59:32 +01:00
Marcus Weseloh 355c50631d Rename p2 in load_ibag to zone_list 2021-03-14 20:58:55 +01:00
Marcus Weseloh b5d80a1248 Rename p2 in load_pgen to zone_list 2021-03-14 20:58:03 +01:00
Marcus Weseloh a044835cf5 Rename p2 in load_pmod to zone_list 2021-03-14 20:56:58 +01:00
Marcus Weseloh 0e761da102 Rename p2 in load_pbag to zone_list 2021-03-14 20:55:52 +01:00
Marcus Weseloh f694d41a0e Rename p3 in fixup_igen to inst_list 2021-03-14 20:54:27 +01:00
Marcus Weseloh fd3e9bdc21 Rename p3 in fixup_pgen to inst_list 2021-03-14 20:54:14 +01:00
Marcus Weseloh bc2afb682b Rename p3 in load_igen to gen_list 2021-03-14 20:51:10 +01:00
Marcus Weseloh b506304bef Rename p3 in load_imod to mod_list 2021-03-14 20:50:18 +01:00
Marcus Weseloh 5bf9cf545f Rename p3 in load_pmod to gen_list 2021-03-14 20:49:45 +01:00
Marcus Weseloh 2c3caafcdf Rename p3 in load_pmod to mod_list 2021-03-14 20:48:58 +01:00
Tom M 8a778e0c0e
Add warning if soundfont bigger 2GB (#811)
Advice the user to use fluidsynth 2.2.0 or later when loading soundfonts > 2GB
2021-03-14 17:20:09 +01:00
derselbst b8fb6c81e1 Change short option for --query-audio-devices to -Q
Resolves #802
2021-03-13 20:15:36 +01:00
derselbst 14ab1ec6ab Merge branch '2.1.x' into master 2021-03-13 18:32:41 +01:00
Patryk Obara 908b98107c Rename generated table files from .c to .inc.h
These two files are not ordinary C files, and are being compiled
through #include's in other C source files, not through invoking
compiler on generated files. This might confuse both developers and
automated systems.

For longer explanation see discussion in #800.
2021-03-13 16:36:32 +01:00
TotalCaesar659 a27457c32f
Update URLs to HTTPS (#796) 2021-03-08 16:46:36 +01:00
Tom M 5d1078f7b9
Merge pull request #795 from mawe42/ladspa-improvements
Improvements to LADSPA subsystem
2021-03-07 12:50:03 +01:00
Marcus Weseloh 17c355ffaf Free the host_nodes list in fx destructor to prevent memory leaks 2021-03-07 12:18:47 +01:00
Tom M a2b2625517
Silence annoying 'non-existing shell command file' error (#794) 2021-03-07 10:54:31 +01:00
Marcus Weseloh 4ec1f799f8 Use separate lists for user and host nodes
Remove the global nodes list with separate host and audio nodes. Instead
use completely separate lists and search through both lists in the only
place where that is required: getting a node by name.
2021-03-06 18:21:14 +01:00
Marcus Weseloh 7e553339e4 Don't add effect control nodes to global node list
As effect control nodes are private to the effect and only ever
accessed via the effect and port name, they don't need to be added
to the global node list and can be cleaned up in the effect
destructor.
2021-03-06 18:21:14 +01:00
Marcus Weseloh ef29d03cc9 Move bookkeeping of nodes out of node creation function
Removal from and iterating through othe node lists is also handled
separately, so adding nodes to the lists should be explicit as well.
2021-03-06 18:20:56 +01:00
Marcus Weseloh 14b288a801 Linking effect ports is only supported for audio ports
Clarify the code and error messages to reflect that
limitation / design decision.
2021-03-06 18:19:39 +01:00
Marcus Weseloh f66a7e1442 Use lists to keep track of LADSPA nodes and effects
Removes the need for static allocation and prevents users from
running into our arbitrary node and effect limits.

Fixes #793
2021-03-06 18:19:39 +01:00
derselbst ca40101025 Increase number of LADSPA nodes
Quick solution for 2.1.8 only.
Addresses #793.
2021-03-06 09:45:32 +01:00
jjceresa e4241469d4
Fix return in fluid_synth_chorus_set_param(), fluid_synth_reverb_set_param() (#789) 2021-03-04 21:47:59 +01:00
derselbst 73182866e0 Merge branch '2.1.x' into master 2021-03-04 20:19:09 +01:00
derselbst 8adaaa7079 Fix regression introduced in aebc4837dd
If a voice has finished, sample_count may be smaller than FLUID_BUFSIZE,
in which case audible artifacts would occur.
Addresses #786
2021-03-04 20:16:19 +01:00
Tom M 57e035f8f7
Add Chris' soundcard enumeration tool (#773) 2021-03-01 18:29:51 +01:00
Arthur Chaloin 676923757c
Fix race condition in fluid_player_callback (#783)
Co-authored-by: Arthur Chaloin <arthur.chaloin@gmail.com>
2021-02-27 13:09:48 +01:00
Arthur Chaloin 13185d32b2
Add optional per tick callback to player (#780)
Co-authored-by: Arthur Chaloin <arthur.chaloin@gmail.com>
Co-authored-by: derselbst <tom.mbrt@googlemail.com>
2021-02-26 21:05:31 +01:00
jjceresa 04c30be0b9 update comment 2021-02-08 10:23:01 +01:00
derselbst 66407e2584 Prevent MIDI player from playing immediately after creation 2021-02-08 10:23:01 +01:00
derselbst 2172e1b009 Rename player_step to player_seek 2021-02-08 10:23:01 +01:00
derselbst 9f3eee0dd5 Document player commands which cannot be used in command file 2021-02-08 10:23:01 +01:00
derselbst d5cb8d312e Fix player_seek command in user command file 2021-02-08 10:23:01 +01:00
jjceresa 77f5bee296
Fix player position displayed in fluid_handle_player_cde() (#775)
This PR fixes the player position displayed in fluid_handle_player_cde() when calling fluid_player_seek().
2021-02-07 22:45:22 +01:00
derselbst 9690c0dd73 Merge branch '2.1.x' into master 2021-02-07 13:52:19 +01:00
derselbst aebc4837dd Simplify control flow to allow auto-vectorization by compiler 2021-02-07 11:05:33 +01:00
derselbst 25b0503ba7 Avoid audible clicks when rapidly chaning panning 2021-02-07 11:05:33 +01:00
Tom M 0d76403f9f
Parallelize SF3 loading (#746) 2021-02-06 20:32:17 +01:00
jjceresa 616fca3d8d Elaborate out-of-polyphony error message 2021-02-06 16:57:32 +01:00
Tom M 8745f542c2
Merge pull request #747 from FluidSynth/oboe-phil
Update Oboe driver
2021-02-06 10:43:07 +01:00
derselbst 641605294c Introduce audio.oboe.sample-rate-conversion-quality setting 2021-01-30 19:31:51 +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 dc3d7b8ffa Fix possible NULL deref
when allocation of drybuf fails
2021-01-29 14:07:01 +01:00
derselbst 4d76a6ad85 Restore int16 sample format for waveout and dsound
Addresses #760
2021-01-29 13:59:21 +01:00
jjceresa 8322d95425
Fix waveout driver crash (#759)
This PR addresses issue https://github.com/FluidSynth/fluidsynth/issues/758.

It ensures that the `internal buffer size` used by waveout device driver and the `extra buffers size` required by fluid_synth_process() are both coherent (i.e they should be of same size). To ensure this, both kind of buffers are now dependent of`audio.period` and `audio.period-size settings`.
2021-01-29 13:56:57 +01:00
rncbc cd28701d52 Allow the MIDI file player restart on-demand (#755)
Resets the default sample timer properly, allowing the internal
MIDI file player to restart its playlist on any other time but
the initial first.

Lets Qsynth play any MIDI files that are drag-n-dropped, anytime
after the first, following synth engine initialization.
2021-01-28 11:25:13 +01:00
derselbst c7878dec74 Update API docs of fluid_settings_getstr_default() 2021-01-28 11:15:23 +01:00
derselbst 4b5afca76c Fix a double-free when issuing the info command on string setting
Fixes #756.
2021-01-28 10:34:39 +01:00
derselbst 70abf1953f Add a comment for issue #751 2021-01-23 17:50:40 +01:00
derselbst 4fd7899d61 Merge branch '2.1.x' into master 2021-01-23 17:16:26 +01:00
derselbst fff51822eb Disable floating point underflow exceptions
They often occur in reverb, chorus and IIR and break our CI for no good reason.
2021-01-23 16:00:42 +01:00
Chris Xiong 8e9d361651 chorus: avoid overwriting input buffer when storing samples in the delay line.
In `fluid_rvoice_mixer.c`:`fluid_rvoice_mixer_process_fx()`:

If an audio processing callback is used, `mix_fx_to_out` would be `FALSE`. As a result, `in_ch` and `out_ch_l` points to the same buffer.

In `fluid_chorus.c`:`fluid_chorus_processreplace()`:
```C
        /* process stereo unit */
        /* store the chorus stereo unit d_out to left and right output */
        left_out[sample_index]  = d_out[0] * chorus->wet1  + d_out[1] * chorus->wet2;
        right_out[sample_index] = d_out[1] * chorus->wet1  + d_out[0] * chorus->wet2;

        /* Write the current input sample into the circular buffer */
        push_in_delay_line(chorus, in[sample_index]);
```

Here the chorus processing code writes to the left output buffer (which will overwrite the input buffer in this case) before the sample from the input buffer is stored into the delay buffer, making the chorus output all zeros. If no audio processing callback is used, `mix_fx_to_out` would be `TRUE` and `in` and `left_out` will not point to the same buffer, therefore the order doesn't matter.

Simply swapping the two steps should be a sufficient fix. This patch also apply the same change to `fluid_chorus_processmix` only for the sake of consistency (since they are almost exact copies of each other).

Resolves #751.
2021-01-23 15:49:26 +01:00
derselbst 1fefa4d2f2 Merge pull request #745 from chirs241097/winadrv-cb
Add support for new_fluid_audio_driver2 to dsound and waveout drivers.
2021-01-23 15:08:24 +01:00
Chris Xiong 64121229ea Add support for multiple stereo outputs when callbacks are used. 2021-01-23 15:06:40 +01:00
derselbst d547b569ad Leave framesPerCallback unspecified 2021-01-22 19:48:54 +01:00
derselbst 998eeee471 Elaborate API docs of fluid_audio_func_t 2021-01-22 19:46:03 +01:00
Chris Xiong 908494524b Consistency changes and removal of other unnecessary stuff. 2021-01-20 11:55:29 +08:00
derselbst c9c80a5fde Oboe driver can have lower latency 2021-01-19 18:48:52 +01:00
derselbst 2cfd56bb10 Modernize Oboe driver 2021-01-19 18:48:52 +01:00
Chris Xiong 772f62fc91 Add support for new_fluid_audio_driver2 while using the waveout driver. 2021-01-19 10:25:24 +08:00
Chris Xiong 9562ae6009 Add support for new_fluid_audio_driver2 while using the dsound driver. 2021-01-19 10:24:40 +08:00
jjceresa 4f2cb370a1
Add shell commands to the MIDI File Player (#713) 2021-01-15 19:04:02 +01:00
Tom M ca6bcda7d9
Merge pull request #739 from FluidSynth/parse-cmd3
Handle settings-related commands in user command file early
2021-01-10 12:08:19 +01:00
jjceresa 2cada68e02
Fix MIDI player tempo reset issues (#711) 2021-01-10 12:01:28 +01:00
derselbst 20ff3f866c Avoid unknown command errors when parsing settings early 2021-01-09 19:44:18 +01:00
derselbst 9bb048f27f Don't print warning when parsing early 2021-01-09 18:51:46 +01:00
derselbst 40ed09367a Parse set commands from config file early 2021-01-09 18:51:33 +01:00
Mauro Carvalho Chehab 4e8f570d32 Don't warn when parsing config files
When fluid_shell is called from fluid_source(), is is currently
printing this message:

    Received EOF while reading commands, exiting the shell.

Suppress it.
2021-01-08 23:48:40 +01:00
Mauro Carvalho Chehab 3d805e9a03 Only change a set if the value actually changed
That prevents warnings about changing a non-realtime parameter
set command is issued, but the value is identical to the
previous one.
2021-01-08 23:47:39 +01:00
derselbst e04cd572cb Merge branch '2.1.x' into master 2021-01-03 21:37:32 +01:00
derselbst 272b3b8717 Update API docs on fluid_synth_sfunload() 2021-01-03 18:30:16 +01:00
jjceresa cf424de5cf delete_fluid_synth() may not unload soundfonts still used by rvoices 2021-01-03 18:30:16 +01:00
jjceresa 0d38823527 SoundFonts cannot be unloaded if polyphony is ever exceeded
If polyphony is exceeded and FluidSynth has to allocate a voice by
calling fluid_synth_free_voice_by_kill_LOCAL(), two problems occur:

 1)The value returned by fluid_synth_get_active_voice_count() never
   returns back to 0.
 2)SoundFont samples are not unref'd properly, and therefore if an attempt is
   made to unload the SoundFont, the deferred unload timer is started, and
   fluid_synth_sfunload_callback() unsuccessfully tries	to unload the SoundFont forever.

These 2 issues are fixed by this commit.
2021-01-03 18:30:16 +01:00
Tom M 5c1cfe6a5f
Regression tests for #727 (#735)
This PR adds regression tests for #727, ensuring that soundfonts are correctly unloaded via the lazy-timer-unloading mechanism.
2021-01-03 09:42:42 +01:00
Tom M 6339feb106 Update API docs on settings recycling 2021-01-03 09:41:46 +01:00
derselbst 57f40ea91c Fix heap-use-after free 2021-01-03 09:41:46 +01:00
derselbst 03cf8e28f6 Add a unit test for issue 733 2021-01-03 09:41:46 +01:00
Tom M 4bfeff5764
Elaborate API docs on voice state 2021-01-01 22:27:25 +01:00
derselbst 26710f1076 Bump to 2.1.6 2021-01-01 21:26:12 +01:00
jjceresa 0ae16f6a2b
Check first MIDI files then Soundfonts files in fluidsynth.c (#731) 2020-12-31 10:28:12 +01:00
Tom M a14c70cbbd
Fix the fluid_synth_set_sample_rate() change problem for jack driver (#722) 2020-12-31 10:25:53 +01:00
derselbst 1be0e5ae7c Log error when audio callback function fails
Addresses #724
2020-12-28 18:08:38 +01:00
Tom M 9a25e71b02
Add FLUID_SEQ_SCALE event type (#723) 2020-12-27 17:53:36 +01:00
derselbst 0853cac6a3 Fix doxygen warnings 2020-12-27 10:48:07 +01:00
derselbst bc056b576b Print error if fluid_is_soundfont() fails 2020-12-22 13:16:30 +01:00
derselbst 3c84dcc816 Update API docs about UTF8 filenames 2020-12-22 11:30:14 +01:00
derselbst ed34742824 Add log messages to fluid_fopen() 2020-12-22 11:30:14 +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
Carlo Bramini f15147d43a
Replace g_ascii_strtoll() with FLUID_STRTOL() (#717) 2020-12-16 09:15:04 +01:00
Carlo Bramini 3719c58246
Make some strings const (#716) 2020-12-16 00:05:28 +01:00
Chris Xiong 9b485fad7c
Handle GS SysEx messages for setting whether a channel is used for rhythm part. (#708)
Some MIDI files that uses the GS standard uses channels other than channel 10 as percussion channel. Currently FluidSynth ignores the messages setting that up, causing notes meant to be played with a drum instrument played with a melodic instrument or vice versa. This patch will partially fix the issue.

Currently the implementation in this patch doesn't cover a specific "quirk" in Roland GS Modules: they seem to remember the last used instrument in the selected mode. This patch simply sets the instrument number to 0 instead.

A test file is attached. If played correctly (with `-o synth.device-id=16`) no out of place drum or piano sounds should be heard.

[wikipedia_MIDI_sample_gstest.mid.gz](https://github.com/FluidSynth/fluidsynth/files/5610727/wikipedia_MIDI_sample_gstest.mid.gz)
2020-11-29 00:20:04 +01:00
Nathan Umali 33c147402b
Update owner of the SoundFont registered trademark. (#706)
As of the time of this PR, the SoundFont registered trademark is owned by Creative Technology Ltd.
http://tmsearch.uspto.gov/bin/showfield?f=doc&state=4803:rj74xq.2.1
http://assignments.uspto.gov/assignments/q?db=tm&qt=sno&reel=&frame=&sno=74325965
2020-11-25 12:31:16 +01:00
jjceresa c9b187bd85
Fx unit api (#673)
This PR addresses #669 point 2.1.
It proposes set/get API functions to change/read fx unit parameters.
The deprecated shell commands are updated. Now the commands line have 2 parameters:
- first parameter is the fx unit index.
- second parameter is the value to apply to the fx unit.
2020-11-22 21:02:06 +01:00
Marcus Weseloh a9135faf70 Structure the large synth header into subgroups
Also include version.h and ladspa.h in the Synthesizer group.
2020-11-12 21:27:00 +01:00
Marcus Weseloh 9248032feb SoundFont API
Includes Generators, Modulators, Loader etc
2020-11-12 21:27:00 +01:00
Marcus Weseloh 7f1ac22869 Miscellaneous group 2020-11-12 21:27:00 +01:00
Marcus Weseloh 4a40695541 Settings documentation 2020-11-12 21:27:00 +01:00
Marcus Weseloh 39ae70793a MIDI Seqencer documentation 2020-11-12 21:27:00 +01:00
Marcus Weseloh 4185b25d6f MIDI input group
Contains MIDI Driver, MIDI Router, MIDI Player and MIDI Events
2020-11-12 21:27:00 +01:00
Marcus Weseloh 66b7c19893 Audio output group
With subgroups Audio Driver and File Renderer
2020-11-12 21:27:00 +01:00
Marcus Weseloh af68288628 Command Shell group for all shell related commands
With subgroups for command handler, shell and server.
2020-11-12 21:27:00 +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
jjceresa 032700f4e1
Add hint message when compiled without getopt support (#697) 2020-10-27 17:57:21 +01:00
jjceresa 42819d3e40 avoid an unlikely race condition 2020-10-27 14:01:37 +01:00
Marcus Weseloh c8fea77528 Fix possible uninitialized use of dry_idx variable 2020-10-26 21:01:59 +01:00
Marcus Weseloh 7fc56567ca Remove unused variable 2020-10-26 20:59:44 +01:00
jjceresa 5b8f3cbbc2
Ensure WaveOut compatibility with Win9X/NT (#687) 2020-10-14 17:54:56 +02:00
Tom M 97615ef2cf
Promote Controller/Pressure/Bend event functions to 32bits (#670) 2020-10-08 16:33:52 +02:00
derselbst d64ab70709 Fix build on Windows 9x/ME
Addresses #679
2020-10-04 20:42:08 +02:00
derselbst 94dbb9601e Add proper unicode support to Windows error reporting 2020-10-04 13:40:26 +02:00
derselbst 66d916a34a Fix Windows build 2020-10-04 13:32:38 +02:00
derselbst abc89d7d6c Improve error reporting in Waveout and DSound drivers 2020-10-04 13:21:15 +02:00
jjceresa b5da68393c
Fix minor bug in windows audio driver (#680) 2020-10-04 12:39:54 +02:00
jjceresa b55884b273
Make winmidi driver multi devices capable. (#677) 2020-09-27 14:22:56 +02:00
derselbst 90ba627794 Remove a FIXME 2020-09-13 13:38:38 +02:00
derselbst e48e48121b Remove a FIXME
Not aware of any problems caused by the old glib thread API. It will be removed sooner or later anyway.
2020-09-13 13:38:38 +02:00
derselbst f6038ea194 Add comment into empty block 2020-09-13 13:38:38 +02:00
derselbst dceb6e9835 Remove a FIXME
I have no clue what it refers to or what it's meant by that.
2020-09-13 13:38:38 +02:00
derselbst c94ccdfed1 Remove a FIXME
I don't see any 'allocation' of preset. And ALL public synth functions have a mutex lock which might potentially block when called from synth context, but only then if the client app pessimizes this situation by extensively calling the synth from outside the synth context.
2020-09-13 13:38:38 +02:00
derselbst 0b8fa2e386 Remove a FIXME
I don't see any problem calling fluid_channel_init() from within synth context
2020-09-13 13:38:38 +02:00
derselbst 18fdafe37f Fix another NULL dereference
Access to field 'zone' results in a dereference of a null pointer (loaded from variable 'pr'), if size is negative. However, size should be unsigned.
2020-09-13 13:38:38 +02:00
derselbst c4cd8bfc24 Fix a NULL dereference
Access to field 'zone' results in a dereference of a null pointer (loaded from variable 'prev_preset'), if `size` is negative. Problem is: Parameter `size` is `chunk.size` and should be unsigned.
2020-09-13 13:38:38 +02:00
derselbst ec74ed905b Fix an impossible NULL deref 2020-09-13 13:38:38 +02:00
derselbst 7ff98227c6 Remove dead code 2020-09-13 13:38:38 +02: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
derselbst 6776569abe Deprecate fluid_event_any_control_change() 2020-09-11 22:22:35 +02:00
derselbst 23b270c08b Merge branch '2.1.x' into master 2020-09-06 14:54:26 +02:00
jjceresa f94cee0a50
Add multi channels support for audio driver. (#667)
This PR addresses #665.

1) Add new functions for multi channels support: `fluid_synth_write_float_channels()`, `fluid_synth_write_s16_channels()`
2) `dsound` and `waveout` driver make use of this support. tested on 2 audio devices: 
    - creative SB Live! (6 channels).
    - Realtek: ALC889A (8 channels).
2020-09-02 21:31:50 +02:00
jjceresa 57af8803f2
Mapping of fx unit output to dry buffers in mix mode. (#668)
Currently, all fx unit output (in mix mode) are mapped to the `first buffer`.
This is not appropriate for synth.audio-groups > 1

This PR allows the mapping of fx output based on `fx unit index` and `synth.audio-groups` value.
This allows us to get the `fx output `mixed to the respective  `buffer` on which a `MIDI channel` is mapped.
For example: with `synth.audio-groups = 3` and  `synth.effect-groups = 3`:
- MIDI chan 0 (dry + fx0) is mapped to buf 0
- MIDI chan 1 (dry + fx1) is mapped to buf 1
- MIDI chan 2 (dry + fx2) is mapped to buf 2
2020-09-02 21:10:31 +02:00
Tom M aea6644324
Use a runtime check to detect version of libinstpatch (#666)
It could be that during runtime an older version of libinstpatch is used than the one fluidsynth was compiled against. In this case, libinstpatch will fail to load DLS fonts, because libinstpatch's initialization semantics don't match those compiled into fluidsynth.
2020-08-31 20:35:21 +02:00
jjceresa c76949e6d3
Limiting audio-channels to audio-groups (#663) 2020-08-22 13:24:41 +02:00
derselbst fa6f9c3570 Remove unused member variable 2020-08-17 18:23:43 +02:00
derselbst 4b83ee55c0 Merge branch '2.1.x' into master 2020-08-10 20:35:42 +02:00
jjceresa 3ee2bbed96 fix NULL permitted for out and fx pointer buffer
Closes #659
2020-08-10 20:33:42 +02:00
Tom M 31c4e12ac9
Update Travis CI (#658)
* update to Ubuntu Focal
* use clang10
* avoid unintentional fallbacks to  default `/usr/bin/c++` compiler
* fix related compiler warnings
2020-07-28 21:05:01 +02:00
derselbst 3c94f6366d Merge branch '2.1.x' into master 2020-07-12 13:03:59 +02:00
derselbst 2393aef3bd Fix printf format warnings 2020-07-12 12:55:32 +02:00
derselbst 62b715483f Merge branch '2.1.x' into master 2020-07-09 19:39:21 +02:00
derselbst d7abe8bdfd Fix a possible race condition during midi autoconnect 2020-07-09 19:30:32 +02:00
derselbst eac0de0345 Fix a NULL deref in jack driver 2020-07-09 19:10:11 +02:00
derselbst 85f94c61c9 Fix passing arguments from incompatible pointer type 2020-07-08 19:20:13 +02:00
derselbst d73135fc48 Merge branch '2.1.x' into master 2020-07-05 16:32:47 +02:00
derselbst c5293fc753 Fix an uninitialized memory access
that could possibly trigger an FPE trap for instruments that use the exclusive class generator
2020-06-28 14:58:02 +02:00
derselbst 4261848dd4 Fix regression introduced in a89399476e
Mentioned commit broke fluid_synth_start() when using a DLS soundfont.
2020-06-26 17:38:49 +02:00
Tom M aa32da0a47
Properly handle overlapping notes when using fluid_event_note() (#637) 2020-06-15 08:38:56 +02:00
Tom M e16ca05a58
Avoid num_samples from becoming negative (#653)
For Soundfonts bigger 2GiB, num_samples becomes negative. When being passed to safe_fread() it's promoted to long long and when being passed to fread(), it's cast to size_t. Works fine in twos-complement, but still is not nice.
2020-06-08 09:24:23 +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 19a20eb852 Fix another NULL deref related to #635 2020-05-23 15:31:48 +02:00
derselbst a865ac33d9 Remove SDL2 not inited warning for upcoming release
Addresses #649
2020-05-19 19:44:47 +02:00
derselbst 9ad2bcaa10 Quote MIDI device names
Addresses #650
2020-05-19 16:39:07 +02:00
derselbst 4f1fdc0df7 Fix unicode string comparison 2020-05-19 16:39:07 +02:00
derselbst 45efbd97c0 Revise log messages in new_fluid_winmidi_driver()
Addresses #650.
2020-05-19 16:39:07 +02:00
derselbst 69e7eca670 Fix notes not being played that start at the value of seek_ticks
Fixes #646
2020-05-17 09:56:35 +02:00
jjceresa d63524683f
Fix ordering of operations (#647) 2020-05-09 09:31:51 +02:00
derselbst 304096add7 Update API docs about synthesis context 2020-05-02 20:12:01 +02:00
jjceresa 8a3eaf9b18
Make fluidsynth call ipatch_close() (#644) 2020-05-02 14:31:34 +02:00
derselbst 87a6debba0 Replace custom version check by GLIB_CHECK_VERSION 2020-05-02 13:42:10 +02:00
derselbst 87c7599e63 Remove unused variable 2020-05-02 13:24:33 +02:00
jjceresa 6aea18bef4
Allow the reverb to pre allocate delay lines. (#638)
This PR allows the reverb to pre-allocate the memory needed for the maximum sample-rate of the synth. That means that on sample rate change there are no memory allocation and the function fluid_revmodel_samplerate_change() should always return FLUID_OK.

The PR addresses discussion in #608.
2020-05-01 13:26:52 +02:00
jjceresa 791dac6736
Stop dsound properly. (#642)
Stopping `dsound `before stopping `audio thread` avoid dsound playing transient glitches between the time audio task is stopped and dsound will be released. These short trailing glitches are particularly audible when captured by a reverb connected on output.
2020-04-30 19:51:24 +02:00
Tom M e2d435dad6
Fix a NULL deref in delete_rvoice_mixer_threads() (#641)
The function attempts to lock a mutex that might have not been created yet, due to a previous error.
2020-04-30 19:49:58 +02:00
jjceresa ff14432cd9
Make chorus capable of sample rate change. (#639) 2020-04-27 18:07:22 +02:00
Tom M a89399476e
Fix a NULL pointer deref if dynamic-sample-loading is enabled (#636) 2020-04-25 17:26:21 +02:00
derselbst 85cf123d38 Guard against multiple calls to fluid_player_seek()
Addresses #634
2020-04-22 17:28:47 +02:00
derselbst 893f48e4a2 Amend 69cfa781eb
Remove incorrect atomic read from player->seek_ticks. Addresses #634
2020-04-20 15:57:59 +02:00
derselbst 69cfa781eb Fix a race condition while fluid_player is seeking
Fixes #634
2020-04-19 12:08:48 +02:00
derselbst f15b8e5447 Update API docs
for fluid_get_sysconf() and fluid_get_userconf()
2020-04-18 23:56:59 +02:00
Tom M 85237e4fc8
Fix cross-compilation from Win32 to ARM using vcpkg (#630)
For some reason, the configure command must be specified explicitly in the `gentables` build step. Otherwise, the ARM target compiler will be used to build `make_tables` rather than the host compiler. 

Now that microsoft/vcpkg#10485 has been completed, an ARM CI build can be added to AppVeyor. Also, the build status table in the README has been updated.
2020-04-08 11:13:42 +02:00
derselbst 631c9798cb Update API docs on fluid_player_set_bpm()
Resolves #624
2020-03-20 19:57:43 +01:00
derselbst eff728753b Update API docs 2020-03-08 09:55:09 +01:00
Tom M cc85d285b5
Fix a memory leak in Oboe driver (#626) 2020-03-07 14:15:13 +01:00
Tom M c9d023230a
Add verbose error logging for opensles and oboe (#627) 2020-03-07 14:14:28 +01:00
derselbst cabb219285 Update API docs 2020-03-07 13:42:09 +01:00
derselbst ddbd0afcc8 Fix a possible NULL dereference 2020-03-03 16:48:24 +01:00