Commit Graph

1173 Commits

Author SHA1 Message Date
Chris Robinson bf4ddfef6d Implement a simplistic MSADPCM encoder
It's not particularly good, but it's better than silence.
2014-03-05 07:27:22 -08:00
Chris Robinson 61569e09ed Allocate enough temp space for the ADPCM decoders and encoders 2014-03-05 06:18:55 -08:00
Chris Robinson a4126b66d4 Use specialized methods for converting ALshort to IMA4 and MSADPCM
As before, to avoid unnecessary direct copies
2014-03-05 06:13:00 -08:00
Chris Robinson f82f3f10ab Use specialized methods for converting IMA4 and MSADPCM to ALshort
Since the decoder methods already convert to ALshort, there's no need to use a
temp buffer that's just going to copy directly to the destination.
2014-03-05 04:59:24 -08:00
Chris Robinson 15b68fe694 Use maxi to clamp an int to a lower-bound 2014-03-05 04:37:55 -08:00
Chris Robinson fb1f9aad6e Expand the sign bit on the initial MSADPCM delta value 2014-03-05 00:30:23 -08:00
Chris Robinson a1c440bd09 Add an extension to support MSADPCM buffer formats 2014-03-04 22:44:30 -08:00
Chris Robinson f3a87d72b2 Add an extension to alter the block alignment for buffer unpack/pack ops
This is for unpacking (reading, e.g. alBufferData) and packing (writing, e.g.
alGetBufferSamplesSOFT) operations. The alignments are specified in sample
frames, with 0 meaning the default (65 for IMA4, 1 otherwise). IMA4 alignment
must be a multiple of 8, plus 1 (e.g. alignment = n*8 + 1), otherwise an error
will occur during (un)packing. Chenging the block alignment does not affect
already-loaded sample data, only future unpack/pack operations... so for
example, this is perfectly valid:

// Load mono IMA4 data with a block alignment of 1024 bytes, or 2041 sample
// frames.
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 2041);
alBufferData(buffer, AL_FORMAT_MONO_IMA4, data, data_len, srate);
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 0);
2014-03-04 05:53:35 -08:00
Chris Robinson b0a6b6427c Parameterize the block alignment 2014-03-04 04:29:35 -08:00
Chris Robinson a6eb38ea7f Use alloca for temp space decoding/encoding IMA4 blocks 2014-03-03 20:02:15 -08:00
Chris Robinson a2d9133ffc Reduce explicit template declarations and ignore IMA4-to-IMA4 conversions
Since we never store IMA4 data in buffers, we should only ever convert from
(user input) or to (user output) IMA4. Once we allow user-specified pack/unpack
block alignment, this wouldn't be a simple memcpy anyway.
2014-03-03 17:25:46 -08:00
Chris Robinson c442c93a93 Store the original frame size alignment in the buffer 2014-03-03 17:05:08 -08:00
Chris Robinson ea8a85b19c Move PATH_MAX fallback definitions to alMain.h 2014-02-27 18:17:20 -08:00
Chris Robinson 6e7c0e15eb Use OpenDataFile to load soundfonts relative to data directories 2014-02-27 02:20:51 -08:00
Chris Robinson a8249c3469 Move OpenDataFile to helpers.c so other sources can use it 2014-02-27 01:49:23 -08:00
Chris Robinson c68ce288d0 Move HRTF macros and function declarations to a separate header 2014-02-23 21:11:01 -08:00
Chris Robinson 9f43de62ab Add a return value to FindHrtfFormat 2014-02-23 20:14:07 -08:00
Chris Robinson 112b0f166f Add an alcGetInteger64vSOFT method and a way to get the device clock 2014-02-01 17:55:42 -08:00
Chris Robinson 69f3a7da6d Keep track of a device clock time, based on the number of samples processed 2014-02-01 16:37:11 -08:00
Chris Robinson 65a5311449 Rename aftertouch to keypressure 2014-01-17 04:18:49 -08:00
Chris Robinson 08ba5d9dba Use a proper struct for envelope properties 2014-01-17 00:36:33 -08:00
Chris Robinson e118ac93a0 Handle fontsound sample types using explicit enum values
Uses AL_MONO_SOFT, AL_RIGHT_SOFT, and AL_LEFT_SOFT. "Linked" samples types
aren't explicitly supported due to being under-defined in the SF2 spec, nor are
ROM samples currently.
2014-01-15 22:18:07 -08:00
Chris Robinson 50b74629dd Add a flag to specify the device being paused
Used to prevent UpdateDeviceParams from restarting the device, if a new context
is created while paused.
2014-01-15 16:44:12 -08:00
Chris Robinson 56899716d6 Add an extension to pause audio processing 2014-01-15 16:27:17 -08:00
Chris Robinson 0c80f62de7 Add a method to get soundfont samples 2014-01-13 00:20:14 -08:00
Chris Robinson 6f3dac6f58 Allow getting preset properties even when referenced 2014-01-12 23:57:44 -08:00
Chris Robinson e252a100f7 Minor non-functional cleanup 2014-01-12 16:27:21 -08:00
Chris Robinson a5bfc1e30b Add a method to get the current MIDI state 2014-01-12 12:27:46 -08:00
Chris Robinson cf66516a27 Load soundfont modulators into FluidSynth 2014-01-06 13:07:12 -08:00
Chris Robinson 4079ee2200 Add methods to get and set modulator properties on fontsounds 2014-01-05 17:21:34 -08:00
Chris Robinson 5f961a392e Move some soundfont methods to ALsoundfont 2014-01-05 05:11:07 -08:00
Chris Robinson 540a99e71f Allow "deleting" the default soundfont
The ID remains valid and the soundfont will be reloaded as needed, but this
provides a way for the application to clear up the soundfont memory.
2014-01-04 05:30:57 -08:00
Chris Robinson bb54743425 Allow querying default soundfont properties
Any attempts to modify it or its held objects will result in an
AL_INVALID_OPERATION error.
2014-01-04 04:49:10 -08:00
Chris Robinson 355b8db915 Don't allow min key/vel ranges to exceed max range 2014-01-03 23:19:14 -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 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 f790d0e91f Use a uint map for modulators 2014-01-02 14:43:44 -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 5f85a1dcf0 Move some error macros to alError.h 2014-01-02 10:42:00 -08:00
Chris Robinson 01f547b93e Move some preset alloc/dealloc code to separate functions 2014-01-02 10:39:21 -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 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