Commit Graph

1960 Commits

Author SHA1 Message Date
Chris Robinson
2dd87946fd Update some trace messages to be more useful 2014-01-03 23:19:52 -08:00
Chris Robinson
13066bbf87 Allow selecting the default soundfont using ID 0 2014-01-03 22:58:51 -08:00
Chris Robinson
42a67731c4 Add storage for a default soundfont object 2014-01-03 20:21:12 -08:00
Chris Robinson
3a31402b1e Remove an unused method 2014-01-03 19:35:55 -08:00
Chris Robinson
d9846f3219 Move ALsoundfont methods to the right source file 2014-01-03 19:18:06 -08:00
Chris Robinson
e6e7e461c0 Avoid using alFontsoundiSOFT when loading a soundfont
This should now make the soundfont loader thread-safe.
2014-01-03 18:52:17 -08:00
Chris Robinson
5dc4ea15bb Don't handle the list type in the RiffHdr struct 2014-01-03 18:09:51 -08:00
Chris Robinson
49c17ad520 Mostly load into fontsound objects directly
This leaves only one unsafe alFontsoundiSOFT call.
2014-01-02 13:53:16 -08:00
Chris Robinson
fcf9e72202 Load presets directly into objects 2014-01-02 11:40:30 -08:00
Chris Robinson
01f547b93e Move some preset alloc/dealloc code to separate functions 2014-01-02 10:39:21 -08:00
Chris Robinson
3ff33e2f79 Update the soundfont preset count after loading a soundfont 2014-01-02 09:09:57 -08:00
Chris Robinson
7d94e9c52f Don't allow soundfonts with existing presets in alLoadSoundfontSOFT 2014-01-01 07:33:48 -08:00
Chris Robinson
0a5a08c0fb Pass the ALsoundfont object to loadSf2, rather than its ID 2014-01-01 07:25:23 -08:00
Chris Robinson
e699ab8614 Force all FluidSynth sounds off when changing soundfonts
Selecting soundfonts should only happen when the MIDI engine is stopped or
reset. When stopped some notes may be left in a release phase, but we need to
ensure all fluid_sample_t objects are finished before unloading since the
soundfont (and associated sample memory) may be deleted at any time afterward.
2013-12-31 00:49:43 -08:00
Chris Robinson
6b2d3c3cfa Remove some unused MIDI backend methods 2013-12-29 06:02:48 -08:00
Chris Robinson
396a2f1595 Don't destroy the fluid_sfont_t if any of its samples are still playing
FluidSynth apparently doesn't check for this itself before calling the free
callback.
2013-12-29 05:58:40 -08:00
Chris Robinson
37d183efc0 Update soundfont selection functions
A filename is no longer specified, and alMidiSoundfontsSOFT is renamed to
alMidiSoundfontvSOFT.
2013-12-29 05:44:18 -08:00
Chris Robinson
4e73b95fc0 Add the last remaining "real-time" properties 2013-12-29 05:09:50 -08:00
Chris Robinson
4c35f7c632 Add chorus and reverb send properties 2013-12-29 04:36:01 -08:00
Chris Robinson
15aa12847d Check for negative soundfont indices getting passed to the loader 2013-12-29 04:25:28 -08:00
Chris Robinson
699d84491f Add pan and attenuation properties 2013-12-29 04:24:32 -08:00
Chris Robinson
d030e07879 Add tuning properties 2013-12-29 03:43:00 -08:00
Chris Robinson
1d41122372 Add filter properties 2013-12-29 03:18:31 -08:00
Chris Robinson
deecbbc55d Add modulation envelope properties 2013-12-29 02:40:12 -08:00
Chris Robinson
d9aedc1416 Add a few more pitch properties 2013-12-29 02:25:40 -08:00
Chris Robinson
fc928bb75a Add volume envelope properties 2013-12-29 02:14:10 -08:00
Chris Robinson
4659669a74 Fix copy-paste errors in error messages 2013-12-29 00:56:01 -08:00
Chris Robinson
5aa274999c Accumulate with default modulator amounts 2013-12-29 00:52:03 -08:00
Chris Robinson
09665715ed Add support for the fontsound loop mode 2013-12-29 00:34:58 -08:00
Chris Robinson
0d7996409e Ensure the soundfont version is 2.x 2013-12-28 10:34:26 -08:00
Chris Robinson
fe55cd6de8 Add alLoadSoundfontSOFT to load a soundfont via callback
Some hefty caveats:
This function is not thread-safe. In particular, the current context affecting
the thread must not be changed, and the provided soundfont must not be
altered while the function is executing. Ideally, this will be fixed.

Error handling is poor. Some RIFF structure errors may not be caught (e.g. sub-
chunks with sizes greater than the parent chunk allows for), and generated AL
errors are ignored, possibly leading to resource leaks in certain situations.
These should be fixed in time.

There is minimal error checking on the provided soundfont ID. It does not
ensure a valid ID has been provided, nor does it ensure the provided soundfont
can be modified. These short-comings should be fixed eventually.

Proper cleanup is the responsibility of the caller. The caller must get the
preset objects from the soundfont before deleting it, and the fontsound objects
from each preset before deleting them, to make sure all resources are properly
deleted.
2013-12-28 09:58:55 -08:00
Chris Robinson
7156f4439c Allow loading multiple soundfonts with FluidSynth 2013-12-27 06:41:57 -08:00
Chris Robinson
0678e3fc2b Create a custom fluid_sfloader_t loader
This allows us to load and use soundfont objects the app specifies (the first
one, at least), rather than having to load from a file. It doesn't sound that
good since modulators and most generators aren't yet available, but this will
steadily improve.
2013-12-27 06:23:07 -08:00
Chris Robinson
f85d733f9d Add a method to set and get soundfonts
The main purpose of this is to select soundfonts for playback, eventually,
instead of the existing method that takes a filename.
2013-12-27 02:59:50 -08:00
Chris Robinson
cc30c5754f Remove the generator list 2013-12-26 22:10:41 -08:00
Chris Robinson
d5f687b2fa Allow specifying key and velocity ranges on fontsounds 2013-12-26 21:45:16 -08:00
Chris Robinson
35f9e35aa3 Add methods to set and get sounds on a preset 2013-12-25 22:39:38 -08:00
Chris Robinson
b5ae424dbd Store a list of sounds in the preset 2013-12-25 19:50:46 -08:00
Chris Robinson
677b864565 Remove the zone, sample, and instrument object types 2013-12-25 19:35:43 -08:00
Chris Robinson
b650ecbc23 Add methods to add generators and modulators to fontsounds 2013-12-25 19:23:34 -08:00
Chris Robinson
94ddc5cb18 Add a new fontsound object type
This is basically a combined preset and intrument zone with sample header.
2013-12-25 19:13:59 -08:00
Chris Robinson
a43b296c60 Add methods to get and set presets on a soundfont 2013-12-23 04:07:53 -08:00
Chris Robinson
d7de86966d Add methods to get and set a preset object's preset and bank numbers 2013-12-23 03:23:42 -08:00
Chris Robinson
0df5eb90ea Make sure key and velocity ranges are the first two generators 2013-12-21 15:28:46 -08:00
Chris Robinson
ede3c20880 Free thunk entry in the object destructor 2013-12-20 01:04:38 -08:00
Chris Robinson
5dc3f3626d Better protect against improper alSoundfontSamplesSOFT calls 2013-12-20 00:50:43 -08:00
Chris Robinson
d596cf9cf3 Use a different autowah filter range
Still just guesses, but this seems to avoid math problems with low peak gains.
2013-12-20 00:16:23 -08:00
Chris Robinson
1bd828603e Add functions to set a soundfont's sample data 2013-12-19 04:19:03 -08:00
Chris Robinson
03a6bf22a5 Fix compiling without FluidSynth 2013-12-19 02:12:01 -08:00
Chris Robinson
99933fac49 Allow creating instrument objects 2013-12-19 00:57:07 -08:00