Commit graph

824 commits

Author SHA1 Message Date
derselbst
734e5db849 prefer using DEBUG rather than NDEBUG 2018-06-02 13:23:50 +02:00
KO Myung-Hun
85356d2732 fix compilation below GLib v2.26.0
GStatBuf was introduced in GLib v2.26.0, fixes #389
2018-05-28 21:32:48 +02:00
derselbst
d0d156f50f silence gcc4.8 erroneously reporting uninitialized vars 2018-05-20 10:45:35 +02:00
derselbst
c61b93dd74 update copyright year 2018-05-20 10:28:23 +02:00
derselbst
b70b24ce0a remove fluid_rvoice_mixer_set_threads() as rvoice event function
Changing the number of rendering threads on-the-fly is not considered to be a usecase. In fact it will cause glitchy audio if doing so while synthesizing because all rendering threads are killed and their mixdown buffers are reallocated. This change should fix glitchy audio that might occur at the beginning of synthesization, as the rvoice_event for thread allocation may be dispatched (too) late.
2018-05-19 17:04:37 +02:00
derselbst
ce337e2497 use explicit array access in fluid_synth_nwrite_float()
rather than pointer arithmetic
2018-05-18 13:09:03 +02:00
derselbst
6bcdf87c06 fix broken multithread rendering
and minor current_blockcount cleanups
2018-05-18 13:07:16 +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
derselbst
df4c9878de fix endless loop in fluid_sample_timer_process() 2018-05-18 09:58:05 +02:00
Tom M
51252b72b4
Merge branch 'master' into issue49 2018-05-17 22:13:36 +02:00
Tom M
b40fb9d782
Merge pull request #382 from FluidSynth/unregister
fix double free when deleting fluid_seqbind_t
2018-05-17 22:13:08 +02:00
derselbst
0188cd9d93 rename reverb roomsize setting to match naming conventions 2018-05-17 21:44:03 +02:00
derselbst
435361ef0c rename chorus getters to match naming conventions
fluid_synth_get_chorus_speed() and fluid_synth_get_chorus_depth()
2018-05-17 21:38:04 +02:00
derselbst
57abab0a31 document reverb and chorus settings 2018-05-17 19:59:34 +02:00
derselbst
e1a3e2468b require explicit unregistering of sequencer clients 2018-05-17 15:36:38 +02:00
derselbst
75e168cb58 update API doc of fluid_synth_process() and add usage example 2018-05-17 14:43:59 +02:00
derselbst
70837ce8fc turn reverb and chorus settings into realtime settings 2018-05-14 14:56:34 +02:00
carlo-bramini
04930d62d1 __restrict supported from VS 2005 and newer (#383)
Check if the MS compiler really supports this keyword.
2018-05-14 13:52:28 +02:00
derselbst
5d3f727547 fix use after free in fluid_sample_timer_process() 2018-05-14 10:27:21 +02:00
derselbst
5f70eb8226 fix double free when deleting fluid_seqbind_t 2018-05-13 11:38:22 +02:00
Tom M
f1384f03d9
Merge branch 'master' into rvoice-align 2018-05-11 16:53:42 +02:00
derselbst
b9ffd8f587 deprecate reverb and chorus shell commands 2018-05-10 21:26:08 +02:00
derselbst
8690b4dbda remove default reverb and chorus macros from public API
should now be fetched through a settings instance
2018-05-10 20:00:25 +02:00
derselbst
4f2be10507 add reverb and chorus settings
as suggested by #49
2018-05-10 20:00:25 +02:00
derselbst
8c2ef30038 fix uninitialized member access
of voice_zone->range.ignore; introduced in #370
2018-05-09 11:39:21 +02:00
jjceresa
3dcb7d3b92 remove redundant function declarations (#379)
Remove fluid_channel_get_interp_method(), fluid_channel_set_interp_method(), fluid_channel_get_preset() and fluid_channel_get_num() as they are already defined as macros.
2018-05-05 21:08:59 +02:00
derselbst
d47de30f16 fix tautological comparision
on platforms where `char` is implemented as `unsigned char`, addresses #378
2018-05-05 20:55:26 +02:00
jjceresa
2bff09b420 fluid_rvoice_check_sample_sanity cleanup (#375)
Check already done by the caller.
2018-05-05 16:40:55 +02:00
derselbst
d8f46f2bae remove unused vars, clarify comments 2018-05-05 15:17:09 +02:00
derselbst
5280aae7ac optimize fluid_align_ptr() for alignment powers of two 2018-05-04 16:40:45 +02:00
Tom M
05c2d57e65
Merge pull request #372 from FluidSynth/rvoice-refactor3
rvoice_mixer refactorings + cleanups
2018-05-02 20:51:53 +02:00
derselbst
c64d2b44be silence uninitialized warning 2018-04-30 10:16:01 +02:00
derselbst
edd52edac2 consistently use signed int for sfont_id, bank_num and preset_num 2018-04-30 10:09:48 +02:00
derselbst
3e3bef87ec report errors in fluid_handle_set() 2018-04-29 16:11:30 +02:00
derselbst
1a5ea8d8e5 fix signedness warning 2018-04-27 21:32:00 +02:00
derselbst
ab255b7178 avoid polling variables from global mem
that never change
2018-04-27 20:54:30 +02:00
derselbst
1d9dfd2a2a optimize fluid_mixer_buffers_zero()
only zero needed parts of sample buffers
2018-04-27 18:25:07 +02:00
derselbst
b7cf79bc15 vectorize mixdown loop of fluid_mixer_buffers_mix() 2018-04-27 17:49:22 +02:00
derselbst
58008aae18 convert rvoice_mixer mixdown buffer to 1D arrays 2018-04-27 17:34:29 +02:00
derselbst
ed312b7acc refactor fluid_rvoice_mixer_process_fx() 2018-04-26 22:01:50 +02:00
derselbst
89015494cb vectorize mixing loop of fluid_rvoice_buffers_mix() 2018-04-26 22:01:49 +02:00
derselbst
f332f32a7c remove optimization for centered stereo samples
in favour of vectorized mixing loop. Was incredibly unlikely to happen anyway.
2018-04-26 16:47:06 +02:00
derselbst
ba9da3b790 enable FLUID_ASSERT macro 2018-04-26 16:38:12 +02:00
derselbst
7ebdabae0c allocate mono voice mix buffer on the heap 2018-04-26 16:25:26 +02:00
derselbst
e229f62020 cmake: detect openMP 2018-04-26 16:25:18 +02:00
derselbst
cdbd508007 add fluid_align_ptr() for aligning pointers 2018-04-26 16:07:19 +02:00
Marcus Weseloh
9ad07430ea
Merge pull request #370 from FluidSynth/unique-sfont-insts
Only import Soundfont instruments once
2018-04-25 22:58:01 +02:00
derselbst
354bea9cfc fix build if ENABLE_MIXER_THREADS == 0 2018-04-25 21:08:48 +02:00
derselbst
2ad96d020e avoid leaking rvoice_mixer threads
introduced in 7ae9099293
2018-04-25 21:05:02 +02:00
derselbst
f8e4890a63 refactor data types of fluid_channel_t members
Use char if possible + reorder fields to avoid padding. Overall saved 408 bytes per fluid_channel_t instance
2018-04-25 17:21:38 +02:00
derselbst
f34567fb61 reorder fields of struct _fluid_voice_t
to minimize padding
2018-04-25 16:21:37 +02:00
derselbst
f867e3b15a fix rvoice_buffers initialization loop 2018-04-25 15:59:00 +02:00
derselbst
8aa073b4a4 remove redundant fluid_rvoice_mixer_t::remove_voice_callback
call rvoice_eventhandler directly to handle finished voices
2018-04-25 15:59:00 +02:00
derselbst
5d28ecc5cc remove redundant fluid_rvoice_mixer_t::buf_blocks
as it's always equal to FLUID_MIXER_MAX_BUFFERS_DEFAULT
2018-04-25 15:59:00 +02:00
derselbst
0b64c8d887 remove fluid_rvoice_dsp_t::is_looping flag
and pass it to interpolate functions directly and reorder flags
2018-04-25 15:58:59 +02:00
derselbst
b95266cf6c remove fluid_rvoice_dsp_t::dsp_buf
pass dsp_buf to interpolation functions directly
2018-04-25 15:58:59 +02:00
derselbst
9178eebf39 add FLUID_RESTRICT
for restrict pointers
2018-04-25 15:58:59 +02:00
derselbst
f2cf1f82c7 move fluid_rvoice_buffers_mix() to rvoice_mixer 2018-04-25 14:57:40 +02:00
derselbst
907ec27a9e optimize away memset/mix if voice is quiet 2018-04-25 14:56:20 +02:00
Marcus Weseloh
df3bab0b40 Only import instruments once from Soundfont
This changes the way instruments and their related information is imported
from a Soundfont. Previously, each preset zone got a complete copy of the
instrument and related information, wasting a lot of precious memory.

After this change, an instrument and related information is only
imported once and then linked into all preset zones that use this
instrument.
2018-04-22 19:09:23 +02:00
Marcus Weseloh
c4003bef39 Store mutable information about inst zones in new fluid_voice_zone_t struct
This change separates the static instrument zone information read from
the Soundfont from the information that gets modified on import and
later via the legato handling. It opens opens up the possibility of
having unique instruments that only get imported once and then linked
into the individual preset zones.
2018-04-22 19:08:09 +02:00
Marcus Weseloh
3603a34a77 Also load 46 zero words area after sample for uncompressed samples 2018-04-22 12:20:37 +02:00
Marcus Weseloh
3ce3575269 Ensure that loops are sanitized and sample is optimized for dynamically loaded samples 2018-04-22 10:37:14 +02:00
Marcus Weseloh
7240461e5b Merge branch 'master' into dynamic-sample-loading 2018-04-21 23:34:20 +02:00
Marcus Weseloh
9dcb4148cb Only open the Soundfont for sample reading if necessary 2018-04-21 23:22:45 +02:00
derselbst
02de830043 fix dangling pointer on inst_zone sample lookup
fixes #369
2018-04-21 23:17:19 +02:00
derselbst
323b9b8cbf avoid assigning incompatible pointers 2018-04-21 22:31:18 +02:00
derselbst
17dded3700 avoid NULL deref in fluid_rampreset_preset_delete() 2018-04-21 16:55:08 +02:00
derselbst
71592ec679 fix memory leaks during sfont loading 2018-04-21 16:48:56 +02:00
derselbst
08147cc3d6 avoid double free in fluid_sample_set_sound_data() 2018-04-21 16:33:27 +02:00
Marcus Weseloh
073da2141c Implement dynamic sample loading
This change adds a new feature that enables loading and unloading of
sample data on demand. As soon as a preset is selected for a channel, all
of it's samples are loaded into memory. When a preset is unselected, all
of it's samples are unloaded from memory (unless they are being used by
another selected preset).

This feature is disabled by default and can be switched on with the
"synth.dynamic-sample-loading" setting.
2018-04-18 09:14:55 +02:00
Marcus Weseloh
a985c68a13 Enable decompressed Ogg Vorbis samples to be stored in sample cache
This change moves the Ogg Vorbis decompression to fluid_sffile, so that
this is the only place where we have to deal with compressed audio.

It also changes the way the samples are loaded for SF3 files: previously,
the compressed data was copied into memory, then the individual samples
were decompressed (resulting in both compressed and decompressed data to
stay in memory). Also, decompressed data wasn't cached, so previous loads
of the same file ran the decompressed again for each sample.

After this change, the vorbis decompression is changed so that it reads the
compressed data directly from the Soundfont file. And the resulting WAV
data is stored in the sample cache.
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
Marcus Weseloh
3d05360f33 Split preset parsing from Soundfont file open 2018-04-18 09:14:55 +02:00
derselbst
8051b43c02 fix result checking for fwrite()
Potentially fixes infinite loop in file renderer, when fwrite() returns zero. Addressing #367.
2018-04-17 16:43:52 +02:00
Tom M
d3e6781abd
Merge pull request #364 from FluidSynth/197
Unify calling conventions for rvoice update functions
2018-04-11 19:42:19 +02:00
derselbst
ff19788fda avoid memory leak in new_fluid_voice() 2018-04-11 19:33:40 +02:00
derselbst
78de299da4 make param array of fluid_rvoice_function_t const 2018-04-11 19:22:55 +02:00
derselbst
cb35fac1c6 make VintageDreams sf2 an explicit requirement for unit tests 2018-04-11 11:03:12 +02:00
derselbst
b76aeead01 remove obsolete alloc preset comments 2018-04-11 10:05:24 +02:00
derselbst
0af950a1e2 avoid swapping rvoices when can_access_rvoice is false 2018-04-11 09:56:42 +02:00
derselbst
036595f7db avoid duplicate call of fluid_rvoice_set_output_rate() 2018-04-11 09:56:03 +02:00
Marcus Weseloh
839f62f89d Remove unused variable 2018-04-10 22:09:33 +02:00
derselbst
0ccb0460fb update rvoice function related docs 2018-04-09 16:57:34 +02:00
derselbst
5034e0ca8b rename fluid_rvoice_eventhandler_push*() 2018-04-09 16:40:25 +02:00
derselbst
b4456d1b4c rename EVENT_PARAMS to MAX_EVENT_PARAMS 2018-04-09 16:32:32 +02:00
Marcus Weseloh
efa97718fa Increase soundfont references only when assigning preset to channel
Previously, the refcount was increased when retrieving a preset from
a soundfont. That doesn't really make sense anymore.
2018-04-08 23:03:14 +02:00
Marcus Weseloh
5a8880560d Remove now invalid comments about having to free presets 2018-04-08 23:03:14 +02:00
Marcus Weseloh
1a1bf7d0ea Remove now obsolete preset stack code and struct members 2018-04-08 23:03:14 +02:00
Marcus Weseloh
66610abcb9 Refactor fluid_preset_t handling in defsfont and ramsfont
Removes the need for a pre-allocated stack of fluid_preset_t's. Upon
adding a loader specific preset, a fluid_preset_t is automatically
created. defsfont and ramsfont now keep track of the fluid_preset_t's,
not the loader specific ones.

Also changes the sfont::iteration_next signature to directly return
the next preset. This is possible as presets are now only created once
and returned as a pointer.
2018-04-08 22:59:55 +02:00
derselbst
0bfa332fd9 remove redundant call to fluid_synth_set_sample_rate()
on synth creation
2018-04-08 18:49:18 +02:00
derselbst
ddd14cb00b duplicate rvoice_eventhandler in fluid_voice_t
avoiding several indirection to access it
2018-04-08 18:35:54 +02:00
derselbst
7c2e76f2f3 avoid NULL deref during voice creation
by executing rvoice event function directly instead of enqueueing events
2018-04-08 18:12:53 +02:00
derselbst
9c44aaba62 remove fluid_rvoice_eventhandler_push5() 2018-04-08 17:35:31 +02:00
derselbst
7ae9099293 unify rvoice update functions calling conventions
by proper typedefing
2018-04-08 17:22:57 +02:00
Tom M
189433a757
Merge pull request #363 from FluidSynth/197
rvoice_* related cleanup
2018-04-08 13:49:06 +02:00
Tom M
dcb54f8438
Merge pull request #361 from FluidSynth/unit-test
Introduce unit tests
2018-04-08 13:45:43 +02:00
derselbst
11f5950284 rename fluid_sample_null_ptr()
to better reflect its purpose
2018-04-08 12:45:54 +02:00
derselbst
a25f816c33 unify chrous and reverb types 2018-04-08 12:34:42 +02:00
derselbst
aa0d32f29a remove unused fluid_voice_write() 2018-04-08 12:18:38 +02:00
derselbst
5829fdc27c remove obsolete synth.parallel-render setting 2018-04-08 12:10:33 +02:00
derselbst
a7bb2e8a08 remove obsolete fluid_rvoice_eventhandler_t::is_threadsafe 2018-04-08 12:07:10 +02:00
derselbst
5698106dde fix various doxygen warnings 2018-04-08 10:36:52 +02:00
derselbst
4623fe3eb3 make fluid_synth_remove_sfont() return FLUID_OK|FAILED 2018-04-08 10:19:57 +02:00
Tom M
b37157b709
Merge pull request #362 from jnonis/master
Fix for LADSPA chorus send port.
2018-04-08 10:08:32 +02:00
Marcus Weseloh
fa0d103907 Remove unnecessary debug warnings for equal sample loopstart and loopend 2018-04-08 00:07:25 +02:00
derselbst
4ede11e71f remove redundant struct _fluid_sfont_info_t
integrate its members into fluid_sfont_t
2018-04-07 22:17:08 +02:00
derselbst
87bbba9069 disable unit tests on macosx
libintl is not found for some reason
2018-04-07 19:09:49 +02:00
derselbst
6ab1c7fde3 avoid memory leak during sample import 2018-04-07 18:21:25 +02:00
derselbst
19587d343a dont exit sample processing early
when a single sample is broken
2018-04-07 18:14:09 +02:00
derselbst
b1b870049b fix return value on sample validation 2018-04-07 18:09:37 +02:00
Marcus Weseloh
32961c4031
Merge pull request #360 from FluidSynth/sfont-loader-refactor
SoundFont Loading Refactor
2018-04-07 12:05:41 +02:00
Marcus Weseloh
9c1f3bd53e Return FLUID_OK instead if TRUE to be consistent with other return values 2018-04-05 19:20:47 +02:00
Marcus Weseloh
362a3f2a81 Fix bug in removing element from samplecache_list 2018-04-05 19:20:17 +02:00
Marcus Weseloh
f8bc376392 Use glib's g_stat to get file modification time 2018-04-04 11:11:41 +02:00
Marcus Weseloh
7e36bcf058 Rename parameters and variables to better reflect their contents / use
As fluid_defsfont contains code that deals with fluid_sfont_t and
fluid_defsfont_t, fluid_preset_t and fluid_defpreset_t, it sometimes gets
very confusion to know which type is currently being accessed by "sfont"
or "preset".

Also clarify some preset zone / inst zone ambiguities.
2018-04-04 11:11:41 +02:00
Marcus Weseloh
d1c620f998 Use fluid_list_get to access list entry data 2018-04-04 11:11:41 +02:00
Marcus Weseloh
109e8990b8 Use FLUID_STRDUP instead of manual allocate and copy for strings in defsfont loader 2018-04-04 11:11:41 +02:00
Marcus Weseloh
cf04a4ff73 Use FLUID_ARRAY instead of FLUID_MALLOC for sample buffers 2018-04-04 11:11:41 +02:00
Marcus Weseloh
312459eaf1 Treat failures while loading 24-bit sample data as not fatal 2018-04-04 11:11:41 +02:00
Marcus Weseloh
352bdef533 Properly free memory on error 2018-04-04 11:11:41 +02:00
Marcus Weseloh
e8717e5b40 Remove explicit cast of FLUID_MALLOC return value 2018-04-04 11:11:41 +02:00
Marcus Weseloh
c7e579aa75 Remove redundant error messages 2018-04-04 11:11:41 +02:00
Marcus Weseloh
29296b0e20 Ensure that sample_data memory is unlocked even if sample_data_24 mlock fails 2018-04-04 11:11:41 +02:00
Marcus Weseloh
d5407742a6 Always release the mutex when exiting fluid_samplecache_load
And change fluid_samplecache_unload to use the same style.
2018-04-04 11:11:41 +02:00
Marcus Weseloh
8024907610 No need for fluid_sample_* functions in fluid_sfont to be public 2018-04-04 11:11:41 +02:00
Marcus Weseloh
4932b4af90 Refactor sample cache loader
- move sample reading to fluid_sffile
- refactor sample cache to use fluid_list and separate long functions into
  smaller ones
- include sample start and count in cache key, in preparation for lazy loading
- make defsfont use new sample cache loader interface
2018-04-04 11:11:41 +02:00
Marcus Weseloh
5bc2d33bb9 Differences in sample chunk sizes are not an error but simply an indication of a changed file 2018-04-04 11:11:41 +02:00
Marcus Weseloh
870fc56d6a Code cleanup and formatting in fluid_samplecache 2018-04-04 11:11:41 +02:00
Marcus Weseloh
a274a394e0 Clang-format fluid_samplecache 2018-04-04 11:11:41 +02:00
Marcus Weseloh
4ec1cfe73e Move sample caching code to own file fluid_samplecache.c/h 2018-04-04 11:11:41 +02:00
Marcus Weseloh
76102f2009 Remove unnecessary fluid_sample_t::valid flag 2018-04-04 11:11:41 +02:00
Marcus Weseloh
963a5e98b4 Move sample and loop validation to fluid_sfont
Makes it possible to use the same validation logic for both SF2 and SF3
samples.
2018-04-04 11:11:41 +02:00
Marcus Weseloh
987d8a5f17 Move vorbis decompression to fluid_sfont 2018-04-04 11:11:41 +02:00
Marcus Weseloh
0a664e0797 Remove unnecessary conversion of sample pointers to offsets
SFSample should provide the sample pointers as specified in the Soundfont
file. If any mangling of the pointers is required, it should happen in the
defsfont loader.
2018-04-04 11:11:34 +02:00
Marcus Weseloh
9341059b24 Remove underscore functions for log messages
They were only used in soundfont loading code, so are probably a remnant
from Smurf. The rest of the FluidSynth code doesn't use underscore
functions, so remove them here as well for consistency.

Also use single quotes in double quoted string, to remove the need for
escaping chars.
2018-04-04 11:08:45 +02:00
Marcus Weseloh
1bc69be41b Rename fluid_sf2_* functions to fluid_sffile_* 2018-04-04 11:08:45 +02:00
Marcus Weseloh
b6bdb6b059 Cleanup delete_* functions 2018-04-04 11:08:45 +02:00
Marcus Weseloh
7f09321714 Make size macro names easier to read 2018-04-04 11:08:45 +02:00
Marcus Weseloh
10b87e9d54 Rename fluid_sf2 to fluid_sffile 2018-04-04 11:08:45 +02:00
Marcus Weseloh
5dc64d1544 Cleanup function signatures, passing SFData to every function
Makes the whole file easier to read and gives the implementation a little
more "object-oriented" feel.
2018-04-04 11:08:38 +02:00
Marcus Weseloh
74e2a4b933 More expressive variable names in load_phdr 2018-04-04 11:08:38 +02:00
Marcus Weseloh
9c31e96c60 Store file_callbacks in SFData structure 2018-04-04 11:08:38 +02:00
Marcus Weseloh
181b9727e8 Cleanup error handling in fluid_sf2_load 2018-04-04 11:08:38 +02:00
Marcus Weseloh
fb374814c3 Move public functions to top of file and document them properly 2018-04-04 11:08:38 +02:00
Marcus Weseloh
78be6f7fe1 Use FLUID_FREE instead of free 2018-04-04 11:08:38 +02:00
Marcus Weseloh
500931bd33 Separate typedefs and struct definitons 2018-04-04 11:08:38 +02:00
Marcus Weseloh
e7109a91aa Rename public and static methods to naming conventions
# Conflicts:
#	src/sfloader/fluid_sf2.h
2018-04-04 11:08:38 +02:00
Marcus Weseloh
6fc816c3cb Clarify some function names and comments
# Conflicts:
#	src/sfloader/fluid_sf2.c
2018-04-04 11:08:38 +02:00