Commit graph

175 commits

Author SHA1 Message Date
derselbst
c9a670d26c Merge branch '2.0.x' into master 2019-04-18 20:21:01 +02:00
derselbst
7f11a9bf5c use a common function for opening regular files
Fixes #514
2019-04-18 19:43:39 +02:00
derselbst
e31bbe3504 Merge branch '2.0.x' into master 2019-04-17 19:14:46 +02:00
Marcus Weseloh
a0e91b9878 Fix memory-leak with SF3 samples when dynamic-sample-loading is not active
Vorbis compressed SF3 samples are always loaded individually and stored
in the sample cache in uncompressed form. When dynamic-sample-loading is
not active (the default), then the uncompressed samples did not get
unloaded when unloading the SF3 font.

This fix makes sure that those samples are also freed. For bulk loaded
samples, the sample->data pointer is always the same as the
font->sampledata pointer. For individually loaded samples, the sample->data
pointer always points to a different memory region. So we can use that
information to determine if and when to unload the samples one by one.

Fixes #530
Fixes #528
2019-04-17 19:10:38 +02:00
Tom M
46c2857fb0
Merge branch 'master' into cleanup21 2019-02-17 09:02:32 +01:00
derselbst
96e43ec72c Merge branch '2.0.x' into master 2019-02-17 09:00:32 +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
aa65624f8c Merge branch '2.0.x' into master 2019-02-07 08:55:24 +01:00
derselbst
12dd1c7653 reorder calls to fluid_file_test 2019-02-03 14:28:31 +01:00
derselbst
64c90a6c49 restrict soundfont loading to regular files only
i.e. forbid to load directories, block devices, dangling symlinks, etc.
2019-02-01 11:22:14 +01:00
derselbst
70727b2f7a Merge branch 'master' into cleanup21 2019-01-27 10:48:07 +01:00
jjceresa
b462e25ba3 Removing useless preset_zone parameter. 2019-01-03 19:57:27 +01:00
jjceresa
cc3d93b56e Change on prefixe zone name
-Name of an instrument zone shouldn't prefixed by the preset zone
 name.
 This is due to the fact that instrument zone are common to all
 preset zone. Consequently, an instrument zone cannot identfied
 via a preset zone.
-This new change, simply prefixe a zone as this:
 instrument zone name prefixed by iz:
 preset zone name prefixed by pz:
2019-01-03 19:40:55 +01:00
derselbst
8b1820580b Merge branch '2.0.x' 2018-12-30 12:42:30 +01:00
derselbst
8634613509 fix incorrect documentation of fluid_sample_sizeof() 2018-12-29 18:27:24 +01:00
derselbst
b7b420617b fix double free in fluid_sample_set_sound_data() 2018-12-29 18:21:43 +01:00
derselbst
15d27b7145 fix inverse logic in fluid_sample_set_sound_data() 2018-12-29 17:34:36 +01:00
derselbst
4d612c22f4 fix segfaults in fluid_is_soundfont() and fluid_is_midifile() 2018-12-29 11:18:36 +01:00
derselbst
488da516cd clarify documentation of fluid_sample_sizeof() 2018-12-28 14:54:13 +01:00
derselbst
c8b18056c6 remove unused fluid_sample_t::userdata 2018-12-28 14:47:55 +01:00
derselbst
10ddcc0cd3 Merge branch '2.1-testing' into master 2018-12-21 20:05:32 +01:00
Tom M
d666515c31
Merge pull request #487 from FluidSynth/min-attenuation
Fix minor bug in lower_boundary_for_attenuation()
2018-12-21 19:53:26 +01:00
jjceresa
e9b0f0d24b Add modulators checking at soundfont loading time (#467)
Actually some basic modulators check are done at noteon time (in fluid_voice_add_mod()). That means that we know if a modulator (modx) is invalid only when a MIDI noteon is received and only for a preset modx belongs to. This is not appropriate.

This moves the modulator checking at soundfont loading time. Enhancements are:
1) A better verbose modulator integrity check, for any soundfont loaded at appropriate time.
1.1) All modulators are checked (preset zone (local/global), instrument zone (local/global).
1.2.1) Modulators check are enforced to source src1 and src2  (for non-CC and CC sources) (following SF specs (except for CC LSB) ( see comment in fluid_synth_cc_LOCAL()).
Modulators CC sources checking is coherent with the actual behaviour in fluid_synth_cc_LOCAL() in regard of modulation triggering.
1.2.2) Also, identical modulator in the same zone are detected. 
1.2.3) Any invalid modulator(sources invalid, or modulator identical) is removed at loading time with a warning message displaying the cause and name of the modulators.

2) This fix a bug in noteon, in the case of identical modulators in global preset zone.
Assuming 2 identical modulator (m1 and m2) in a preset global zone, the actual noteon doesn't check this case (the actual code detect identical modulator in all others zones (instrument (local or global), preset(local)) but not preset global).

3) NoteOn is faster.
3.1)There is no more modulators checks at noteon making this more efficient.
3.2) As there are no identical modulator in the same zone, there is no more identity modulator check (i.e local zone against local zone), (i.e global zone against global zone). This result in a faster code and the bug described in (2) is gone.

4) Modulators sources checking as been added in API functions fluid_synth_add_default_mod() and fluid_voice_add_mod(). Please
2018-12-21 19:42:00 +01:00
jjceresa
e8dd6ae389 Import modulator source src1 correctly.
- When primary source input (src1) is set to General Controller
  'No Controller', output will be forced to 0.0 at synthesis time
  (see fluid_mod_get_value()).
  That means that the minimum value of the modulator will be always 0.0.
  We need to force amount value to 0 to ensure a correct evaluation of the
  minimum value later (see fluid_voice_get_lower_boundary_for_attenuation()).
2018-12-21 12:19:37 +01:00
jjceresa
b659fd82a5 Import modulator source src2 correctly.
- When secondary source input (src2) is set to General
  Controller 'No Controller', output will be forced to +1.0 at synthesis time
  (see fluid_mod_get_value()).
  That means that this source will behave unipolar only. We need to force the
  unipolar flags to ensure the modulator will behave correctly later in
  fluid_voice_get_lower_boundary_for_attenuation().
2018-12-19 18:12:09 +01:00
Marcus Weseloh
8da7f11a11 Only retrieve modification time once and remove warning if failed
This change removes the warning message if retrieving the soundfont file
modification time fails in the sample cache loader. The warning made sense
while we didn't have mtime support on all platforms, but after switching
to GLibs g_stat, it's no longer needed.

To reduce the number of calls to fluid_get_file_modification_time and also
get rid of a possible race condition, getting the mtime has been moved to
fluid_samplecache_load.

This change also fixes #483 because it removes the bogus warning messages
if a soundfont was loaded from memory by abusing the filename to store a
pointer.
2018-12-19 14:14:34 +01:00
carlo-bramini
c9b8d40fc2 Fourcc support (#482)
Have a direct comparison to the fourcc code rather than searching through chunk ids all the time with chunkid()
2018-12-19 14:09:29 +01:00
jjceresa
ba9092ef98 Reducing defsfont loader code (#480) 2018-12-02 17:42:51 +01:00
carlo-bramini
b8b41f781f Improve chunk id search (#471)
If we move UNKN_ID to the bottom of the enum, in the for() cycle inside chunkid() if the value is not found then the "i" variable will be already UNKN_ID.
2018-11-25 10:02:33 +01:00
Tom M
06bcf8db9f
Fix an incorrectly aligned result when converting between pointer types (#457)
fix alignment issue of idlist
2018-11-10 08:07:30 +01:00
derselbst
45e0f94b29 fuse fluid_gen_set_default_values() and fluid_gen_init()
avoids iterating over generators twice
2018-10-12 09:34:42 +02:00
derselbst
ce57220d65 dont cast const qualifier away 2018-10-06 14:27:10 +02:00
derselbst
57ef2dfed8 fix memory leaks in load_phdr() and load_ihdr() 2018-10-02 20:20:22 +02:00
derselbst
7f2d655b9c fix various NULL derefs in fluid_sffile 2018-10-02 20:14:56 +02:00
jjceresa
75b77f0186 Remove redundant invalid preset generators checking in fluid_defpreset_noteon() (#430) 2018-09-20 20:11:11 +02:00
derselbst
d7609d43f6 remove ramsfont 2018-06-26 08:34:41 +02:00
derselbst
9382edabd5 enforce coding style guide
using astyle
2018-06-24 13:13:18 +02:00
derselbst
995f22192d add a getter for fluid_preset_t::sfont 2018-06-04 10:49:58 +02:00
derselbst
a33e3c698d set soundfont iteration methods on fluid_sfont_t creation 2018-06-03 07:13:04 +02:00
derselbst
77e608e3ce add public getters and iteration functions for fluid_sfont_t 2018-06-02 15:01:40 +02:00
derselbst
344133a704 add public getters for fluid_preset_t 2018-06-02 14:07:53 +02:00
derselbst
8c2ef30038 fix uninitialized member access
of voice_zone->range.ignore; introduced in #370
2018-05-09 11:39:21 +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
1a5ea8d8e5 fix signedness warning 2018-04-27 21:32:00 +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