Commit Graph

383 Commits

Author SHA1 Message Date
Chris Robinson
3a8ef2f0d6 Initialize source parameters before adding the source to the map 2011-09-10 21:21:07 -07:00
Chris Robinson
4c8e6dead1 Don't defer stopped and initial source state changes
Typically when these are set, an app will be releasing the buffer from the
source, possibly to immediately reuse it. There would be an extra burden placed
on the app if it was required to process updates before it could fully release
the buffer from the source.
2011-09-10 21:02:50 -07:00
Chris Robinson
b28f48c1bd Store the filter gains directly in the source instead of duplicate filter objects 2011-08-31 02:18:16 -07:00
Chris Robinson
9fb91f70aa Rename GetReffedContext to GetContextRef 2011-08-30 23:28:38 -07:00
Chris Robinson
0a1321aaae Add a limit to the UIntMap size and use it for sources and effect slots 2011-08-30 20:33:47 -07:00
Chris Robinson
7d577832cd Add functions to retrieve the source from the source map while removing it 2011-08-30 17:32:49 -07:00
Chris Robinson
ee60248d19 Lock the context while deleting sources only as needed 2011-08-30 00:33:01 -07:00
Chris Robinson
d546813c05 Don't lock the context while checking the validity of objects 2011-08-30 00:04:02 -07:00
Chris Robinson
f02d9e22d7 Do a pointer exchange when replacing the source buffer queue 2011-08-29 23:55:24 -07:00
Chris Robinson
cc67f45892 Use the reference counting functions for the buffer and auxiliary slot refs 2011-08-29 23:10:02 -07:00
Chris Robinson
c6a110ec59 Hold the context lock as needed while generating and deleting sources 2011-08-29 22:51:18 -07:00
Chris Robinson
f5195ee4f2 Remove the Buffer field from the source 2011-08-23 09:55:22 -07:00
Chris Robinson
9f25ad42c1 Explicitly set BufferListStart's prev field 2011-08-23 09:27:35 -07:00
Chris Robinson
199df253ca Always use the thunk functions to get object IDs 2011-08-22 07:40:14 -07:00
Chris Robinson
c1f435cc18 Don't use the thunk array for object lookups 2011-08-22 07:22:02 -07:00
Chris Robinson
858592832f Defer source offset changes requested by the app 2011-08-21 00:49:04 -07:00
Chris Robinson
a97211b572 Use -1 to mark an invalid source offset instead of 0 2011-08-21 00:35:37 -07:00
Chris Robinson
f196a9fc67 Defer source state changes from alSourcePlay/Pause/Stop/Rewind calls 2011-08-20 23:59:24 -07:00
Chris Robinson
7ea71d8bfa Use a separate function to set the source state 2011-08-20 06:31:10 -07:00
Chris Robinson
36446f3a58 Make sure source vectors are finite values 2011-07-20 03:18:46 -07:00
Chris Robinson
5f566ebf05 Fade between HRTF coefficients, to reduce noise from sudden changes 2011-07-16 16:24:01 -07:00
Chris Robinson
ac7ca07221 Get rid of a couple typedefs 2011-07-02 21:33:53 -07:00
Chris Robinson
723755788d Rename Suspend/ProcessContext since they are locking a mutex 2011-06-30 18:10:04 -07:00
Chris Robinson
5736bbc3e4 Add a source property to skip channel virtualization for multi-channel buffers
With virtualization disabled, channels are mapped directly from input to output
and any input channel that is missing an output is dropped. Any virtualization
effects (such as HRTF filters) for positional cues are also skipped.

The idea is to allow applications a way to play pre-filtered audio that channel
vitualization effects could interfere with.
2011-06-29 23:18:49 -07:00
Chris Robinson
1fc44d5788 Select the mixer during a source update 2011-06-25 00:13:56 -07:00
Chris Robinson
0d39ac6528 Allow alThunkAddEntry to return a proper error 2011-06-17 23:59:25 -07:00
Chris Robinson
edf78b077e Use separate lines for HRTF history and values 2011-06-17 16:22:39 -07:00
Chris Robinson
23ae3c69b5 Handle the device's disconnected status earlier when playing a source 2011-06-17 13:21:02 -07:00
Chris Robinson
7d73ac4405 Avoid calling some AL functions from under the context lock
There are still some more occurances to clear out (deletion in gen error,
effects, some filters), which shall be coming up. There is a possibility for a
deadlock between the listlock and the global/context lock, if another attempt
to get the listlock is made while under the context lock.
2011-06-16 09:14:41 -07:00
Chris Robinson
7ddfacb58f Use a minimum phase HRTF data set
This reduces the coefficient size from 128 down to 32, with a set of delays
2011-06-03 01:06:00 -07:00
Chris Robinson
c00b2f9254 Avoid looking in the buffer queue to find the frame size 2011-05-18 17:02:18 -07:00
Chris Robinson
06f5f0b7c8 Make mixers channel-count agnostic
As a result, this combines/removes a bunch of mixers
2011-05-17 13:25:15 -07:00
Chris Robinson
2972de1047 Use function pointers to call the source mixer 2011-05-06 00:20:40 -07:00
Chris Robinson
f843b7e2e3 Implement HRTF mixers for multi-channel sources 2011-05-02 02:22:30 -07:00
Chris Robinson
56d9418119 Add an HRTF filter for mono sources
The data is based on the KEMAR HRTF data provided by MIT, which can be found at
<http://sound.media.mit.edu/resources/KEMAR.html>. The compact measurements
were used. See hrtf_tables.inc for more information.

The filter is only available for stereo output, using a 44100hz playback rate.
Note also that it currently only applies to mono sounds, and the cf_level and
head_dampen config options are ignored while it is active.
2011-05-01 13:59:44 -07:00
Chris Robinson
d8048e136f BufferFreq doesn't need to be a float 2011-02-09 11:19:33 -08:00
Chris Robinson
023658605e Constify some variables 2010-12-09 19:47:08 -08:00
Chris Robinson
1b7be672fa No need to clamp the app-specified pitch 2010-12-03 23:08:26 -08:00
Chris Robinson
9581325b9c Rename SrcFmt -> UserFmt 2010-12-03 22:33:41 -08:00
Chris Robinson
0cf32e2946 Reorder some parameters for consistency 2010-11-29 19:48:18 -08:00
Chris Robinson
693ab4d8bc Fix source offset calculations 2010-11-29 19:36:33 -08:00
Chris Robinson
e4869b447c Store the decomposed source format in the buffer 2010-11-29 19:27:33 -08:00
Chris Robinson
547f356131 Keep a handle on the buffer with the format when queueing new buffers 2010-11-29 17:35:22 -08:00
Chris Robinson
f09ae196a8 Avoid making Resampler[Pre]Padding static 2010-11-28 17:37:14 -08:00
Chris Robinson
0e748d98d5 Rename some stuff for consistency 2010-11-28 13:08:51 -08:00
Chris Robinson
c41e893361 Don't store the internal format in the buffer
The type and channel config are good enough
2010-11-28 12:53:35 -08:00
Chris Robinson
2fd8d6916b Support rear formats directly in the mixer 2010-11-27 22:55:20 -08:00
Chris Robinson
b4eaf1ab5a Avoid a potential overflow when setting the source offset 2010-11-27 22:22:14 -08:00
Chris Robinson
3c8e9a7f24 Clean up the source byte offset code 2010-11-27 22:13:29 -08:00
Chris Robinson
67ec72284d Remove some unneeded muLaw special cases 2010-11-27 22:06:51 -08:00
Chris Robinson
61315d4dfb Shorten a couple really long lines 2010-11-27 00:51:21 -08:00
Chris Robinson
d2895c7985 Use the enums in a couple more places 2010-11-27 00:15:07 -08:00
Chris Robinson
e1c0b5ea24 Call MixSource directly, instead of through a function pointer 2010-11-25 23:09:18 -08:00
Chris Robinson
596514f7aa Make the buffer queue a double-linked list 2010-11-25 18:30:57 -08:00
Chris Robinson
c9363832fe Fully progress the source to a stopped state when no buffers are playable 2010-11-24 10:16:53 -08:00
Chris Robinson
5f6f046d25 Use a double when converting millisecond offsets to byte offsets 2010-11-07 21:41:04 -08:00
Chris Robinson
c95f182a90 Remove unnecessary comments and reorder some lines 2010-11-06 14:07:30 -07:00
Chris Robinson
9fbd6c6c3f Make the SourceMix function a method of the ALsource struct 2010-09-26 01:15:27 -07:00
Chris Robinson
97daaade8a Reduce some more indentation 2010-09-21 16:54:33 -07:00
Chris Robinson
8a1d5a21c3 Reduce some indentation 2010-09-21 15:12:08 -07:00
Chris Robinson
301a8ba3a4 Improve some range checks 2010-09-21 14:41:43 -07:00
Chris Robinson
2d4453968d Implement AL_SOFT_buffer_sub_data using the current AL_EXT_buffer_sub_data spec
This extension can be useful for some applications, but a full EXT version may
not be ready for some time. Using the SOFT moniker will help differentiate it
in case changes need to be done for the EXT version.
2010-09-21 09:43:35 -07:00
Chris Robinson
a2358ffc41 Source positions at and after the end of the buffer queue go back to 0 2010-09-09 18:27:14 -07:00
Chris Robinson
6e32812bc1 Remove unnecessary check 2010-09-07 22:38:29 -07:00
Chris Robinson
50a7be6385 Fix comparison check 2010-09-07 22:23:37 -07:00
Chris Robinson
1e82561a22 Check for invalid negative sizes 2010-09-07 16:18:24 -07:00
Chris Robinson
ba32a52bb6 Remove unused struct member 2010-09-07 16:07:35 -07:00
Chris Robinson
2915d9dbd9 Use click removal to handle harsh panning/volume changes 2010-08-15 00:19:38 -07:00
Chris Robinson
0c49e5ba56 Use click removal when starting a source 2010-08-14 22:59:55 -07:00
Chris Robinson
8003278a55 Combine non-attenuated source calculation functions 2010-08-07 06:57:31 -07:00
Chris Robinson
8f49f2c25e Forward some more source properties instead of duplicating 2010-08-07 01:35:43 -07:00
Chris Robinson
98bc60cfb7 Combine stereo and stereo-duplicate mixers
Use a separate update method for stereo sources to the set appropriate channel
gains
2010-08-05 01:07:20 -07:00
Chris Robinson
e74976e645 Use a callback to specify the source update method 2010-08-03 23:10:00 -07:00
Chris Robinson
42d9140afe Check the buffer's original format when queueing on a source 2010-07-12 15:53:11 -07:00
Chris Robinson
7f6df7695c Use an array of active sources when mixing
Prevents iterating over all allocated sources during mixing updates
2010-06-06 00:17:50 -07:00
Chris Robinson
37190b2caf Add a function to get the frame size from a format 2010-05-24 21:51:30 -07:00
Chris Robinson
8cfac7c6b8 Don't bother storing the loop points in the source 2010-05-24 01:07:13 -07:00
Chris Robinson
58e5404d61 Loop points should be specified in sample offsets 2010-05-21 15:52:35 -07:00
Chris Robinson
c5c83882b3 Use unsigned types when finding the source offsets 2010-05-19 10:38:28 -07:00
Chris Robinson
ea3bc0518c A couple formatting fixes 2010-05-19 10:36:24 -07:00
Chris Robinson
2d46a1001e Use a map for the filter list 2010-05-18 17:54:45 -07:00
Chris Robinson
5d579dd1a8 Store loop points as uncompressed frame offsets in the source when a buffer is attached 2010-05-13 02:10:33 -07:00
Chris Robinson
af4faaf666 Use a UIntMap for the effect slot list 2010-05-12 02:20:14 -07:00
Chris Robinson
f0ce1bff3e Simplify and fix applying a source offset 2010-05-11 11:59:41 -07:00
Chris Robinson
ab3c23478d Use a separate function to convert compressed bytes to frames 2010-05-11 11:06:48 -07:00
Chris Robinson
4e65e9bfa9 Only a streaming source can have a processed buffer 2010-05-11 08:53:38 -07:00
Chris Robinson
0378422fcb Use a map to store sources and buffers
And do a lookup using a binary search instead of linear
2010-05-01 19:59:41 -07:00
Chris Robinson
0760415d08 Use doubles instead of floats for the source offset calculations 2010-04-28 17:58:20 -07:00
Chris Robinson
aaa7082aa8 Get the offset even if the current buffer is 0 2010-04-28 14:08:10 -07:00
Chris Robinson
52663e8a44 Combine two loops into one 2010-04-23 07:23:38 -07:00
Chris Robinson
1544ddf0a5 Avoid reading buffer 0's size 2010-04-10 17:31:08 -07:00
Chris Robinson
7bdf0d5156 Shorten some variable names 2010-03-26 00:41:27 -07:00
Chris Robinson
4ce8a17afd Reduce some indentation 2010-03-24 02:23:00 -07:00
Chris Robinson
99f28f25b0 Avoid calling alDelete* from alGen* 2010-03-20 21:38:05 -07:00
Chris Robinson
a572b13743 Don't use deprecated macros 2010-03-19 14:34:18 -07:00
Chris Robinson
2953daebf5 GetSourceOffset can't fail 2010-03-17 15:19:00 -07:00
Chris Robinson
dd82b68175 Handle source offsets for muLaw formats 2010-03-17 15:15:12 -07:00
Chris Robinson
975f92fc84 Remove unnecessary stop call 2010-03-16 21:29:55 -07:00
Chris Robinson
0097beb84c Remove unused variable 2010-03-16 21:12:36 -07:00
Chris Robinson
65f43637ce Avoid some alIs* calls while under the context lock
Instead, use functions that verify the ID by searching the object list and
returning its handle
2010-03-16 18:54:36 -07:00
Chris Robinson
f37cfc486d Pass the context to alSetError 2010-03-16 17:35:51 -07:00
Chris Robinson
ec917e8e2f Rename some struct members for consistency 2010-03-16 15:37:41 -07:00
Chris Robinson
89d84131a4 Avoid dereferencing a NULL buffer when unqueueing buffer 0 2010-03-15 16:10:21 -07:00
Chris Robinson
1f2d3a0132 Remove duplication of setting source angles 2010-03-14 03:23:18 -07:00
Chris Robinson
b734cab6fc Fix the retrieval of the RW offsets using the correct functions 2010-03-10 07:33:30 -08:00
Chris Robinson
365a62d63a Improve source write offset calculations 2010-02-07 20:11:24 -08:00
Chris Robinson
35ba7d70dc Consolidate some source offset handling code 2010-01-12 02:43:37 -08:00
Chris Robinson
026b4b8f4c Better handle large second offsets 2010-01-12 02:26:38 -08:00
Chris Robinson
c924a50bed Don't use a flag to set an error when applying the source offset 2010-01-12 02:22:38 -08:00
Chris Robinson
705849ca73 Add an option for point resampling 2010-01-11 05:37:20 -08:00
Chris Robinson
88de4e15b3 Mark the source for updating when setting a buffer on it
Changing the buffer can change the playback format, which can require different
source parameter calculations. Queueing a buffer on a source that has no
buffers (or only buffers without a format, eg. buffer 0) has the same effect
2009-12-25 05:09:29 -08:00
Chris Robinson
bd696a6b37 Fix IMA ADPCM offset calculation 2009-12-09 09:50:09 -08:00
Chris Robinson
4697e946d3 Internally store 32-bit float buffer data, and mix accordingly 2009-12-07 10:35:30 -08:00
Chris Robinson
c1eb444a39 Remove some assumptions of 16-bit internal storage 2009-12-02 05:55:33 -08:00
Chris Robinson
d81c9819b8 Remove unnecessary returns 2009-11-28 19:36:05 -08:00
Chris Robinson
98ce1d14c1 Update AL_EXTX_source_distance_model to require explicit enabling
The in-progress spec has been updated to reflect this
2009-11-27 20:05:21 -08:00
Chris Robinson
658923175f Update source parameters only when they need changing 2009-11-25 16:21:47 -08:00
Chris Robinson
a3fcd67a82 Remove some unneeded buffer fields, make padding a constant amount 2009-10-25 08:31:28 -07:00
Chris Robinson
fe3a43e2d4 Remove the format and frequency from the source, get them manually 2009-10-25 06:26:19 -07:00
Chris Robinson
b0a82aa420 Store the buffer format and frequency in the source when updated 2009-10-25 05:03:22 -07:00
Chris Robinson
1665595138 Remove unneeded bufferlistitem properties 2009-10-25 02:59:31 -07:00
Chris Robinson
bbccf76b45 Dereference left over buffers and slots when sources are released 2009-10-24 07:09:44 -07:00
Chris Robinson
921e7ac3e9 Store the buffer handle directly in the source and buffer queue list 2009-10-22 09:31:26 -07:00
Chris Robinson
8501fce38b Remove unused source fields 2009-10-21 15:40:09 -07:00
Chris Robinson
af8e7ab984 Check the source start position in alSourcePlayv instead of the mixer 2009-09-24 12:24:10 -07:00
Chris Robinson
4cd41e3e08 Don't allow setting an invalid auxiliary send 2009-09-21 23:09:31 -07:00
Chris Robinson
7976de05a5 Add base support for ALC_EXT_disconnect
Individual backends need to be updated to handle disconnection events
2009-08-26 19:15:17 -07:00
Chris Robinson
487f0dde75 Print source and auxiliary slot debug warnings from alcDestroyContext 2009-08-16 16:11:22 -07:00
Chris Robinson
decbe4df45 Modify some context checks 2009-08-16 15:09:36 -07:00
Chris Robinson
462f27c129 Use a function to retrieve the current context in an already-locked state
This should help prevent race-conditions with a context being destroyed between
breing retrieved and locked
2009-08-16 14:09:23 -07:00
Chris Robinson
32060f53cd Reset the buffer played count when the queue is removed via the AL_BUFFER property 2009-08-11 14:16:30 -07:00
Chris Robinson
4ee3972f15 Update queued buffer states when source looping is toggled 2009-08-11 07:57:18 -07:00
Chris Robinson
00a9cf4a85 Remove more unneeded variables 2009-07-07 21:11:13 -07:00
Chris Robinson
1dcd538ad9 Remove unneeded variables 2009-07-07 21:01:41 -07:00
Chris Robinson
c67fbd72dd Pay attention to the MAX_SENDS value 2009-04-11 20:04:46 -07:00
Chris Robinson
8d0c4ccb3b The room rolloff factor can go up to 10 2009-03-13 02:12:45 -07:00
Chris Robinson
55b9ccc2de Implement AL_EXTX_source_distance_model
As with other EXTX extensions, this is subject to change and removal as the
spec gets worked on
2008-11-25 18:56:10 -08:00
Chris Robinson
010f7d12f4 Don't ramp gains when starting a sound from the beginning 2008-11-13 05:48:38 -08:00
Chris Robinson
da684564ea Avoid unnecessary floating-point math 2008-11-11 17:59:55 -08:00
Chris Robinson
fc4c867f27 Add initial AL_EXTX_buffer_sub_data support
Note that this is an in-development extension, as noted by the EXTX moniker
instead of EXT. It's behavior is subject to change, and the extension string
will be removed (replaced with the official string once it's finalized).
Developers are discouraged from using this in production code, though feel
free to play around with it.
2008-11-11 05:57:32 -08:00
Chris Robinson
59a71b1454 Remove another unused source member 2008-10-10 01:31:31 -07:00
Chris Robinson
bfa1107781 Remove unneeded source member variable 2008-10-09 23:44:48 -07:00
Chris Robinson
11397f7667 Commit missing changes 2008-10-09 20:58:12 -07:00
Chris Robinson
3863dcc9cb Use a new low-pass filter, based on the I3DL2 spec
Many thanks to Christopher Fitzgerald, for helping with it
2008-10-02 22:20:42 -07:00
Chris Robinson
db541f3cfa Remove unneeded source struct member 2008-08-15 17:43:07 -07:00
Chris Robinson
3e19ba6ca8 Clear channel volumes when starting a source 2008-08-15 16:33:47 -07:00
Chris Robinson
084df2a229 Allow setting the EFX doppler factor source property 2008-08-14 16:14:16 -07:00
Chris Robinson
597e01153e Use arrays instead of pointer-to-arrays for the low-pass filter 2008-07-26 17:13:50 -07:00
Chris Robinson
c7e49c9f57 Implement yet another low-pass filter
This one using the Butterworth IIR filter design
2008-07-25 19:31:12 -07:00
Chris Robinson
93c0f61050 Clarify implicit destruction warnings 2008-07-22 14:29:27 -07:00
Chris Robinson
0042b1f80d Implement doppler factor source property 2008-07-15 02:33:05 -07:00
Chris Robinson
97d3a45aff Don't check the number of objects being deleted with the number currently allocated
Since apps can validly delete buffer 0, and delete the same source/buffer multiple times in a single call
2008-07-11 09:12:11 -07:00
Chris Robinson
db80f682c9 Clean a couple debug messages 2008-01-19 21:41:09 -08:00
Chris Robinson
1b9d740244 Remove duplicated source freeing code 2008-01-18 00:56:01 -08:00
Chris Robinson
73e386dc6f Release effect slots when deleting sources 2008-01-17 21:17:08 -08:00
Chris Robinson
6735fc7911 Add missing config.h includes 2008-01-16 14:09:04 -08:00
Chris Robinson
be34dbe608 Don't include alAuxEffectSlot.h in alSource.h 2008-01-16 14:01:24 -08:00
Chris Robinson
70102e7cd3 Fix debug comments 2008-01-16 13:58:10 -08:00
Chris Robinson
8ad16145f6 Make sure sources are deleted with the context 2008-01-16 13:27:15 -08:00
Chris Robinson
bb7b18d4e1 Keep track of references to effect slots, so they aren't deleted while in use 2008-01-16 13:20:09 -08:00
Chris Robinson
10a9bc62bf Store a reference to the effect slot in a source's send, not a copy 2008-01-16 12:43:25 -08:00
Chris Robinson
42306f93b3 Set default room rolloff factor 2008-01-15 19:59:19 -08:00
Chris Robinson
7b1b8bd741 Set the default outer cone gainhf 2008-01-15 17:40:37 -08:00
Chris Robinson
a11f25e47b Fix source and buffer out-of-memory conditions 2008-01-15 16:30:43 -08:00
Chris Robinson
3d78d93b40 Merge branch 'master' into efx-experiment 2007-12-31 19:34:52 -08:00
Chris Robinson
1397417fcd Handle AL_FORMAT_REAR* formats 2007-12-31 05:46:20 -08:00
Chris Robinson
79b95da0a3 Check specific formats before general properties 2007-12-31 02:57:58 -08:00
Chris Robinson
e82c27ab04 Fix includes so alMain.h doesn't include so much by itself 2007-12-31 01:09:57 -08:00
Chris Robinson
5f8e65e099 Implement AL_EXT_FLOAT32 2007-12-28 22:41:14 -08:00
Chris Robinson
d7bf7a8b0d Don't rely on the exact formats as much for sources 2007-12-28 18:53:46 -08:00
Chris Robinson
7bf9ebf545 Allow auxiliary effect slot 0 when (un)setting the source auxiliary send 2007-12-18 23:51:21 -08:00
Chris Robinson
1e9302f564 Don't assume only one max send when setting source properties 2007-12-18 19:47:42 -08:00
Chris Robinson
e5609279da Implement AL_AUXILIARY_SEND_FILTER_GAIN_AUTO property 2007-12-18 19:13:41 -08:00
Chris Robinson
afd3b71849 Implement AL_ROOM_ROLLOFF_FACTOR property 2007-12-18 19:03:40 -08:00
Chris Robinson
a281027876 Implement AL_AUXILIARY_SEND_FILTER source property 2007-12-18 17:59:28 -08:00
Chris Robinson
233e6f1765 Implement AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO property 2007-12-18 16:54:22 -08:00
Chris Robinson
ebb30ec5b0 Implement AL_AIR_ABSORPTION_FACTOR source property 2007-12-18 13:37:07 -08:00
Chris Robinson
654788f2cf Implement AL_CONE_OUTER_GAINHF source property 2007-12-17 21:56:31 -08:00
Chris Robinson
06f2076f04 Implement AL_DIRECT_FILTER_GAINHF_AUTO source property 2007-12-17 21:33:05 -08:00
Chris Robinson
35a82970a3 Implement AL_DIRECT_FILTER source property
Only AL_FILTER_NULL filter types are currently supported, however
2007-12-17 16:28:16 -08:00
Chris Robinson
2ecb878e68 Remove more unused variables 2007-12-06 22:03:05 -08:00
Chris Robinson
52aed94765 Make some source-local functions static 2007-12-06 22:00:35 -08:00
Chris Robinson
ae5f4e9a74 Initial import 2007-11-13 18:02:18 -08:00