51 Commits

Author SHA1 Message Date
Chris Robinson
d19e42a723 Don't require MIDI sysex data to have the high bit clear 2014-06-26 04:35:51 -07:00
Chris Robinson
03fd2b8266 Remove setState from the MidiSynth vtable 2014-03-23 18:34:49 -07:00
Chris Robinson
9959972c7e Add a stub 'soft' MIDI synth handler
Eventually this one will be used to handle MIDI internally, using our own
mixers and resamplers.
2014-03-22 21:53:00 -07:00
Chris Robinson
65a5311449 Rename aftertouch to keypressure 2014-01-17 04:18:49 -08:00
Chris Robinson
13066bbf87 Allow selecting the default soundfont using ID 0 2014-01-03 22:58:51 -08:00
Chris Robinson
e74e3e2b23 Move alLoadSoundfontSOFT to alSoundfont.c 2014-01-02 09:06:28 -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
7640c658ee Remove explicit locking from alMidiSoundfontvSOFT.
The MIDI backend can lock as it needs.
2013-12-29 05:48:30 -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
06dd9f9b8c Lock the device while selecting soundfonts 2013-12-29 05:36:05 -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
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
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
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
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
5349b90a48 Fix leak if inserting a sysex event fails 2013-12-08 06:20:44 -08:00
Chris Robinson
3f5914e094 Simplify dummy synth processing loop 2013-12-01 01:03:55 -08:00
Chris Robinson
517be463ae Minor comment update 2013-12-01 00:31:39 -08:00
Chris Robinson
dc13ce7a0a Use a method to get the default soundfont filename 2013-12-01 00:22:20 -08:00
Chris Robinson
c834713526 Add methods to set and get the MIDI gain 2013-11-30 23:47:42 -08:00
Chris Robinson
2633fbfc4b Add a method to check if a file is a soundfont 2013-11-30 20:37:37 -08:00
Chris Robinson
e0babed29b Add a workaround for allowing GM2 bank selection with a GM2 On SysEx 2013-11-29 23:57:32 -08:00
Chris Robinson
be446366fb Add a method to specifying MIDI SysEx messages 2013-11-29 05:37:45 -08:00
Chris Robinson
ea1d7d56d3 Add infrastructure for handling SysEx MIDI events 2013-11-29 04:56:33 -08:00
Chris Robinson
82d4e69da1 Don't force MMA bank selection mode 2013-11-29 00:42:27 -08:00
Chris Robinson
f4cf84e72d Combine duplicate soundfont loading code 2013-11-28 05:30:48 -08:00
Chris Robinson
8615a109ce Remove an unneeded MidiSynth field 2013-11-28 05:06:40 -08:00
Chris Robinson
f8c68291d3 Add a method to stop MIDI playback
Unlike pausing, this resets the MIDI clock time to 0, clears the existing event
queue, stops all MIDI sounds, and resets MIDI controllers.
2013-11-28 04:52:53 -08:00
Chris Robinson
29a4ac329a Move MidiSynth locking out of the setState method 2013-11-28 04:29:38 -08:00
Chris Robinson
5dad1688d4 Fix building without FluidSynth 2013-11-28 04:21:39 -08:00
Chris Robinson
98b0a3187e Add a config option for specifying the default MIDI soundfont 2013-11-28 04:16:46 -08:00
Chris Robinson
7794e53667 Be a bit safer with MIDI state changes 2013-11-28 03:57:45 -08:00
Chris Robinson
bb0207d784 Add a method to load a soundfont 2013-11-28 03:38:17 -08:00
Chris Robinson
a3c76c3274 Add an option for FLuidSynth to handle MIDI 2013-11-28 03:08:28 -08:00
Chris Robinson
a48f362d28 Start a MIDI interface extension 2013-11-28 01:53:05 -08:00
Chris Robinson
489723723c Cleanups for MidiSynth
Remove an unneeded field, make MidiSynth_getTime public, and properly return a
64-bit time from it.
2013-11-27 19:41:52 -08:00
Chris Robinson
5554b8cfc9 Add a MidiSynth interface for devices 2013-11-27 18:45:02 -08:00
Chris Robinson
3a1613253b Add a base MidiSynth struct 2013-11-27 05:12:11 -08:00