Commit graph

156 commits

Author SHA1 Message Date
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
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
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
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
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
3d05360f33 Split preset parsing from Soundfont file open 2018-04-18 09:14:55 +02:00
Marcus Weseloh
839f62f89d Remove unused variable 2018-04-10 22:09:33 +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
5698106dde fix various doxygen warnings 2018-04-08 10:36:52 +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
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
9c1f3bd53e Return FLUID_OK instead if TRUE to be consistent with other return values 2018-04-05 19:20:47 +02:00