Commit Graph

2744 Commits

Author SHA1 Message Date
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 2b772a5607 Allow specifying all 4 sample types
ROM-based types will be specified with a separate property
2013-12-27 01:08:48 -08:00
Chris Robinson 307ac564ca Allow specifying some fontsound sample properties 2013-12-26 23:37:22 -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 cb3f82a4bf Do not allow deleting preset or instrument ID 0 2013-12-24 21:23:51 -08:00
Chris Robinson f7556b827a Allow querying the soundfont sample length and format type 2013-12-24 02:55:11 -08:00
Chris Robinson b0878fe609 Do not accept preset or instrument ID 0 as valid 2013-12-23 23:42:21 -08:00
Chris Robinson c911ca89a3 Unlock the soundfont earlier after switching preset lists 2013-12-23 23:31:47 -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
Chris Robinson 57491bf14c Call the right delete method when generating presets fails 2013-12-19 00:56:12 -08:00
Chris Robinson 666acb314b Rename some ALsoundfont fields 2013-12-19 00:37:56 -08:00
Chris Robinson 4288d3cd01 Move the soundfont and preset extension functions to separate sources 2013-12-19 00:27:11 -08:00
Chris Robinson 1b5c3495c9 Add methods to create and destroy presets 2013-12-19 00:09:55 -08:00
Chris Robinson 1e536cf7ca Properly initialize and cleanup the soundfont map 2013-12-18 23:21:59 -08:00
Chris Robinson 73fc4592ab Make alIsSoundfontSOFT check soundfont IDs 2013-12-18 23:12:44 -08:00
Chris Robinson 8083fb5be7 Add a new ALsoundfont object type
Includes a basic hierarchy for presets, instruments, samples, zones,
generators, and modulators.
2013-12-18 22:51:53 -08:00
Chris Robinson b9468dc917 Fix header guard and remove duplicate code 2013-12-18 19:17:03 -08:00
Chris Robinson cd90bdd9bd Add an option to use the HRTF time delay measured from the dataset 2013-12-18 12:43:59 -08:00
Chris Robinson 0653680690 Move the base MidiSynth to a separate file 2013-12-17 23:03:34 -08:00
Chris Robinson 0095a59fc9 Move the dummy MIDI handler to a separate file 2013-12-17 22:43:10 -08:00
Chris Robinson ee92b3142d Move FluidSynth to its own file 2013-12-17 22:36:25 -08:00
Chris Robinson ef0341c180 Make MidiSynth's methods non-static 2013-12-17 21:56:28 -08:00
Chris Robinson 7f51569186 Update the midi soundfont config option 2013-12-16 15:05:53 -08:00
Chris Robinson 189d73dd87 Render some MIDI samples even when stopped
Because stopping MIDI playback puts any playing notes into release phase, they
should be rendered. Ideally it could stop rendering once output goes silent.
2013-12-15 21:03:23 -08:00
Chris Robinson f244ef6f82 Use macros for MIDI controller values 2013-12-15 20:15:30 -08:00
Chris Robinson bcc2b9a490 Don't explicitly set reverb or chorus 2013-12-13 16:14:50 -08:00
Chris Robinson 1dd05bac5c Add a alMidiResetSOFT method to reset the synth
Playback is stopped, the queue is flushed, the clock is reset to 0, and the
MIDI system is reset to power-up status.
2013-12-13 14:15:01 -08:00
Chris Robinson a343d78724 Update behavior for alMidiStopSOFT
alMidiStopSOFT now has the following behavior:
* All pending MIDI events up to the current time are processed first, before
the queue is flushed.
* All channels then receive an All Notes Off event so that notes go through
their release phase. Controllers are *NOT* reset.
* Clock time is reset to 0, like before.
2013-12-13 13:40:53 -08:00
Chris Robinson 57eef756c3 Fix retrieving source properties 2013-12-09 13:04:16 -08:00
Chris Robinson 5349b90a48 Fix leak if inserting a sysex event fails 2013-12-08 06:20:44 -08:00
Chris Robinson ac525db845 Fix numeric constant type (double->float) 2013-12-08 05:01:06 -08:00
Chris Robinson a846418964 Rename pthread wrappers used for Windows to althread 2013-12-06 02:12:45 -08:00
Chris Robinson 3f5914e094 Simplify dummy synth processing loop 2013-12-01 01:03:55 -08:00