Commit Graph

2189 Commits

Author SHA1 Message Date
derselbst a94bc82a3c Initialize allocated memory to garbage
for debug builds.
2019-10-05 16:43:53 +02:00
derselbst ad37aa50b6 rename fluid_print_zone_voice_mod to match naming conv 2019-10-05 15:38:27 +02:00
derselbst 399e15e138 rename fluid_print_voice_mod to match naming convention 2019-10-05 15:35:13 +02:00
derselbst 978e51bafa use FLUID_LOG and FLUID_DBG 2019-10-05 15:14:51 +02:00
derselbst 2be0012057 remove conditional compilation of fluid_print_voice_mod() and friends
fixes release build
2019-10-05 15:13:35 +02:00
derselbst 06c8980b93 Merge branch 'master' into linked-modulators 2019-10-05 14:44:02 +02:00
derselbst 24e7c5090b Minor update to the synth API 2019-10-05 14:43:17 +02:00
derselbst 587fbf2e67 Fix broken previous merge.
Fixes build and closes #567.
2019-10-05 14:24:22 +02:00
jjceresa c44c327044 fix comment in test_modulator_amount.c 2019-10-04 14:34:22 +02:00
jjceresa c9447e74cd Add test in test_modulator_amount.c 2019-10-04 14:30:52 +02:00
jjceresa 454e322ddb Make float_equal true float compare 2019-10-04 14:09:59 +02:00
jjceresa f60320a7db More comments in test_modulator_amount.c 2019-10-04 14:05:44 +02:00
jjceresa 795c0c65ee fix test_modulator_amount.c 2019-10-03 13:49:45 +02:00
jjceresa 60684cb33b add parenthesis, remove unused variables 2019-10-03 11:50:15 +02:00
jjceresa 4e0f436c9a add test for API fluid_voice_add_mod() 2019-10-01 23:56:11 +02:00
jjceresa 2afab29bab move printing functions to the proper file.
- move fluid_dump_linked_mod() to fluid_mod.c
- move fluid_print_voice_mod() to fluid_voice.c
2019-10-01 18:03:46 +02:00
jjceresa 6ce17ed648 Remove dest0_idx param in fluid_linked_branch_test_identity()
- This parameter was useful only with old recursive implementation
  of this function.
2019-10-01 16:40:38 +02:00
jjceresa a87162746e add mod_idx param to fluid_dump_linked_mod() 2019-10-01 14:25:04 +02:00
jjceresa 638663e4ac add comments in fluid_print_voice_mod() 2019-10-01 02:03:41 +02:00
jjceresa 500b9b643b fix comments in fluid_dump_linked_mod() 2019-10-01 01:28:41 +02:00
jjceresa 869c8c2a76 Add printing of voices modulators in fluid_defpreset_noteon()
- When DEBUG macro is set, this allows printing of voices
  modulators on stdout.
- Printing is done by fluid_print_voice_mod() which allows
  displaying of voices modulators belonging to any combination (preset
  zone, intrument zone).
  Filters names are useful for printing voice modulators of only one
  zone when necessary.
2019-10-01 01:17:46 +02:00
jjceresa 5b17840770 fix comments in fluid_check_linked_mod_path() 2019-09-30 11:37:25 +02:00
jjceresa 3d8471d06c Replace space by underscore in list name 2019-09-29 01:16:42 +02:00
jjceresa 7587ef68df Add tests in test_modulator_links.c
These test check expected internal ordering of linked
modulators returned in linked_mod list:
 - Tests 3.2, 3.2.1
 - Test  3.3, 3.3.1
2019-09-29 00:56:20 +02:00
derselbst 9ab3e3ab51 Merge branch '2.0.x' into master 2019-09-28 07:38:54 +02:00
derselbst 62b38b1c66 Minor typo in API docs 2019-09-27 16:53:27 +02:00
derselbst ca7f7047ad Correctly define DEBUG macro 2019-09-27 14:05:13 +02:00
derselbst 44453ff232 Ensure the reverb engine is initialized after synth creation
The parameters (roomsize, level, etc.) of the reverb effects unit are initialized at the very end of `new_fluid_synth()` with `fluid_synth_set_reverb_full_LOCAL()`.
This however only adds an update-event to the `rvoice_mixer` queue.
The call to `fluid_synth_process_event_queue()` in `new_fluid_synth()` should make sure, that this event is dispatched and triggers the actual update.
However, the event is not dispatched immediately, because the rvoice event queue has not been committed yet, that is, a call to `fluid_rvoice_eventhandler_flush()` is missing.

So, although a reverb param initialization event has been queued, the reverb params still are garbage initialized (on Windows to some `-6.2774385622041925e+66`).

The next call to through the synth's public API will flush the queue and finally dispatch the update event, but when will it happen?

1. If the soundfont is specified as command-line argument, this call will happen before the audio driver starts rendering.
2. If the soundfont is loaded via shell command `load`, the audio driver will first start rendering audio, after updating the reverb.

Case 1. is trivial, everything works as it should.
Case 2. is interesting. Since the synth already started rendering audio by using that uninitialized reverb unit, the reverb engine's internal buffer is completely filled up with noise. Before outputting that signal to sound card, the sound is clipped to `1.0f`. That's the click we hear at the beginning. And because the reverb is so loud, the rendered audio signal stays 1.0f for quite a long time (...or always, can't tell).

Why is it not reproducible on Linux? Because GCC and Clang (AFAIK) leave all values uninitialized after allocating memory. And because malloc() often return zero-initialized memory, the reverb params seem to be nicely zero-initialized. MSVC however, always initializes memory with garbage, which is why we "hear" this resonance disaster.

Solution: Just update the reverb params via public API, which implicitly calls `fluid_rvoice_eventhandler_flush()`.

Fixes #563.
2019-09-27 14:01:40 +02:00
jjceresa 47b2a26491 fix bug introduced by 8d34e2547 2019-09-26 00:11:34 +02:00
derselbst 9793c0def3 bump to 2.0.7 2019-09-24 16:23:55 +02:00
Tom M 17042f4dc1
Add a public wrapper function for free() (#562)
to allow proper deallocation for programming languages other than C.
2019-09-24 16:14:34 +02:00
jjceresa 467d951869 Merge branch 'master' into linked-modulators 2019-09-23 19:42:19 +02:00
Tom M 7fac580ae3
Merge pull request #561 from FluidSynth/synth-default-mod
Minor cleanups
2019-09-23 18:03:06 +02:00
jjceresa 22142245ca fix comment in fluid_synth_remove_default_mod() 2019-09-22 16:12:32 +02:00
jjceresa 02134d6959 optimize fluid_delete_synth() 2019-09-22 03:21:09 +02:00
jjceresa b9421409aa optimize fluid_synth_remove_default_mod() 2019-09-22 02:56:14 +02:00
jjceresa c4c05533bb check mode param beforehand in fluid_synth_add_default_mod() 2019-09-22 02:53:10 +02:00
jjceresa 03d518eeba Add mod_count parameter to fluid_list_check_linked_mod()
1)@param mod_count number of modulators in table list_mod:
  - If > 0, the function assumes that list_mod is a table and
    initializes it as a list of modulators chained by next field, so that the caller
    doesn't need to do this initialization. This is appropriate when the
    function is called from fluid_voice_add_mod2().

  - If 0, the function assumes that mod_list is a list of modulators with next
    field properly initalialized by the caller. This is appropriate when the
    function is called from the soundfont loader.

 2) Test 11 is added to test_modulator_links.c allowing to test	this new  parameter.
2019-09-17 18:35:47 +02:00
jjceresa 7510d908f3 fix comments in test 10 2019-09-17 15:20:18 +02:00
jjceresa 22f94f84d9 Add linked_count parameter to fluid_list_check_linked_mod()
1)@param linked_count, number of modulators in linked_mod:
      - If > 0, the function assumes that linked_mod contains a table provided
        by the caller. The function returns linked modulators directly in
	this table which is faster because it doesn't allocate memory.
        This is appropriate when the function is called from fluid_voice_add_mod2().
      - If 0, the function makes internal allocation and returns the list in
        linked_mod. This is appropriate when the function is called from
        the soundfont loader as the list of linked modulators must exist during the
	life of the preset it belongs to. NULL is returned in linked_mod if there is
	no linked modulators in list_mod.

   2) Test 10 is added to test_modulator_links.c allowing to test this new  parameter.
2019-09-17 04:05:47 +02:00
jjceresa a0bd115e18 fix typos comments in fluid_list_check_linked_mod() 2019-09-16 22:47:34 +02:00
jjceresa a4afcfff28 rename variable linked_count to linked_idx 2019-09-16 22:27:44 +02:00
jjceresa d5ea4705ad fix typos in comments 2019-09-16 22:19:24 +02:00
jjceresa 3795c7dee9 alloc path bit table on stack 2019-09-16 17:56:21 +02:00
jjceresa 74c1699867 More comments in test_fluid_zone_check_mod.c 2019-09-15 22:28:42 +02:00
jjceresa 0dfe7c18fe remove commented line 2019-09-15 03:52:47 +02:00
jjceresa 7ca6bcc16a Enforce fluid_voice_add_mod() checking 2019-09-15 03:46:31 +02:00
jjceresa 650d654f3d Add comments in fluid_list_check_linked_mod(), fluid_zone_check_mod() 2019-09-15 01:37:27 +02:00
jjceresa 76d5c83743 Rename function, remove duplicate functions, add comments
- rename fluid_test_linked_mod_test_identity()  to
  fluid_linked_mod_dump_test_identity()
- make use of duplicate function fluid_dump_linked_mod() in
  fluid_desfont.c
- add comments
2019-09-15 00:42:42 +02:00
jjceresa 5f6914bb34 Add Sostenuto PDF documentation (#559)
This document explains what sostenuto pedal is compared to sustain pedal. It is intended for a musician playing live. It gives information about specifications and implementation in fluidsynth.
2019-09-14 17:19:43 +03:00